From d1caf1a861608a937d8e2f05915251aa1029de57 Mon Sep 17 00:00:00 2001 From: Keyrxng <106303466+Keyrxng@users.noreply.github.com> Date: Thu, 13 Jun 2024 17:05:31 +0100 Subject: [PATCH 1/3] fix: link after claim --- static/scripts/rewards/init.ts | 1 - static/scripts/rewards/web3/erc20-permit.ts | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) 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..00d74d18 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://${tx.chainId === 1 ? "etherscan" : "gnosisscan"}.io/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) { From f36fdb8c5530f838c9027476a9227c2f43f25c6d Mon Sep 17 00:00:00 2001 From: Keyrxng <106303466+Keyrxng@users.noreply.github.com> Date: Thu, 13 Jun 2024 17:36:10 +0100 Subject: [PATCH 2/3] fix: view claim test --- cypress/e2e/claim-portal-success.cy.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cypress/e2e/claim-portal-success.cy.ts b/cypress/e2e/claim-portal-success.cy.ts index 9f0b1bb5..a8a374b1 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:\/\/gnosisscan.io\/tx/); + }); }); }); From f703fb6bf7d1b38719d3f6e29fa55f1b4c4b6aac Mon Sep 17 00:00:00 2001 From: Keyrxng <106303466+Keyrxng@users.noreply.github.com> Date: Sat, 15 Jun 2024 08:20:44 +0100 Subject: [PATCH 3/3] chore: use blockscan explorer --- cypress/e2e/claim-portal-success.cy.ts | 2 +- static/scripts/rewards/web3/erc20-permit.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/claim-portal-success.cy.ts b/cypress/e2e/claim-portal-success.cy.ts index a8a374b1..7e76314e 100644 --- a/cypress/e2e/claim-portal-success.cy.ts +++ b/cypress/e2e/claim-portal-success.cy.ts @@ -43,7 +43,7 @@ describe("Claims Portal Success", () => { cy.get("#view-claim").invoke("click") .then(() => { - cy.get("@open").should("be.calledWithMatch", /https:\/\/gnosisscan.io\/tx/); + cy.get("@open").should("be.calledWithMatch", /https:\/\/blockscan.com\/tx/); }); }); }); diff --git a/static/scripts/rewards/web3/erc20-permit.ts b/static/scripts/rewards/web3/erc20-permit.ts index 00d74d18..fe68afd1 100644 --- a/static/scripts/rewards/web3/erc20-permit.ts +++ b/static/scripts/rewards/web3/erc20-permit.ts @@ -101,7 +101,7 @@ async function waitForTransaction(tx: TransactionResponse) { try { const receipt = await tx.wait(); viewClaimButton.onclick = () => { - window.open(`https://${tx.chainId === 1 ? "etherscan" : "gnosisscan"}.io/tx/${receipt.transactionHash}`, "_blank"); + window.open(`https://blockscan.com/tx/${receipt.transactionHash}`, "_blank"); } toaster.create("success", `Claim Complete.`);