Skip to content

Live Fee Estimator on Invoice Creation Form #411

Description

@Kingsman-99

Description

Creators currently have no on-form visibility into the Stellar network fee they will pay when submitting or releasing an invoice payment, leading to surprises at signing time. This issue embeds a live fee estimator in the /invoice/new form that queries the Stellar fee stats endpoint in real time, shows the base, median, and surge fee in stroops alongside a human-readable XLM equivalent, and updates whenever the operation count changes (i.e., as recipients are added or removed).

Technical Context

Create hooks/useFeeEstimate.ts that polls StellarSdk.Server.feeStats() every 10 seconds and exposes { baseFee, medianFee, p90Fee, loading, error }. Build components/invoice/FeeEstimateBar.tsx that consumes this hook and accepts operationCount: number as a prop to compute total fee (fee multiplied by ops). Display three tiers (economy/standard/priority) as a segmented bar with tooltips explaining each. Wire operationCount from the current recipient list length in app/invoice/new/page.tsx. The selected fee tier should be surfaced to the Freighter signing call as the fee parameter on TransactionBuilder. Polling must stop when the component unmounts.

Acceptance Criteria

  • Fee estimates update within 10 seconds of loading the creation form and reflect the Stellar network's current feeStats response
  • Adding or removing a recipient immediately recalculates the total fee based on the updated operation count
  • All three fee tiers (economy/standard/priority) are displayed with correct stroop values derived from the feeStats percentiles and their XLM equivalents rounded to 7 decimal places
  • The selected fee tier is passed as the fee parameter to TransactionBuilder when Freighter initiates the signing flow
  • An error state is shown when feeStats returns an error or times out, with a fallback to the Stellar minimum base fee (100 stroops)
  • All CI checks (npm test, npm run build, ESLint/TypeScript) pass and the branch has no merge conflicts

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programcomplexity: highuiUI styling and visual changes

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions