createTransformer
Construct a whole-pipe transformer.transform: (required)(data: I, ctx: BatchContext) => O | Promise<O>. Called once per batch.start: (optional)(ctx: StartCtx) => void | Promise<void>. Called once when the pipe starts. Use this to load state, warm up caches, or query the portal for historical data before the main stream begins.stop: (optional)(ctx: StopCtx) => void | Promise<void>. Called once when the pipe stops.fork: (optional)(cursor: BlockCursor, ctx: Ctx) => void | Promise<void>. Called before the next batch whenever the source detects a chain reorg.cursoridentifies the last safe block. See Fork handling.profiler: (optional){ name: string; hidden?: boolean }. Overrides the transformer’s node name in the profiler tree.
Context variables
Each callback receives a context object. The fields differ by callback.transform(data, ctx: BatchContext)
ctx is the full per-batch context. Fields:
ctx.stream: BatchStreamContext
ctx.batch: BatchMetadata
start(ctx: StartCtx)
Fired once, before any batch. Use to warm up caches or run one-off queries.
fork(cursor, ctx: Ctx)
Fired before the next batch whenever a reorg is detected. cursor is the last block to keep; drop state produced for anything after it.