Skip to content

[P1-4] Inline Indexer — Plots #9

@realproject7

Description

@realproject7

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

  • P1-4a: Implement POST /api/index/plot route with the full flow: fetch receipt → parse PlotChained event → fetch content from IPFS (10s timeout via AbortSignal.timeout) → fallback to request body content if IPFS fails → verify keccak256(content) == onchain contentHash → get block timestamp via getBlock() → 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions