diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-01-30 21:35:04 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-01-30 21:35:04 +0800 |
commit | 0a73bbe279ccc0f39363f0bb700c5f581ec5f654 (patch) | |
tree | 5b9d1834fb0f708d264a10f2393f752b6ecea239 /packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts | |
parent | 2e3c02887efc24de35ce82b3662d9c47a0056a8c (diff) | |
download | dexon-0x-contracts-0a73bbe279ccc0f39363f0bb700c5f581ec5f654.tar dexon-0x-contracts-0a73bbe279ccc0f39363f0bb700c5f581ec5f654.tar.gz dexon-0x-contracts-0a73bbe279ccc0f39363f0bb700c5f581ec5f654.tar.bz2 dexon-0x-contracts-0a73bbe279ccc0f39363f0bb700c5f581ec5f654.tar.lz dexon-0x-contracts-0a73bbe279ccc0f39363f0bb700c5f581ec5f654.tar.xz dexon-0x-contracts-0a73bbe279ccc0f39363f0bb700c5f581ec5f654.tar.zst dexon-0x-contracts-0a73bbe279ccc0f39363f0bb700c5f581ec5f654.zip |
Add zeroEx.etherToken.getContractAddressifExists
Diffstat (limited to 'packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts')
-rw-r--r-- | packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts b/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts index b03571636..1373e7baf 100644 --- a/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts @@ -163,6 +163,15 @@ export class EtherTokenWrapper extends ContractWrapper { public unsubscribeAll(): void { super.unsubscribeAll(); } + /** + * Retrieves the Ethereum address of the EtherToken contract deployed on the network + * that the user-passed web3 provider is connected to. If it's an unknown private network - undefined is returned. + * @returns The Ethereum address of the EtherToken contract or undefined. + */ + public getContractAddressIfExists(): string | undefined { + const contractAddress = artifacts.EtherTokenArtifact.networks[this._networkId].address; + return contractAddress; + } private _invalidateContractInstance(): void { this.unsubscribeAll(); this._etherTokenContractsByAddress = {}; |