feat: expired trade refund flow (#71)#100
Open
JafetCHVDev wants to merge 1 commit into
Open
Conversation
- Add callRefundOnChain() to Stellar service for Soroban contract refund - Add refundTrade() service with validation (buyer-only, expired, lock_tx_hash) - Add POST /trades/:id/refund endpoint - Add refundTradeRequest() to frontend API client - Show 'Recuperar fondos' button on expired trades for buyer in TradeDetail - Add RefundedView with tx hash and Stellar explorer link - Add RefundConfirmDialog with amount detail and gas fee warning - Add refunded status to STATUS_CONFIG, History filters, and trade history
|
@JafetCHVDev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the expired trade refund flow for the Trade Detail screen. When a trade expires, the buyer can now recover their funds by triggering an on-chain refund via the Soroban contract.
Changes
Backend
stellar.service.ts— AddedcallRefundOnChain()to invoke the Soroban escrow contract'srefund()function after the timeout ledger has been reachedtrade.service.ts— AddedrefundTrade()with full validation: verifies the caller is the buyer, the trade is past expiration, and on-chain funds exist (lock_tx_hash). Transitions the trade torefundedstatus and stores the refund transaction hashroutes/trades.ts— AddedPOST /trades/:id/refundendpointFrontend
TradeDetail.tsx:ExpiredViewnow shows a "Recuperar fondos" button when the current user is the buyerRefundConfirmDialogprovides a two-step confirmation with amount breakdown and gas fee warningRefundedViewdisplays the terminal refunded state with the Stellar transaction hash and explorer linkrefundedtoSTATUS_CONFIGwith purple styling andundoiconapi.ts— AddedrefundTradeRequest()function andRefundTradeResponsetypeHistory.tsx— Addedrefundedfilter tab ("Reembolsados") and status labelAcceptance Criteria
refund()on Soroban and updates state torefundedrefundedstate appears in history with visual distinction fromcompletedCloses #71