Summary
XLM amounts and transaction timestamps are formatted inline across multiple components, each with slightly different precision or locale handling. Two shared hooks should centralise these concerns so every surface renders consistent output.
Scope
- Add
useFormatXlm(amount: bigint | number, decimals?: number): string — defaults to 2 decimal places, uses Intl.NumberFormat for locale-aware thousands separators, allows decimal override
- Add
useRelativeTime(timestamp: number): string — returns human-readable relative strings like 2 minutes ago, 3 days ago, using Intl.RelativeTimeFormat; updates every 60 seconds while the component is mounted
- Replace existing inline format calls in holdings, trade panel, and activity feed with the two hooks
Acceptance Criteria
ETA: 12 hours
Coordinate on Telegram
Summary
XLM amounts and transaction timestamps are formatted inline across multiple components, each with slightly different precision or locale handling. Two shared hooks should centralise these concerns so every surface renders consistent output.
Scope
useFormatXlm(amount: bigint | number, decimals?: number): string— defaults to 2 decimal places, usesIntl.NumberFormatfor locale-aware thousands separators, allows decimal overrideuseRelativeTime(timestamp: number): string— returns human-readable relative strings like2 minutes ago,3 days ago, usingIntl.RelativeTimeFormat; updates every 60 seconds while the component is mountedAcceptance Criteria
useFormatXlmreturns correct value with locale separators and configurable decimalsuseRelativeTimereturns correct relative string and refreshes every 60 secondshooks/formattingmoduleETA: 12 hours
Coordinate on Telegram