diff options
author | Fabio Berger <me@fabioberger.com> | 2017-11-24 05:21:45 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-11-24 05:21:45 +0800 |
commit | b7b1721145f3894ade757a2ad4c366e2b6eadbe9 (patch) | |
tree | 0b724c1eb0c218a482a5b31b7438f67c33af61e3 /packages/0x.js/src/stores | |
parent | 5068f1666a9d1dec2140f2a98e96bb880e854105 (diff) | |
download | dexon-sol-tools-b7b1721145f3894ade757a2ad4c366e2b6eadbe9.tar dexon-sol-tools-b7b1721145f3894ade757a2ad4c366e2b6eadbe9.tar.gz dexon-sol-tools-b7b1721145f3894ade757a2ad4c366e2b6eadbe9.tar.bz2 dexon-sol-tools-b7b1721145f3894ade757a2ad4c366e2b6eadbe9.tar.lz dexon-sol-tools-b7b1721145f3894ade757a2ad4c366e2b6eadbe9.tar.xz dexon-sol-tools-b7b1721145f3894ade757a2ad4c366e2b6eadbe9.tar.zst dexon-sol-tools-b7b1721145f3894ade757a2ad4c366e2b6eadbe9.zip |
Pass 'latest' to ExchangeTransferSimulator when used for validating orders, and pass 'pending' when used in the order watcher.
Diffstat (limited to 'packages/0x.js/src/stores')
-rw-r--r-- | packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts b/packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts index c83e61606..7c94031c3 100644 --- a/packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts +++ b/packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts @@ -9,6 +9,7 @@ import {BlockParamLiteral} from '../types'; */ export class BalanceAndProxyAllowanceLazyStore { private token: TokenWrapper; + private defaultBlock: BlockParamLiteral; private balance: { [tokenAddress: string]: { [userAddress: string]: BigNumber, @@ -19,15 +20,16 @@ export class BalanceAndProxyAllowanceLazyStore { [userAddress: string]: BigNumber, }, }; - constructor(token: TokenWrapper) { + constructor(token: TokenWrapper, defaultBlock: BlockParamLiteral) { this.token = token; + this.defaultBlock = defaultBlock; this.balance = {}; this.proxyAllowance = {}; } public async getBalanceAsync(tokenAddress: string, userAddress: string): Promise<BigNumber> { if (_.isUndefined(this.balance[tokenAddress]) || _.isUndefined(this.balance[tokenAddress][userAddress])) { const methodOpts = { - defaultBlock: BlockParamLiteral.Pending, + defaultBlock: this.defaultBlock, }; const balance = await this.token.getBalanceAsync(tokenAddress, userAddress, methodOpts); this.setBalance(tokenAddress, userAddress, balance); @@ -53,7 +55,7 @@ export class BalanceAndProxyAllowanceLazyStore { if (_.isUndefined(this.proxyAllowance[tokenAddress]) || _.isUndefined(this.proxyAllowance[tokenAddress][userAddress])) { const methodOpts = { - defaultBlock: BlockParamLiteral.Pending, + defaultBlock: this.defaultBlock, }; const proxyAllowance = await this.token.getProxyAllowanceAsync(tokenAddress, userAddress, methodOpts); this.setProxyAllowance(tokenAddress, userAddress, proxyAllowance); |