From 4fca642498ee60ce5ccf24a5a7afe7c17f1204bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=A2=E3=83=AC=E3=82=AF=E3=82=B5=E3=83=B3=E3=83=80?= =?UTF-8?q?=E3=83=BC=2Eeth?= <4975670+0x4007@users.noreply.github.com> Date: Thu, 12 Sep 2024 12:51:21 +0900 Subject: [PATCH] Revert "optimistic view claim rendering" --- .cspell.json | 3 +-- static/scripts/rewards/web3/erc20-permit.ts | 16 ++++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.cspell.json b/.cspell.json index 216070ff..fd192d49 100644 --- a/.cspell.json +++ b/.cspell.json @@ -41,8 +41,7 @@ "URLSAFE", "WXDAI", "XDAI", - "xmark", - "outfile" + "xmark" ], "dictionaries": ["typescript", "node", "software-terms", "html"], "import": ["@cspell/dict-typescript/cspell-ext.json", "@cspell/dict-node/cspell-ext.json", "@cspell/dict-software-terms"], diff --git a/static/scripts/rewards/web3/erc20-permit.ts b/static/scripts/rewards/web3/erc20-permit.ts index fcce270d..9e1fe826 100644 --- a/static/scripts/rewards/web3/erc20-permit.ts +++ b/static/scripts/rewards/web3/erc20-permit.ts @@ -100,9 +100,15 @@ async function transferFromPermit(permit2Contract: Contract, app: AppState) { async function waitForTransaction(tx: TransactionResponse) { try { const receipt = await tx.wait(); + viewClaimButton.onclick = () => { + window.open(`https://blockscan.com/tx/${receipt.transactionHash}`, "_blank"); + }; - console.log(receipt.transactionHash); toaster.create("success", `Claim Complete.`); + buttonController.showViewClaim(); + buttonController.hideLoader(); + buttonController.hideMakeClaim(); + console.log(receipt.transactionHash); return receipt; } catch (error: unknown) { @@ -134,15 +140,9 @@ export function claimErc20PermitHandlerWrapper(app: AppState) { const permit2Contract = new ethers.Contract(permit2Address, permit2Abi, signer); if (!permit2Contract) return; - const tx: TransactionResponse = await transferFromPermit(permit2Contract, app); + const tx = await transferFromPermit(permit2Contract, app); if (!tx) return; - viewClaimButton.onclick = () => window.open(`https://blockscan.com/tx/${tx.hash}`, "_blank"); - - buttonController.showViewClaim(); - buttonController.hideLoader(); - buttonController.hideMakeClaim(); - const receipt = await waitForTransaction(tx); if (!receipt) return;