Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes shareLinks right after minting #3703

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading