aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/add-token.js
diff options
context:
space:
mode:
authorThomas Huang <tmashuang@users.noreply.github.com>2017-11-03 01:02:09 +0800
committerGitHub <noreply@github.com>2017-11-03 01:02:09 +0800
commit86e88dc8135e9729a86c4b8ce3c00a9d4cad0a3e (patch)
tree1da4b27d85cb0e155c7709d7b3a73d75645726a5 /ui/app/add-token.js
parentc1d2a1226c5ba4e5cfe1eeae2f52a86b67fc7404 (diff)
parent56e9f98bd05de8ae26f653d15eec4304f0c72155 (diff)
downloadtangerine-wallet-browser-86e88dc8135e9729a86c4b8ce3c00a9d4cad0a3e.tar.gz
tangerine-wallet-browser-86e88dc8135e9729a86c4b8ce3c00a9d4cad0a3e.tar.zst
tangerine-wallet-browser-86e88dc8135e9729a86c4b8ce3c00a9d4cad0a3e.zip
Merge pull request #2519 from danjm/NewUI-flat-lintfixes
[NewUI-flat] New ui flat lintfixes
Diffstat (limited to 'ui/app/add-token.js')
-rw-r--r--ui/app/add-token.js23
1 files changed, 5 insertions, 18 deletions
diff --git a/ui/app/add-token.js b/ui/app/add-token.js
index 518701a1d..10aaae103 100644
--- a/ui/app/add-token.js
+++ b/ui/app/add-token.js
@@ -21,9 +21,7 @@ const fuse = new Fuse(contractList, {
})
const actions = require('./actions')
const ethUtil = require('ethereumjs-util')
-const abi = require('human-standard-token-abi')
-const Eth = require('ethjs-query')
-const EthContract = require('ethjs-contract')
+const { tokenInfoGetter } = require('./token-util')
const R = require('ramda')
const emptyAddr = '0x0000000000000000000000000000000000000000'
@@ -63,11 +61,7 @@ function AddTokenScreen () {
}
AddTokenScreen.prototype.componentWillMount = function () {
- if (typeof global.ethereumProvider === 'undefined') return
-
- this.eth = new Eth(global.ethereumProvider)
- this.contract = new EthContract(this.eth)
- this.TokenContract = this.contract(abi)
+ this.tokenInfoGetter = tokenInfoGetter()
}
AddTokenScreen.prototype.toggleToken = function (address, token) {
@@ -164,18 +158,11 @@ AddTokenScreen.prototype.validate = function () {
}
AddTokenScreen.prototype.attemptToAutoFillTokenParams = async function (address) {
- const contract = this.TokenContract.at(address)
-
- const results = await Promise.all([
- contract.symbol(),
- contract.decimals(),
- ])
-
- const [ symbol, decimals ] = results
+ const { symbol, decimals } = await this.tokenInfoGetter(address)
if (symbol && decimals) {
this.setState({
- customSymbol: symbol[0],
- customDecimals: decimals[0].toString(),
+ customSymbol: symbol,
+ customDecimals: decimals.toString(),
})
}
}