Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions src/components/PoolAdd/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/components/PoolRemove/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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({
Expand Down Expand Up @@ -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(
Expand Down