write: (required) Async function({ read, logger }) => Promise<void>. Iterate the stream by callingread()and consuming{ data, ctx }batches. The function returns when the stream ends.resolveFork: (optional)(canonicalBlocks: BlockCursor[]) => Promise<BlockCursor | null>. Called when the source detects a chain reorg.canonicalBlocksis the portal’s view of the canonical chain (a.k.a.previousBlocksin Portal API/stream409 responses). Find the common ancestor, roll back everything persisted above it, and return the cursor to resume from — ornullif no common ancestor can be determined (the stream will throw). See Fork handling. You don’t need this callback when the source is configured to read only finalized blocks.
The write context
Per-batch context (ctx)
Each { data, ctx } yielded by read() carries the same BatchContext that transformers receive. Fields: