diff --git a/components/Forms/GrantUpdate.tsx b/components/Forms/GrantUpdate.tsx index e8af9c1c..f570f92e 100644 --- a/components/Forms/GrantUpdate.tsx +++ b/components/Forms/GrantUpdate.tsx @@ -26,6 +26,8 @@ import { errorManager } from "../Utilities/errorManager"; import { urlRegex } from "@/utilities/regexs/urlRegex"; import { sanitizeObject } from "@/utilities/sanitize"; import { useGrantStore } from "@/store/grant"; +import fetchData from "@/utilities/fetchData"; +import { INDEXER } from "@/utilities/indexer"; const updateSchema = z.object({ title: z @@ -134,8 +136,16 @@ export const GrantUpdateForm: FC = ({ await grantUpdate .attest(walletSigner as any, changeStepperStep) - .then(async () => { + .then(async (res) => { let retries = 1000; + const txHash = res?.tx[0]?.hash; + if (txHash) { + await fetchData( + INDEXER.ATTESTATION_LISTENER(txHash, grantToUpdate.chainID), + "POST", + {} + ); + } changeStepperStep("indexing"); while (retries > 0) { await refreshProject() diff --git a/components/Forms/Milestone.tsx b/components/Forms/Milestone.tsx index 12fa6157..85af3e28 100644 --- a/components/Forms/Milestone.tsx +++ b/components/Forms/Milestone.tsx @@ -32,6 +32,8 @@ import { useRouter } from "next/navigation"; import { PAGES } from "@/utilities/pages"; import { errorManager } from "../Utilities/errorManager"; import { sanitizeObject } from "@/utilities/sanitize"; +import fetchData from "@/utilities/fetchData"; +import { INDEXER } from "@/utilities/indexer"; const milestoneSchema = z.object({ title: z @@ -147,8 +149,16 @@ export const MilestoneForm: FC = ({ const walletSigner = await walletClientToSigner(walletClient); await milestoneToAttest .attest(walletSigner as any, changeStepperStep) - .then(async () => { + .then(async (res) => { let retries = 1000; + const txHash = res?.tx[0]?.hash; + if (txHash) { + await fetchData( + INDEXER.ATTESTATION_LISTENER(txHash, milestoneToAttest.chainID), + "POST", + {} + ); + } changeStepperStep("indexing"); while (retries > 0) { await refreshProject() diff --git a/components/Forms/MilestoneUpdate.tsx b/components/Forms/MilestoneUpdate.tsx index 3feb309f..99c65baa 100644 --- a/components/Forms/MilestoneUpdate.tsx +++ b/components/Forms/MilestoneUpdate.tsx @@ -29,6 +29,8 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { cn } from "@/utilities/tailwind"; import { useRouter } from "next/navigation"; import { PAGES } from "@/utilities/pages"; +import fetchData from "@/utilities/fetchData"; +import { INDEXER } from "@/utilities/indexer"; interface MilestoneUpdateFormProps { milestone: IMilestoneResponse; @@ -143,9 +145,20 @@ export const MilestoneUpdateForm: FC = ({ }), changeStepperStep ) - .then(async () => { + .then(async (res) => { let retries = 1000; changeStepperStep("indexing"); + const txHash = res?.tx[0]?.hash; + if (txHash) { + await fetchData( + INDEXER.ATTESTATION_LISTENER( + txHash, + milestoneInstance?.chainID as number + ), + "POST", + {} + ); + } while (retries > 0) { await refreshProject() .then(async (fetchedProject) => { @@ -238,9 +251,20 @@ export const MilestoneUpdateForm: FC = ({ }), changeStepperStep ) - .then(async () => { + .then(async (res) => { let retries = 1000; changeStepperStep("indexing"); + const txHash = res?.tx[0]?.hash; + if (txHash) { + await fetchData( + INDEXER.ATTESTATION_LISTENER( + txHash, + milestoneInstance?.chainID as number + ), + "POST", + {} + ); + } while (retries > 0) { await refreshProject() .then(async (fetchedProject) => { diff --git a/components/Forms/ProjectUpdate.tsx b/components/Forms/ProjectUpdate.tsx index 8feb0804..6f8ed387 100644 --- a/components/Forms/ProjectUpdate.tsx +++ b/components/Forms/ProjectUpdate.tsx @@ -21,6 +21,8 @@ import { useAccount, useSwitchChain } from "wagmi"; import { z } from "zod"; import { errorManager } from "../Utilities/errorManager"; import { sanitizeObject } from "@/utilities/sanitize"; +import fetchData from "@/utilities/fetchData"; +import { INDEXER } from "@/utilities/indexer"; const updateSchema = z.object({ title: z @@ -93,9 +95,17 @@ export const ProjectUpdateForm: FC = ({ await projectUpdate .attest(walletSigner as any, changeStepperStep) - .then(async () => { + .then(async (res) => { let retries = 1000; changeStepperStep("indexing"); + const txHash = res?.tx[0]?.hash; + if (txHash) { + await fetchData( + INDEXER.ATTESTATION_LISTENER(txHash, projectUpdate.chainID), + "POST", + {} + ); + } while (retries > 0) { await refreshProject() .then(async (fetchedProject) => {