diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-11-23 23:41:05 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-11-24 05:15:00 +0800 |
commit | 34beee1edcd59b0f78c3dcce51cf847291ae06b4 (patch) | |
tree | 4befed4f518ec6d1d285b52e429db8c44a22ad46 /packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts | |
parent | 7bc6a7b23f655a62a71f5d28e3aadcd245f856b8 (diff) | |
download | dexon-0x-contracts-34beee1edcd59b0f78c3dcce51cf847291ae06b4.tar dexon-0x-contracts-34beee1edcd59b0f78c3dcce51cf847291ae06b4.tar.gz dexon-0x-contracts-34beee1edcd59b0f78c3dcce51cf847291ae06b4.tar.bz2 dexon-0x-contracts-34beee1edcd59b0f78c3dcce51cf847291ae06b4.tar.lz dexon-0x-contracts-34beee1edcd59b0f78c3dcce51cf847291ae06b4.tar.xz dexon-0x-contracts-34beee1edcd59b0f78c3dcce51cf847291ae06b4.tar.zst dexon-0x-contracts-34beee1edcd59b0f78c3dcce51cf847291ae06b4.zip |
Refactor getContractAddress to contractWrapper
Diffstat (limited to 'packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts')
-rw-r--r-- | packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts b/packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts index 468e58350..35337fa35 100644 --- a/packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts @@ -104,16 +104,10 @@ export class TokenRegistryWrapper extends ContractWrapper { * @returns The Ethereum address of the TokenRegistry contract being used. */ public getContractAddress(): string { - const networkId = this._web3Wrapper.getNetworkId(); - if (_.isUndefined(this._contractAddressIfExists)) { - const contractAddress = artifacts.TokenRegistryArtifact.networks[networkId].address; - if (_.isUndefined(contractAddress)) { - throw new Error(ZeroExError.ExchangeContractDoesNotExist); - } - return contractAddress; - } else { - return this._contractAddressIfExists; - } + const contractAddress = this._getContractAddress( + artifacts.TokenRegistryArtifact, this._contractAddressIfExists, + ); + return contractAddress; } private _invalidateContractInstance(): void { delete this._tokenRegistryContractIfExists; |