aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-04-28 08:03:56 +0800
committerDan <danjm.com@gmail.com>2018-04-28 08:03:56 +0800
commitb71dbf52d190a597ad3e06e4717cc641e1abe57a (patch)
tree2ebbc94fae4c5feecf11ce583613f72790afb2c3 /ui
parent6de450488b8303e01d4be60c571e99f995711e51 (diff)
downloadtangerine-wallet-browser-b71dbf52d190a597ad3e06e4717cc641e1abe57a.tar
tangerine-wallet-browser-b71dbf52d190a597ad3e06e4717cc641e1abe57a.tar.gz
tangerine-wallet-browser-b71dbf52d190a597ad3e06e4717cc641e1abe57a.tar.bz2
tangerine-wallet-browser-b71dbf52d190a597ad3e06e4717cc641e1abe57a.tar.lz
tangerine-wallet-browser-b71dbf52d190a597ad3e06e4717cc641e1abe57a.tar.xz
tangerine-wallet-browser-b71dbf52d190a597ad3e06e4717cc641e1abe57a.tar.zst
tangerine-wallet-browser-b71dbf52d190a597ad3e06e4717cc641e1abe57a.zip
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.js2
-rw-r--r--ui/app/components/pending-tx/index.js24
-rw-r--r--ui/app/token-util.js4
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,
}
}