diff options
author | Fabio Berger <me@fabioberger.com> | 2018-03-25 08:22:06 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-03-25 08:22:06 +0800 |
commit | 109fc41474f5319a27052ab09234cc0426eb22ce (patch) | |
tree | 3017f330b9edc39b1da06439e796ba00c103735f /packages/website/ts/blockchain.ts | |
parent | bed7d87b7ff64989051e6b2115a1c77e1e72ff55 (diff) | |
download | dexon-sol-tools-109fc41474f5319a27052ab09234cc0426eb22ce.tar dexon-sol-tools-109fc41474f5319a27052ab09234cc0426eb22ce.tar.gz dexon-sol-tools-109fc41474f5319a27052ab09234cc0426eb22ce.tar.bz2 dexon-sol-tools-109fc41474f5319a27052ab09234cc0426eb22ce.tar.lz dexon-sol-tools-109fc41474f5319a27052ab09234cc0426eb22ce.tar.xz dexon-sol-tools-109fc41474f5319a27052ab09234cc0426eb22ce.tar.zst dexon-sol-tools-109fc41474f5319a27052ab09234cc0426eb22ce.zip |
Add error popover if TokenRegistry on network user is browsing on don't include the requisite default tokens for 0x Portal to function
Diffstat (limited to 'packages/website/ts/blockchain.ts')
-rw-r--r-- | packages/website/ts/blockchain.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index a3427baee..2268bf1ab 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -544,6 +544,22 @@ export class Blockchain { ? {} : trackedTokenStorage.getTrackedTokensByAddress(this._userAddressIfExists, this.networkId); const tokenRegistryTokens = _.values(tokenRegistryTokensByAddress); + const tokenRegistryTokenSymbols = _.map(tokenRegistryTokens, t => t.symbol); + const defaultTrackedTokensInRegistry = _.intersection( + tokenRegistryTokenSymbols, + configs.DEFAULT_TRACKED_TOKEN_SYMBOLS, + ); + if (defaultTrackedTokensInRegistry.length !== configs.DEFAULT_TRACKED_TOKEN_SYMBOLS.length) { + this._dispatcher.updateShouldBlockchainErrDialogBeOpen(true); + this._dispatcher.encounteredBlockchainError(BlockchainErrs.DefaultTokensNotInTokenRegistry); + const err = new Error( + `Default tracked tokens (${JSON.stringify( + configs.DEFAULT_TRACKED_TOKEN_SYMBOLS, + )}) not found in tokenRegistry: ${JSON.stringify(tokenRegistryTokens)}`, + ); + await errorReporter.reportAsync(err); + return; + } if (_.isEmpty(trackedTokensByAddress)) { _.each(configs.DEFAULT_TRACKED_TOKEN_SYMBOLS, symbol => { const token = _.find(tokenRegistryTokens, t => t.symbol === symbol); |