aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/reducers
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/reducers
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/reducers')
-rw-r--r--ui/app/reducers/metamask.js23
1 files changed, 16 insertions, 7 deletions
diff --git a/ui/app/reducers/metamask.js b/ui/app/reducers/metamask.js
index 6d0a5bb10..d6b6de3b0 100644
--- a/ui/app/reducers/metamask.js
+++ b/ui/app/reducers/metamask.js
@@ -24,6 +24,7 @@ function reduceMetamask (state, action) {
frequentRpcList: [],
addressBook: [],
selectedTokenAddress: null,
+ contractExchangeRates: {},
tokenExchangeRates: {},
tokens: [],
send: {
@@ -176,14 +177,22 @@ function reduceMetamask (state, action) {
conversionDate: action.value.conversionDate,
})
- case actions.UPDATE_TOKEN_EXCHANGE_RATE:
- const { payload: { pair, marketinfo } } = action
- return extend(metamaskState, {
- tokenExchangeRates: {
- ...metamaskState.tokenExchangeRates,
- [pair]: marketinfo,
+ case actions.UPDATE_CONTRACT_EXCHANGE_RATES:
+ const { payload: { newExchangeRates } } = action
+ return {
+ ...metamaskState,
+ contractExchangeRates: newExchangeRates,
+ }
+
+ case actions.UPDATE_CONTRACT_EXCHANGE_RATE:
+ const { payload: { address, rate } } = action
+ return {
+ ...metamaskState,
+ contractExchangeRates: {
+ ...metamaskState.contractExchangeRates,
+ [address]: rate,
},
- })
+ }
case actions.UPDATE_TOKENS:
return extend(metamaskState, {