diff --git a/lib/rpc.ts b/lib/rpc.ts index 4a873171..1c3f2278 100644 --- a/lib/rpc.ts +++ b/lib/rpc.ts @@ -26,13 +26,13 @@ export const publicClient = createPublicClient({ * Load-balanced RPC nodes may not have the receipt immediately after * `waitForTransactionReceipt` completes on the client side. */ -export async function getReceiptWithRetry(hash: Hex, maxAttempts = 3) { +export async function getReceiptWithRetry(hash: Hex, maxAttempts = 5) { for (let attempt = 1; attempt <= maxAttempts; attempt++) { try { return await publicClient.getTransactionReceipt({ hash }); } catch (err) { if (attempt === maxAttempts) throw err; - await new Promise((r) => setTimeout(r, attempt * 1000)); + await new Promise((r) => setTimeout(r, attempt * 2000)); } } throw new Error("unreachable"); diff --git a/src/components/DonateWidget.tsx b/src/components/DonateWidget.tsx index f091abcb..4cc1b28c 100644 --- a/src/components/DonateWidget.tsx +++ b/src/components/DonateWidget.tsx @@ -88,8 +88,9 @@ export function DonateWidget({ storylineId }: DonateWidgetProps) { setTxState("pending"); await publicClient.waitForTransactionReceipt({ hash }); - // Trigger donation indexer + // Trigger donation indexer (delay for RPC propagation on Base Sepolia) setTxState("indexing"); + await new Promise((r) => setTimeout(r, 5000)); const indexRes = await fetch("/api/index/donation", { method: "POST", headers: { "Content-Type": "application/json" },