diff --git a/cypress/e2e/claim-portal-success.cy.ts b/cypress/e2e/claim-portal-success.cy.ts index 9f0b1bb5..7e76314e 100644 --- a/cypress/e2e/claim-portal-success.cy.ts +++ b/cypress/e2e/claim-portal-success.cy.ts @@ -36,6 +36,15 @@ describe("Claims Portal Success", () => { // anvil confirms it instantly so there is two notifications cy.get("body").should("contain.text", "Transaction sent"); cy.get("body").should("contain.text", "Claim Complete"); + + cy.window().then((win) => { + win.open = cy.stub().as("open"); + }); + + cy.get("#view-claim").invoke("click") + .then(() => { + cy.get("@open").should("be.calledWithMatch", /https:\/\/blockscan.com\/tx/); + }); }); }); diff --git a/static/scripts/rewards/init.ts b/static/scripts/rewards/init.ts index bf9cf9bd..1b465d1a 100644 --- a/static/scripts/rewards/init.ts +++ b/static/scripts/rewards/init.ts @@ -4,7 +4,6 @@ import { grid } from "./the-grid"; displayCommitHash(); // @DEV: display commit hash in footer grid(document.getElementById("grid") as HTMLElement, gridLoadedCallback); // @DEV: display grid background - readClaimDataFromUrl(app).catch(console.error); // @DEV: read claim data from URL declare const commitHash: string; // @DEV: passed in at build time check build/esbuild-build.ts diff --git a/static/scripts/rewards/web3/erc20-permit.ts b/static/scripts/rewards/web3/erc20-permit.ts index 90f1b199..fe68afd1 100644 --- a/static/scripts/rewards/web3/erc20-permit.ts +++ b/static/scripts/rewards/web3/erc20-permit.ts @@ -5,7 +5,7 @@ import { erc20Abi, permit2Abi } from "../abis"; import { app, AppState } from "../app-state"; import { permit2Address } from "@ubiquity-dao/rpc-handler"; import { supabase } from "../render-transaction/read-claim-data-from-url"; -import { MetaMaskError, buttonController, errorToast, getMakeClaimButton, toaster } from "../toaster"; +import { MetaMaskError, buttonController, errorToast, getMakeClaimButton, toaster, viewClaimButton } from "../toaster"; import { connectWallet } from "./connect-wallet"; export async function fetchTreasury(permit: Permit): Promise<{ balance: BigNumber; allowance: BigNumber; decimals: number; symbol: string }> { @@ -100,12 +100,17 @@ 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; } catch (error: unknown) { if (error instanceof Error) {