flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[Frontend] Stop hardcoding 7 decimals in stream-details amount formatting

Open blurbeast opened this issue 2 weeks ago • 3 comments

Overview & Background

The stream-details page formats every amount with a hardcoded 7 decimals — nine call sites, e.g. formatAmount(ratePerSecond, 7) in frontend/src/app/streams/[id]/stream-details-content.tsx:518,522,552,556,567,571,575,594,902. Meanwhile useStreams.ts:72-77 resolves real per-token decimals with the comment "never silent 18", and soroban.ts:296-305 even calls the token's decimals() on-chain. Any token whose contract exposes a different decimals() value renders amounts off by orders of magnitude. The local StreamDetail interface has no decimals field, making the bug invisible at the type level.


Technical Specification & Architecture

  1. Carry tokenDecimals on StreamDetail (available from the same decimals() lookup amount.ts performs).
  2. Pass it to every formatAmount call instead of the literal 7.
  3. Remove the local type's blindness: make missing decimals a compile error.

Target Files

  • frontend/src/app/streams/[id]/stream-details-content.tsx
  • frontend/src/hooks/useStreams.ts
  • frontend/src/utils/amount.ts

Acceptance Criteria

  • [ ] No hardcoded decimal count remains in amount formatting.
  • [ ] A non-7-decimal token renders correctly on the stream details page.
  • [ ] The StreamDetail type requires decimals.

blurbeast avatar Nov 18 '26 19:11 blurbeast

@xeron-droid has applied to work on this issue as part of the Stellar Wave Program's 11th wave.

i can solve

ℹ️ Repo Maintainers: To accept this application, review their application or assign @xeron-droid to this issue.

xeron-droid avatar Nov 21 '26 07:11 xeron-droid

Congratulations, @xeron-droid! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on November 25, 2026.

🧑‍💻 @xeron-droid: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

[!WARNING] When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

🌊 Happy Wave 🌊

drips-wave[bot] avatar Nov 21 '26 07:11 drips-wave[bot]

This issue has been completed by @xeron-droid as part of the Stellar Wave Program's 11th Wave 🥳

😎 @xeron-droid: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

drips-wave[bot] avatar Nov 24 '26 17:11 drips-wave[bot]