Skip to content

Commit

Permalink
more specific error in weth form
Browse files Browse the repository at this point in the history
  • Loading branch information
sehyunc committed Oct 9, 2024
1 parent 7191ed8 commit 5794904
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion components/dialogs/transfer/weth-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,11 @@ export function WETHForm({
mint,
})
const { status: withdrawTaskStatus, setTaskId: setWithdrawTaskId } =
useWaitForTask(() => {
useWaitForTask(async () => {
if (unwrapRequired) {
setCurrentStep((prev) => prev + 1)
// Wait to prevent contract error
await new Promise((resolve) => setTimeout(resolve, 1000))
unwrapEth({
address: baseToken.address,
args: [parseEther(amount)],
Expand Down Expand Up @@ -519,6 +521,13 @@ export function WETHForm({
)
) {
title = "Waiting for confirmation"
} else if (wrapStatus === "error" || wrapConfirmationStatus === "error") {
title = "Failed to wrap ETH"
} else if (
unwrapStatus === "error" ||
unwrapConfirmationStatus === "error"
) {
title = "Failed to unwrap ETH"
} else if (statuses.some((status) => status.status === "error")) {
title = `Failed to ${direction === ExternalTransferDirection.Deposit ? "deposit" : "withdraw"} WETH`
} else if (
Expand Down

0 comments on commit 5794904

Please sign in to comment.