aboutsummaryrefslogtreecommitdiffstats
path: root/src/contract_wrappers/contract_wrapper.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-06-21 19:56:14 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-06-21 19:56:14 +0800
commit40a7be0690c81d2e42543aa075ef8da6606e7b7e (patch)
tree73231f3671133364b53d55074f27e03bd61a1d38 /src/contract_wrappers/contract_wrapper.ts
parent096d3bdb26921cb3e7d05e65dc286ddf49f98a8a (diff)
downloaddexon-sol-tools-40a7be0690c81d2e42543aa075ef8da6606e7b7e.tar
dexon-sol-tools-40a7be0690c81d2e42543aa075ef8da6606e7b7e.tar.gz
dexon-sol-tools-40a7be0690c81d2e42543aa075ef8da6606e7b7e.tar.bz2
dexon-sol-tools-40a7be0690c81d2e42543aa075ef8da6606e7b7e.tar.lz
dexon-sol-tools-40a7be0690c81d2e42543aa075ef8da6606e7b7e.tar.xz
dexon-sol-tools-40a7be0690c81d2e42543aa075ef8da6606e7b7e.tar.zst
dexon-sol-tools-40a7be0690c81d2e42543aa075ef8da6606e7b7e.zip
Use different lodash import syntax which allows to include only used functions
Diffstat (limited to 'src/contract_wrappers/contract_wrapper.ts')
-rw-r--r--src/contract_wrappers/contract_wrapper.ts15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/contract_wrappers/contract_wrapper.ts b/src/contract_wrappers/contract_wrapper.ts
index f9c1bc1cf..dd403ce8b 100644
--- a/src/contract_wrappers/contract_wrapper.ts
+++ b/src/contract_wrappers/contract_wrapper.ts
@@ -1,4 +1,5 @@
-import * as _ from 'lodash';
+import includes from 'lodash/includes';
+import isUndefined from 'lodash/isUndefined';
import contract = require('truffle-contract');
import {Web3Wrapper} from '../web3_wrapper';
import {ZeroExError, Artifact, ContractInstance} from '../types';
@@ -15,17 +16,17 @@ export class ContractWrapper {
c.setProvider(providerObj);
const networkIdIfExists = await this._web3Wrapper.getNetworkIdIfExistsAsync();
- const artifactNetworkConfigs = _.isUndefined(networkIdIfExists) ?
+ const artifactNetworkConfigs = isUndefined(networkIdIfExists) ?
undefined :
artifact.networks[networkIdIfExists];
let contractAddress;
- if (!_.isUndefined(address)) {
+ if (!isUndefined(address)) {
contractAddress = address;
- } else if (!_.isUndefined(artifactNetworkConfigs)) {
+ } else if (!isUndefined(artifactNetworkConfigs)) {
contractAddress = artifactNetworkConfigs.address;
}
- if (!_.isUndefined(contractAddress)) {
+ if (!isUndefined(contractAddress)) {
const doesContractExist = await this._web3Wrapper.doesContractExistAtAddressAsync(contractAddress);
if (!doesContractExist) {
throw new Error(ZeroExError.CONTRACT_DOES_NOT_EXIST);
@@ -33,11 +34,11 @@ export class ContractWrapper {
}
try {
- const contractInstance = _.isUndefined(address) ? await c.deployed() : await c.at(address);
+ const contractInstance = isUndefined(address) ? await c.deployed() : await c.at(address);
return contractInstance;
} catch (err) {
const errMsg = `${err}`;
- if (_.includes(errMsg, 'not been deployed to detected network')) {
+ 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}`);