From 7d957538b46bbc9cd757d5b9a0351bf27e4e5419 Mon Sep 17 00:00:00 2001 From: Ara Kevonian Date: Tue, 17 Apr 2018 06:47:36 -0700 Subject: Add stateLayer param to getOrderState and clean up variable names --- .../0x.js/src/stores/balance_proxy_allowance_lazy_store.ts | 8 ++++---- .../0x.js/src/stores/order_filled_cancelled_lazy_store.ts | 12 +++++++----- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'packages/0x.js/src/stores') 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 97739f969..c8395415e 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,7 +9,7 @@ import { BalanceAndProxyAllowanceFetcher } from '../abstract/balance_and_proxy_a * Copy on read store for balances/proxyAllowances of tokens/accounts */ export class BalanceAndProxyAllowanceLazyStore implements BalanceAndProxyAllowanceFetcher { - private _token: TokenWrapper; + private _tokenWrapper: TokenWrapper; private _defaultBlock: BlockParamLiteral; private _balance: { [tokenAddress: string]: { @@ -22,7 +22,7 @@ export class BalanceAndProxyAllowanceLazyStore implements BalanceAndProxyAllowan }; }; constructor(token: TokenWrapper, defaultBlock: BlockParamLiteral) { - this._token = token; + this._tokenWrapper = token; this._defaultBlock = defaultBlock; this._balance = {}; this._proxyAllowance = {}; @@ -32,7 +32,7 @@ export class BalanceAndProxyAllowanceLazyStore implements BalanceAndProxyAllowan const methodOpts = { defaultBlock: this._defaultBlock, }; - const balance = await this._token.getBalanceAsync(tokenAddress, userAddress, methodOpts); + const balance = await this._tokenWrapper.getBalanceAsync(tokenAddress, userAddress, methodOpts); this.setBalance(tokenAddress, userAddress, balance); } const cachedBalance = this._balance[tokenAddress][userAddress]; @@ -60,7 +60,7 @@ export class BalanceAndProxyAllowanceLazyStore implements BalanceAndProxyAllowan const methodOpts = { defaultBlock: this._defaultBlock, }; - const proxyAllowance = await this._token.getProxyAllowanceAsync(tokenAddress, userAddress, methodOpts); + const proxyAllowance = await this._tokenWrapper.getProxyAllowanceAsync(tokenAddress, userAddress, methodOpts); this.setProxyAllowance(tokenAddress, userAddress, proxyAllowance); } const cachedProxyAllowance = this._proxyAllowance[tokenAddress][userAddress]; diff --git a/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts b/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts index 134508057..eebc2b52c 100644 --- a/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts +++ b/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts @@ -9,15 +9,17 @@ import { OrderFilledCancelledFetcher } from '../abstract/order_filled_cancelled_ * Copy on read store for filled/cancelled taker amounts */ export class OrderFilledCancelledLazyStore implements OrderFilledCancelledFetcher { - private _exchange: ExchangeWrapper; + private _exchangeWrapper: ExchangeWrapper; + private _defaultBlock: BlockParamLiteral; private _filledTakerAmount: { [orderHash: string]: BigNumber; }; private _cancelledTakerAmount: { [orderHash: string]: BigNumber; }; - constructor(exchange: ExchangeWrapper) { - this._exchange = exchange; + constructor(exchange: ExchangeWrapper, defaultBlock: BlockParamLiteral) { + this._exchangeWrapper = exchange; + this._defaultBlock = defaultBlock; this._filledTakerAmount = {}; this._cancelledTakerAmount = {}; } @@ -26,7 +28,7 @@ export class OrderFilledCancelledLazyStore implements OrderFilledCancelledFetche const methodOpts = { defaultBlock: BlockParamLiteral.Pending, }; - const filledTakerAmount = await this._exchange.getFilledTakerAmountAsync(orderHash, methodOpts); + const filledTakerAmount = await this._exchangeWrapper.getFilledTakerAmountAsync(orderHash, methodOpts); this.setFilledTakerAmount(orderHash, filledTakerAmount); } const cachedFilled = this._filledTakerAmount[orderHash]; @@ -43,7 +45,7 @@ export class OrderFilledCancelledLazyStore implements OrderFilledCancelledFetche const methodOpts = { defaultBlock: BlockParamLiteral.Pending, }; - const cancelledTakerAmount = await this._exchange.getCancelledTakerAmountAsync(orderHash, methodOpts); + const cancelledTakerAmount = await this._exchangeWrapper.getCancelledTakerAmountAsync(orderHash, methodOpts); this.setCancelledTakerAmount(orderHash, cancelledTakerAmount); } const cachedCancelled = this._cancelledTakerAmount[orderHash]; -- cgit v1.2.3