Remove TokenRegistry from 0x.js
This commit is contained in:
parent
5e22ce05c5
commit
3824ea9079
@ -2,11 +2,10 @@ import { assert } from '@0xproject/assert';
|
|||||||
import {
|
import {
|
||||||
ContractWrappers,
|
ContractWrappers,
|
||||||
ContractWrappersConfig,
|
ContractWrappersConfig,
|
||||||
|
ERC20ProxyWrapper,
|
||||||
|
ERC20TokenWrapper,
|
||||||
EtherTokenWrapper,
|
EtherTokenWrapper,
|
||||||
ExchangeWrapper,
|
ExchangeWrapper,
|
||||||
TokenRegistryWrapper,
|
|
||||||
TokenTransferProxyWrapper,
|
|
||||||
TokenWrapper,
|
|
||||||
} from '@0xproject/contract-wrappers';
|
} from '@0xproject/contract-wrappers';
|
||||||
import {
|
import {
|
||||||
generatePseudoRandomSalt,
|
generatePseudoRandomSalt,
|
||||||
@ -37,10 +36,7 @@ export class ZeroEx {
|
|||||||
*/
|
*/
|
||||||
public exchange: ExchangeWrapper;
|
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.
|
* 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.proxy = this._contractWrappers.proxy;
|
||||||
this.token = this._contractWrappers.token;
|
this.token = this._contractWrappers.token;
|
||||||
this.exchange = this._contractWrappers.exchange;
|
this.exchange = this._contractWrappers.exchange;
|
||||||
this.tokenRegistry = this._contractWrappers.tokenRegistry;
|
|
||||||
this.etherToken = this._contractWrappers.etherToken;
|
this.etherToken = this._contractWrappers.etherToken;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -8,7 +8,6 @@ export const zeroExPrivateNetworkConfigSchema = {
|
|||||||
gasPrice: { $ref: '/Number' },
|
gasPrice: { $ref: '/Number' },
|
||||||
zrxContractAddress: { $ref: '/Address' },
|
zrxContractAddress: { $ref: '/Address' },
|
||||||
exchangeContractAddress: { $ref: '/Address' },
|
exchangeContractAddress: { $ref: '/Address' },
|
||||||
tokenRegistryContractAddress: { $ref: '/Address' },
|
|
||||||
tokenTransferProxyContractAddress: { $ref: '/Address' },
|
tokenTransferProxyContractAddress: { $ref: '/Address' },
|
||||||
orderWatcherConfig: {
|
orderWatcherConfig: {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
@ -29,7 +28,6 @@ export const zeroExPrivateNetworkConfigSchema = {
|
|||||||
'networkId',
|
'networkId',
|
||||||
'zrxContractAddress',
|
'zrxContractAddress',
|
||||||
'exchangeContractAddress',
|
'exchangeContractAddress',
|
||||||
'tokenRegistryContractAddress',
|
|
||||||
'tokenTransferProxyContractAddress',
|
'tokenTransferProxyContractAddress',
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
@ -22,7 +22,6 @@ export const zeroExPublicNetworkConfigSchema = {
|
|||||||
gasPrice: { $ref: '/Number' },
|
gasPrice: { $ref: '/Number' },
|
||||||
zrxContractAddress: { $ref: '/Address' },
|
zrxContractAddress: { $ref: '/Address' },
|
||||||
exchangeContractAddress: { $ref: '/Address' },
|
exchangeContractAddress: { $ref: '/Address' },
|
||||||
tokenRegistryContractAddress: { $ref: '/Address' },
|
|
||||||
tokenTransferProxyContractAddress: { $ref: '/Address' },
|
tokenTransferProxyContractAddress: { $ref: '/Address' },
|
||||||
orderWatcherConfig: {
|
orderWatcherConfig: {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
|
@ -28,9 +28,7 @@ describe('ZeroEx library', () => {
|
|||||||
it('overrides provider in nested web3s and invalidates contractInstances', async () => {
|
it('overrides provider in nested web3s and invalidates contractInstances', async () => {
|
||||||
// Instantiate the contract instances with the current provider
|
// Instantiate the contract instances with the current provider
|
||||||
await (zeroEx.exchange as any)._getExchangeContractAsync();
|
await (zeroEx.exchange as any)._getExchangeContractAsync();
|
||||||
await (zeroEx.tokenRegistry as any)._getTokenRegistryContractAsync();
|
|
||||||
expect((zeroEx.exchange as any)._exchangeContractIfExists).to.not.be.undefined();
|
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
|
// Add property to newProvider so that we can differentiate it from old provider
|
||||||
(provider as any).zeroExTestId = 1;
|
(provider as any).zeroExTestId = 1;
|
||||||
@ -38,15 +36,12 @@ describe('ZeroEx library', () => {
|
|||||||
|
|
||||||
// Check that contractInstances with old provider are removed after provider update
|
// Check that contractInstances with old provider are removed after provider update
|
||||||
expect((zeroEx.exchange as any)._exchangeContractIfExists).to.be.undefined();
|
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
|
// Check that all nested zeroExContract/web3Wrapper instances return the updated provider
|
||||||
const nestedWeb3WrapperProvider = ((zeroEx as any)._contractWrappers as ContractWrappers).getProvider();
|
const nestedWeb3WrapperProvider = ((zeroEx as any)._contractWrappers as ContractWrappers).getProvider();
|
||||||
expect((nestedWeb3WrapperProvider as any).zeroExTestId).to.be.a('number');
|
expect((nestedWeb3WrapperProvider as any).zeroExTestId).to.be.a('number');
|
||||||
const exchangeWeb3WrapperProvider = (zeroEx.exchange as any)._web3Wrapper.getProvider();
|
const exchangeWeb3WrapperProvider = (zeroEx.exchange as any)._web3Wrapper.getProvider();
|
||||||
expect(exchangeWeb3WrapperProvider.zeroExTestId).to.be.a('number');
|
expect(exchangeWeb3WrapperProvider.zeroExTestId).to.be.a('number');
|
||||||
const tokenRegistryWeb3WrapperProvider = (zeroEx.tokenRegistry as any)._web3Wrapper.getProvider();
|
|
||||||
expect(tokenRegistryWeb3WrapperProvider.zeroExTestId).to.be.a('number');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('#isValidSignature', () => {
|
describe('#isValidSignature', () => {
|
||||||
|
@ -8,7 +8,6 @@ export const contractWrappersPrivateNetworkConfigSchema = {
|
|||||||
gasPrice: { $ref: '/Number' },
|
gasPrice: { $ref: '/Number' },
|
||||||
zrxContractAddress: { $ref: '/Address' },
|
zrxContractAddress: { $ref: '/Address' },
|
||||||
exchangeContractAddress: { $ref: '/Address' },
|
exchangeContractAddress: { $ref: '/Address' },
|
||||||
tokenRegistryContractAddress: { $ref: '/Address' },
|
|
||||||
tokenTransferProxyContractAddress: { $ref: '/Address' },
|
tokenTransferProxyContractAddress: { $ref: '/Address' },
|
||||||
blockPollingIntervalMs: { type: 'number' },
|
blockPollingIntervalMs: { type: 'number' },
|
||||||
orderWatcherConfig: {
|
orderWatcherConfig: {
|
||||||
@ -30,7 +29,6 @@ export const contractWrappersPrivateNetworkConfigSchema = {
|
|||||||
'networkId',
|
'networkId',
|
||||||
'zrxContractAddress',
|
'zrxContractAddress',
|
||||||
'exchangeContractAddress',
|
'exchangeContractAddress',
|
||||||
'tokenRegistryContractAddress',
|
|
||||||
'tokenTransferProxyContractAddress',
|
'tokenTransferProxyContractAddress',
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
@ -22,7 +22,6 @@ export const contractWrappersPublicNetworkConfigSchema = {
|
|||||||
gasPrice: { $ref: '/Number' },
|
gasPrice: { $ref: '/Number' },
|
||||||
zrxContractAddress: { $ref: '/Address' },
|
zrxContractAddress: { $ref: '/Address' },
|
||||||
exchangeContractAddress: { $ref: '/Address' },
|
exchangeContractAddress: { $ref: '/Address' },
|
||||||
tokenRegistryContractAddress: { $ref: '/Address' },
|
|
||||||
tokenTransferProxyContractAddress: { $ref: '/Address' },
|
tokenTransferProxyContractAddress: { $ref: '/Address' },
|
||||||
blockPollingIntervalMs: { type: 'number' },
|
blockPollingIntervalMs: { type: 'number' },
|
||||||
orderWatcherConfig: {
|
orderWatcherConfig: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user