diff --git a/kraiken-lib/src/format.ts b/kraiken-lib/src/format.ts index efc55fe..06d906d 100644 --- a/kraiken-lib/src/format.ts +++ b/kraiken-lib/src/format.ts @@ -27,5 +27,6 @@ export function commaNumber(value: number): string { /** Format a token amount with comma grouping and 2 decimal places (e.g. "1,234.56") */ export function formatTokenAmount(value: number): string { + if (!isFinite(value)) return '0.00'; return value.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 }); } diff --git a/web-app/src/components/collapse/CollapseActive.vue b/web-app/src/components/collapse/CollapseActive.vue index b748ce4..8955831 100644 --- a/web-app/src/components/collapse/CollapseActive.vue +++ b/web-app/src/components/collapse/CollapseActive.vue @@ -50,7 +50,7 @@
Total
-
{{ taxPaidGes !== undefined && profit !== undefined ? total.toFixed(5) : '...' }} $KRK
+
{{ taxPaidGes !== undefined && profit !== undefined ? formatTokenAmount(total) : '...' }} $KRK