Skip to content

Commit

Permalink
Ana/fix amount null in claim rewards (#416)
Browse files Browse the repository at this point in the history
* fix amount null in claim rewards

* small refactor

* apply suggestion
  • Loading branch information
Bitcoinera authored Mar 10, 2020
1 parent ff67103 commit ca5a971
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/reducers/cosmosV0-reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,17 @@ function rewardCoinReducer(reward, stakingDenom) {
const stringBit = reward.match(/[a-z]+/gi)
const multiDenomRewardsArray = reward.split(`,`)
if (multiDenomRewardsArray.length > 1) {
return multiDenomRewardsArray
.map(reward => rewardCoinReducer(reward))
.filter(({ denom }) => denom === denomLookup(stakingDenom))[0]
const mappedMultiDenomRewardsArray = multiDenomRewardsArray.map(reward =>
rewardCoinReducer(reward)
)
let stakingDenomRewards = mappedMultiDenomRewardsArray.find(
({ denom }) => denom === denomLookup(stakingDenom)
)
// if there is no staking denom reward we will display the first alt-token reward
return (
stakingDenomRewards ||
mappedMultiDenomRewardsArray.find(({ amount }) => amount > 0)
)
}
return {
denom: denomLookup(stringBit),
Expand Down

0 comments on commit ca5a971

Please sign in to comment.