Skip to content

Commit

Permalink
Ana/correct terra denoms (#398)
Browse files Browse the repository at this point in the history
* correct terra denoms

* variable renaming

Co-authored-by: Fabian <frznhope@gmail.com>
  • Loading branch information
faboweb authored Mar 5, 2020
1 parent cc7a382 commit bc45c6c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/reducers/terraV3-reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ function undelegationEndTimeReducer(transaction) {

function balanceReducer(coin, fiatValue, gasPrices) {
return {
...coin,
amount: coin.amount,
denom: correctTerraDenomsReducer(coin.denom),
fiatValue: fiatValue
? {
amount: fiatValue.amount || 0,
Expand All @@ -52,7 +53,7 @@ function rewardReducer(rewards, validatorsDictionary) {
formattedRewards.forEach(({ reward, validator }) =>
reward.forEach(denomReward => {
multiDenomRewardsArray.push({
denom: denomLookup(denomReward.denom),
denom: correctTerraDenomsReducer(denomLookup(denomReward.denom)),
amount: atoms(denomReward.amount),
validator: validator
})
Expand All @@ -61,6 +62,15 @@ function rewardReducer(rewards, validatorsDictionary) {
return multiDenomRewardsArray
}

function correctTerraDenomsReducer(viewDenom) {
const corrector = {
KRW: 'KRT',
SDR: 'SDT',
USD: 'UST'
}
return corrector[viewDenom] ? corrector[viewDenom] : viewDenom
}

module.exports = {
...cosmosV2Reducers,
balanceReducer,
Expand Down

0 comments on commit bc45c6c

Please sign in to comment.