Skip to content

Commit 7b75c06

Browse files
committed
fix: update Boltz swap status in history
- PendingSwaps now routes to /api/swap/boltz/:id for boltz provider swaps - Boltz status endpoint updates DB on every poll (processing → settled) - Manually fixed stuck swap GVZmeNCt8fvW to settled - Pending swaps list correctly filters out completed boltz swaps
1 parent 05e5ebb commit 7b75c06

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/components/web-wallet/BoltzSwap.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export function BoltzSwap({ walletId, btcAddress, btcBalance, lnBalance }: Props
8181
setSwapStatus(data.status);
8282
// Success states
8383
if (['transaction.claimed', 'invoice.settled'].includes(data.status)) {
84+
// Final status check already updated DB via the API call above
8485
setSwapState('complete');
8586
clearInterval(interval);
8687
}

src/components/web-wallet/SwapHistory.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,19 @@ export function PendingSwaps({ walletId }: { walletId: string }) {
328328
const updatedSwaps = await Promise.all(
329329
data.swaps.map(async (swap: Swap) => {
330330
try {
331-
const statusRes = await fetch(`/api/swap/${swap.id}`);
331+
// Use correct status endpoint based on provider
332+
const statusUrl = swap.provider === 'boltz'
333+
? `/api/swap/boltz/${swap.id}`
334+
: `/api/swap/${swap.id}`;
335+
const statusRes = await fetch(statusUrl);
332336
const statusData = await statusRes.json();
333-
if (statusRes.ok && statusData.swap) {
334-
return { ...swap, status: statusData.swap.status };
337+
if (statusRes.ok) {
338+
if (swap.provider === 'boltz' && statusData.status) {
339+
// Boltz status endpoint already updates DB, just refresh local state
340+
return { ...swap, status: statusData.status, deposit_tx_hash: statusData.transaction?.id || swap.deposit_tx_hash };
341+
} else if (statusData.swap) {
342+
return { ...swap, status: statusData.swap.status };
343+
}
335344
}
336345
} catch {
337346
// Keep original status on error

0 commit comments

Comments
 (0)