From b69f5533d902a1aba121b7d3752475c11084885b Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Wed, 16 Aug 2017 09:49:18 -0700 Subject: ReEnable Token List --- ui/app/account-detail.js | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) (limited to 'ui/app') 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() } -- cgit From 722d91c8661a2c0912b7eaf9bcf20f220b76e384 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Wed, 16 Aug 2017 09:49:23 -0700 Subject: Remove default tokens --- ui/app/components/token-list.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/token-list.js b/ui/app/components/token-list.js index 5ea31ae8d..1ea15521a 100644 --- a/ui/app/components/token-list.js +++ b/ui/app/components/token-list.js @@ -5,16 +5,6 @@ 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 inherits(TokenList, Component) @@ -153,7 +143,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, }) -- cgit From 3b6ee032f58de18c80f66833c54e4f9795ffbced Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Wed, 16 Aug 2017 09:50:16 -0700 Subject: Remove dead code --- ui/app/components/token-list.js | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/token-list.js b/ui/app/components/token-list.js index 1ea15521a..4bcde7d1d 100644 --- a/ui/app/components/token-list.js +++ b/ui/app/components/token-list.js @@ -3,7 +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 module.exports = TokenList @@ -189,16 +188,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 -} - -- cgit From 9fbdeab3deeb12999b14acfb9f8d6dd28b979c10 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Wed, 16 Aug 2017 12:53:53 -0700 Subject: Fallback to ethplorer link --- ui/app/components/token-list.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/components/token-list.js b/ui/app/components/token-list.js index 4bcde7d1d..2346568bc 100644 --- a/ui/app/components/token-list.js +++ b/ui/app/components/token-list.js @@ -27,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) => { -- cgit