diff options
author | Ara Kevonian <ara@dextroid.io> | 2018-04-17 21:47:36 +0800 |
---|---|---|
committer | Ara Kevonian <ara@dextroid.io> | 2018-04-17 21:47:36 +0800 |
commit | 7d957538b46bbc9cd757d5b9a0351bf27e4e5419 (patch) | |
tree | 6bb5c372c5e6f74b5b69d683658dc17b46c6fcbc /packages/0x.js/src/fetchers | |
parent | 5355da6cad157bb67d1b55a2f8463efe3e072385 (diff) | |
download | dexon-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/fetchers')
-rw-r--r-- | packages/0x.js/src/fetchers/simple_balance_and_proxy_allowance_fetcher.ts | 10 | ||||
-rw-r--r-- | packages/0x.js/src/fetchers/simple_order_filled_cancelled_fetcher.ts | 18 |
2 files changed, 17 insertions, 11 deletions
diff --git a/packages/0x.js/src/fetchers/simple_balance_and_proxy_allowance_fetcher.ts b/packages/0x.js/src/fetchers/simple_balance_and_proxy_allowance_fetcher.ts index 877f07a22..c00dba5cf 100644 --- a/packages/0x.js/src/fetchers/simple_balance_and_proxy_allowance_fetcher.ts +++ b/packages/0x.js/src/fetchers/simple_balance_and_proxy_allowance_fetcher.ts @@ -5,22 +5,24 @@ import {BalanceAndProxyAllowanceFetcher} from '../abstract/balance_and_proxy_all import {TokenWrapper} from '../contract_wrappers/token_wrapper'; export class SimpleBalanceAndProxyAllowanceFetcher implements BalanceAndProxyAllowanceFetcher { - private _token: TokenWrapper; + private _tokenWrapper: TokenWrapper; private _defaultBlock: BlockParamLiteral; constructor(token: TokenWrapper, defaultBlock: BlockParamLiteral) { - this._token = token; + this._tokenWrapper = token; this._defaultBlock = defaultBlock; } public async getBalanceAsync(tokenAddress: string, userAddress: string): Promise<BigNumber> { const methodOpts = { defaultBlock: this._defaultBlock, }; - return this._token.getBalanceAsync(tokenAddress, userAddress, methodOpts); + const balance = this._tokenWrapper.getBalanceAsync(tokenAddress, userAddress, methodOpts); + return balance; } public async getProxyAllowanceAsync(tokenAddress: string, userAddress: string): Promise<BigNumber> { const methodOpts = { defaultBlock: this._defaultBlock, }; - return this._token.getProxyAllowanceAsync(tokenAddress, userAddress, methodOpts); + const proxyAllowance = this._tokenWrapper.getProxyAllowanceAsync(tokenAddress, userAddress, methodOpts); + return proxyAllowance; } } diff --git a/packages/0x.js/src/fetchers/simple_order_filled_cancelled_fetcher.ts b/packages/0x.js/src/fetchers/simple_order_filled_cancelled_fetcher.ts index e24f02726..1c8aec1a1 100644 --- a/packages/0x.js/src/fetchers/simple_order_filled_cancelled_fetcher.ts +++ b/packages/0x.js/src/fetchers/simple_order_filled_cancelled_fetcher.ts @@ -5,20 +5,24 @@ import {OrderFilledCancelledFetcher} from '../abstract/order_filled_cancelled_fe import {ExchangeWrapper} from '../contract_wrappers/exchange_wrapper'; export class SimpleOrderFilledCancelledFetcher implements OrderFilledCancelledFetcher { - private _exchange: ExchangeWrapper; - constructor(exchange: ExchangeWrapper) { - this._exchange = exchange; + private _exchangeWrapper: ExchangeWrapper; + private _defaultBlock: BlockParamLiteral; + constructor(exchange: ExchangeWrapper, defaultBlock: BlockParamLiteral) { + this._exchangeWrapper = exchange; + this._defaultBlock = defaultBlock; } public async getFilledTakerAmountAsync(orderHash: string): Promise<BigNumber> { const methodOpts = { - defaultBlock: BlockParamLiteral.Pending, + defaultBlock: this._defaultBlock, }; - return this._exchange.getFilledTakerAmountAsync(orderHash, methodOpts); + const filledTakerAmount = this._exchangeWrapper.getFilledTakerAmountAsync(orderHash, methodOpts); + return filledTakerAmount; } public async getCancelledTakerAmountAsync(orderHash: string): Promise<BigNumber> { const methodOpts = { - defaultBlock: BlockParamLiteral.Pending, + defaultBlock: this._defaultBlock, }; - return this._exchange.getCancelledTakerAmountAsync(orderHash, methodOpts); + const cancelledTakerAmount = this._exchangeWrapper.getCancelledTakerAmountAsync(orderHash, methodOpts); + return cancelledTakerAmount; } } |