📌 Description
formatAmount and feeInBps in src/lib/format.ts format numeric amounts for display across MetricsBar, StatCard, and the tables. Stellar amounts can carry seven decimal places of precision and large magnitudes; if these helpers pass values through plain JS Number arithmetic, values beyond Number.MAX_SAFE_INTEGER-adjacent ranges risk silent precision loss in the displayed figure.
🧩 Requirements and context
- Add tests for large amounts (e.g. near
Number.MAX_SAFE_INTEGER) and high-precision decimal amounts, asserting the formatted output matches the expected exact string.
- If precision loss is confirmed for realistic Stellar-scale amounts, consider a string/bigint-safe formatting path as a follow-up (flag it in the issue rather than necessarily fixing it here if it requires an API/type change).
- Keep
formatAmount's existing output format for typical/small amounts unchanged.
🛠️ Suggested execution
- Add the large/high-precision cases to
src/lib/format.test.ts.
- If a real precision bug is found and fixable within
format.ts's current number-based signature, fix it; otherwise document the limitation clearly in a code comment.
✅ Acceptance criteria
🔒 Security notes
Display-only; a precision-loss bug here would mislead a user about an amount's exact value without affecting the actual on-chain/backend accounting.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
formatAmountandfeeInBpsinsrc/lib/format.tsformat numeric amounts for display acrossMetricsBar,StatCard, and the tables. Stellar amounts can carry seven decimal places of precision and large magnitudes; if these helpers pass values through plain JSNumberarithmetic, values beyondNumber.MAX_SAFE_INTEGER-adjacent ranges risk silent precision loss in the displayed figure.🧩 Requirements and context
Number.MAX_SAFE_INTEGER) and high-precision decimal amounts, asserting the formatted output matches the expected exact string.formatAmount's existing output format for typical/small amounts unchanged.🛠️ Suggested execution
src/lib/format.test.ts.format.ts's currentnumber-based signature, fix it; otherwise document the limitation clearly in a code comment.✅ Acceptance criteria
🔒 Security notes
Display-only; a precision-loss bug here would mislead a user about an amount's exact value without affecting the actual on-chain/backend accounting.
📋 Guidelines