Skip to content

Commit 84c6b4f

Browse files
author
Nick Lionis
authored
Merge pull request #3703 from gitcoinco/fix/attestation-uid-missing-in-sharelink
fixes shareLinks right after minting
2 parents 7f8b7fe + 9683d17 commit 84c6b4f

File tree

3 files changed

+10
-29
lines changed

3 files changed

+10
-29
lines changed

packages/grant-explorer/src/features/common/ShareButtons.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export function createTwitterShareUrl(props: TwitterButtonParams) {
9494
}
9595

9696
export function createTwitterAttestationShareText(attestationLink: string) {
97-
return `Just minted my donation on Gitcoin 🫡\n\nMy impact is now onchain!\n\n${attestationLink}`;
97+
return `Just minted my donation on @gitcoin 🫡\n\nMy impact is now onchain!\n\n${attestationLink}`;
9898
}
9999

100100
export function createTwitterAttestationShareUrl(attestationLink: string) {
@@ -105,11 +105,11 @@ export function createTwitterAttestationShareUrl(attestationLink: string) {
105105
}
106106

107107
export function getFarcasterAttestationShareText() {
108-
const encodedText1 = encodeURIComponent(
109-
`Just minted my donation on Gitcoin 🫡\n\nMy impact is now onchain!`
110-
);
108+
const encodedText1 = encodeURIComponent(`Just minted my donation on `);
109+
const encodedText2 = encodeURIComponent(` 🫡\n\nMy impact is now onchain!`);
110+
111111
// NB: mentions should not be encoded
112-
return encodedText1;
112+
return `${encodedText1}@gitcoin${encodedText2}`;
113113
}
114114

115115
export function createFarcasterShareUrl(

packages/grant-explorer/src/hooks/attestations/useAttestMutation.ts

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -57,28 +57,13 @@ export const useAttestMutation = (
5757
const hash = await walletClient.writeContract(request);
5858
await publicClient.waitForTransactionReceipt({
5959
hash,
60-
confirmations: 1,
60+
confirmations: 2,
6161
});
62-
63-
const blockNumber = await publicClient.getBlockNumber();
64-
65-
// Get AttestationUID from the hash logs
66-
const events = await publicClient.getContractEvents({
67-
address: easAddress as `0x${string}`,
68-
abi: legacyABI,
69-
fromBlock: blockNumber - 3n,
70-
toBlock: "latest",
71-
eventName: "Attested",
72-
});
73-
74-
let attestationUID: string = "";
75-
76-
events.forEach((event) => {
77-
const { args, transactionHash } = event;
78-
if (transactionHash === hash) {
79-
attestationUID = args.uid as string;
80-
}
62+
const receipt = await publicClient.getTransactionReceipt({
63+
hash,
8164
});
65+
// TODO make this dynamic when attestation network expands to more networks (Legacy-Proxy) have different logs
66+
const attestationUID = receipt.logs[2].topics[1] as string;
8267

8368
return attestationUID;
8469
} catch (error) {
@@ -91,8 +76,6 @@ export const useAttestMutation = (
9176
console.error("Error attesting data:", error);
9277
},
9378
onSuccess: () => {
94-
// We need to find out if we are going to close the modal and
95-
// route to a new page or show the success page inside the modal
9679
handleToggleModal();
9780
updateStatus(ProgressStatus.IS_SUCCESS);
9881
},

packages/grant-explorer/src/hooks/attestations/useGetAttestationData.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ export const useGetAttestationData = (
4848

4949
const data = await response.json();
5050

51-
console.log("Attestation data:", data);
52-
5351
return {
5452
data: data.signedAttestation,
5553
impactImageCid: data.impactImageCid,

0 commit comments

Comments
 (0)