[#154] Add receipt fetch retry to indexer routes#162
Conversation
Load-balanced RPC nodes may not have the receipt immediately after waitForTransactionReceipt completes on the client. Added getReceiptWithRetry helper (3 attempts, 1s backoff) and applied it to all three indexer routes (donation, storyline, plot). Fixes #154 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
T2b APPROVE
Clean, minimal fix:
-
getReceiptWithRetry(lib/rpc.ts) — Simple retry with linear backoff (1s, 2s, 3s). Properly re-throws on final attempt.Hextype import is correct. -
All 3 indexer routes updated consistently — donation, storyline, plot all switch from
lib/viemshim tolib/rpcand use the retry helper. The existingcatch → 502error handling still applies if all retries fail.
No issues found.
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The PR addresses the exact failure mode in #154 by retrying receipt reads in the indexer routes instead of failing immediately on the first stale RPC response. The helper is centralized in lib/rpc.ts, applied consistently to all three affected routes, and local validation plus CI are green.
Findings
- [info] No remaining blocking findings.
- File:
lib/rpc.ts:26 - Suggestion: None.
- File:
Decision
Approving because the change is narrowly scoped to the receipt-availability race, covers every affected indexer route, and passes lint-and-typecheck, typecheck, tests, and build validation.
Summary
getReceiptWithRetryhelper inlib/rpc.ts— 3 attempts with 1s exponential backoff/api/index/donation,/api/index/storyline,/api/index/plotlib/viem(compat shim) to directlib/rpcimportsFixes #154
Test plan
tsc --noEmit— zero errorsnext build— cleanvitest run— 22/22 tests pass🤖 Generated with Claude Code