/**
 * MidnightCrawler, Blockchain Crawler Orchestrator
 *
 * Two-phase operation:
 * 1. Catch-Up: Sync historical blocks from lastIndexedHeight to chain tip
 * 2. Live: Subscribe to new block headers and process in real-time
 *
 */
import { MidnightNodeProvider } from '../providers/MidnightNodeProvider';
export interface CrawlerConfig {
    enabled: boolean;
    nodeUrl?: string;
    batchSize?: number;
    maxRetries?: number;
    retryDelay?: number;
    requestTimeout?: number;
    fetchConcurrency?: number;
    rpcBatchSize?: number;
}
export declare class MidnightCrawler {
    private nodeProvider;
    private isRunning;
    private isCatchingUp;
    private processing;
    private pendingHeights;
    private subscriptionId;
    private db;
    private processor;
    private startTime;
    private blocksProcessed;
    private config;
    constructor(nodeProvider: MidnightNodeProvider, config: CrawlerConfig);
    start(): Promise<void>;
    private runIngestPipeline;
    stop(): Promise<void>;
    private catchUp;
    /**
     * Pipelined catch-up with JSON-RPC batching.
     *
     * Each in-flight unit is now a BATCH of K consecutive heights. Each batch
     * does exactly 2 WSS round-trips (one for hashes, one for blocks+timestamps).
     * `fetchConcurrency` batches stay in flight at once.
     *
     * Throughput model: bps ≈ K × concurrency × (1 / (2 × RTT)). For RTT=200ms,
     * K=32, concurrency=8: 32×8/0.4 = 640 bps theoretical. Real-world ceiling
     * comes from public-endpoint rate limits.
     *
     * Persist is serial in height order (reorg detection requires monotonic
     * progression). With persist at ~15ms/block we get a write ceiling of
     * ~65 bps per persister thread. If fetch outpaces persist, `wait=0` in the
     * diagnostic line and persist becomes the floor.
     */
    private runCatchUpPipeline;
    /**
     * Batch fetch with the same transient-error retry policy as
     * `fetchBlockWithRetry`. On retry, the entire batch is re-fetched.
     */
    private fetchBlockBatchWithRetry;
    /**
     * Fetch a block's data (no DB write) with the same transient-error retry
     * policy used by the legacy `processBlockWithRetry`.
     */
    private fetchBlockWithRetry;
    private subscribeLive;
    private processLiveBlock;
    private checkForReorg;
    private findForkPoint;
    private handleReorg;
    private processBlockWithRetry;
    private getSyncState;
    private recordError;
    private getCatchUpStartHeight;
    private sleep;
}
