From 3824ea9079f3034fb34750c8b80125462f42c79c Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 11 Jul 2018 18:46:12 +0200 Subject: Remove TokenRegistry from 0x.js --- packages/0x.js/src/0x.ts | 9 ++------- .../0x.js/src/schemas/zero_ex_private_network_config_schema.ts | 2 -- .../0x.js/src/schemas/zero_ex_public_network_config_schema.ts | 1 - packages/0x.js/test/0x.js_test.ts | 5 ----- .../schemas/contract_wrappers_private_network_config_schema.ts | 2 -- .../schemas/contract_wrappers_public_network_config_schema.ts | 1 - 6 files changed, 2 insertions(+), 18 deletions(-) (limited to 'packages') diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts index 3d2f23002..c6315ac7a 100644 --- a/packages/0x.js/src/0x.ts +++ b/packages/0x.js/src/0x.ts @@ -2,11 +2,10 @@ import { assert } from '@0xproject/assert'; import { ContractWrappers, ContractWrappersConfig, + ERC20ProxyWrapper, + ERC20TokenWrapper, EtherTokenWrapper, ExchangeWrapper, - TokenRegistryWrapper, - TokenTransferProxyWrapper, - TokenWrapper, } from '@0xproject/contract-wrappers'; import { generatePseudoRandomSalt, @@ -37,10 +36,7 @@ export class ZeroEx { */ public exchange: ExchangeWrapper; /** - * An instance of the TokenRegistryWrapper class containing methods for interacting with the 0x - * TokenRegistry smart contract. */ - public tokenRegistry: TokenRegistryWrapper; /** * An instance of the TokenWrapper class containing methods for interacting with any ERC20 token smart contract. */ @@ -136,7 +132,6 @@ export class ZeroEx { this.proxy = this._contractWrappers.proxy; this.token = this._contractWrappers.token; this.exchange = this._contractWrappers.exchange; - this.tokenRegistry = this._contractWrappers.tokenRegistry; this.etherToken = this._contractWrappers.etherToken; } /** diff --git a/packages/0x.js/src/schemas/zero_ex_private_network_config_schema.ts b/packages/0x.js/src/schemas/zero_ex_private_network_config_schema.ts index f7f649a6d..6036b2695 100644 --- a/packages/0x.js/src/schemas/zero_ex_private_network_config_schema.ts +++ b/packages/0x.js/src/schemas/zero_ex_private_network_config_schema.ts @@ -8,7 +8,6 @@ export const zeroExPrivateNetworkConfigSchema = { gasPrice: { $ref: '/Number' }, zrxContractAddress: { $ref: '/Address' }, exchangeContractAddress: { $ref: '/Address' }, - tokenRegistryContractAddress: { $ref: '/Address' }, tokenTransferProxyContractAddress: { $ref: '/Address' }, orderWatcherConfig: { type: 'object', @@ -29,7 +28,6 @@ export const zeroExPrivateNetworkConfigSchema = { 'networkId', 'zrxContractAddress', 'exchangeContractAddress', - 'tokenRegistryContractAddress', 'tokenTransferProxyContractAddress', ], }; diff --git a/packages/0x.js/src/schemas/zero_ex_public_network_config_schema.ts b/packages/0x.js/src/schemas/zero_ex_public_network_config_schema.ts index f7f6727f0..7bedb7438 100644 --- a/packages/0x.js/src/schemas/zero_ex_public_network_config_schema.ts +++ b/packages/0x.js/src/schemas/zero_ex_public_network_config_schema.ts @@ -22,7 +22,6 @@ export const zeroExPublicNetworkConfigSchema = { gasPrice: { $ref: '/Number' }, zrxContractAddress: { $ref: '/Address' }, exchangeContractAddress: { $ref: '/Address' }, - tokenRegistryContractAddress: { $ref: '/Address' }, tokenTransferProxyContractAddress: { $ref: '/Address' }, orderWatcherConfig: { type: 'object', diff --git a/packages/0x.js/test/0x.js_test.ts b/packages/0x.js/test/0x.js_test.ts index 425fc6380..815f94de1 100644 --- a/packages/0x.js/test/0x.js_test.ts +++ b/packages/0x.js/test/0x.js_test.ts @@ -28,9 +28,7 @@ describe('ZeroEx library', () => { it('overrides provider in nested web3s and invalidates contractInstances', async () => { // Instantiate the contract instances with the current provider await (zeroEx.exchange as any)._getExchangeContractAsync(); - await (zeroEx.tokenRegistry as any)._getTokenRegistryContractAsync(); expect((zeroEx.exchange as any)._exchangeContractIfExists).to.not.be.undefined(); - expect((zeroEx.tokenRegistry as any)._tokenRegistryContractIfExists).to.not.be.undefined(); // Add property to newProvider so that we can differentiate it from old provider (provider as any).zeroExTestId = 1; @@ -38,15 +36,12 @@ describe('ZeroEx library', () => { // Check that contractInstances with old provider are removed after provider update expect((zeroEx.exchange as any)._exchangeContractIfExists).to.be.undefined(); - expect((zeroEx.tokenRegistry as any)._tokenRegistryContractIfExists).to.be.undefined(); // Check that all nested zeroExContract/web3Wrapper instances return the updated provider const nestedWeb3WrapperProvider = ((zeroEx as any)._contractWrappers as ContractWrappers).getProvider(); expect((nestedWeb3WrapperProvider as any).zeroExTestId).to.be.a('number'); const exchangeWeb3WrapperProvider = (zeroEx.exchange as any)._web3Wrapper.getProvider(); expect(exchangeWeb3WrapperProvider.zeroExTestId).to.be.a('number'); - const tokenRegistryWeb3WrapperProvider = (zeroEx.tokenRegistry as any)._web3Wrapper.getProvider(); - expect(tokenRegistryWeb3WrapperProvider.zeroExTestId).to.be.a('number'); }); }); describe('#isValidSignature', () => { 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 index 4b68daf1a..d293b4d4f 100644 --- 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 @@ -8,7 +8,6 @@ export const contractWrappersPrivateNetworkConfigSchema = { gasPrice: { $ref: '/Number' }, zrxContractAddress: { $ref: '/Address' }, exchangeContractAddress: { $ref: '/Address' }, - tokenRegistryContractAddress: { $ref: '/Address' }, tokenTransferProxyContractAddress: { $ref: '/Address' }, blockPollingIntervalMs: { type: 'number' }, orderWatcherConfig: { @@ -30,7 +29,6 @@ export const contractWrappersPrivateNetworkConfigSchema = { '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 index 988872376..f59b30ad0 100644 --- 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 @@ -22,7 +22,6 @@ export const contractWrappersPublicNetworkConfigSchema = { gasPrice: { $ref: '/Number' }, zrxContractAddress: { $ref: '/Address' }, exchangeContractAddress: { $ref: '/Address' }, - tokenRegistryContractAddress: { $ref: '/Address' }, tokenTransferProxyContractAddress: { $ref: '/Address' }, blockPollingIntervalMs: { type: 'number' }, orderWatcherConfig: { -- cgit v1.2.3