aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-11-24 03:48:44 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-11-24 05:15:47 +0800
commit0c74d5ba0157429f7f4651dcfe750bf00360962c (patch)
tree726cac455172e60922a918ef1644a2c50a29a773 /packages/0x.js/src
parent0cd1959706b454833d4ba58e038e83cc6cb47e7d (diff)
downloaddexon-sol-tools-0c74d5ba0157429f7f4651dcfe750bf00360962c.tar
dexon-sol-tools-0c74d5ba0157429f7f4651dcfe750bf00360962c.tar.gz
dexon-sol-tools-0c74d5ba0157429f7f4651dcfe750bf00360962c.tar.bz2
dexon-sol-tools-0c74d5ba0157429f7f4651dcfe750bf00360962c.tar.lz
dexon-sol-tools-0c74d5ba0157429f7f4651dcfe750bf00360962c.tar.xz
dexon-sol-tools-0c74d5ba0157429f7f4651dcfe750bf00360962c.tar.zst
dexon-sol-tools-0c74d5ba0157429f7f4651dcfe750bf00360962c.zip
Move variable declaration inside the if
Diffstat (limited to 'packages/0x.js/src')
-rw-r--r--packages/0x.js/src/contract_wrappers/contract_wrapper.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/0x.js/src/contract_wrappers/contract_wrapper.ts b/packages/0x.js/src/contract_wrappers/contract_wrapper.ts
index 522b40d52..395d974b2 100644
--- a/packages/0x.js/src/contract_wrappers/contract_wrapper.ts
+++ b/packages/0x.js/src/contract_wrappers/contract_wrapper.ts
@@ -96,6 +96,18 @@ export class ContractWrapper {
await this._web3Wrapper.getContractInstanceFromArtifactAsync<ContractType>(artifact, addressIfExists);
return contractInstance;
}
+ protected _getContractAddress(artifact: Artifact, addressIfExists?: string): string {
+ if (_.isUndefined(addressIfExists)) {
+ const networkId = this._web3Wrapper.getNetworkId();
+ const contractAddress = artifact.networks[networkId].address;
+ if (_.isUndefined(contractAddress)) {
+ throw new Error(ZeroExError.ExchangeContractDoesNotExist);
+ }
+ return contractAddress;
+ } else {
+ return addressIfExists;
+ }
+ }
private _onLogStateChanged<ArgsType extends ContractEventArgs>(isRemoved: boolean, log: Web3.LogEntry): void {
_.forEach(this._filters, (filter: Web3.FilterObject, filterToken: string) => {
if (filterUtils.matchesFilter(log, filter)) {