diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-10-16 08:00:48 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-10-16 08:09:35 +0800 |
commit | e093864bff4b9e6191d6ed4d7fe8ce9c60c5c367 (patch) | |
tree | 0d0a7b05745e54aaea0006ae30676b0d5e210c2d /packages/contract-wrappers/src | |
parent | 38b146c395429f860f57fa1865e01175eee39e62 (diff) | |
download | dexon-sol-tools-e093864bff4b9e6191d6ed4d7fe8ce9c60c5c367.tar dexon-sol-tools-e093864bff4b9e6191d6ed4d7fe8ce9c60c5c367.tar.gz dexon-sol-tools-e093864bff4b9e6191d6ed4d7fe8ce9c60c5c367.tar.bz2 dexon-sol-tools-e093864bff4b9e6191d6ed4d7fe8ce9c60c5c367.tar.lz dexon-sol-tools-e093864bff4b9e6191d6ed4d7fe8ce9c60c5c367.tar.xz dexon-sol-tools-e093864bff4b9e6191d6ed4d7fe8ce9c60c5c367.tar.zst dexon-sol-tools-e093864bff4b9e6191d6ed4d7fe8ce9c60c5c367.zip |
Update json-schemas for contract-wrappers
Diffstat (limited to 'packages/contract-wrappers/src')
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'], -}; |