From c6882d0bd8615209dfc2e486bcfa5b64fcb50242 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 10 May 2018 16:51:45 +0200 Subject: Rename zeroExContract... to contractWrappers... --- packages/0x.js/src/0x.ts | 4 +-- packages/0x.js/src/index.ts | 2 +- .../contract-wrappers/src/contract_wrappers.ts | 16 +++++----- packages/contract-wrappers/src/index.ts | 2 +- .../src/schemas/contract_wrappers_config_schema.ts | 5 ++++ ...tract_wrappers_private_network_config_schema.ts | 35 ++++++++++++++++++++++ ...ntract_wrappers_public_network_config_schema.ts | 29 ++++++++++++++++++ .../src/schemas/zero_ex_contract_config_schema.ts | 5 ---- ...ro_ex_contract_private_network_config_schema.ts | 35 ---------------------- ...ero_ex_contract_public_network_config_schema.ts | 29 ------------------ packages/contract-wrappers/src/types.ts | 2 +- 11 files changed, 82 insertions(+), 82 deletions(-) create mode 100644 packages/contract-wrappers/src/schemas/contract_wrappers_config_schema.ts create mode 100644 packages/contract-wrappers/src/schemas/contract_wrappers_private_network_config_schema.ts create mode 100644 packages/contract-wrappers/src/schemas/contract_wrappers_public_network_config_schema.ts delete mode 100644 packages/contract-wrappers/src/schemas/zero_ex_contract_config_schema.ts delete mode 100644 packages/contract-wrappers/src/schemas/zero_ex_contract_private_network_config_schema.ts delete mode 100644 packages/contract-wrappers/src/schemas/zero_ex_contract_public_network_config_schema.ts diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts index c68a17015..9bcb0dddc 100644 --- a/packages/0x.js/src/0x.ts +++ b/packages/0x.js/src/0x.ts @@ -6,7 +6,7 @@ import { TokenRegistryWrapper, TokenTransferProxyWrapper, TokenWrapper, - ZeroExContractConfig, + ContractWrappersConfig, } from '@0xproject/contract-wrappers'; import { generatePseudoRandomSalt, @@ -131,7 +131,7 @@ 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: Provider, config: ZeroExContractConfig) { + constructor(provider: Provider, config: ContractWrappersConfig) { assert.isWeb3Provider('provider', provider); this._contractWrappers = new ContractWrappers(provider, config); diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index e9528d4d1..c79dbdb77 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -47,5 +47,5 @@ export { LogFillContractEventArgs, ExchangeContractEventArgs, ExchangeEvents, - ZeroExContractConfig, + ContractWrappersConfig, } from '@0xproject/contract-wrappers'; diff --git a/packages/contract-wrappers/src/contract_wrappers.ts b/packages/contract-wrappers/src/contract_wrappers.ts index 1934ea2d0..381c4a63f 100644 --- a/packages/contract-wrappers/src/contract_wrappers.ts +++ b/packages/contract-wrappers/src/contract_wrappers.ts @@ -18,10 +18,10 @@ import { ExchangeWrapper } from './contract_wrappers/exchange_wrapper'; import { TokenRegistryWrapper } from './contract_wrappers/token_registry_wrapper'; import { TokenTransferProxyWrapper } from './contract_wrappers/token_transfer_proxy_wrapper'; import { TokenWrapper } from './contract_wrappers/token_wrapper'; -import { zeroExContractConfigSchema } from './schemas/zero_ex_contract_config_schema'; -import { zeroExContractPrivateNetworkConfigSchema } from './schemas/zero_ex_contract_private_network_config_schema'; -import { zeroExContractPublicNetworkConfigSchema } from './schemas/zero_ex_contract_public_network_config_schema'; -import { ZeroExContractConfig } from './types'; +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'; import { decorators } from './utils/decorators'; @@ -62,11 +62,11 @@ export class ContractWrappers { * @param config The configuration object. Look up the type for the description. * @return An instance of the ContractWrappers class. */ - constructor(provider: Provider, config: ZeroExContractConfig) { + constructor(provider: Provider, config: ContractWrappersConfig) { assert.isWeb3Provider('provider', provider); - assert.doesConformToSchema('config', config, zeroExContractConfigSchema, [ - zeroExContractPrivateNetworkConfigSchema, - zeroExContractPublicNetworkConfigSchema, + assert.doesConformToSchema('config', config, ContractWrappersConfigSchema, [ + contractWrappersPrivateNetworkConfigSchema, + contractWrappersPublicNetworkConfigSchema, ]); const artifactJSONs = _.values(artifacts); const abiArrays = _.map(artifactJSONs, artifact => artifact.abi); diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts index f88313eb1..45af8a707 100644 --- a/packages/contract-wrappers/src/index.ts +++ b/packages/contract-wrappers/src/index.ts @@ -15,7 +15,7 @@ export { OrderCancellationRequest, OrderFillRequest, ContractEventArgs, - ZeroExContractConfig, + ContractWrappersConfig, MethodOpts, OrderTransactionOpts, TransactionOpts, diff --git a/packages/contract-wrappers/src/schemas/contract_wrappers_config_schema.ts b/packages/contract-wrappers/src/schemas/contract_wrappers_config_schema.ts new file mode 100644 index 000000000..ac248b2d4 --- /dev/null +++ b/packages/contract-wrappers/src/schemas/contract_wrappers_config_schema.ts @@ -0,0 +1,5 @@ +export const ContractWrappersConfigSchema = { + id: '/ContractWrappersConfig', + oneOf: [{ $ref: '/ZeroExContractPrivateNetworkConfig' }, { $ref: '/ZeroExContractPublicNetworkConfig' }], + type: 'object', +}; 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 new file mode 100644 index 000000000..759078feb --- /dev/null +++ b/packages/contract-wrappers/src/schemas/contract_wrappers_private_network_config_schema.ts @@ -0,0 +1,35 @@ +export const contractWrappersPrivateNetworkConfigSchema = { + id: '/ZeroExContractPrivateNetworkConfig', + properties: { + networkId: { + type: 'number', + minimum: 1, + }, + gasPrice: { $ref: '/Number' }, + zrxContractAddress: { $ref: '/Address' }, + exchangeContractAddress: { $ref: '/Address' }, + tokenRegistryContractAddress: { $ref: '/Address' }, + tokenTransferProxyContractAddress: { $ref: '/Address' }, + orderWatcherConfig: { + type: 'object', + properties: { + pollingIntervalMs: { + type: 'number', + minimum: 0, + }, + numConfirmations: { + type: 'number', + minimum: 0, + }, + }, + }, + }, + type: 'object', + required: [ + 'networkId', + 'zrxContractAddress', + 'exchangeContractAddress', + 'tokenRegistryContractAddress', + 'tokenTransferProxyContractAddress', + ], +}; 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 new file mode 100644 index 000000000..bf1000afa --- /dev/null +++ b/packages/contract-wrappers/src/schemas/contract_wrappers_public_network_config_schema.ts @@ -0,0 +1,29 @@ +export const contractWrappersPublicNetworkConfigSchema = { + id: '/ZeroExContractPublicNetworkConfig', + properties: { + networkId: { + type: 'number', + enum: [1, 3, 4, 42, 50], + }, + gasPrice: { $ref: '/Number' }, + zrxContractAddress: { $ref: '/Address' }, + exchangeContractAddress: { $ref: '/Address' }, + tokenRegistryContractAddress: { $ref: '/Address' }, + tokenTransferProxyContractAddress: { $ref: '/Address' }, + orderWatcherConfig: { + type: 'object', + properties: { + pollingIntervalMs: { + type: 'number', + minimum: 0, + }, + numConfirmations: { + type: 'number', + minimum: 0, + }, + }, + }, + }, + type: 'object', + required: ['networkId'], +}; diff --git a/packages/contract-wrappers/src/schemas/zero_ex_contract_config_schema.ts b/packages/contract-wrappers/src/schemas/zero_ex_contract_config_schema.ts deleted file mode 100644 index eec386643..000000000 --- a/packages/contract-wrappers/src/schemas/zero_ex_contract_config_schema.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const zeroExContractConfigSchema = { - id: '/ZeroExContractConfig', - oneOf: [{ $ref: '/ZeroExContractPrivateNetworkConfig' }, { $ref: '/ZeroExContractPublicNetworkConfig' }], - type: 'object', -}; diff --git a/packages/contract-wrappers/src/schemas/zero_ex_contract_private_network_config_schema.ts b/packages/contract-wrappers/src/schemas/zero_ex_contract_private_network_config_schema.ts deleted file mode 100644 index 6d93d4e60..000000000 --- a/packages/contract-wrappers/src/schemas/zero_ex_contract_private_network_config_schema.ts +++ /dev/null @@ -1,35 +0,0 @@ -export const zeroExContractPrivateNetworkConfigSchema = { - id: '/ZeroExContractPrivateNetworkConfig', - properties: { - networkId: { - type: 'number', - minimum: 1, - }, - gasPrice: { $ref: '/Number' }, - zrxContractAddress: { $ref: '/Address' }, - exchangeContractAddress: { $ref: '/Address' }, - tokenRegistryContractAddress: { $ref: '/Address' }, - tokenTransferProxyContractAddress: { $ref: '/Address' }, - orderWatcherConfig: { - type: 'object', - properties: { - pollingIntervalMs: { - type: 'number', - minimum: 0, - }, - numConfirmations: { - type: 'number', - minimum: 0, - }, - }, - }, - }, - type: 'object', - required: [ - 'networkId', - 'zrxContractAddress', - 'exchangeContractAddress', - 'tokenRegistryContractAddress', - 'tokenTransferProxyContractAddress', - ], -}; diff --git a/packages/contract-wrappers/src/schemas/zero_ex_contract_public_network_config_schema.ts b/packages/contract-wrappers/src/schemas/zero_ex_contract_public_network_config_schema.ts deleted file mode 100644 index 79a241cd2..000000000 --- a/packages/contract-wrappers/src/schemas/zero_ex_contract_public_network_config_schema.ts +++ /dev/null @@ -1,29 +0,0 @@ -export const zeroExContractPublicNetworkConfigSchema = { - id: '/ZeroExContractPublicNetworkConfig', - properties: { - networkId: { - type: 'number', - enum: [1, 3, 4, 42, 50], - }, - gasPrice: { $ref: '/Number' }, - zrxContractAddress: { $ref: '/Address' }, - exchangeContractAddress: { $ref: '/Address' }, - tokenRegistryContractAddress: { $ref: '/Address' }, - tokenTransferProxyContractAddress: { $ref: '/Address' }, - orderWatcherConfig: { - type: 'object', - properties: { - pollingIntervalMs: { - type: 'number', - minimum: 0, - }, - numConfirmations: { - type: 'number', - minimum: 0, - }, - }, - }, - }, - type: 'object', - required: ['networkId'], -}; diff --git a/packages/contract-wrappers/src/types.ts b/packages/contract-wrappers/src/types.ts index 301b5abf9..9a463d635 100644 --- a/packages/contract-wrappers/src/types.ts +++ b/packages/contract-wrappers/src/types.ts @@ -127,7 +127,7 @@ export type SyncMethod = (...args: any[]) => any; * tokenTransferProxyContractAddress: The address of the token transfer proxy contract to use * orderWatcherConfig: All the configs related to the orderWatcher */ -export interface ZeroExContractConfig { +export interface ContractWrappersConfig { networkId: number; gasPrice?: BigNumber; exchangeContractAddress?: string; -- cgit v1.2.3