From 635ec6ed0ab70a597cbac6276cdfd7cc94421e6c Mon Sep 17 00:00:00 2001 From: Nick Lionis Date: Wed, 23 Oct 2024 18:51:14 +0300 Subject: [PATCH] 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,