diff --git a/src/components/PoolAdd/index.tsx b/src/components/PoolAdd/index.tsx index b5d0c0c..0131027 100644 --- a/src/components/PoolAdd/index.tsx +++ b/src/components/PoolAdd/index.tsx @@ -1083,16 +1083,7 @@ const Swap = () => { // Number(toAmount.replace(/,/g, "")) * 10 ** token2.decimals // ), ] - : [ - toAmountBI, - fromAmountBI, - Math.round( - Number(toAmount.replace(/,/g, "")) * 10 ** token.decimals - ), - Math.round( - Number(fromAmount.replace(/,/g, "")) * 10 ** token2.decimals - ), - ], + : [toAmountBI, fromAmountBI], 0 ).then((Provider_depositR: any) => { if (Provider_depositR.success) { @@ -1744,7 +1735,20 @@ const Swap = () => { console.log("swapR", swapR); if (!swapR.success) { - return new Error("Add liquidity group simulation failed"); + const err = swapR as unknown as { message?: unknown; error?: unknown }; + const detail = + typeof err.error === "string" + ? err.error + : err.error != null + ? String(err.error) + : typeof err.message === "string" + ? err.message + : ""; + throw new Error( + detail + ? `Add liquidity group simulation failed: ${detail}` + : "Add liquidity group simulation failed" + ); } setProgress(50); diff --git a/src/components/PoolRemove/index.tsx b/src/components/PoolRemove/index.tsx index 445c2e9..c912ae2 100644 --- a/src/components/PoolRemove/index.tsx +++ b/src/components/PoolRemove/index.tsx @@ -698,7 +698,7 @@ const PoolRemove = () => { const arc200_balanceOfR = await ci.arc200_balanceOf( activeAccount.address ); - if (!arc200_balanceOfR.success) return new Error("Balance failed"); + if (!arc200_balanceOfR.success) throw new Error("Balance failed"); const poolShare = arc200_balanceOfR.returnValue; const withdrawAmount = @@ -717,7 +717,7 @@ const PoolRemove = () => { [0, 0] ); if (!Provider_withdrawR.success) - return new Error("Add liquidity simulation failed"); + throw new Error("Withdraw preview simulation failed"); const Provider_withdraw = Provider_withdrawR.returnValue; console.log({ @@ -887,7 +887,7 @@ const PoolRemove = () => { const customR = await ci.custom(); console.log({ customR }); if (!customR.success) - return new Error("Remove liquidity group simulation failed"); + throw new Error("Remove liquidity group simulation failed"); const stxns = await signTransactions( customR.txns.map(