From 635ec6ed0ab70a597cbac6276cdfd7cc94421e6c Mon Sep 17 00:00:00 2001 From: Nick Lionis Date: Wed, 23 Oct 2024 18:51:14 +0300 Subject: [PATCH 1/2] fixes shareLinks right after minting --- .../hooks/attestations/useAttestMutation.ts | 27 ++++--------------- .../attestations/useGetAttestationData.ts | 2 -- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/packages/grant-explorer/src/hooks/attestations/useAttestMutation.ts b/packages/grant-explorer/src/hooks/attestations/useAttestMutation.ts index 2898e3e16..cb53da4aa 100644 --- a/packages/grant-explorer/src/hooks/attestations/useAttestMutation.ts +++ b/packages/grant-explorer/src/hooks/attestations/useAttestMutation.ts @@ -57,28 +57,13 @@ export const useAttestMutation = ( const hash = await walletClient.writeContract(request); await publicClient.waitForTransactionReceipt({ hash, - confirmations: 1, + confirmations: 2, }); - - const blockNumber = await publicClient.getBlockNumber(); - - // Get AttestationUID from the hash logs - const events = await publicClient.getContractEvents({ - address: easAddress as `0x${string}`, - abi: legacyABI, - fromBlock: blockNumber - 3n, - toBlock: "latest", - eventName: "Attested", - }); - - let attestationUID: string = ""; - - events.forEach((event) => { - const { args, transactionHash } = event; - if (transactionHash === hash) { - attestationUID = args.uid as string; - } + const receipt = await publicClient.getTransactionReceipt({ + hash, }); + // TODO make this dynamic when attestation network expands to more networks (Legacy-Proxy) have different logs + const attestationUID = receipt.logs[2].topics[1] as string; return attestationUID; } catch (error) { @@ -91,8 +76,6 @@ export const useAttestMutation = ( console.error("Error attesting data:", error); }, onSuccess: () => { - // We need to find out if we are going to close the modal and - // route to a new page or show the success page inside the modal handleToggleModal(); updateStatus(ProgressStatus.IS_SUCCESS); }, diff --git a/packages/grant-explorer/src/hooks/attestations/useGetAttestationData.ts b/packages/grant-explorer/src/hooks/attestations/useGetAttestationData.ts index 4c28f6714..ad762bd4b 100644 --- a/packages/grant-explorer/src/hooks/attestations/useGetAttestationData.ts +++ b/packages/grant-explorer/src/hooks/attestations/useGetAttestationData.ts @@ -48,8 +48,6 @@ export const useGetAttestationData = ( const data = await response.json(); - console.log("Attestation data:", data); - return { data: data.signedAttestation, impactImageCid: data.impactImageCid, From 9683d17eeb7d9b2f4f3b857b8609dc31087bb049 Mon Sep 17 00:00:00 2001 From: Nick Lionis Date: Wed, 23 Oct 2024 19:10:52 +0300 Subject: [PATCH 2/2] changed in share-url Gitcoin=>@gitcoin --- .../src/features/common/ShareButtons.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/grant-explorer/src/features/common/ShareButtons.tsx b/packages/grant-explorer/src/features/common/ShareButtons.tsx index 5384f13ae..b25c0dcc2 100755 --- a/packages/grant-explorer/src/features/common/ShareButtons.tsx +++ b/packages/grant-explorer/src/features/common/ShareButtons.tsx @@ -94,7 +94,7 @@ export function createTwitterShareUrl(props: TwitterButtonParams) { } export function createTwitterAttestationShareText(attestationLink: string) { - return `Just minted my donation on Gitcoin 🫡\n\nMy impact is now onchain!\n\n${attestationLink}`; + return `Just minted my donation on @gitcoin 🫡\n\nMy impact is now onchain!\n\n${attestationLink}`; } export function createTwitterAttestationShareUrl(attestationLink: string) { @@ -105,11 +105,11 @@ export function createTwitterAttestationShareUrl(attestationLink: string) { } export function getFarcasterAttestationShareText() { - const encodedText1 = encodeURIComponent( - `Just minted my donation on Gitcoin 🫡\n\nMy impact is now onchain!` - ); + const encodedText1 = encodeURIComponent(`Just minted my donation on `); + const encodedText2 = encodeURIComponent(` 🫡\n\nMy impact is now onchain!`); + // NB: mentions should not be encoded - return encodedText1; + return `${encodedText1}@gitcoin${encodedText2}`; } export function createFarcasterShareUrl(