Skip to content

[Frontend] Add real-time claimable amount countdown on stream detail #419

@ogazboiz

Description

@ogazboiz

https://t.me/+DOylgFv1jyJlNzM0

Description

The get_claimable_amount contract view is already called on stream load but the displayed value is static. For a streaming-payment app the claimable amount should tick upward in real time so recipients can see tokens accumulating. This issue adds a client-side interval that recalculates (or polls the API for) the claimable amount every second and updates the display smoothly.

Acceptance Criteria

  • Claimable amount on the stream detail page updates every second while the stream is ACTIVE
  • The interval is computed client-side using rate_per_second * elapsed_seconds_since_last_checkpoint for zero-latency display, with a periodic API re-sync every 30 s to correct drift
  • Counter pauses when the stream is PAUSED or COMPLETED
  • Counter stops and cleans up the interval when the component unmounts (no memory leaks)
  • Formatted value uses the existing amount-formatting utility (e.g. 7.0000312 XLM)
  • A subtle CSS animation (e.g. brief highlight pulse) draws attention to each update tick

Files to Touch

  • src/hooks/useClaimableAmount.ts — new hook with local interval + remote sync
  • src/app/streams/[id]/page.tsx — wire the hook to the claimable amount display
  • src/components/streams/ClaimableAmountDisplay.tsx — extract display into its own component
  • src/lib/api/streams.ts — add getClaimableAmount(id) API helper if not present

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programfrontendFrontend related tasks

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions