diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/actions.js | 3 | ||||
-rw-r--r-- | ui/app/util.js | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js index 192a73f76..25cb2c23f 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -1,5 +1,6 @@ const abi = require('human-standard-token-abi') const getBuyEthUrl = require('../../app/scripts/lib/buy-eth-url') +const { getTokenAddressFromTokenObject } = require('./util') const ethUtil = require('ethereumjs-util') var actions = { @@ -1094,10 +1095,12 @@ function removeToken (address) { function addTokens (tokens) { return dispatch => { if (Array.isArray(tokens)) { + dispatch(actions.setSelectedToken(getTokenAddressFromTokenObject(tokens[0]))) return Promise.all(tokens.map(({ address, symbol, decimals }) => ( dispatch(addToken(address, symbol, decimals)) ))) } else { + dispatch(actions.setSelectedToken(getTokenAddressFromTokenObject(tokens))) return Promise.all( Object .entries(tokens) diff --git a/ui/app/util.js b/ui/app/util.js index 70c503550..800ccb218 100644 --- a/ui/app/util.js +++ b/ui/app/util.js @@ -56,6 +56,7 @@ module.exports = { exportAsFile: exportAsFile, isInvalidChecksumAddress, allNull, + getTokenAddressFromTokenObject, } function valuesFor (obj) { @@ -281,3 +282,7 @@ function exportAsFile (filename, data) { function allNull (obj) { return Object.entries(obj).every(([key, value]) => value === null) } + +function getTokenAddressFromTokenObject (token) { + return Object.values(token)[0].address.toLowerCase() +} |