Skip to content

Commit

Permalink
feat: add listreceivedbyaddress
Browse files Browse the repository at this point in the history
  • Loading branch information
gridcat committed Jun 27, 2021
1 parent 2cd3e3d commit 0ffe63f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 12 deletions.
25 changes: 25 additions & 0 deletions src/RPC/Wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { BackupWallet } from '../contracts/backupWallet';
import { BalanceDetail } from '../contracts/balanceDetail';
import { CheckWallet } from '../contracts/checkwallet';
import { Output, RawTransaction } from '../contracts/rawTransaction';
import { Receivement } from '../contracts/receivement';
import { Script } from '../contracts/script';
import { DetailedRawTransaction, Transaction } from '../contracts/transaction';
import { WalletInfo } from '../contracts/walletInfo';
Expand Down Expand Up @@ -433,4 +434,28 @@ export class Wallet extends RPCBase {
public async listAddressGroupings(): Promise<[string, number][][]> {
return this.call('listaddressgroupings');
}

/** @todo: listreceivedbyaccount */

/**
* List balances by receiving address.
*
* @param {number} [minConf=1] - The minimum number of confirmations before payments are included.
* @param {boolean} [includeEmpty=false] - Whether to include addresses that haven't received any payments.
* @param {boolean} [includeWatchOnly=false] - Whether to include watchonly addresses (see 'importaddress').
* @returns {Promise<Receivement[]>}
* @memberof Wallet
*/
public listReceivedByAddress(
minConf = 1,
includeEmpty = false,
includeWatchOnly = false,
): Promise<Receivement[]> {
return this.call<Receivement[]>(
'listreceivedbyaddress',
minConf,
includeEmpty,
includeWatchOnly,
);
}
}
24 changes: 12 additions & 12 deletions src/contracts/receivement.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
export interface IReceivement {
import { Address, TX } from '../types';

export interface Receivement {
/**
* Only returned if imported addresses were involved in transaction
*
* @type {boolean}
* @memberof IReceivement
* @memberof Receivement
*/
involvesWatchonly: boolean;
involvesWatchonly: boolean;
/**
* The receiving address
*
* @type {string}
* @memberof IReceivement
* @type {Address}
* @memberof Receivement
*/
address: string;
address: Address;
/**
* The account of the receiving address. The default account is "".
*
* @deprecated
* @type {string}
* @memberof IReceivement
* @memberof Receivement
*/
account: string;
/**
* The total amount in GRC received by the address
*
* @type {number}
* @memberof IReceivement
* @memberof Receivement
*/
amount: number;
/**
* The number of confirmations of the most recent transaction included
*
* @type {number}
* @memberof IReceivement
* @memberof Receivement
*/
confirmations: number;
// eslint-disable-next-line camelcase
tx_count: number;
txids: any;
txids: TX[];
}

0 comments on commit 0ffe63f

Please sign in to comment.