aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/blockchain.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-03-11 19:33:34 +0800
committerFabio Berger <me@fabioberger.com>2018-03-11 19:33:34 +0800
commitcaaa70f6302b0d84d43ca93ab014e0cf37886c0a (patch)
tree21967186c45a0e84a0ed54d3aeffa7596aad3be0 /packages/website/ts/blockchain.ts
parent56a8e0a09a61ca2c399c676da695bf4cd4ed63a6 (diff)
downloaddexon-sol-tools-caaa70f6302b0d84d43ca93ab014e0cf37886c0a.tar
dexon-sol-tools-caaa70f6302b0d84d43ca93ab014e0cf37886c0a.tar.gz
dexon-sol-tools-caaa70f6302b0d84d43ca93ab014e0cf37886c0a.tar.bz2
dexon-sol-tools-caaa70f6302b0d84d43ca93ab014e0cf37886c0a.tar.lz
dexon-sol-tools-caaa70f6302b0d84d43ca93ab014e0cf37886c0a.tar.xz
dexon-sol-tools-caaa70f6302b0d84d43ca93ab014e0cf37886c0a.tar.zst
dexon-sol-tools-caaa70f6302b0d84d43ca93ab014e0cf37886c0a.zip
Fix getTokenBalanceAndAllowanceAsync to take ownerAddressIfExists so that we don't sometimes pass an empty string and sometimes undefined
Diffstat (limited to 'packages/website/ts/blockchain.ts')
-rw-r--r--packages/website/ts/blockchain.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts
index 3e19cb715..14582eae9 100644
--- a/packages/website/ts/blockchain.ts
+++ b/packages/website/ts/blockchain.ts
@@ -496,18 +496,21 @@ export class Blockchain {
);
return tokenBalanceAndAllowance;
}
- public async getTokenBalanceAndAllowanceAsync(ownerAddress: string, tokenAddress: string): Promise<BigNumber[]> {
+ public async getTokenBalanceAndAllowanceAsync(
+ ownerAddressIfExists: string,
+ tokenAddress: string,
+ ): Promise<BigNumber[]> {
utils.assert(!_.isUndefined(this._zeroEx), 'ZeroEx must be instantiated.');
- if (_.isEmpty(ownerAddress)) {
+ if (_.isUndefined(ownerAddressIfExists)) {
const zero = new BigNumber(0);
return [zero, zero];
}
let balance = new BigNumber(0);
let allowance = new BigNumber(0);
if (this._doesUserAddressExist()) {
- balance = await this._zeroEx.token.getBalanceAsync(tokenAddress, ownerAddress);
- allowance = await this._zeroEx.token.getProxyAllowanceAsync(tokenAddress, ownerAddress);
+ balance = await this._zeroEx.token.getBalanceAsync(tokenAddress, ownerAddressIfExists);
+ allowance = await this._zeroEx.token.getProxyAllowanceAsync(tokenAddress, ownerAddressIfExists);
}
return [balance, allowance];
}