Skip to content

Commit

Permalink
chore: remove excess commas in balance
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Jan 24, 2024
1 parent a8d21b5 commit 41a2fec
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/common/balances/Balance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ function format(
withMutedDecimals = true,
alwaysShowDecimals = false,
): React.ReactNode {
const [prefix, postfix] = formatBalance(value, {
// Remove any excess decimals, because this expects big integers
const balanceValue = value.toString().split('.')[0]

const [prefix, postfix] = formatBalance(balanceValue, {
forceUnit: '-',
decimals,
withSi: false,
Expand All @@ -38,7 +41,7 @@ function format(
const isShort = _isShort || (withSi && prefix.length >= K_LENGTH && !alwaysShowDecimals)

if (prefix.length > M_LENGTH && !alwaysShowDecimals) {
const balance = formatBalance(value, { decimals, withUnit: false })
const balance = formatBalance(balanceValue, { decimals, withUnit: false })
return (
<>
{balance}&nbsp;{currency}
Expand Down

0 comments on commit 41a2fec

Please sign in to comment.