import { EventEmitter, EventReturnType } from "./events";
import { CloseEvent, PeerRequestEvent } from "./events/impls";
import { PeerConnectOptions } from "./options";
import { Peer } from "./peer";
/**
 * Events emitted by {@link RainwayConnection}
 */
export interface RainwayConnectionEvents {
    /**
     * Raised when a remote peer wants to connect to this device.
     */
    "peer-request": (ev: PeerRequestEvent) => EventReturnType;
    /**
     * Raised when the connection to Rainway is closed.
     */
    close: (ev: CloseEvent) => EventReturnType;
}
/**
 * A connection to the Rainway network over which peer connection requests are transmitted.
 */
export declare class RainwayConnection extends EventEmitter<RainwayConnectionEvents> {
    /**
     * GC pin `this` so that we behave like other node wrappers, in that
     * as long as at least one RainwayConnection is around, we won't terminate node
     */
    private pinned;
    private _peers;
    /**
     * A numeric ID identifying the local peer. A Peer ID identifies a Rainway peer to other peers.
     */
    readonly id: BigInt;
    /**
     * The optional user-specified string identifying the local peer.
     */
    readonly externalId: string;
    /**
     *  List of peers connected via this Rainway connection.
     */
    get peers(): ReadonlyArray<Peer>;
    /** @internal */
    constructor(id: BigInt, externalId?: string);
    /**
     * Connect to another peer on the Rainway Network.
     * @param options - connection options
     * @returns - connection object
     */
    connect(options: PeerConnectOptions): Promise<Peer>;
    /**
     * Destroys the Rainway network connection, including all sub resources.
     */
    close(): void;
}
