aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src/stores
diff options
context:
space:
mode:
authorAra Kevonian <ara@dextroid.io>2018-04-17 21:47:36 +0800
committerAra Kevonian <ara@dextroid.io>2018-04-17 21:47:36 +0800
commit7d957538b46bbc9cd757d5b9a0351bf27e4e5419 (patch)
tree6bb5c372c5e6f74b5b69d683658dc17b46c6fcbc /packages/0x.js/src/stores
parent5355da6cad157bb67d1b55a2f8463efe3e072385 (diff)
downloaddexon-sol-tools-7d957538b46bbc9cd757d5b9a0351bf27e4e5419.tar
dexon-sol-tools-7d957538b46bbc9cd757d5b9a0351bf27e4e5419.tar.gz
dexon-sol-tools-7d957538b46bbc9cd757d5b9a0351bf27e4e5419.tar.bz2
dexon-sol-tools-7d957538b46bbc9cd757d5b9a0351bf27e4e5419.tar.lz
dexon-sol-tools-7d957538b46bbc9cd757d5b9a0351bf27e4e5419.tar.xz
dexon-sol-tools-7d957538b46bbc9cd757d5b9a0351bf27e4e5419.tar.zst
dexon-sol-tools-7d957538b46bbc9cd757d5b9a0351bf27e4e5419.zip
Add stateLayer param to getOrderState and clean up variable names
Diffstat (limited to 'packages/0x.js/src/stores')
-rw-r--r--packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts8
-rw-r--r--packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts12
2 files changed, 11 insertions, 9 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 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];