Skip to content

Commit

Permalink
fix: safety check if swap was found (#484)
Browse files Browse the repository at this point in the history
  • Loading branch information
dni committed Feb 13, 2024
1 parent 9be3c87 commit 71841cf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/SwapChecker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ export const SwapChecker = () => {
};

const prepareSwap = (swapId: string, data: any) => {
const currentSwap = swaps().find((s) => swapId === s.id);
const currentSwap = swaps().find((s: any) => swapId === s.id);
if (currentSwap === undefined) {
log.warn(`prepareSwap: swap ${swapId} not found`);
return;
}
if (swap() && swap().id === currentSwap.id) {
setSwapStatus(data.status);
}
Expand All @@ -149,6 +153,10 @@ export const SwapChecker = () => {

const claimSwap = async (swapId: string, data: any) => {
const currentSwap = swaps().find((s) => swapId === s.id);
if (currentSwap === undefined) {
log.warn(`claimSwap: swap ${swapId} not found`);
return;
}
if (
currentSwap.asset !== RBTC &&
currentSwap.claimTx === undefined &&
Expand Down

0 comments on commit 71841cf

Please sign in to comment.