Fix the bug when didn't invalidate etherToken contract instance

This commit is contained in:
Leonid Logvinov
2017-07-04 11:48:41 -07:00
parent 74e991db94
commit a45f6ff4af
3 changed files with 5 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ v0.8.0 - TBD
* `zeroEx.exchange.invalidateContractInstancesAsync`
* `zeroEx.proxy.invalidateContractInstance`
* `zeroEx.tokenRegistry.invalidateContractInstance`
* Fix the bug when `zeroEx.setProviderAsync` didn't invalidate etherToken contract instance
v0.7.1 - _Jun. 26, 2017_
------------------------

View File

@@ -172,6 +172,7 @@ export class ZeroEx {
(this.tokenRegistry as any)._invalidateContractInstance();
await (this.token as any)._invalidateContractInstancesAsync();
(this.proxy as any)._invalidateContractInstance();
(this.etherToken as any)._invalidateContractInstance();
}
/**
* Get user Ethereum addresses available through the supplied web3 instance available for sending transactions.

View File

@@ -64,6 +64,9 @@ export class EtherTokenWrapper extends ContractWrapper {
const wethContract = await this._getEtherTokenContractAsync();
return wethContract.address;
}
private _invalidateContractInstance(): void {
delete this._etherTokenContractIfExists;
}
private async _getEtherTokenContractAsync(): Promise<EtherTokenContract> {
if (!_.isUndefined(this._etherTokenContractIfExists)) {
return this._etherTokenContractIfExists;