You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue #727 already tracks a hardcoded-en-USformatUsdc duplicate in src/lib/recentStreamMapper.ts. This is a third, independent copy of the same pattern in a different file: streamsService.ts's formatUsdc hardcodes "en-US" in its own Intl.NumberFormat call rather than using the app's shared locale-aware formatter (src/lib/formatters.ts). Since getTreasuryMetrics() (which calls deriveMockMetrics whenever VITE_USE_MOCKS is enabled) feeds the dashboard's "Active Streams" / "Total Streaming" / "Withdrawable" metric cards, a non-US locale user running in mock mode sees US-formatted thousands separators here even after the recentStreamMapper.ts copy from #727 is fixed, because this is a wholly separate function.
Requirements
streamsService.ts's formatUsdc must use the app's shared locale-resolution approach from src/lib/formatters.ts instead of hardcoding "en-US", consistent with the fix required for recentStreamMapper.ts in Add idempotency-key support to the contracts write endpoints #727.
Preserve the existing maximumFractionDigits: 0 formatting behavior and the "USDC" suffix.
Suggested execution
Import the shared locale-aware number formatter from src/lib/formatters.ts into streamsService.ts and use it inside formatUsdc, replacing the hardcoded "en-US"Intl.NumberFormat call.
Consider consolidating all three formatUsdc-shaped functions (formatters.ts's canonical one, recentStreamMapper.ts's, and this one) into a single shared implementation to prevent a fourth copy from appearing later.
Add a test asserting getTreasuryMetrics() in mock mode produces locale-aware output when navigator.language is set to a non-US locale.
Acceptance criteria
streamsService.ts's formatUsdc no longer hardcodes "en-US".
Description
src/lib/api/streamsService.tshas its own locally-definedformatUsdc, used byderiveMockMetricsto build the dashboard's treasury metrics:Issue #727 already tracks a hardcoded-
en-USformatUsdcduplicate insrc/lib/recentStreamMapper.ts. This is a third, independent copy of the same pattern in a different file:streamsService.ts'sformatUsdchardcodes"en-US"in its ownIntl.NumberFormatcall rather than using the app's shared locale-aware formatter (src/lib/formatters.ts). SincegetTreasuryMetrics()(which callsderiveMockMetricswheneverVITE_USE_MOCKSis enabled) feeds the dashboard's "Active Streams" / "Total Streaming" / "Withdrawable" metric cards, a non-US locale user running in mock mode sees US-formatted thousands separators here even after therecentStreamMapper.tscopy from #727 is fixed, because this is a wholly separate function.Requirements
streamsService.ts'sformatUsdcmust use the app's shared locale-resolution approach fromsrc/lib/formatters.tsinstead of hardcoding"en-US", consistent with the fix required forrecentStreamMapper.tsin Add idempotency-key support to the contracts write endpoints #727.maximumFractionDigits: 0formatting behavior and the"USDC"suffix.Suggested execution
src/lib/formatters.tsintostreamsService.tsand use it insideformatUsdc, replacing the hardcoded"en-US"Intl.NumberFormatcall.formatUsdc-shaped functions (formatters.ts's canonical one,recentStreamMapper.ts's, and this one) into a single shared implementation to prevent a fourth copy from appearing later.getTreasuryMetrics()in mock mode produces locale-aware output whennavigator.languageis set to a non-US locale.Acceptance criteria
streamsService.ts'sformatUsdcno longer hardcodes"en-US".Security notes
None; i18n correctness fix.
Guidelines