From 0a32ae6cb553076667513fa61af14d4e8eef5b5b Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 5 Jul 2018 12:04:08 +0200 Subject: Add defaultBlock param to getBalanceInWeiAsync --- packages/web3-wrapper/src/web3_wrapper.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'packages/web3-wrapper/src/web3_wrapper.ts') diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts index 2d7b590b5..5dd1150d7 100644 --- a/packages/web3-wrapper/src/web3_wrapper.ts +++ b/packages/web3-wrapper/src/web3_wrapper.ts @@ -230,11 +230,16 @@ export class Web3Wrapper { * @param owner Account whose balance you wish to check * @returns Balance in wei */ - public async getBalanceInWeiAsync(owner: string): Promise { + public async getBalanceInWeiAsync(owner: string, defaultBlock?: BlockParam): Promise { assert.isETHAddressHex('owner', owner); + if (!_.isUndefined(defaultBlock)) { + Web3Wrapper._assertBlockParam(defaultBlock); + } + const marshalledDefaultBlock = marshaller.marshalBlockParam(defaultBlock); + const encodedOwner = marshaller.marshalAddress(owner); const balanceInWei = await this._sendRawPayloadAsync({ method: 'eth_getBalance', - params: [owner], + params: [encodedOwner, marshalledDefaultBlock], }); // Rewrap in a new BigNumber return new BigNumber(balanceInWei); -- cgit