From edffcebcd79bee4853a4d2849ef2df476f4a831f Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Thu, 4 Jul 2024 11:13:23 +0300 Subject: [PATCH] Update components/swap.tsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- components/swap.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/swap.tsx b/components/swap.tsx index 72a3254..e3b53d1 100644 --- a/components/swap.tsx +++ b/components/swap.tsx @@ -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) } }