import { ForkName, ForkPreDeneb } from "@lodestar/params";
import { BlobIndex, ColumnIndex, SignedBeaconBlock, Slot, deneb, fulu } from "@lodestar/types";
import { VersionedHashes } from "../../../execution/index.js";
import { AddBlob, AddBlock, AddColumn, BlobMeta, BlobWithSource, BlockInputInit, ColumnWithSource, CreateBlockInputMeta, DAData, DAType, IBlockInput, LogMetaBasic, LogMetaBlobs, LogMetaColumns, MissingColumnMeta, PromiseParts, SourceMeta } from "./types.js";
export type BlockInput = BlockInputPreData | BlockInputBlobs | BlockInputColumns;
export declare function isBlockInputPreDeneb(blockInput: IBlockInput): blockInput is BlockInputPreData;
export declare function isBlockInputBlobs(blockInput: IBlockInput): blockInput is BlockInputBlobs;
export declare function isBlockInputColumns(blockInput: IBlockInput): blockInput is BlockInputColumns;
type BlockInputState<F extends ForkName> = {
    hasBlock: false;
    hasAllData: false;
} | {
    hasBlock: false;
    hasAllData: true;
} | {
    hasBlock: true;
    hasAllData: false;
    block: SignedBeaconBlock<F>;
    source: SourceMeta;
} | {
    hasBlock: true;
    hasAllData: true;
    block: SignedBeaconBlock<F>;
    source: SourceMeta;
    timeCompleteSec: number;
};
declare abstract class AbstractBlockInput<F extends ForkName = ForkName, TData extends DAData = DAData> implements IBlockInput<F, TData> {
    abstract type: DAType;
    daOutOfRange: boolean;
    timeCreatedSec: number;
    forkName: ForkName;
    slot: Slot;
    blockRootHex: string;
    parentRootHex: string;
    abstract state: BlockInputState<F>;
    protected blockPromise: PromiseParts<SignedBeaconBlock<F>>;
    protected dataPromise: PromiseParts<TData>;
    constructor(init: BlockInputInit);
    abstract addBlock(props: AddBlock<F>): void;
    hasBlock(): boolean;
    getBlock(): SignedBeaconBlock<F>;
    getBlockSource(): SourceMeta;
    hasAllData(): boolean;
    hasBlockAndAllData(): boolean;
    getLogMeta(): LogMetaBasic;
    getTimeComplete(): number;
    waitForBlock(timeout: number, signal?: AbortSignal): Promise<SignedBeaconBlock<F>>;
    waitForAllData(timeout: number, signal?: AbortSignal): Promise<TData>;
    waitForBlockAndAllData(timeout: number, signal?: AbortSignal): Promise<this>;
}
type BlockInputPreDataState = {
    hasBlock: true;
    hasAllData: true;
    block: SignedBeaconBlock<ForkPreDeneb>;
    source: SourceMeta;
    timeCompleteSec: number;
};
/**
 * Pre-DA, BlockInput only has a single state.
 * - the block simply exists
 */
export declare class BlockInputPreData extends AbstractBlockInput<ForkPreDeneb, null> {
    type: DAType.PreData;
    state: BlockInputPreDataState;
    private constructor();
    static createFromBlock(props: AddBlock & CreateBlockInputMeta): BlockInputPreData;
    addBlock(_: AddBlock, opts?: {
        throwOnDuplicateAdd: boolean;
    }): void;
}
export type ForkBlobsDA = ForkName.deneb | ForkName.electra;
type BlockInputBlobsState = {
    hasBlock: true;
    hasAllData: true;
    versionedHashes: VersionedHashes;
    block: SignedBeaconBlock<ForkBlobsDA>;
    source: SourceMeta;
    timeCompleteSec: number;
} | {
    hasBlock: true;
    hasAllData: false;
    versionedHashes: VersionedHashes;
    block: SignedBeaconBlock<ForkBlobsDA>;
    source: SourceMeta;
} | {
    hasBlock: false;
    hasAllData: false;
};
/**
 * With blobs, BlockInput has several states:
 * - The block is seen and all blobs are seen
 * - The block is seen and all blobs are not yet seen
 * - The block is yet not seen and its unknown if all blobs are seen
 */
export declare class BlockInputBlobs extends AbstractBlockInput<ForkBlobsDA, deneb.BlobSidecars> {
    type: DAType.Blobs;
    state: BlockInputBlobsState;
    private blobsCache;
    private constructor();
    static createFromBlock(props: AddBlock<ForkBlobsDA> & CreateBlockInputMeta): BlockInputBlobs;
    static createFromBlob(props: AddBlob & CreateBlockInputMeta): BlockInputBlobs;
    getLogMeta(): LogMetaBlobs;
    addBlock({ blockRootHex, block, source, seenTimestampSec, peerIdStr }: AddBlock<ForkBlobsDA>, opts?: {
        throwOnDuplicateAdd: boolean;
    }): void;
    hasBlob(blobIndex: BlobIndex): boolean;
    addBlob({ blockRootHex, blobSidecar, source, peerIdStr, seenTimestampSec }: AddBlob, opts?: {
        throwOnDuplicateAdd: boolean;
    }): void;
    getVersionedHashes(): VersionedHashes;
    getMissingBlobMeta(): BlobMeta[];
    getAllBlobsWithSource(): BlobWithSource[];
    getBlobs(): deneb.BlobSidecars;
}
export type ForkColumnsDA = ForkName.fulu;
type BlockInputColumnsState = {
    hasBlock: true;
    hasAllData: true;
    versionedHashes: VersionedHashes;
    block: SignedBeaconBlock<ForkColumnsDA>;
    source: SourceMeta;
    timeCompleteSec: number;
} | {
    hasBlock: true;
    hasAllData: false;
    versionedHashes: VersionedHashes;
    block: SignedBeaconBlock<ForkColumnsDA>;
    source: SourceMeta;
} | {
    hasBlock: false;
    hasAllData: true;
    versionedHashes: VersionedHashes;
} | {
    hasBlock: false;
    hasAllData: false;
    versionedHashes: VersionedHashes;
};
/**
 * With columns, BlockInput has several states:
 * - The block is seen and all required sampled columns are seen
 * - The block is seen and all required sampled columns are not yet seen
 * - The block is not yet seen and all required sampled columns are seen
 * - The block is not yet seen and all required sampled columns are not yet seen
 */
export declare class BlockInputColumns extends AbstractBlockInput<ForkColumnsDA, fulu.DataColumnSidecars> {
    type: DAType.Columns;
    state: BlockInputColumnsState;
    private columnsCache;
    private readonly sampledColumns;
    private readonly custodyColumns;
    private constructor();
    get columnCount(): number;
    static createFromBlock(props: AddBlock<ForkColumnsDA> & CreateBlockInputMeta & {
        sampledColumns: ColumnIndex[];
        custodyColumns: ColumnIndex[];
    }): BlockInputColumns;
    static createFromColumn(props: AddColumn & CreateBlockInputMeta & {
        sampledColumns: ColumnIndex[];
        custodyColumns: ColumnIndex[];
    }): BlockInputColumns;
    getLogMeta(): LogMetaColumns;
    addBlock(props: AddBlock<ForkColumnsDA>, opts?: {
        throwOnDuplicateAdd: boolean;
    }): void;
    addColumn({ blockRootHex, columnSidecar, source, seenTimestampSec, peerIdStr }: AddColumn, opts?: {
        throwOnDuplicateAdd: boolean;
    }): void;
    hasColumn(columnIndex: number): boolean;
    getVersionedHashes(): VersionedHashes;
    getCustodyColumns(): fulu.DataColumnSidecars;
    getSampledColumnsWithSource(): ColumnWithSource[];
    getSampledColumns(): fulu.DataColumnSidecars;
    getAllColumnsWithSource(): ColumnWithSource[];
    getAllColumns(): fulu.DataColumnSidecars;
    getMissingSampledColumnMeta(): MissingColumnMeta;
}
export {};
//# sourceMappingURL=blockInput.d.ts.map