Add setProvider method to 0x.js that updates the web3 provider and invalidates any contractInstances instantiated with the old provider
This commit is contained in:
parent
87491e6741
commit
55b00ab380
@ -133,6 +133,14 @@ export class ZeroEx {
|
||||
this.web3Wrapper = new Web3Wrapper(web3);
|
||||
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
|
||||
|
@ -9,6 +9,9 @@ export class Web3Wrapper {
|
||||
this.web3 = new Web3();
|
||||
this.web3.setProvider(web3.currentProvider);
|
||||
}
|
||||
public setProvider(provider: Web3.Provider) {
|
||||
this.web3.setProvider(provider);
|
||||
}
|
||||
public isAddress(address: string): boolean {
|
||||
return this.web3.isAddress(address);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user