Skip to content

Commit

Permalink
fix: Don't show swaps as 'refundable' when there was no lockup tx
Browse files Browse the repository at this point in the history
  • Loading branch information
kiocosta committed Feb 4, 2025
1 parent cf96270 commit 6d0655a
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/pages/Refund.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ const Refund = () => {
setRefundableSwaps(refundableSwaps().concat(swap));
};

const swapsToRefund = (await getSwaps())
const allSwaps = await getSwaps();

const swapsToRefund = allSwaps
.filter(refundSwapsSanityFilter)
.filter((swap) =>
[
swapStatusFailed.InvoiceFailedToPay,
swapStatusFailed.TransactionLockupFailed,
].includes(swap.status),
.filter(
(swap) =>
swapStatusFailed.TransactionLockupFailed === swap.status,
);
setRefundableSwaps(swapsToRefund);

void (await getSwaps())
void allSwaps
.filter(refundSwapsSanityFilter)
.filter(
(swap) =>
Expand All @@ -53,12 +53,7 @@ const Refund = () => {
!(await updateSwapStatus(swap.id, res.status)) &&
Object.values(swapStatusFailed).includes(res.status)
) {
if (res.status !== swapStatusFailed.SwapExpired) {
addToRefundableSwaps(swap);
return;
}

// Make sure coins were locked for the swap with the status "swap.expired"
// Make sure coins were locked for the swaps with status "swap.expired" or "swap.failedToPay"
await getLockupTransaction(swap.id, swap.type);
addToRefundableSwaps(swap);
}
Expand Down

0 comments on commit 6d0655a

Please sign in to comment.