aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/selectors.js
diff options
context:
space:
mode:
authorbitpshr <mail@bitpshr.net>2018-04-16 11:37:42 +0800
committerbitpshr <mail@bitpshr.net>2018-04-16 11:46:40 +0800
commita350e80feea6747a5e10088ac6ec15171a590a65 (patch)
tree93be19006b469678ffaec07b754104827dd1e61a /ui/app/selectors.js
parent3afe76bcba5eb1b84c748b13b61d1a22bed40bd3 (diff)
downloadtangerine-wallet-browser-a350e80feea6747a5e10088ac6ec15171a590a65.tar
tangerine-wallet-browser-a350e80feea6747a5e10088ac6ec15171a590a65.tar.gz
tangerine-wallet-browser-a350e80feea6747a5e10088ac6ec15171a590a65.tar.bz2
tangerine-wallet-browser-a350e80feea6747a5e10088ac6ec15171a590a65.tar.lz
tangerine-wallet-browser-a350e80feea6747a5e10088ac6ec15171a590a65.tar.xz
tangerine-wallet-browser-a350e80feea6747a5e10088ac6ec15171a590a65.tar.zst
tangerine-wallet-browser-a350e80feea6747a5e10088ac6ec15171a590a65.zip
Fetch token prices based on contract address
Diffstat (limited to 'ui/app/selectors.js')
-rw-r--r--ui/app/selectors.js19
1 files changed, 6 insertions, 13 deletions
diff --git a/ui/app/selectors.js b/ui/app/selectors.js
index 2bdc39004..60cc264da 100644
--- a/ui/app/selectors.js
+++ b/ui/app/selectors.js
@@ -62,22 +62,15 @@ function getSelectedToken (state) {
}
function getSelectedTokenExchangeRate (state) {
- const tokenExchangeRates = state.metamask.tokenExchangeRates
+ const contractExchangeRates = state.metamask.contractExchangeRates
const selectedToken = getSelectedToken(state) || {}
- const { symbol = '' } = selectedToken
-
- const pair = `${symbol.toLowerCase()}_eth`
- const { rate: tokenExchangeRate = 0 } = tokenExchangeRates[pair] || {}
-
- return tokenExchangeRate
+ const { address } = selectedToken
+ return contractExchangeRates[address] || 0
}
-function getTokenExchangeRate (state, tokenSymbol) {
- const pair = `${tokenSymbol.toLowerCase()}_eth`
- const tokenExchangeRates = state.metamask.tokenExchangeRates
- const { rate: tokenExchangeRate = 0 } = tokenExchangeRates[pair] || {}
-
- return tokenExchangeRate
+function getTokenExchangeRate (state, address) {
+ const contractExchangeRates = state.metamask.contractExchangeRates
+ return contractExchangeRates[address] || 0
}
function conversionRateSelector (state) {