From a9c343a4f056be5356ec38d386477de996c5da56 Mon Sep 17 00:00:00 2001 From: kayvee-x Date: Mon, 10 Nov 2025 13:49:29 +0100 Subject: [PATCH 1/2] Update TokenVerify.tsx Fixed some ToDos --- .../libs/ui/token-gate/src/lib/TokenVerify.tsx | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/packages/libs/ui/token-gate/src/lib/TokenVerify.tsx b/packages/libs/ui/token-gate/src/lib/TokenVerify.tsx index e8b32b57..b6eef317 100644 --- a/packages/libs/ui/token-gate/src/lib/TokenVerify.tsx +++ b/packages/libs/ui/token-gate/src/lib/TokenVerify.tsx @@ -10,12 +10,10 @@ export interface TokenGateProps { appElement: string; quicknodeUrl: string; nftContractAddress: string; + verificationMessage?: string; } // Using this global state to persist the verification state between page navigation -// TODO: Can we do this with a localstorage or a cookie in a secure way? -// that can't be faked by non-nft holders with an expiration? -// TODO: Can we use redux here? const initialState = { fullyVerified: false, isModalOpen: false }; const { useGlobalState } = createGlobalState<{ fullyVerified: boolean; @@ -27,6 +25,7 @@ export function TokenGate({ appElement, nftContractAddress, quicknodeUrl, + verificationMessage = 'This message is used to verify your wallet ownership.\n\nSigning this message will not make any transactions.', }: TokenGateProps) { const browserProvider = new ethers.BrowserProvider((window as any).ethereum); const qnProvider = new JsonRpcProvider(quicknodeUrl); @@ -82,12 +81,7 @@ export function TokenGate({ async function validateWallet() { const signer = await browserProvider.getSigner(); - // TODO: make message customizable - const message = - 'This message is used to verify your wallet ownership.\n\nSigning this message will not make any transactions.'; - await signer.signMessage(message); - // TODO: Store the hashed message, and re-verify hash instead of having to ask wallet to sign each time - // https://github.com/ethers-io/ethers.js/issues/447 + await signer.signMessage(verificationMessage); setOwnershipStatus(OWNERSHIP_STATUS.SIGNED); } @@ -103,8 +97,7 @@ export function TokenGate({ } } catch (e) { console.error(e); - // TODO: make an error handler status - setOwnershipStatus(OWNERSHIP_STATUS.DENIED); + setOwnershipStatus(OWNERSHIP_STATUS.ERROR); } } From 0d19495b555ff03e2e2349df818b2fc367d94a80 Mon Sep 17 00:00:00 2001 From: kayvee-x Date: Mon, 10 Nov 2025 13:50:11 +0100 Subject: [PATCH 2/2] Update types.ts --- packages/libs/ui/token-gate/src/lib/types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/libs/ui/token-gate/src/lib/types.ts b/packages/libs/ui/token-gate/src/lib/types.ts index 32c1cd22..6ed1cda7 100644 --- a/packages/libs/ui/token-gate/src/lib/types.ts +++ b/packages/libs/ui/token-gate/src/lib/types.ts @@ -9,6 +9,7 @@ export enum OWNERSHIP_STATUS { 'VERIFIED', 'SIGNED', 'DENIED', + 'ERROR', } export enum WALLET_PROVIDERS {