diff --git a/src/pages/stakingPage/components/VestingComponents/VestingStats.tsx b/src/pages/stakingPage/components/VestingComponents/VestingStats.tsx index 7dcca07..011877f 100644 --- a/src/pages/stakingPage/components/VestingComponents/VestingStats.tsx +++ b/src/pages/stakingPage/components/VestingComponents/VestingStats.tsx @@ -40,7 +40,7 @@ export const VestingStats: React.FC = ({ - {vestingData ? formatBalance(vestingData.claimable) : '0.0000'} + {vestingData ? formatBalance(vestingData.claimable) : '0'} @@ -51,7 +51,7 @@ export const VestingStats: React.FC = ({ - {vestingData ? Number(formatBalance(vestingData.totalVested)).toFixed(2) : '0.0000'} + {vestingData ? formatBalance(vestingData.totalVested) : '0'} diff --git a/src/pages/stakingPage/utils/formatters.ts b/src/pages/stakingPage/utils/formatters.ts index ce6486c..6612e0e 100644 --- a/src/pages/stakingPage/utils/formatters.ts +++ b/src/pages/stakingPage/utils/formatters.ts @@ -1,23 +1,18 @@ /** - * Format balance with 4 decimal places and commas for large numbers + * Format balance with 2 decimal places and commas for large numbers */ export const formatBalance = (value: string): string => { try { // Convert scientific notation to regular number const num = Number(value); - if (isNaN(num)) return '0.0000'; + if (isNaN(num)) return '0.00'; - // If it's a large number, format it with commas - if (num > 1000) { - return num.toLocaleString('en-US', { - minimumFractionDigits: 4, - maximumFractionDigits: 4, - }); - } - - // Otherwise just show 4 decimal places - return num.toFixed(4); + // Format with 2 decimal places and commas for large numbers + return num.toLocaleString('en-US', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }); } catch (error) { - return '0.0000'; + return '0.00'; } };