/** * `waitForTransaction` — Promise variant of `watchTransaction`. Use * when you'd rather `await` the outcome than register callbacks. * * Resolves with a discriminated union: { status: 'mined' | 'dropped' * | 'replaced' | 'failed', ... }. Rejects only on tracker/source * errors — transaction outcomes are part of the resolved value, not * exceptions. * * Internally constructs a private ChainSource + TxTracker and tears * them down before resolving. */ import type { PublicClient } from 'viem'; import type { ChainSource, TransactionReceipt } from '@valve-tech/chain-source'; import type { Hash, TxEventReplacedBy, TxEventSeenInBlock } from './events.js'; export type WaitForTransactionOutcome = { status: 'mined'; event: TxEventSeenInBlock; } | { status: 'dropped'; reason: 'unseen-for-N-blocks'; } | { status: 'replaced'; replacementHash: Hash; event: TxEventReplacedBy; } | { status: 'failed'; event: TxEventSeenInBlock; receipt: TransactionReceipt; }; export interface WaitForTransactionOptions { client: PublicClient; hash: Hash; /** Required confirmations before 'mined' resolves. Default 1. */ confirmations?: number; /** Blocks of "no observation" before 'dropped' resolves. Default 12. */ staleAfterBlocks?: number; /** * If true, fetches the receipt at inclusion and resolves with * 'failed' when receipt.status === '0x0'. Adds one RPC. */ withReceipts?: boolean; /** * 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; pollIntervalMs?: number; onError?: (method: string, err: unknown) => void; } /** * @internal * Test-injection seam — same shape as watchTransaction's seam. * Not re-exported from index.ts. */ export interface WaitForTransactionInternalOptions extends WaitForTransactionOptions { _sourceOverride?: ChainSource; } export declare const waitForTransaction: (options: WaitForTransactionOptions) => Promise; //# sourceMappingURL=wait-for-transaction.d.ts.map