From 52007e5864a545c76e0a58cdc82fc8107167526b Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 23 Nov 2017 13:50:03 -0600 Subject: Reuse the protected function to get contract address --- packages/0x.js/src/contract_wrappers/exchange_wrapper.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'packages') diff --git a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts index 883cc0f49..637c27361 100644 --- a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts @@ -705,16 +705,8 @@ export class ExchangeWrapper extends ContractWrapper { * @returns The Ethereum address of the Exchange contract being used. */ public getContractAddress(): string { - const networkId = this._web3Wrapper.getNetworkId(); - if (_.isUndefined(this._contractAddressIfExists)) { - const contractAddress = artifacts.ExchangeArtifact.networks[networkId].address; - if (_.isUndefined(contractAddress)) { - throw new Error(ZeroExError.ExchangeContractDoesNotExist); - } - return contractAddress; - } else { - return this._contractAddressIfExists; - } + const contractAddress = this._getContractAddress(artifacts.ExchangeArtifact, this._contractAddressIfExists); + return contractAddress; } /** * Checks if order is still fillable and throws an error otherwise. Useful for orderbook -- cgit v1.2.3