aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-11-10 05:48:36 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-11-10 05:48:45 +0800
commit1c6e6842c66a61795794556cb08ed778494358f5 (patch)
treea4f95b449fe45ac680d81a3ad6f97f36a40cb901
parent6f5a55b5fe4c6f0f56303b6ac5dcbd99129ee7bd (diff)
downloaddexon-0x-contracts-1c6e6842c66a61795794556cb08ed778494358f5.tar.gz
dexon-0x-contracts-1c6e6842c66a61795794556cb08ed778494358f5.tar.zst
dexon-0x-contracts-1c6e6842c66a61795794556cb08ed778494358f5.zip
Revert "Use _.get for optional configs"
This reverts commit ecc54b07c70c9f191a0eb0dece8137f088250a41.
-rw-r--r--src/0x.ts17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/0x.ts b/src/0x.ts
index 75a154930..7c381a498 100644
--- a/src/0x.ts
+++ b/src/0x.ts
@@ -1,6 +1,5 @@
import * as _ from 'lodash';
import BigNumber from 'bignumber.js';
-import * as Web3 from 'web3';
import {SchemaValidator, schemas} from '0x-json-schemas';
import {bigNumberConfigs} from './bignumber_config';
import * as ethUtil from 'ethereumjs-util';
@@ -188,7 +187,7 @@ export class ZeroEx {
const artifactJSONs = _.values(artifacts);
const abiArrays = _.map(artifactJSONs, artifact => artifact.abi);
this._abiDecoder = new AbiDecoder(abiArrays);
- const gasPrice: number|undefined = _.get(config, 'gasPrice');
+ const gasPrice = _.isUndefined(config) ? undefined : config.gasPrice;
const defaults = {
gasPrice,
};
@@ -198,7 +197,7 @@ export class ZeroEx {
this._abiDecoder,
this._getTokenTransferProxyAddressAsync.bind(this),
);
- const exchageContractAddressIfExists: string|undefined = _.get(config, 'exchangeContractAddress');
+ const exchageContractAddressIfExists = _.isUndefined(config) ? undefined : config.exchangeContractAddress;
this.exchange = new ExchangeWrapper(
this._web3Wrapper,
this._abiDecoder,
@@ -209,11 +208,13 @@ export class ZeroEx {
this._web3Wrapper,
this._getTokenTransferProxyAddressAsync.bind(this),
);
- const tokenRegistryContractAddressIfExists = _.get(config, 'tokenRegistryContractAddress');
- this.tokenRegistry = new TokenRegistryWrapper(this._web3Wrapper, 'tokenRegistryContractAddressIfExists');
- const etherTokenContractAddressIfExists = _.get(config, 'etherTokenContractAddress');
- this.etherToken = new EtherTokenWrapper(this._web3Wrapper, this.token, 'etherTokenContractAddressIfExists');
- const mempoolPollingIntervalMs: number|undefined = _.get(config, 'mempoolPollingIntervalMs');
+ const tokenRegistryContractAddressIfExists = _.isUndefined(config) ?
+ undefined :
+ config.tokenRegistryContractAddress;
+ this.tokenRegistry = new TokenRegistryWrapper(this._web3Wrapper, tokenRegistryContractAddressIfExists);
+ const etherTokenContractAddressIfExists = _.isUndefined(config) ? undefined : config.etherTokenContractAddress;
+ this.etherToken = new EtherTokenWrapper(this._web3Wrapper, this.token, etherTokenContractAddressIfExists);
+ const mempoolPollingIntervalMs = _.isUndefined(config) ? undefined : config.mempoolPollingIntervalMs;
const orderStateUtils = new OrderStateUtils(this.token, this.exchange);
this.orderStateWatcher = new OrderStateWatcher(
this._web3Wrapper, this._abiDecoder, orderStateUtils, mempoolPollingIntervalMs,