Description
When a Stellar payment transaction fails (insufficient fee, sequence number mismatch, destination account not found, etc.), the user currently receives only a raw error code with no actionable guidance. This issue builds a payment retry wizard that intercepts failed transaction submissions, parses the Stellar error code into a human-readable explanation, suggests the appropriate corrective action (bump fee, refresh sequence number, activate destination account), and guides the user through corrected re-submission step by step.
Technical Context
Create lib/stellarErrorParser.ts mapping Stellar result_codes (e.g., tx_insufficient_fee, op_no_destination, tx_bad_seq, op_underfunded) to { title, explanation, suggestedAction, actionType: 'bump-fee'|'refresh-seq'|'fund-destination'|'manual' }. Build components/invoice/PaymentRetryWizard.tsx as a modal triggered when usePaymentSubmission receives a submission error. The wizard shows: step 1 (error explanation), step 2 (corrective action UI including bump fee slider, refresh seq button, or fund-destination link), step 3 (re-build and re-sign transaction with correction applied). Re-building uses TransactionBuilder with fresh loadAccount data for the correct sequence number. Log all retry attempts to the invoice audit trail. Limit automatic retries to 3 before surfacing a manual fallback.
Acceptance Criteria
Description
When a Stellar payment transaction fails (insufficient fee, sequence number mismatch, destination account not found, etc.), the user currently receives only a raw error code with no actionable guidance. This issue builds a payment retry wizard that intercepts failed transaction submissions, parses the Stellar error code into a human-readable explanation, suggests the appropriate corrective action (bump fee, refresh sequence number, activate destination account), and guides the user through corrected re-submission step by step.
Technical Context
Create
lib/stellarErrorParser.tsmapping Stellarresult_codes(e.g.,tx_insufficient_fee,op_no_destination,tx_bad_seq,op_underfunded) to{ title, explanation, suggestedAction, actionType: 'bump-fee'|'refresh-seq'|'fund-destination'|'manual' }. Buildcomponents/invoice/PaymentRetryWizard.tsxas a modal triggered whenusePaymentSubmissionreceives a submission error. The wizard shows: step 1 (error explanation), step 2 (corrective action UI including bump fee slider, refresh seq button, or fund-destination link), step 3 (re-build and re-sign transaction with correction applied). Re-building usesTransactionBuilderwith freshloadAccountdata for the correct sequence number. Log all retry attempts to the invoice audit trail. Limit automatic retries to 3 before surfacing a manual fallback.Acceptance Criteria
tx_insufficient_feeerror surfaces a wizard step with a fee-bump slider pre-set to the median fee fromfeeStats, and submitting the wizard creates a fee-bump transactiontx_bad_seqerror surfaces a "Refresh Sequence Number" button; clicking it callsloadAccountto get the current sequence number and rebuilds the transactionop_no_destinationerror explains that the destination account is not yet funded and provides a link to fund it on the testnet Friendbot (or a mainnet guide)