aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-02-06 04:56:41 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-02-06 04:56:41 +0800
commit7e5b7a7f2af0711f91895ecac3acb95c9d4878dd (patch)
tree5112c44f2345df641cea4165cc0fe1864f157e1c /packages/0x.js/src
parent881d32e73324b226bdc97f96fb583edb7a5311c1 (diff)
parent156e85a6b3347c8c7f3751632ef98757194a5ab0 (diff)
downloaddexon-sol-tools-7e5b7a7f2af0711f91895ecac3acb95c9d4878dd.tar
dexon-sol-tools-7e5b7a7f2af0711f91895ecac3acb95c9d4878dd.tar.gz
dexon-sol-tools-7e5b7a7f2af0711f91895ecac3acb95c9d4878dd.tar.bz2
dexon-sol-tools-7e5b7a7f2af0711f91895ecac3acb95c9d4878dd.tar.lz
dexon-sol-tools-7e5b7a7f2af0711f91895ecac3acb95c9d4878dd.tar.xz
dexon-sol-tools-7e5b7a7f2af0711f91895ecac3acb95c9d4878dd.tar.zst
dexon-sol-tools-7e5b7a7f2af0711f91895ecac3acb95c9d4878dd.zip
Merge branch 'development' of github.com:0xProject/0x.js into development
Diffstat (limited to 'packages/0x.js/src')
-rw-r--r--packages/0x.js/src/contract_wrappers/contract_wrapper.ts2
-rw-r--r--packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts13
2 files changed, 14 insertions, 1 deletions
diff --git a/packages/0x.js/src/contract_wrappers/contract_wrapper.ts b/packages/0x.js/src/contract_wrappers/contract_wrapper.ts
index dcd59059f..2fbf8c32d 100644
--- a/packages/0x.js/src/contract_wrappers/contract_wrapper.ts
+++ b/packages/0x.js/src/contract_wrappers/contract_wrapper.ts
@@ -32,7 +32,7 @@ const CONTRACT_NAME_TO_NOT_FOUND_ERROR: {
export class ContractWrapper {
protected _web3Wrapper: Web3Wrapper;
- private _networkId: number;
+ protected _networkId: number;
private _abiDecoder?: AbiDecoder;
private _blockAndLogStreamerIfExists?: BlockAndLogStreamer;
private _blockAndLogStreamIntervalIfExists?: NodeJS.Timer;
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 cbafcfe94..32c9ae6a9 100644
--- a/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts
+++ b/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts
@@ -162,6 +162,19 @@ 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 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 networkSpecificArtifact = artifacts.EtherTokenArtifact.networks[this._networkId];
+ const contractAddressIfExists = _.isUndefined(networkSpecificArtifact)
+ ? undefined
+ : networkSpecificArtifact.address;
+ return contractAddressIfExists;
+ }
private _invalidateContractInstance(): void {
this._unsubscribeAll();
this._etherTokenContractsByAddress = {};