diff options
Convert decimals to string in getSymbolAndDecimals; return null for symbol or decimals.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/components/pages/add-token.js | 2 | ||||
-rw-r--r-- | ui/app/components/pending-tx/index.js | 24 | ||||
-rw-r--r-- | ui/app/token-util.js | 4 |
3 files changed, 10 insertions, 20 deletions
diff --git a/ui/app/components/pages/add-token.js b/ui/app/components/pages/add-token.js index 566e42450..8d52571d0 100644 --- a/ui/app/components/pages/add-token.js +++ b/ui/app/components/pages/add-token.js @@ -192,7 +192,7 @@ AddTokenScreen.prototype.attemptToAutoFillTokenParams = async function (address) if (symbol && decimals) { this.setState({ customSymbol: symbol, - customDecimals: decimals.toString(), + customDecimals: decimals, autoFilled: true, }) } diff --git a/ui/app/components/pending-tx/index.js b/ui/app/components/pending-tx/index.js index 392650e01..fb409cb92 100644 --- a/ui/app/components/pending-tx/index.js +++ b/ui/app/components/pending-tx/index.js @@ -94,23 +94,13 @@ PendingTx.prototype.setTokenData = async function () { if (isTokenTransaction) { const { symbol, decimals } = await getSymbolAndDecimals(txParams.to, existingTokens) - if (symbol && decimals) { - this.setState({ - transactionType: TX_TYPES.SEND_TOKEN, - tokenAddress: txParams.to, - tokenSymbol: symbol, - tokenDecimals: decimals, - isFetching: false, - }) - } else { - this.setState({ - transactionType: TX_TYPES.SEND_TOKEN, - tokenAddress: txParams.to, - tokenSymbol: null, - tokenDecimals: null, - isFetching: false, - }) - } + this.setState({ + transactionType: TX_TYPES.SEND_TOKEN, + tokenAddress: txParams.to, + tokenSymbol: symbol, + tokenDecimals: decimals, + isFetching: false, + }) } else { this.setState({ transactionType: TX_TYPES.SEND_ETHER, diff --git a/ui/app/token-util.js b/ui/app/token-util.js index 2ae3b15b9..1b0091826 100644 --- a/ui/app/token-util.js +++ b/ui/app/token-util.js @@ -38,8 +38,8 @@ async function getSymbolAndDecimals (tokenAddress, existingTokens = []) { const [ symbol = [], decimals = [] ] = result return { - symbol: symbol[0], - decimals: decimals[0], + symbol: symbol[0] || null, + decimals: decimals[0] && decimals[0].toString() || null, } } |