aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contract-wrappers/src')
-rw-r--r--packages/contract-wrappers/src/contract_wrappers.ts7
-rw-r--r--packages/contract-wrappers/src/schemas/contract_wrappers_config_schema.ts22
-rw-r--r--packages/contract-wrappers/src/schemas/contract_wrappers_private_network_config_schema.ts36
-rw-r--r--packages/contract-wrappers/src/schemas/contract_wrappers_public_network_config_schema.ts44
4 files changed, 22 insertions, 87 deletions
diff --git a/packages/contract-wrappers/src/contract_wrappers.ts b/packages/contract-wrappers/src/contract_wrappers.ts
index ebca2e99d..9802e685d 100644
--- a/packages/contract-wrappers/src/contract_wrappers.ts
+++ b/packages/contract-wrappers/src/contract_wrappers.ts
@@ -21,8 +21,6 @@ import { ExchangeWrapper } from './contract_wrappers/exchange_wrapper';
import { ForwarderWrapper } from './contract_wrappers/forwarder_wrapper';
import { OrderValidatorWrapper } from './contract_wrappers/order_validator_wrapper';
import { ContractWrappersConfigSchema } from './schemas/contract_wrappers_config_schema';
-import { contractWrappersPrivateNetworkConfigSchema } from './schemas/contract_wrappers_private_network_config_schema';
-import { contractWrappersPublicNetworkConfigSchema } from './schemas/contract_wrappers_public_network_config_schema';
import { ContractWrappersConfig } from './types';
import { assert } from './utils/assert';
import { constants } from './utils/constants';
@@ -78,10 +76,7 @@ export class ContractWrappers {
*/
constructor(provider: Provider, config: ContractWrappersConfig) {
assert.isWeb3Provider('provider', provider);
- assert.doesConformToSchema('config', config, ContractWrappersConfigSchema, [
- contractWrappersPrivateNetworkConfigSchema,
- contractWrappersPublicNetworkConfigSchema,
- ]);
+ assert.doesConformToSchema('config', config, ContractWrappersConfigSchema);
const txDefaults = {
gasPrice: config.gasPrice,
};
diff --git a/packages/contract-wrappers/src/schemas/contract_wrappers_config_schema.ts b/packages/contract-wrappers/src/schemas/contract_wrappers_config_schema.ts
index ac248b2d4..ae1ce668c 100644
--- a/packages/contract-wrappers/src/schemas/contract_wrappers_config_schema.ts
+++ b/packages/contract-wrappers/src/schemas/contract_wrappers_config_schema.ts
@@ -1,5 +1,25 @@
export const ContractWrappersConfigSchema = {
id: '/ContractWrappersConfig',
- oneOf: [{ $ref: '/ZeroExContractPrivateNetworkConfig' }, { $ref: '/ZeroExContractPublicNetworkConfig' }],
+ properties: {
+ networkId: {
+ type: 'number',
+ },
+ gasPrice: { $ref: '/numberSchema' },
+ contractAddresses: {
+ type: 'object',
+ properties: {
+ erc20Proxy: { $ref: '/addressSchema' },
+ erc721Proxy: { $ref: '/addressSchema' },
+ zrxToken: { $ref: '/addressSchema' },
+ etherToken: { $ref: '/addressSchema' },
+ exchange: { $ref: '/addressSchema' },
+ assetProxyOwner: { $ref: '/addressSchema' },
+ forwarder: { $ref: '/addressSchema' },
+ orderValidator: { $ref: '/addressSchema' },
+ },
+ },
+ blockPollingIntervalMs: { type: 'number' },
+ },
type: 'object',
+ required: ['networkId'],
};
diff --git a/packages/contract-wrappers/src/schemas/contract_wrappers_private_network_config_schema.ts b/packages/contract-wrappers/src/schemas/contract_wrappers_private_network_config_schema.ts
deleted file mode 100644
index 904690ae7..000000000
--- a/packages/contract-wrappers/src/schemas/contract_wrappers_private_network_config_schema.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-export const contractWrappersPrivateNetworkConfigSchema = {
- id: '/ZeroExContractPrivateNetworkConfig',
- properties: {
- networkId: {
- type: 'number',
- minimum: 1,
- },
- gasPrice: { $ref: '/numberSchema' },
- zrxContractAddress: { $ref: '/addressSchema' },
- exchangeContractAddress: { $ref: '/addressSchema' },
- erc20ProxyContractAddress: { $ref: '/addressSchema' },
- erc721ProxyContractAddress: { $ref: '/addressSchema' },
- blockPollingIntervalMs: { type: 'number' },
- orderWatcherConfig: {
- type: 'object',
- properties: {
- pollingIntervalMs: {
- type: 'number',
- minimum: 0,
- },
- numConfirmations: {
- type: 'number',
- minimum: 0,
- },
- },
- },
- },
- type: 'object',
- required: [
- 'networkId',
- 'zrxContractAddress',
- 'exchangeContractAddress',
- 'erc20ProxyContractAddress',
- 'erc721ProxyContractAddress',
- ],
-};
diff --git a/packages/contract-wrappers/src/schemas/contract_wrappers_public_network_config_schema.ts b/packages/contract-wrappers/src/schemas/contract_wrappers_public_network_config_schema.ts
deleted file mode 100644
index 5cd008ae0..000000000
--- a/packages/contract-wrappers/src/schemas/contract_wrappers_public_network_config_schema.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-const networkNameToId: { [networkName: string]: number } = {
- mainnet: 1,
- ropsten: 3,
- rinkeby: 4,
- kovan: 42,
- ganache: 50,
-};
-
-export const contractWrappersPublicNetworkConfigSchema = {
- id: '/ZeroExContractPublicNetworkConfig',
- properties: {
- networkId: {
- type: 'number',
- enum: [
- networkNameToId.mainnet,
- networkNameToId.kovan,
- networkNameToId.ropsten,
- networkNameToId.rinkeby,
- networkNameToId.ganache,
- ],
- },
- gasPrice: { $ref: '/numberSchema' },
- zrxContractAddress: { $ref: '/addressSchema' },
- exchangeContractAddress: { $ref: '/addressSchema' },
- erc20ProxyContractAddress: { $ref: '/addressSchema' },
- erc721ProxyContractAddress: { $ref: '/addressSchema' },
- blockPollingIntervalMs: { type: 'number' },
- orderWatcherConfig: {
- type: 'object',
- properties: {
- pollingIntervalMs: {
- type: 'number',
- minimum: 0,
- },
- numConfirmations: {
- type: 'number',
- minimum: 0,
- },
- },
- },
- },
- type: 'object',
- required: ['networkId'],
-};