diff options
author | Fabio Berger <me@fabioberger.com> | 2017-05-30 18:28:07 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-05-30 18:28:07 +0800 |
commit | 55b00ab3809973e385b6baffd9c44d6db5540b12 (patch) | |
tree | 8dec738d372f593b4567e0233f5157a03e3bcda6 /src/0x.js.ts | |
parent | 87491e67414aad0fc30b3df4610bfd8e2ac4b96d (diff) | |
download | dexon-0x-contracts-55b00ab3809973e385b6baffd9c44d6db5540b12.tar.gz dexon-0x-contracts-55b00ab3809973e385b6baffd9c44d6db5540b12.tar.zst dexon-0x-contracts-55b00ab3809973e385b6baffd9c44d6db5540b12.zip |
Add setProvider method to 0x.js that updates the web3 provider and invalidates any contractInstances instantiated with the old provider
Diffstat (limited to 'src/0x.js.ts')
-rw-r--r-- | src/0x.js.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/0x.js.ts b/src/0x.js.ts index 11dbe3058..4b7edc0e9 100644 --- a/src/0x.js.ts +++ b/src/0x.js.ts @@ -134,6 +134,14 @@ export class ZeroEx { this.exchange = new ExchangeWrapper(this.web3Wrapper); } /** + * Sets a new provider for the web3 instance used by 0x.js internally and invalidates any instantiated + * contract instances created with the old provider. + */ + public setProvider(provider: Web3.Provider) { + this.web3Wrapper.setProvider(provider); + this.exchange.invalidateExchangeContract(); + } + /** * Signs an orderHash and returns it's elliptic curve signature * This method currently supports TestRPC, Geth and Parity above and below V1.6.6 */ |