diff options
author | Paul Bouchon <mail@bitpshr.net> | 2018-12-01 00:52:00 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-01 00:52:00 +0800 |
commit | 45a9f40aa614753e274275eaeb4dd6c0251dcf45 (patch) | |
tree | d217985773ea7944eb0f9456505444f1d8262b70 /app | |
parent | c7233e2cc7ba52308528a74e89938deada5394b8 (diff) | |
download | tangerine-wallet-browser-45a9f40aa614753e274275eaeb4dd6c0251dcf45.tar tangerine-wallet-browser-45a9f40aa614753e274275eaeb4dd6c0251dcf45.tar.gz tangerine-wallet-browser-45a9f40aa614753e274275eaeb4dd6c0251dcf45.tar.bz2 tangerine-wallet-browser-45a9f40aa614753e274275eaeb4dd6c0251dcf45.tar.lz tangerine-wallet-browser-45a9f40aa614753e274275eaeb4dd6c0251dcf45.tar.xz tangerine-wallet-browser-45a9f40aa614753e274275eaeb4dd6c0251dcf45.tar.zst tangerine-wallet-browser-45a9f40aa614753e274275eaeb4dd6c0251dcf45.zip |
bugfix: normalize contract addresss when fetching exchange rates (#5863)
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/controllers/token-rates.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/scripts/controllers/token-rates.js b/app/scripts/controllers/token-rates.js index a8936f13b..3f9482856 100644 --- a/app/scripts/controllers/token-rates.js +++ b/app/scripts/controllers/token-rates.js @@ -1,5 +1,6 @@ const ObservableStore = require('obs-store') const log = require('loglevel') +const normalizeAddress = require('eth-sig-util').normalize // By default, poll every 3 minutes const DEFAULT_INTERVAL = 180 * 1000 @@ -35,7 +36,8 @@ class TokenRatesController { const response = await fetch(`https://exchanges.balanc3.net/pie?${query}&autoConversion=true`) const { prices = [] } = await response.json() prices.forEach(({ pair, price }) => { - contractExchangeRates[pair.split('/')[0]] = typeof price === 'number' ? price : 0 + const address = pair.split('/')[0] + contractExchangeRates[normalizeAddress(address)] = typeof price === 'number' ? price : 0 }) } catch (error) { log.warn(`MetaMask - TokenRatesController exchange rate fetch failed.`, error) |