From f3e6ef0fa96e2252e41b7ed6f2c3e88a1560153e Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 8 Feb 2018 18:01:53 +0100 Subject: Better validate ZeroExConfig on public networks --- packages/0x.js/src/0x.ts | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'packages/0x.js/src/0x.ts') diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts index 6cfa65cc2..d024e6097 100644 --- a/packages/0x.js/src/0x.ts +++ b/packages/0x.js/src/0x.ts @@ -13,6 +13,8 @@ import { TokenTransferProxyWrapper } from './contract_wrappers/token_transfer_pr import { TokenWrapper } from './contract_wrappers/token_wrapper'; import { OrderStateWatcher } from './order_watcher/order_state_watcher'; import { zeroExConfigSchema } from './schemas/zero_ex_config_schema'; +import { zeroExPrivateNetworkConfigSchema } from './schemas/zero_ex_private_network_config_schema'; +import { zeroExPublicNetworkConfigSchema } from './schemas/zero_ex_public_network_config_schema'; import { ECSignature, Order, SignedOrder, Web3Provider, ZeroExConfig, ZeroExError } from './types'; import { assert } from './utils/assert'; import { constants } from './utils/constants'; @@ -20,6 +22,9 @@ import { decorators } from './utils/decorators'; import { signatureUtils } from './utils/signature_utils'; import { utils } from './utils/utils'; +assert.schemaValidator.addSchema(zeroExPrivateNetworkConfigSchema); +assert.schemaValidator.addSchema(zeroExPublicNetworkConfigSchema); + /** * The ZeroEx class is the single entry-point into the 0x.js library. It contains all of the library's functionality * and all calls to the library should be made through a ZeroEx instance. -- cgit v1.2.3 From 7b67afae06c93290e6d8c4a4f0de2435f31ae714 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 20 Feb 2018 11:39:36 -0800 Subject: Change assert.doesConformToShema interface --- packages/0x.js/src/0x.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'packages/0x.js/src/0x.ts') diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts index d024e6097..c578478d8 100644 --- a/packages/0x.js/src/0x.ts +++ b/packages/0x.js/src/0x.ts @@ -22,9 +22,6 @@ import { decorators } from './utils/decorators'; import { signatureUtils } from './utils/signature_utils'; import { utils } from './utils/utils'; -assert.schemaValidator.addSchema(zeroExPrivateNetworkConfigSchema); -assert.schemaValidator.addSchema(zeroExPublicNetworkConfigSchema); - /** * The ZeroEx class is the single entry-point into the 0x.js library. It contains all of the library's functionality * and all calls to the library should be made through a ZeroEx instance. @@ -168,7 +165,10 @@ export class ZeroEx { */ constructor(provider: Web3Provider, config: ZeroExConfig) { assert.isWeb3Provider('provider', provider); - assert.doesConformToSchema('config', config, zeroExConfigSchema); + assert.doesConformToSchema('config', config, zeroExConfigSchema, [ + zeroExPrivateNetworkConfigSchema, + zeroExPublicNetworkConfigSchema, + ]); const artifactJSONs = _.values(artifacts); const abiArrays = _.map(artifactJSONs, artifact => artifact.abi); this._abiDecoder = new AbiDecoder(abiArrays); -- cgit v1.2.3