diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2017-08-17 04:38:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-17 04:38:21 +0800 |
commit | 0477e08a6d38cd749ea5649e7dbd2b1e56207a2e (patch) | |
tree | 485d7996dc5412c45589c352c86ad834d02dd523 | |
parent | 60fdbd67af8b8b931c068d35ce81d11e21da2cef (diff) | |
parent | 9fbdeab3deeb12999b14acfb9f8d6dd28b979c10 (diff) | |
download | tangerine-wallet-browser-0477e08a6d38cd749ea5649e7dbd2b1e56207a2e.tar tangerine-wallet-browser-0477e08a6d38cd749ea5649e7dbd2b1e56207a2e.tar.gz tangerine-wallet-browser-0477e08a6d38cd749ea5649e7dbd2b1e56207a2e.tar.bz2 tangerine-wallet-browser-0477e08a6d38cd749ea5649e7dbd2b1e56207a2e.tar.lz tangerine-wallet-browser-0477e08a6d38cd749ea5649e7dbd2b1e56207a2e.tar.xz tangerine-wallet-browser-0477e08a6d38cd749ea5649e7dbd2b1e56207a2e.tar.zst tangerine-wallet-browser-0477e08a6d38cd749ea5649e7dbd2b1e56207a2e.zip |
Merge pull request #1928 from MetaMask/RemoveDefaultTokens
Remove default tokens
-rw-r--r-- | CHANGELOG.md | 3 | ||||
-rw-r--r-- | ui/app/account-detail.js | 35 | ||||
-rw-r--r-- | ui/app/components/token-list.js | 45 |
3 files changed, 31 insertions, 52 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 31824b171..afd075c1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Current Master +- Reenable token list. +- Remove default tokens. + ## 3.9.7 2017-8-15 - hotfix - disable token list diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js index 7af53a694..02089ecd0 100644 --- a/ui/app/account-detail.js +++ b/ui/app/account-detail.js @@ -12,7 +12,7 @@ const ExportAccountView = require('./components/account-export') const ethUtil = require('ethereumjs-util') const EditableLabel = require('./components/editable-label') const TabBar = require('./components/tab-bar') -// const TokenList = require('./components/token-list') +const TokenList = require('./components/token-list') const AccountDropdowns = require('./components/account-dropdowns').AccountDropdowns module.exports = connect(mapStateToProps)(AccountDetailScreen) @@ -255,34 +255,17 @@ AccountDetailScreen.prototype.tabSections = function () { AccountDetailScreen.prototype.tabSwitchView = function () { const props = this.props - const { address/*, network */} = props - const { currentAccountTab/*, tokens*/ } = this.props + const { address, network } = props + const { currentAccountTab, tokens } = this.props switch (currentAccountTab) { case 'tokens': - // return h(TokenList, { - // userAddress: address, - // network, - // tokens, - // addToken: () => this.props.dispatch(actions.showAddTokenPage()), - // }) - return h('.hotFix', { - style: { - padding: '80px', - }, - }, [ - 'Token lists are temporarily down. You can check you your token balances ', - h('span.hotFix', { - style: { - color: 'rgba(247, 134, 28, 1)', - cursor: 'pointer', - }, - onClick: () => { - global.platform.openWindow({ - url: `https://ethplorer.io/address/${address}`, - }) - }, - }, 'here')]) + return h(TokenList, { + userAddress: address, + network, + tokens, + addToken: () => this.props.dispatch(actions.showAddTokenPage()), + }) default: return this.transactionList() } diff --git a/ui/app/components/token-list.js b/ui/app/components/token-list.js index 5ea31ae8d..2346568bc 100644 --- a/ui/app/components/token-list.js +++ b/ui/app/components/token-list.js @@ -3,17 +3,6 @@ const h = require('react-hyperscript') const inherits = require('util').inherits const TokenTracker = require('eth-token-tracker') const TokenCell = require('./token-cell.js') -const normalizeAddress = require('eth-sig-util').normalize - -const defaultTokens = [] -const contracts = require('eth-contract-metadata') -for (const address in contracts) { - const contract = contracts[address] - if (contract.erc20) { - contract.address = address - defaultTokens.push(contract) - } -} module.exports = TokenList @@ -38,7 +27,24 @@ TokenList.prototype.render = function () { if (error) { log.error(error) - return this.message('There was a problem loading your token balances.') + return h('.hotFix', { + style: { + padding: '80px', + }, + }, [ + 'We had trouble loading your token balances. You can view them ', + h('span.hotFix', { + style: { + color: 'rgba(247, 134, 28, 1)', + cursor: 'pointer', + }, + onClick: () => { + global.platform.openWindow({ + url: `https://ethplorer.io/address/${userAddress}`, + }) + }, + }, 'here'), + ]) } const tokenViews = tokens.map((tokenData) => { @@ -153,7 +159,7 @@ TokenList.prototype.createFreshTokenTracker = function () { this.tracker = new TokenTracker({ userAddress, provider: global.ethereumProvider, - tokens: uniqueMergeTokens(defaultTokens, this.props.tokens), + tokens: this.props.tokens, pollingInterval: 8000, }) @@ -199,16 +205,3 @@ TokenList.prototype.componentWillUnmount = function () { this.tracker.stop() } -function uniqueMergeTokens (tokensA, tokensB) { - const uniqueAddresses = [] - const result = [] - tokensA.concat(tokensB).forEach((token) => { - const normal = normalizeAddress(token.address) - if (!uniqueAddresses.includes(normal)) { - uniqueAddresses.push(normal) - result.push(token) - } - }) - return result -} - |