aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src/0x.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-11-22 04:25:27 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-11-24 05:13:36 +0800
commit92efc6584700d34db734396e76626003c1bba37d (patch)
tree3ea287301390b2082c1423ec0ec36228d12be7bb /packages/0x.js/src/0x.ts
parent17e41f2391a73656cce2ddf43c27acd2ae6260fd (diff)
downloaddexon-sol-tools-92efc6584700d34db734396e76626003c1bba37d.tar
dexon-sol-tools-92efc6584700d34db734396e76626003c1bba37d.tar.gz
dexon-sol-tools-92efc6584700d34db734396e76626003c1bba37d.tar.bz2
dexon-sol-tools-92efc6584700d34db734396e76626003c1bba37d.tar.lz
dexon-sol-tools-92efc6584700d34db734396e76626003c1bba37d.tar.xz
dexon-sol-tools-92efc6584700d34db734396e76626003c1bba37d.tar.zst
dexon-sol-tools-92efc6584700d34db734396e76626003c1bba37d.zip
Add networkId to ZeroExConfig and make it required
Diffstat (limited to 'packages/0x.js/src/0x.ts')
-rw-r--r--packages/0x.js/src/0x.ts23
1 files changed, 7 insertions, 16 deletions
diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts
index 85c2b7724..1f4af9fea 100644
--- a/packages/0x.js/src/0x.ts
+++ b/packages/0x.js/src/0x.ts
@@ -169,17 +169,14 @@ export class ZeroEx {
* @param config The configuration object. Look up the type for the description.
* @return An instance of the 0x.js ZeroEx class.
*/
- constructor(provider: Web3Provider, config?: ZeroExConfig) {
+ constructor(provider: Web3Provider, config: ZeroExConfig) {
assert.isWeb3Provider('provider', provider);
- if (!_.isUndefined(config)) {
- assert.doesConformToSchema('config', config, zeroExConfigSchema);
- }
+ assert.doesConformToSchema('config', config, zeroExConfigSchema);
const artifactJSONs = _.values(artifacts);
const abiArrays = _.map(artifactJSONs, artifact => artifact.abi);
this._abiDecoder = new AbiDecoder(abiArrays);
- const gasPrice = _.isUndefined(config) ? undefined : config.gasPrice;
const defaults = {
- gasPrice,
+ gasPrice: config.gasPrice,
};
this._web3Wrapper = new Web3Wrapper(provider, defaults);
this.token = new TokenWrapper(
@@ -187,26 +184,20 @@ export class ZeroEx {
this._abiDecoder,
this._getTokenTransferProxyAddressAsync.bind(this),
);
- const exchageContractAddressIfExists = _.isUndefined(config) ? undefined : config.exchangeContractAddress;
this.exchange = new ExchangeWrapper(
this._web3Wrapper,
this._abiDecoder,
this.token,
- exchageContractAddressIfExists,
+ config.exchangeContractAddress,
);
this.proxy = new TokenTransferProxyWrapper(
this._web3Wrapper,
this._getTokenTransferProxyAddressAsync.bind(this),
);
- 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;
+ this.tokenRegistry = new TokenRegistryWrapper(this._web3Wrapper, config.tokenRegistryContractAddress);
+ this.etherToken = new EtherTokenWrapper(this._web3Wrapper, this.token, config.etherTokenContractAddress);
this.orderStateWatcher = new OrderStateWatcher(
- this._web3Wrapper, this._abiDecoder, this.token, this.exchange, orderWatcherConfig,
+ this._web3Wrapper, this._abiDecoder, this.token, this.exchange, config.orderWatcherConfig,
);
}
/**