Skip to content

Commit

Permalink
Merge pull request #3703 from gitcoinco/fix/attestation-uid-missing-i…
Browse files Browse the repository at this point in the history
…n-sharelink

fixes shareLinks right after minting
  • Loading branch information
nijoe1 authored Oct 23, 2024
2 parents 7f8b7fe + 9683d17 commit 84c6b4f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 29 deletions.
10 changes: 5 additions & 5 deletions packages/grant-explorer/src/features/common/ShareButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ export const useGetAttestationData = (

const data = await response.json();

console.log("Attestation data:", data);

return {
data: data.signedAttestation,
impactImageCid: data.impactImageCid,
Expand Down

0 comments on commit 84c6b4f

Please sign in to comment.