diff options
author | Leonid <logvinov.leon@gmail.com> | 2017-06-22 22:21:56 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-22 22:21:56 +0800 |
commit | 94cab6f694027d47971d661bca33beac42f4ade1 (patch) | |
tree | c411ec567878a8178aa64313bd9b76dfcb455fc7 /src/contract_wrappers/contract_wrapper.ts | |
parent | 25a9ba90f508e0d147c060f60a9e3683e07d45e4 (diff) | |
download | dexon-sol-tools-94cab6f694027d47971d661bca33beac42f4ade1.tar dexon-sol-tools-94cab6f694027d47971d661bca33beac42f4ade1.tar.gz dexon-sol-tools-94cab6f694027d47971d661bca33beac42f4ade1.tar.bz2 dexon-sol-tools-94cab6f694027d47971d661bca33beac42f4ade1.tar.lz dexon-sol-tools-94cab6f694027d47971d661bca33beac42f4ade1.tar.xz dexon-sol-tools-94cab6f694027d47971d661bca33beac42f4ade1.tar.zst dexon-sol-tools-94cab6f694027d47971d661bca33beac42f4ade1.zip |
Revert "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.ts | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/contract_wrappers/contract_wrapper.ts b/src/contract_wrappers/contract_wrapper.ts index f5d2cd4eb..f9c1bc1cf 100644 --- a/src/contract_wrappers/contract_wrapper.ts +++ b/src/contract_wrappers/contract_wrapper.ts @@ -1,5 +1,4 @@ -import includes = require('lodash/includes'); -import isUndefined = require('lodash/isUndefined'); +import * as _ from 'lodash'; import contract = require('truffle-contract'); import {Web3Wrapper} from '../web3_wrapper'; import {ZeroExError, Artifact, ContractInstance} from '../types'; @@ -16,17 +15,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); @@ -34,11 +33,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}`); |