/** * `watchTransaction` — one-shot convenience over createChainSource + * createTxTracker. Provex upstream item 4 (memory: * upstream-candidates.md#L43). Use this when you don't need the full * tracker API — just "tell me when this hash mines or drops." * * Internally constructs a private ChainSource and TxTracker, sets up * a single-hash subscription, and tears down both source + tracker on * terminal state or explicit stop. */ import type { PublicClient } from 'viem'; import { type ChainSource } from '@valve-tech/chain-source'; import type { Hash, TxEventSeenInBlock } from './events.js'; export interface WatchTransactionOptions { client: PublicClient; hash: Hash; /** Required confirmations before onMined fires. Default 1. */ confirmations?: number; /** Blocks of "no observation" before onDropped fires. Default 12. */ staleAfterBlocks?: number; /** * Tag emitted events with this chainId. Falls back to * `client.chain?.id`, then `0`. Consumers piping events from multiple * watchers into one stream should set this for unambiguous routing. */ chainId?: number; /** Pass through to the internal ChainSource. */ pollIntervalMs?: number; onMined?: (event: TxEventSeenInBlock) => void; onDropped?: () => void; onError?: (method: string, err: unknown) => void; } /** * Extended options for internal use only — not part of the public API. * The `_sourceOverride` seam allows tests to inject a pre-built * `ChainSource` (driven by `emitBlock`/`emitMempool`) in place of the * default `createChainSource(client)` path. Production callers never * need this. * * @internal */ export interface WatchTransactionInternalOptions extends WatchTransactionOptions { /** @internal — test injection seam; do not use in production code. */ _sourceOverride?: ChainSource; } /** * Watch a single tx hash. Returns an unsubscribe function — calling * it before terminal cancels the watch and tears down the internal * source/tracker. * * @example * const stop = watchTransaction({ * client, * hash: '0xabc...', * confirmations: 3, * onMined: (event) => console.log('mined at', event.blockNumber), * onDropped: () => console.log('dropped'), * }) * // ... later, before terminal * stop() */ export declare const watchTransaction: (options: WatchTransactionOptions | WatchTransactionInternalOptions) => (() => void); //# sourceMappingURL=watch-transaction.d.ts.map