diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-10-16 08:35:25 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-10-16 08:35:25 +0800 |
commit | 6f8e98e53727a1efc08800017cf2bde38884c982 (patch) | |
tree | d58aa9662d32688f17675d70ed77be2170f54e06 /packages/contract-wrappers/src/contract_wrappers.ts | |
parent | e093864bff4b9e6191d6ed4d7fe8ce9c60c5c367 (diff) | |
download | dexon-sol-tools-6f8e98e53727a1efc08800017cf2bde38884c982.tar dexon-sol-tools-6f8e98e53727a1efc08800017cf2bde38884c982.tar.gz dexon-sol-tools-6f8e98e53727a1efc08800017cf2bde38884c982.tar.bz2 dexon-sol-tools-6f8e98e53727a1efc08800017cf2bde38884c982.tar.lz dexon-sol-tools-6f8e98e53727a1efc08800017cf2bde38884c982.tar.xz dexon-sol-tools-6f8e98e53727a1efc08800017cf2bde38884c982.tar.zst dexon-sol-tools-6f8e98e53727a1efc08800017cf2bde38884c982.zip |
In contract-wrappers, remove setProvider and add unsubscribeAll method.
Diffstat (limited to 'packages/contract-wrappers/src/contract_wrappers.ts')
-rw-r--r-- | packages/contract-wrappers/src/contract_wrappers.ts | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/packages/contract-wrappers/src/contract_wrappers.ts b/packages/contract-wrappers/src/contract_wrappers.ts index 9802e685d..36381c623 100644 --- a/packages/contract-wrappers/src/contract_wrappers.ts +++ b/packages/contract-wrappers/src/contract_wrappers.ts @@ -143,21 +143,13 @@ export class ContractWrappers { ); } /** - * Sets a new web3 provider for contract-wrappers. Updating the provider will stop all - * subscriptions so you will need to re-subscribe to all events relevant to your app after this call. - * @param provider The Web3Provider you would like the contract-wrappers library to use from now on. - * @param networkId The id of the network your provider is connected to + * Unsubscribes from all subscriptions for all contracts. */ - public setProvider(provider: Provider): void { - this._web3Wrapper.setProvider(provider); - (this.exchange as any)._invalidateContractInstances(); - (this.erc20Token as any)._invalidateContractInstances(); - (this.erc20Proxy as any)._invalidateContractInstance(); - (this.erc721Token as any)._invalidateContractInstances(); - (this.erc721Proxy as any)._invalidateContractInstance(); - (this.etherToken as any)._invalidateContractInstance(); - (this.forwarder as any)._invalidateContractInstance(); - (this.orderValidator as any)._invalidateContractInstance(); + public unsubscribeAll(): void { + this.exchange.unsubscribeAll(); + this.erc20Token.unsubscribeAll(); + this.erc721Token.unsubscribeAll(); + this.etherToken.unsubscribeAll(); } /** * Get the provider instance currently used by contract-wrappers |