Revert "Use _.get for optional configs"
This reverts commit ecc54b07c7.
			
			
This commit is contained in:
		
							
								
								
									
										17
									
								
								src/0x.ts
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								src/0x.ts
									
									
									
									
									
								
							@@ -1,6 +1,5 @@
 | 
				
			|||||||
import * as _ from 'lodash';
 | 
					import * as _ from 'lodash';
 | 
				
			||||||
import BigNumber from 'bignumber.js';
 | 
					import BigNumber from 'bignumber.js';
 | 
				
			||||||
import * as Web3 from 'web3';
 | 
					 | 
				
			||||||
import {SchemaValidator, schemas} from '0x-json-schemas';
 | 
					import {SchemaValidator, schemas} from '0x-json-schemas';
 | 
				
			||||||
import {bigNumberConfigs} from './bignumber_config';
 | 
					import {bigNumberConfigs} from './bignumber_config';
 | 
				
			||||||
import * as ethUtil from 'ethereumjs-util';
 | 
					import * as ethUtil from 'ethereumjs-util';
 | 
				
			||||||
@@ -188,7 +187,7 @@ export class ZeroEx {
 | 
				
			|||||||
        const artifactJSONs = _.values(artifacts);
 | 
					        const artifactJSONs = _.values(artifacts);
 | 
				
			||||||
        const abiArrays = _.map(artifactJSONs, artifact => artifact.abi);
 | 
					        const abiArrays = _.map(artifactJSONs, artifact => artifact.abi);
 | 
				
			||||||
        this._abiDecoder = new AbiDecoder(abiArrays);
 | 
					        this._abiDecoder = new AbiDecoder(abiArrays);
 | 
				
			||||||
        const gasPrice: number|undefined = _.get(config, 'gasPrice');
 | 
					        const gasPrice = _.isUndefined(config) ? undefined : config.gasPrice;
 | 
				
			||||||
        const defaults = {
 | 
					        const defaults = {
 | 
				
			||||||
            gasPrice,
 | 
					            gasPrice,
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
@@ -198,7 +197,7 @@ export class ZeroEx {
 | 
				
			|||||||
            this._abiDecoder,
 | 
					            this._abiDecoder,
 | 
				
			||||||
            this._getTokenTransferProxyAddressAsync.bind(this),
 | 
					            this._getTokenTransferProxyAddressAsync.bind(this),
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
        const exchageContractAddressIfExists: string|undefined = _.get(config, 'exchangeContractAddress');
 | 
					        const exchageContractAddressIfExists = _.isUndefined(config) ? undefined : config.exchangeContractAddress;
 | 
				
			||||||
        this.exchange = new ExchangeWrapper(
 | 
					        this.exchange = new ExchangeWrapper(
 | 
				
			||||||
            this._web3Wrapper,
 | 
					            this._web3Wrapper,
 | 
				
			||||||
            this._abiDecoder,
 | 
					            this._abiDecoder,
 | 
				
			||||||
@@ -209,11 +208,13 @@ export class ZeroEx {
 | 
				
			|||||||
            this._web3Wrapper,
 | 
					            this._web3Wrapper,
 | 
				
			||||||
            this._getTokenTransferProxyAddressAsync.bind(this),
 | 
					            this._getTokenTransferProxyAddressAsync.bind(this),
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
        const tokenRegistryContractAddressIfExists = _.get(config, 'tokenRegistryContractAddress');
 | 
					        const tokenRegistryContractAddressIfExists = _.isUndefined(config) ?
 | 
				
			||||||
        this.tokenRegistry = new TokenRegistryWrapper(this._web3Wrapper, 'tokenRegistryContractAddressIfExists');
 | 
					                                                     undefined :
 | 
				
			||||||
        const etherTokenContractAddressIfExists = _.get(config, 'etherTokenContractAddress');
 | 
					                                                     config.tokenRegistryContractAddress;
 | 
				
			||||||
        this.etherToken = new EtherTokenWrapper(this._web3Wrapper, this.token, 'etherTokenContractAddressIfExists');
 | 
					        this.tokenRegistry = new TokenRegistryWrapper(this._web3Wrapper, tokenRegistryContractAddressIfExists);
 | 
				
			||||||
        const mempoolPollingIntervalMs: number|undefined = _.get(config, 'mempoolPollingIntervalMs');
 | 
					        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);
 | 
					        const orderStateUtils = new OrderStateUtils(this.token, this.exchange);
 | 
				
			||||||
        this.orderStateWatcher = new OrderStateWatcher(
 | 
					        this.orderStateWatcher = new OrderStateWatcher(
 | 
				
			||||||
            this._web3Wrapper, this._abiDecoder, orderStateUtils, mempoolPollingIntervalMs,
 | 
					            this._web3Wrapper, this._abiDecoder, orderStateUtils, mempoolPollingIntervalMs,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user