aboutsummaryrefslogtreecommitdiffstats
path: root/packages/web3-wrapper/src
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-07-05 18:04:08 +0800
committerFabio Berger <me@fabioberger.com>2018-07-05 18:04:08 +0800
commit0a32ae6cb553076667513fa61af14d4e8eef5b5b (patch)
tree3d378404caf7bfd382fbd516bc94de637c4dc34f /packages/web3-wrapper/src
parent3d67f122a501e49a005c4ebdb0a68be0f67fcea8 (diff)
downloaddexon-0x-contracts-0a32ae6cb553076667513fa61af14d4e8eef5b5b.tar.gz
dexon-0x-contracts-0a32ae6cb553076667513fa61af14d4e8eef5b5b.tar.zst
dexon-0x-contracts-0a32ae6cb553076667513fa61af14d4e8eef5b5b.zip
Add defaultBlock param to getBalanceInWeiAsync
Diffstat (limited to 'packages/web3-wrapper/src')
-rw-r--r--packages/web3-wrapper/src/web3_wrapper.ts9
1 files changed, 7 insertions, 2 deletions
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<BigNumber> {
+ public async getBalanceInWeiAsync(owner: string, defaultBlock?: BlockParam): Promise<BigNumber> {
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<string>({
method: 'eth_getBalance',
- params: [owner],
+ params: [encodedOwner, marshalledDefaultBlock],
});
// Rewrap in a new BigNumber
return new BigNumber(balanceInWei);