diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2017-12-20 13:44:08 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-12-20 22:30:25 +0800 |
commit | cb11aec84df346d5180c7d5874859c1c34f0bf1c (patch) | |
tree | b959a65bdcfc3e8b01dca1bc160f93a0df8a4bf9 /packages/0x.js/src/stores | |
parent | 972e1675f6490bc10e8d9fd64cce2f7945cd4840 (diff) | |
download | dexon-sol-tools-cb11aec84df346d5180c7d5874859c1c34f0bf1c.tar.gz dexon-sol-tools-cb11aec84df346d5180c7d5874859c1c34f0bf1c.tar.zst dexon-sol-tools-cb11aec84df346d5180c7d5874859c1c34f0bf1c.zip |
Add new underscore-privates rule to @0xproject/tslint-config and fix lint errors
Diffstat (limited to 'packages/0x.js/src/stores')
-rw-r--r-- | packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts | 66 | ||||
-rw-r--r-- | packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts | 36 |
2 files changed, 51 insertions, 51 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 cde1ef095..ce93a70da 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 @@ -8,77 +8,77 @@ import {BlockParamLiteral} from '../types'; * Copy on read store for balances/proxyAllowances of tokens/accounts */ export class BalanceAndProxyAllowanceLazyStore { - private token: TokenWrapper; - private defaultBlock: BlockParamLiteral; - private balance: { + private _token: TokenWrapper; + private _defaultBlock: BlockParamLiteral; + private _balance: { [tokenAddress: string]: { [userAddress: string]: BigNumber; }; }; - private proxyAllowance: { + private _proxyAllowance: { [tokenAddress: string]: { [userAddress: string]: BigNumber; }; }; constructor(token: TokenWrapper, defaultBlock: BlockParamLiteral) { - this.token = token; - this.defaultBlock = defaultBlock; - this.balance = {}; - this.proxyAllowance = {}; + 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])) { + if (_.isUndefined(this._balance[tokenAddress]) || _.isUndefined(this._balance[tokenAddress][userAddress])) { const methodOpts = { - defaultBlock: this.defaultBlock, + defaultBlock: this._defaultBlock, }; - const balance = await this.token.getBalanceAsync(tokenAddress, userAddress, methodOpts); + const balance = await this._token.getBalanceAsync(tokenAddress, userAddress, methodOpts); this.setBalance(tokenAddress, userAddress, balance); } - const cachedBalance = this.balance[tokenAddress][userAddress]; + const cachedBalance = this._balance[tokenAddress][userAddress]; return cachedBalance; } public setBalance(tokenAddress: string, userAddress: string, balance: BigNumber): void { - if (_.isUndefined(this.balance[tokenAddress])) { - this.balance[tokenAddress] = {}; + if (_.isUndefined(this._balance[tokenAddress])) { + this._balance[tokenAddress] = {}; } - this.balance[tokenAddress][userAddress] = balance; + this._balance[tokenAddress][userAddress] = balance; } public deleteBalance(tokenAddress: string, userAddress: string): void { - if (!_.isUndefined(this.balance[tokenAddress])) { - delete this.balance[tokenAddress][userAddress]; - if (_.isEmpty(this.balance[tokenAddress])) { - delete this.balance[tokenAddress]; + if (!_.isUndefined(this._balance[tokenAddress])) { + delete this._balance[tokenAddress][userAddress]; + if (_.isEmpty(this._balance[tokenAddress])) { + delete this._balance[tokenAddress]; } } } public async getProxyAllowanceAsync(tokenAddress: string, userAddress: string): Promise<BigNumber> { - if (_.isUndefined(this.proxyAllowance[tokenAddress]) || - _.isUndefined(this.proxyAllowance[tokenAddress][userAddress])) { + if (_.isUndefined(this._proxyAllowance[tokenAddress]) || + _.isUndefined(this._proxyAllowance[tokenAddress][userAddress])) { const methodOpts = { - defaultBlock: this.defaultBlock, + defaultBlock: this._defaultBlock, }; - const proxyAllowance = await this.token.getProxyAllowanceAsync(tokenAddress, userAddress, methodOpts); + const proxyAllowance = await this._token.getProxyAllowanceAsync(tokenAddress, userAddress, methodOpts); this.setProxyAllowance(tokenAddress, userAddress, proxyAllowance); } - const cachedProxyAllowance = this.proxyAllowance[tokenAddress][userAddress]; + const cachedProxyAllowance = this._proxyAllowance[tokenAddress][userAddress]; return cachedProxyAllowance; } public setProxyAllowance(tokenAddress: string, userAddress: string, proxyAllowance: BigNumber): void { - if (_.isUndefined(this.proxyAllowance[tokenAddress])) { - this.proxyAllowance[tokenAddress] = {}; + if (_.isUndefined(this._proxyAllowance[tokenAddress])) { + this._proxyAllowance[tokenAddress] = {}; } - this.proxyAllowance[tokenAddress][userAddress] = proxyAllowance; + this._proxyAllowance[tokenAddress][userAddress] = proxyAllowance; } public deleteProxyAllowance(tokenAddress: string, userAddress: string): void { - if (!_.isUndefined(this.proxyAllowance[tokenAddress])) { - delete this.proxyAllowance[tokenAddress][userAddress]; - if (_.isEmpty(this.proxyAllowance[tokenAddress])) { - delete this.proxyAllowance[tokenAddress]; + if (!_.isUndefined(this._proxyAllowance[tokenAddress])) { + delete this._proxyAllowance[tokenAddress][userAddress]; + if (_.isEmpty(this._proxyAllowance[tokenAddress])) { + delete this._proxyAllowance[tokenAddress]; } } } public deleteAll(): void { - this.balance = {}; - this.proxyAllowance = {}; + this._balance = {}; + this._proxyAllowance = {}; } } 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 b35355e38..54e260a8e 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 @@ -8,54 +8,54 @@ import {BlockParamLiteral} from '../types'; * Copy on read store for filled/cancelled taker amounts */ export class OrderFilledCancelledLazyStore { - private exchange: ExchangeWrapper; - private filledTakerAmount: { + private _exchange: ExchangeWrapper; + private _filledTakerAmount: { [orderHash: string]: BigNumber; }; - private cancelledTakerAmount: { + private _cancelledTakerAmount: { [orderHash: string]: BigNumber; }; constructor(exchange: ExchangeWrapper) { - this.exchange = exchange; - this.filledTakerAmount = {}; - this.cancelledTakerAmount = {}; + this._exchange = exchange; + this._filledTakerAmount = {}; + this._cancelledTakerAmount = {}; } public async getFilledTakerAmountAsync(orderHash: string): Promise<BigNumber> { - if (_.isUndefined(this.filledTakerAmount[orderHash])) { + if (_.isUndefined(this._filledTakerAmount[orderHash])) { const methodOpts = { defaultBlock: BlockParamLiteral.Pending, }; - const filledTakerAmount = await this.exchange.getFilledTakerAmountAsync(orderHash, methodOpts); + const filledTakerAmount = await this._exchange.getFilledTakerAmountAsync(orderHash, methodOpts); this.setFilledTakerAmount(orderHash, filledTakerAmount); } - const cachedFilled = this.filledTakerAmount[orderHash]; + const cachedFilled = this._filledTakerAmount[orderHash]; return cachedFilled; } public setFilledTakerAmount(orderHash: string, filledTakerAmount: BigNumber): void { - this.filledTakerAmount[orderHash] = filledTakerAmount; + this._filledTakerAmount[orderHash] = filledTakerAmount; } public deleteFilledTakerAmount(orderHash: string): void { - delete this.filledTakerAmount[orderHash]; + delete this._filledTakerAmount[orderHash]; } public async getCancelledTakerAmountAsync(orderHash: string): Promise<BigNumber> { - if (_.isUndefined(this.cancelledTakerAmount[orderHash])) { + if (_.isUndefined(this._cancelledTakerAmount[orderHash])) { const methodOpts = { defaultBlock: BlockParamLiteral.Pending, }; - const cancelledTakerAmount = await this.exchange.getCancelledTakerAmountAsync(orderHash, methodOpts); + const cancelledTakerAmount = await this._exchange.getCancelledTakerAmountAsync(orderHash, methodOpts); this.setCancelledTakerAmount(orderHash, cancelledTakerAmount); } - const cachedCancelled = this.cancelledTakerAmount[orderHash]; + const cachedCancelled = this._cancelledTakerAmount[orderHash]; return cachedCancelled; } public setCancelledTakerAmount(orderHash: string, cancelledTakerAmount: BigNumber): void { - this.cancelledTakerAmount[orderHash] = cancelledTakerAmount; + this._cancelledTakerAmount[orderHash] = cancelledTakerAmount; } public deleteCancelledTakerAmount(orderHash: string): void { - delete this.cancelledTakerAmount[orderHash]; + delete this._cancelledTakerAmount[orderHash]; } public deleteAll(): void { - this.filledTakerAmount = {}; - this.cancelledTakerAmount = {}; + this._filledTakerAmount = {}; + this._cancelledTakerAmount = {}; } } |