diff options
author | Fabio Berger <me@fabioberger.com> | 2017-11-10 06:01:30 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-11-10 06:01:30 +0800 |
commit | 9d2432520792bd47958c948a8563a398c0184b17 (patch) | |
tree | f62de8bd07fe58011115dd54c063d8b90ba2d854 | |
parent | 126a165f558326625d892c4a379c0ebd66088c9a (diff) | |
parent | 1c6e6842c66a61795794556cb08ed778494358f5 (diff) | |
download | dexon-sol-tools-9d2432520792bd47958c948a8563a398c0184b17.tar dexon-sol-tools-9d2432520792bd47958c948a8563a398c0184b17.tar.gz dexon-sol-tools-9d2432520792bd47958c948a8563a398c0184b17.tar.bz2 dexon-sol-tools-9d2432520792bd47958c948a8563a398c0184b17.tar.lz dexon-sol-tools-9d2432520792bd47958c948a8563a398c0184b17.tar.xz dexon-sol-tools-9d2432520792bd47958c948a8563a398c0184b17.tar.zst dexon-sol-tools-9d2432520792bd47958c948a8563a398c0184b17.zip |
Merge branch 'orderWatcher' of github.com:0xProject/0x.js into orderWatcher
* 'orderWatcher' of github.com:0xProject/0x.js:
Revert "Use _.get for optional configs"
# Conflicts:
# src/0x.ts
-rw-r--r-- | src/0x.ts | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -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'; @@ -189,7 +188,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, }; @@ -199,7 +198,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, @@ -210,11 +209,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 orderWatcherConfig: OrderStateWatcherConfig|undefined = _.get(config, 'orderWatcherConfig'); + 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 orderWatcherConfig = _.isUndefined(config) ? undefined : config.orderWatcherConfig; const orderStateUtils = new OrderStateUtils(this.token, this.exchange); this.orderStateWatcher = new OrderStateWatcher( this._web3Wrapper, this._abiDecoder, orderStateUtils, orderWatcherConfig, |