Skip to content

Commit

Permalink
Ana/3804 real fix polkadot balances also empty when none (#566)
Browse files Browse the repository at this point in the history
* real fix for 3804 polkadot balance validation

* fix extra 0 decimals in balance
  • Loading branch information
Bitcoinera authored Apr 4, 2020
1 parent 773a6df commit 1c9224d
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions lib/reducers/polkadotV0-reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,23 @@ function validatorReducer(network, validator) {

function balanceReducer(network, balance, total) {
// hack. We convert the balance into an Array to make it an Iterable
if (balance == 0) {
return []
}
return [
{
amount: BigNumber(balance)
.times(network.coinLookup[0].chainToViewConversionFactor)
.toFixed(4),
total: BigNumber(total)
.times(network.coinLookup[0].chainToViewConversionFactor)
.toFixed(4),
amount:
(BigNumber(balance)
.times(network.coinLookup[0].chainToViewConversionFactor)
.toFixed(4) *
10000) /
10000,
total:
(BigNumber(total)
.times(network.coinLookup[0].chainToViewConversionFactor)
.toFixed(4) *
10000) /
10000,
denom: network.coinLookup[0].viewDenom
}
]
Expand Down

0 comments on commit 1c9224d

Please sign in to comment.