aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts')
-rw-r--r--packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts8
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);