Skip to content

[Frontend] Add withdraw action to stream detail page #418

Description

@ogazboiz

https://t.me/+DOylgFv1jyJlNzM0

Description

The stream detail page does not expose a withdraw action for recipients. This issue adds a Withdraw button visible only to the stream's recipient when there is a non-zero claimable amount. Clicking it calls POST /streams/:id/withdraw, feeds the returned txHash into the existing TransactionTracker component, and handles success/error states gracefully.

Acceptance Criteria

  • "Withdraw" button is visible on the detail page only when connectedWallet === stream.recipient and claimableAmount > 0
  • Clicking calls POST /api/v1/streams/:id/withdraw; button shows loading spinner during the request
  • On success, TransactionTracker is rendered with the returned txHash; claimable amount resets to 0 optimistically
  • On error, a toast notification displays the error reason from the API
  • React Query cache for the stream and claimable amount is invalidated after success
  • Button is disabled while a transaction is in-flight to prevent double-submission

Files to Touch

  • src/app/streams/[id]/page.tsx — add Withdraw button and handler
  • src/hooks/useWithdrawStream.ts — mutation hook wrapping the API call
  • src/lib/api/streams.ts — add withdrawStream(id) API helper
  • src/components/TransactionTracker.tsx — confirm it accepts txHash prop (no change expected)

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programfrontendFrontend related tasks

Type

No type

Fields

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