Skip to content

Commit 0477e08

Browse files
authored
Merge pull request #1928 from MetaMask/RemoveDefaultTokens
Remove default tokens
2 parents 60fdbd6 + 9fbdeab commit 0477e08

File tree

3 files changed

+31
-52
lines changed

3 files changed

+31
-52
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Current Master
44

5+
- Reenable token list.
6+
- Remove default tokens.
7+
58
## 3.9.7 2017-8-15
69

710
- hotfix - disable token list

ui/app/account-detail.js

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const ExportAccountView = require('./components/account-export')
1212
const ethUtil = require('ethereumjs-util')
1313
const EditableLabel = require('./components/editable-label')
1414
const TabBar = require('./components/tab-bar')
15-
// const TokenList = require('./components/token-list')
15+
const TokenList = require('./components/token-list')
1616
const AccountDropdowns = require('./components/account-dropdowns').AccountDropdowns
1717

1818
module.exports = connect(mapStateToProps)(AccountDetailScreen)
@@ -255,34 +255,17 @@ AccountDetailScreen.prototype.tabSections = function () {
255255

256256
AccountDetailScreen.prototype.tabSwitchView = function () {
257257
const props = this.props
258-
const { address/*, network */} = props
259-
const { currentAccountTab/*, tokens*/ } = this.props
258+
const { address, network } = props
259+
const { currentAccountTab, tokens } = this.props
260260

261261
switch (currentAccountTab) {
262262
case 'tokens':
263-
// return h(TokenList, {
264-
// userAddress: address,
265-
// network,
266-
// tokens,
267-
// addToken: () => this.props.dispatch(actions.showAddTokenPage()),
268-
// })
269-
return h('.hotFix', {
270-
style: {
271-
padding: '80px',
272-
},
273-
}, [
274-
'Token lists are temporarily down. You can check you your token balances ',
275-
h('span.hotFix', {
276-
style: {
277-
color: 'rgba(247, 134, 28, 1)',
278-
cursor: 'pointer',
279-
},
280-
onClick: () => {
281-
global.platform.openWindow({
282-
url: `https://ethplorer.io/address/${address}`,
283-
})
284-
},
285-
}, 'here')])
263+
return h(TokenList, {
264+
userAddress: address,
265+
network,
266+
tokens,
267+
addToken: () => this.props.dispatch(actions.showAddTokenPage()),
268+
})
286269
default:
287270
return this.transactionList()
288271
}

ui/app/components/token-list.js

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,6 @@ const h = require('react-hyperscript')
33
const inherits = require('util').inherits
44
const TokenTracker = require('eth-token-tracker')
55
const TokenCell = require('./token-cell.js')
6-
const normalizeAddress = require('eth-sig-util').normalize
7-
8-
const defaultTokens = []
9-
const contracts = require('eth-contract-metadata')
10-
for (const address in contracts) {
11-
const contract = contracts[address]
12-
if (contract.erc20) {
13-
contract.address = address
14-
defaultTokens.push(contract)
15-
}
16-
}
176

187
module.exports = TokenList
198

@@ -38,7 +27,24 @@ TokenList.prototype.render = function () {
3827

3928
if (error) {
4029
log.error(error)
41-
return this.message('There was a problem loading your token balances.')
30+
return h('.hotFix', {
31+
style: {
32+
padding: '80px',
33+
},
34+
}, [
35+
'We had trouble loading your token balances. You can view them ',
36+
h('span.hotFix', {
37+
style: {
38+
color: 'rgba(247, 134, 28, 1)',
39+
cursor: 'pointer',
40+
},
41+
onClick: () => {
42+
global.platform.openWindow({
43+
url: `https://ethplorer.io/address/${userAddress}`,
44+
})
45+
},
46+
}, 'here'),
47+
])
4248
}
4349

4450
const tokenViews = tokens.map((tokenData) => {
@@ -153,7 +159,7 @@ TokenList.prototype.createFreshTokenTracker = function () {
153159
this.tracker = new TokenTracker({
154160
userAddress,
155161
provider: global.ethereumProvider,
156-
tokens: uniqueMergeTokens(defaultTokens, this.props.tokens),
162+
tokens: this.props.tokens,
157163
pollingInterval: 8000,
158164
})
159165

@@ -199,16 +205,3 @@ TokenList.prototype.componentWillUnmount = function () {
199205
this.tracker.stop()
200206
}
201207

202-
function uniqueMergeTokens (tokensA, tokensB) {
203-
const uniqueAddresses = []
204-
const result = []
205-
tokensA.concat(tokensB).forEach((token) => {
206-
const normal = normalizeAddress(token.address)
207-
if (!uniqueAddresses.includes(normal)) {
208-
uniqueAddresses.push(normal)
209-
result.push(token)
210-
}
211-
})
212-
return result
213-
}
214-

0 commit comments

Comments
 (0)