aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ts/0x.js.ts4
-rw-r--r--src/ts/contract_wrappers/contract_wrapper.ts9
2 files changed, 7 insertions, 6 deletions
diff --git a/src/ts/0x.js.ts b/src/ts/0x.js.ts
index 8496a0989..bd4978c96 100644
--- a/src/ts/0x.js.ts
+++ b/src/ts/0x.js.ts
@@ -1,11 +1,11 @@
+import * as _ from 'lodash';
import * as BigNumber from 'bignumber.js';
import * as BN from 'bn.js';
import * as ethUtil from 'ethereumjs-util';
import contract = require('truffle-contract');
import * as Web3 from 'web3';
-import {Web3Wrapper} from './web3_wrapper';
import * as ethABI from 'ethereumjs-abi';
-import * as _ from 'lodash';
+import {Web3Wrapper} from './web3_wrapper';
import {constants} from './utils/constants';
import {assert} from './utils/assert';
import {ExchangeWrapper} from './contract_wrappers/exchange_wrapper';
diff --git a/src/ts/contract_wrappers/contract_wrapper.ts b/src/ts/contract_wrappers/contract_wrapper.ts
index aeb52b0e1..225cb960f 100644
--- a/src/ts/contract_wrappers/contract_wrapper.ts
+++ b/src/ts/contract_wrappers/contract_wrapper.ts
@@ -9,14 +9,15 @@ export class ContractWrapper {
constructor(web3Wrapper: Web3Wrapper) {
this.web3Wrapper = web3Wrapper;
}
- // this.exchange = await this.instantiateContractIfExistsAsync(ExchangeArtifacts);
protected async instantiateContractIfExistsAsync(artifact: Artifact, address?: string): Promise<ContractInstance> {
const c = await contract(artifact);
const providerObj = this.web3Wrapper.getCurrentProvider();
c.setProvider(providerObj);
- const networkId = await this.web3Wrapper.getNetworkIdIfExistsAsync();
- const artifactNetworkConfigs = _.isUndefined(networkId) ? undefined : artifact.networks[networkId];
+ const networkIdIfExists = await this.web3Wrapper.getNetworkIdIfExistsAsync();
+ const artifactNetworkConfigs = _.isUndefined(networkIdIfExists) ?
+ undefined :
+ artifact.networks[networkIdIfExists];
let contractAddress;
if (!_.isUndefined(address)) {
contractAddress = address;
@@ -41,10 +42,10 @@ export class ContractWrapper {
return contractInstance;
} catch (err) {
const errMsg = `${err}`;
- utils.consoleLog(`Notice: Error encountered: ${err} ${err.stack}`);
if (_.includes(errMsg, 'not been deployed to detected network')) {
throw new Error(ZeroExError.CONTRACT_DOES_NOT_EXIST);
} else {
+ utils.consoleLog(`Notice: Error encountered: ${err} ${err.stack}`);
throw new Error(ZeroExError.UNHANDLED_ERROR);
}
}