From c146e190ffcd3f84ab73e30663b507d8a1d4a289 Mon Sep 17 00:00:00 2001 From: Keyrxng <106303466+Keyrxng@users.noreply.github.com> Date: Thu, 12 Sep 2024 18:05:27 +0100 Subject: [PATCH] chore: view claim rendering --- static/scripts/rewards/web3/erc20-permit.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/static/scripts/rewards/web3/erc20-permit.ts b/static/scripts/rewards/web3/erc20-permit.ts index 9e1fe826..7406a882 100644 --- a/static/scripts/rewards/web3/erc20-permit.ts +++ b/static/scripts/rewards/web3/erc20-permit.ts @@ -100,14 +100,8 @@ 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"); - }; toaster.create("success", `Claim Complete.`); - buttonController.showViewClaim(); - buttonController.hideLoader(); - buttonController.hideMakeClaim(); console.log(receipt.transactionHash); return receipt; @@ -140,9 +134,15 @@ export function claimErc20PermitHandlerWrapper(app: AppState) { const permit2Contract = new ethers.Contract(permit2Address, permit2Abi, signer); if (!permit2Contract) return; - const tx = await transferFromPermit(permit2Contract, app); + const tx: TransactionResponse = 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;