import { BundleInfo, BundleView } from "./typedefs";
import { ChainTracker } from "./ChainTracker";
export declare class Peer {
    private sendFunc;
    private readonly closeFunc;
    private callWhenReady;
    private callOnTimeout;
    hasMap?: ChainTracker;
    ready: Promise<Peer>;
    constructor(sendFunc: (msg: Uint8Array) => void, closeFunc?: () => void);
    close(): void;
    _receiveHasMap(hasMap: ChainTracker): void;
    /**
     * The Message proto contains an embedded one-of.  Essentially this will wrap
     * the bundle bytes payload in a wrapper by prefixing a few bytes to it.
     * In theory the "Message" proto could be expanded with some extra metadata
     * (e.g. send time) in the future.
     * Note that the bundle is always passed around as bytes and then
     * parsed as needed to avoid losing unknown fields.
     * @param bundleBytes: the bytes corresponding to a bundle
     * @returns a serialized "Message" proto
     */
    private static makeBundleMessage;
    /**
     * Sends a bundle if we've received a greeting and our internal recordkeeping indicates
     * that the peer could use this particular bundle (but ensures that we're not sending
     * bundles that would cause gaps in the peer's chain.)
     * @param bundleBytes The bundle to be sent.
     * @param bundleInfo Metadata about the bundle.
     */
    _sendIfNeeded(bundle: BundleView): void;
    _sendAck(changeSetInfo: BundleInfo): void;
}
