import { MessageRef, StreamMessage, StreamPartID } from '@streamr/protocol';
import { EthereumAddress } from '@streamr/utils';
export interface Gap {
    from: StreamMessage;
    to: StreamMessage;
}
export interface OrderedMessageChainContext {
    streamPartId: StreamPartID;
    publisherId: EthereumAddress;
    msgChainId: string;
}
export interface Events {
    orderedMessageAdded: (msg: StreamMessage) => void;
    gapFound: (gap: Gap) => void;
    gapResolved: () => void;
    unfillableGap: (gap: Gap) => void;
}
export declare class OrderedMessageChain {
    private lastOrderedMsg?;
    private currentGap?;
    private readonly pendingMsgs;
    private readonly eventEmitter;
    private readonly context;
    private readonly abortSignal;
    constructor(context: OrderedMessageChainContext, abortSignal: AbortSignal);
    addMessage(msg: StreamMessage): void;
    resolveMessages(to: MessageRef | undefined, gapCheckEnabled: boolean): void;
    waitUntilIdle(): Promise<void>;
    private consumePendingOrderedMessages;
    private checkGapFound;
    private checkGapResolved;
    private isNextOrderedMessage;
    private isStaleMessage;
    getContext(): OrderedMessageChainContext;
    on<E extends keyof Events>(eventName: E, listener: Events[E]): void;
    once<E extends keyof Events>(eventName: E, listener: Events[E]): void;
    off<E extends keyof Events>(eventName: E, listener: Events[E]): void;
}
