Context
The primary indexing path: frontend calls this API after a chainPlot() transaction confirms. Inline indexer pattern (§4.1) — no cron, no event listener. Frontend triggers indexing by POSTing the txHash.
The indexer fetches the receipt, parses the PlotChained event, fetches content from IPFS by CID, verifies the content hash matches the onchain contentHash, and upserts to Supabase. If IPFS fetch times out (10s), it falls back to content provided in the request body.
Important: Use publicClient.getBlock() to get the block timestamp — it is NOT available on the transaction receipt in viem.
Sub-tickets
Proposal Reference
§4.1 (Indexing Layer: Supabase Inline Indexer)
Dependencies
P1-1 (Filebase helper), P1-2 (content utils), P1-3 (ABI definitions), P0-2 (Supabase schema)
Context
The primary indexing path: frontend calls this API after a
chainPlot()transaction confirms. Inline indexer pattern (§4.1) — no cron, no event listener. Frontend triggers indexing by POSTing the txHash.The indexer fetches the receipt, parses the PlotChained event, fetches content from IPFS by CID, verifies the content hash matches the onchain contentHash, and upserts to Supabase. If IPFS fetch times out (10s), it falls back to content provided in the request body.
Important: Use
publicClient.getBlock()to get the block timestamp — it is NOT available on the transaction receipt in viem.Sub-tickets
POST /api/index/plotroute with the full flow: fetch receipt → parse PlotChained event → fetch content from IPFS (10s timeout viaAbortSignal.timeout) → fallback to request body content if IPFS fails → verifykeccak256(content) == onchain contentHash→ get block timestamp viagetBlock()→ upsert to Supabase. Deduplicate on(tx_hash, log_index).Proposal Reference
§4.1 (Indexing Layer: Supabase Inline Indexer)
Dependencies
P1-1 (Filebase helper), P1-2 (content utils), P1-3 (ABI definitions), P0-2 (Supabase schema)