import { type L2Block } from '../l2_block.js';
import { type L2BlockSource, type L2Tips } from '../l2_block_source.js';
/** Creates a stream of events for new blocks, chain tips updates, and reorgs, out of polling an archiver or a node. */
export declare class L2BlockStream {
    private l2BlockSource;
    private localData;
    private handler;
    private readonly log;
    private opts;
    private readonly runningPromise;
    private isSyncing;
    constructor(l2BlockSource: Pick<L2BlockSource, 'getBlocks' | 'getBlockHeader' | 'getL2Tips'>, localData: L2BlockStreamLocalDataProvider, handler: L2BlockStreamEventHandler, log?: import("@aztec/foundation/log").Logger, opts?: {
        proven?: boolean;
        pollIntervalMS?: number;
        batchSize?: number;
        startingBlock?: number;
    });
    start(): void;
    stop(): Promise<void>;
    isRunning(): boolean;
    sync(): Promise<void>;
    protected work(): Promise<void>;
    /**
     * Returns whether the source and local agree on the block hash at a given height.
     * @param blockNumber - The block number to test.
     * @param args - A cache of data already requested from source, to avoid re-requesting it.
     */
    private areBlockHashesEqualAt;
    private emitEvent;
}
/** Interface to the local view of the chain. Implemented by world-state. */
export interface L2BlockStreamLocalDataProvider {
    getL2BlockHash(number: number): Promise<string | undefined>;
    getL2Tips(): Promise<L2Tips>;
}
/** Interface to a handler of events emitted. */
export interface L2BlockStreamEventHandler {
    handleBlockStreamEvent(event: L2BlockStreamEvent): Promise<void>;
}
export type L2BlockStreamEvent = {
    type: 'blocks-added';
    /** New blocks added to the chain. */
    blocks: L2Block[];
} | {
    type: 'chain-pruned';
    /** Last correct block number (new tip of the unproven chain). */
    blockNumber: number;
} | {
    type: 'chain-proven';
    /** New proven block number */
    blockNumber: number;
} | {
    type: 'chain-finalized';
    /** New finalized block number */
    blockNumber: number;
};
//# sourceMappingURL=l2_block_stream.d.ts.map