Skip to content

Add transaction cost estimation before stream creation #22

@pragmaticAweds

Description

@pragmaticAweds

Context

When a user is about to create a payment stream, the summary card shows the stream parameters (recipient, amount, duration) but does not display the estimated transaction fees, minimum balance requirements, or total cost including gas. Users get surprised by the actual cost when the wallet prompts for signing. Providing an upfront cost estimate reduces transaction abandonment and builds trust.

What Success Looks Like

  • The PaymentStreamSummary component shows an estimated transaction fee (in XLM) before the user confirms
  • The fee estimate is fetched by simulating the transaction without submitting it (using Soroban's simulateTransaction)
  • A breakdown is shown: stream amount + estimated network fee + minimum reserve (if applicable)
  • If the user's XLM balance is too low to cover fees, a warning is displayed before they attempt the transaction
  • The fee estimate updates when stream parameters change (debounced to avoid excessive RPC calls)

Implementation Guidance

  • apps/web/src/components/modules/payment-stream/PaymentStreamSummary.tsx — where to display the estimate
  • apps/web/src/services/stellar.service.ts — already has simulateTransaction logic that returns fee data
  • Use server.simulateTransaction() to get the estimated fee without submitting
  • Debounce the simulation call (300-500ms) so it doesn't fire on every keystroke
  • Show a small loading spinner next to the fee while the estimate is being fetched
  • Display "~0.0001 XLM" format for the fee — round up for safety

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty: mediumStandard features across multiple codebase sections

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions