-
Notifications
You must be signed in to change notification settings - Fork 33
fix: Fixes #244. Concatenate balances to 2 decimal places on account overview page without rounding #291
Conversation
Note that another approach could be to use BigNumber.js rounding http://mikemcl.github.io/bignumber.js/#constructor-properties |
@@ -35,7 +43,9 @@ export const TokenCard = ({ | |||
</div> | |||
<div className='token_balance'> | |||
{balance ? ( | |||
<span>{balance.toFixed(decimals)} </span> | |||
<span> | |||
{concatBalanceByDecimalPlaces(balance.toString(), decimals)}{' '} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think .toFixed(decimals, 1)
does exactly this, 1 == ROUND_DOWN
Edit: or .dp(decimals, 1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping @ltfschoen Have you had a look at this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amaurymartiny i'll take a look now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amaurymartiny yes, works great!
With these changes, given an account with 0.999432 ETH and 1233.8945 TIB.
Previously the account summary page would show:
Ether: 1.00
THIBCoin: 1233.89
Now it shows:
Ether: 0.99
THIBCoin: 1233.89
Previously the Send Ether page would show: 0.999432
Now it shows: 0.999432
Previously the Send THIBCoin page would show: 1233.894500
Now it shows: 1233.8945