Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
Update components/swap.tsx
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
fadeev and coderabbitai[bot] authored Jul 4, 2024
1 parent 5c2d148 commit edffceb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion components/swap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,13 @@ const Swap = () => {
}
const target = d.coin_type === "ZRC20" ? d.contract : d.zrc20
const dAddress = dIsZETA ? WZETA.contract : target
const q = await client.getQuote(amount, sourceAddress, dAddress)
let q;
try {
q = await client.getQuote(amount, sourceAddress, dAddress)
} catch (error) {
console.error("Error fetching quote:", error);
return "0";
}
return utils.formatUnits(q.amount, q.decimals)
}
}
Expand Down

0 comments on commit edffceb

Please sign in to comment.