Skip to content

Commit

Permalink
💄 Show 2 decimal places
Browse files Browse the repository at this point in the history
  • Loading branch information
DonFungible committed Feb 12, 2025
1 parent cb6fccf commit 3b1468e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/forms/StakeForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export function StakeForm(props: { validator?: Validator; isFlexible?: boolean }
<FormItem>
<FormLabel className="text-[16px] text-primary-outline">
<span className="font-semibold text-white">Amount to Stake</span> (
{balance ? formatLargeMetricsNumber(parseFloat(formatEther(balance.value)).toFixed(3)) : '-'} IP
{balance ? formatLargeMetricsNumber(parseFloat(formatEther(balance.value)).toFixed(2)) : '-'} IP
available)
</FormLabel>
<FormControl>
Expand Down
10 changes: 5 additions & 5 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ export function formatLargeMetricsNumber(value: number | string, options: { useS

if (useSuffix) {
if (absValue >= 1e12) {
formattedValue = (num / 1e12).toFixed(3)
formattedValue = (num / 1e12).toFixed(2)
return parseFloat(formattedValue) + 'T'
} else if (absValue >= 1e9) {
formattedValue = (num / 1e9).toFixed(3)
formattedValue = (num / 1e9).toFixed(2)
return parseFloat(formattedValue) + 'B'
} else if (absValue >= 1e6) {
formattedValue = (num / 1e6).toFixed(3)
formattedValue = (num / 1e6).toFixed(2)
return parseFloat(formattedValue) + 'M'
} else if (absValue >= 1e3) {
formattedValue = (num / 1e3).toFixed(3)
formattedValue = (num / 1e3).toFixed(2)
return parseFloat(formattedValue) + 'K'
} else {
formattedValue = num.toFixed(3)
formattedValue = num.toFixed(2)
return parseFloat(formattedValue).toString()
}
} else {
Expand Down

0 comments on commit 3b1468e

Please sign in to comment.