aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-02-05 19:28:27 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-02-05 19:28:27 +0800
commita816fb5958116127b1fffb78f5fca07624b5b0a5 (patch)
tree8c6e889a3ddf4727664cedf2d7815c08cd6322eb
parent1c1f2ef1ffdf56732e39c4c061d1c845c3fb2248 (diff)
downloaddexon-0x-contracts-a816fb5958116127b1fffb78f5fca07624b5b0a5.tar.gz
dexon-0x-contracts-a816fb5958116127b1fffb78f5fca07624b5b0a5.tar.zst
dexon-0x-contracts-a816fb5958116127b1fffb78f5fca07624b5b0a5.zip
Improve the comment and fix an exception
-rw-r--r--packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts10
1 files changed, 7 insertions, 3 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 1373e7baf..ead6fe9d1 100644
--- a/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts
+++ b/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts
@@ -165,12 +165,16 @@ export class EtherTokenWrapper extends ContractWrapper {
}
/**
* 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.
+ * that the user-passed web3 provider is connected to. If it's not Kovan, Ropsten, Rinkeby, Mainnet or TestRPC
+ * (networkId: 50), it will return undefined (e.g a private network).
* @returns The Ethereum address of the EtherToken contract or undefined.
*/
public getContractAddressIfExists(): string | undefined {
- const contractAddress = artifacts.EtherTokenArtifact.networks[this._networkId].address;
- return contractAddress;
+ const networkSpecificArtifact = artifacts.EtherTokenArtifact.networks[this._networkId];
+ const contractAddressIfExists = _.isUndefined(networkSpecificArtifact)
+ ? undefined
+ : networkSpecificArtifact.address;
+ return contractAddressIfExists;
}
private _invalidateContractInstance(): void {
this.unsubscribeAll();