From 4ebf046cea8ff510567b5d05d188cd9f84ad1988 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 4 Jul 2017 11:12:56 -0700 Subject: Make invalidateContractInstancesAsync private on exchange and token --- src/0x.ts | 4 ++-- src/contract_wrappers/exchange_wrapper.ts | 8 ++++---- src/contract_wrappers/token_wrapper.ts | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/0x.ts b/src/0x.ts index d42c16ca6..25ad538b9 100644 --- a/src/0x.ts +++ b/src/0x.ts @@ -168,9 +168,9 @@ export class ZeroEx { */ public async setProviderAsync(provider: Web3Provider) { this._web3Wrapper.setProvider(provider); - await this.exchange.invalidateContractInstancesAsync(); + await (this.exchange as any)._invalidateContractInstancesAsync(); this.tokenRegistry.invalidateContractInstance(); - await this.token.invalidateContractInstancesAsync(); + await (this.token as any)._invalidateContractInstancesAsync(); this.proxy.invalidateContractInstance(); } /** diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index 9d9428327..72f00ee91 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -92,10 +92,6 @@ export class ExchangeWrapper extends ContractWrapper { this._exchangeLogEventEmitters = []; this._exchangeContractByAddress = {}; } - public async invalidateContractInstancesAsync(): Promise { - await this.stopWatchingAllEventsAsync(); - this._exchangeContractByAddress = {}; - } /** * Returns the unavailable takerAmount of an order. Unavailable amount is defined as the total * amount that has been filled or cancelled. The remaining takerAmount can be calculated by @@ -658,6 +654,10 @@ export class ExchangeWrapper extends ContractWrapper { await Promise.all(stopWatchingPromises); this._exchangeLogEventEmitters = []; } + private async _invalidateContractInstancesAsync(): Promise { + await this.stopWatchingAllEventsAsync(); + this._exchangeContractByAddress = {}; + } private async _isExchangeContractAddressProxyAuthorizedAsync(exchangeContractAddress: string): Promise { const isAuthorized = await this._proxyWrapper.isAuthorizedAsync(exchangeContractAddress); return isAuthorized; diff --git a/src/contract_wrappers/token_wrapper.ts b/src/contract_wrappers/token_wrapper.ts index 1ad1cd9d6..fdf711823 100644 --- a/src/contract_wrappers/token_wrapper.ts +++ b/src/contract_wrappers/token_wrapper.ts @@ -36,10 +36,6 @@ export class TokenWrapper extends ContractWrapper { this._tokenContractsByAddress = {}; this._tokenLogEventEmitters = []; } - public async invalidateContractInstancesAsync(): Promise { - await this.stopWatchingAllEventsAsync(); - this._tokenContractsByAddress = {}; - } /** * Retrieves an owner's ERC20 token balance. * @param tokenAddress The hex encoded contract Ethereum address where the ERC20 token is deployed. @@ -236,6 +232,10 @@ export class TokenWrapper extends ContractWrapper { await Promise.all(stopWatchingPromises); this._tokenLogEventEmitters = []; } + private async _invalidateContractInstancesAsync(): Promise { + await this.stopWatchingAllEventsAsync(); + this._tokenContractsByAddress = {}; + } private async _getTokenContractAsync(tokenAddress: string): Promise { let tokenContract = this._tokenContractsByAddress[tokenAddress]; if (!_.isUndefined(tokenContract)) { -- cgit v1.2.3