aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Huang <tmashuang@users.noreply.github.com>2019-05-01 00:49:58 +0800
committerWhymarrh Whitby <whymarrh.whitby@gmail.com>2019-05-01 00:49:58 +0800
commitc7492f4f54acdab3b763b273481406c885199369 (patch)
treeddbdf3a91d344b16b98ea200d4d778071beefd18
parent4fea9d0cc2ec9c6914931d5e310665aca8e273b6 (diff)
downloadtangerine-wallet-browser-c7492f4f54acdab3b763b273481406c885199369.tar
tangerine-wallet-browser-c7492f4f54acdab3b763b273481406c885199369.tar.gz
tangerine-wallet-browser-c7492f4f54acdab3b763b273481406c885199369.tar.bz2
tangerine-wallet-browser-c7492f4f54acdab3b763b273481406c885199369.tar.lz
tangerine-wallet-browser-c7492f4f54acdab3b763b273481406c885199369.tar.xz
tangerine-wallet-browser-c7492f4f54acdab3b763b273481406c885199369.tar.zst
tangerine-wallet-browser-c7492f4f54acdab3b763b273481406c885199369.zip
Include token checksum address in prices lookup for token rates (#6526)
-rw-r--r--app/scripts/controllers/token-rates.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/scripts/controllers/token-rates.js b/app/scripts/controllers/token-rates.js
index 4e396bb59..6b6265dba 100644
--- a/app/scripts/controllers/token-rates.js
+++ b/app/scripts/controllers/token-rates.js
@@ -1,6 +1,8 @@
const ObservableStore = require('obs-store')
const log = require('loglevel')
const normalizeAddress = require('eth-sig-util').normalize
+const ethUtil = require('ethereumjs-util')
+
// By default, poll every 3 minutes
const DEFAULT_INTERVAL = 180 * 1000
@@ -36,7 +38,7 @@ class TokenRatesController {
const response = await fetch(`https://api.coingecko.com/api/v3/simple/token_price/ethereum?${query}`)
const prices = await response.json()
this._tokens.forEach(token => {
- const price = prices[token.address.toLowerCase()]
+ const price = prices[token.address.toLowerCase()] || prices[ethUtil.toChecksumAddress(token.address)]
contractExchangeRates[normalizeAddress(token.address)] = price ? price[nativeCurrency] : 0
})
} catch (error) {