diff options
author | Francesco Agosti <francesco.agosti93@gmail.com> | 2018-06-05 01:46:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-05 01:46:08 +0800 |
commit | f5c74d123a2fea47ba2671171b2d299146c1332d (patch) | |
tree | 31893e7a08edb731a95928677f455a58c84f383d /packages/website/ts/blockchain.ts | |
parent | d50fbac5f937602d7a90343ea8ff88cee5c4542f (diff) | |
parent | c8421efcd32af9dbe58b433fdb97d009a6d89b84 (diff) | |
download | dexon-sol-tools-f5c74d123a2fea47ba2671171b2d299146c1332d.tar dexon-sol-tools-f5c74d123a2fea47ba2671171b2d299146c1332d.tar.gz dexon-sol-tools-f5c74d123a2fea47ba2671171b2d299146c1332d.tar.bz2 dexon-sol-tools-f5c74d123a2fea47ba2671171b2d299146c1332d.tar.lz dexon-sol-tools-f5c74d123a2fea47ba2671171b2d299146c1332d.tar.xz dexon-sol-tools-f5c74d123a2fea47ba2671171b2d299146c1332d.tar.zst dexon-sol-tools-f5c74d123a2fea47ba2671171b2d299146c1332d.zip |
Merge pull request #644 from 0xProject/feature/website/refactor-token-state-fetching
Move TokenState fetching logic up into Portal.tsx so it can be used by Wallet and PortalOnboardingFlow
Diffstat (limited to 'packages/website/ts/blockchain.ts')
-rw-r--r-- | packages/website/ts/blockchain.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index 212e829dd..6e4d03e27 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -506,7 +506,7 @@ export class Blockchain { public async getTokenBalanceAndAllowanceAsync( ownerAddressIfExists: string, tokenAddress: string, - ): Promise<BigNumber[]> { + ): Promise<[BigNumber, BigNumber]> { utils.assert(!_.isUndefined(this._contractWrappers), 'ContractWrappers must be instantiated.'); if (_.isUndefined(ownerAddressIfExists)) { @@ -516,8 +516,10 @@ export class Blockchain { let balance = new BigNumber(0); let allowance = new BigNumber(0); if (this._doesUserAddressExist()) { - balance = await this._contractWrappers.token.getBalanceAsync(tokenAddress, ownerAddressIfExists); - allowance = await this._contractWrappers.token.getProxyAllowanceAsync(tokenAddress, ownerAddressIfExists); + [balance, allowance] = await Promise.all([ + this._contractWrappers.token.getBalanceAsync(tokenAddress, ownerAddressIfExists), + this._contractWrappers.token.getProxyAllowanceAsync(tokenAddress, ownerAddressIfExists), + ]); } return [balance, allowance]; } |