diff options
author | Fabio Berger <me@fabioberger.com> | 2018-10-18 20:50:03 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-10-18 20:50:03 +0800 |
commit | 745d36813033ed9305361d5d25cc6a4c529d9ced (patch) | |
tree | d8e9d8d7e00b5d43eec5cd2c025239a683c22a04 /packages/website/ts/blockchain.ts | |
parent | aa4a474e1dc79ec4da299663b20e56f6cf01518a (diff) | |
download | dexon-0x-contracts-745d36813033ed9305361d5d25cc6a4c529d9ced.tar dexon-0x-contracts-745d36813033ed9305361d5d25cc6a4c529d9ced.tar.gz dexon-0x-contracts-745d36813033ed9305361d5d25cc6a4c529d9ced.tar.bz2 dexon-0x-contracts-745d36813033ed9305361d5d25cc6a4c529d9ced.tar.lz dexon-0x-contracts-745d36813033ed9305361d5d25cc6a4c529d9ced.tar.xz dexon-0x-contracts-745d36813033ed9305361d5d25cc6a4c529d9ced.tar.zst dexon-0x-contracts-745d36813033ed9305361d5d25cc6a4c529d9ced.zip |
Remove old 0x.js from website
Diffstat (limited to 'packages/website/ts/blockchain.ts')
-rw-r--r-- | packages/website/ts/blockchain.ts | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index 4d5213aef..efb5aef23 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -1,4 +1,3 @@ -import { ZeroEx } from '0x.js'; import { BlockRange, ContractWrappers, @@ -53,6 +52,7 @@ import { backendClient } from 'ts/utils/backend_client'; import { configs } from 'ts/utils/configs'; import { constants } from 'ts/utils/constants'; import { errorReporter } from 'ts/utils/error_reporter'; +import { fakeTokenRegistry } from 'ts/utils/fake_token_registry'; import { tokenAddressOverrides } from 'ts/utils/token_address_overrides'; import { utils } from 'ts/utils/utils'; import FilterSubprovider = require('web3-provider-engine/subproviders/filters'); @@ -74,7 +74,6 @@ export class Blockchain { public networkId: number; public nodeVersion: string; private _contractWrappers: ContractWrappers; - private _zeroEx: ZeroEx; private readonly _dispatcher: Dispatcher; private _web3Wrapper?: Web3Wrapper; private _blockchainWatcher?: BlockchainWatcher; @@ -228,8 +227,9 @@ export class Blockchain { } } public async isAddressInTokenRegistryAsync(tokenAddress: string): Promise<boolean> { - utils.assert(!_.isUndefined(this._zeroEx), 'ZeroEx must be instantiated.'); - const tokenIfExists = await this._zeroEx.tokenRegistry.getTokenIfExistsAsync(tokenAddress); + const tokens = fakeTokenRegistry[this.networkId]; + const tokenIfExists = _.find(tokens, { address: tokenAddress }); + // HACK: Override token addresses on testnets const tokenSymbolToAddressOverrides = tokenAddressOverrides[this.networkId]; let isTokenAddressInOverrides = false; @@ -768,8 +768,7 @@ export class Blockchain { if (this.networkId === constants.NETWORK_ID_MAINNET) { tokenRegistryTokens = await backendClient.getTokenInfosAsync(); } else { - utils.assert(!_.isUndefined(this._zeroEx), 'ZeroEx must be instantiated.'); - tokenRegistryTokens = await this._zeroEx.tokenRegistry.getTokensAsync(); + tokenRegistryTokens = fakeTokenRegistry[this.networkId]; const tokenSymbolToAddressOverrides = tokenAddressOverrides[this.networkId]; if (!_.isUndefined(tokenAddressOverrides)) { // HACK: Override token addresses on testnets @@ -865,11 +864,6 @@ export class Blockchain { networkId, }; this._contractWrappers = new ContractWrappers(provider, contractWrappersConfig); - if (!_.isUndefined(this._zeroEx)) { - this._zeroEx.setProvider(provider, networkId); - } else { - this._zeroEx = new ZeroEx(provider, { networkId }); - } if (!_.isUndefined(this._blockchainWatcher)) { this._blockchainWatcher.destroy(); } |