/**
 * Wrap a network node.
 */
import { DhtAddress, PeerDescriptor } from '@streamr/dht';
import { StreamMessage, StreamPartID } from '@streamr/protocol';
import { NetworkOptions, ProxyDirection } from '@streamr/trackerless-network';
import { MetricsContext } from '@streamr/utils';
import { Authentication } from './Authentication';
import { NetworkPeerDescriptor, StrictStreamrClientConfig } from './Config';
import { DestroySignal } from './DestroySignal';
import { OperatorRegistry } from './registry/OperatorRegistry';
/** @deprecated This in an internal interface */
export interface NetworkNodeStub {
    getNodeId: () => DhtAddress;
    addMessageListener: (listener: (msg: StreamMessage) => void) => void;
    removeMessageListener: (listener: (msg: StreamMessage) => void) => void;
    join: (streamPartId: StreamPartID, neighborRequirement?: {
        minCount: number;
        timeout: number;
    }) => Promise<void>;
    leave: (streamPartId: StreamPartID) => Promise<void>;
    broadcast: (streamMessage: StreamMessage) => Promise<void>;
    getStreamParts: () => StreamPartID[];
    getNeighbors: (streamPartId: StreamPartID) => ReadonlyArray<DhtAddress>;
    getPeerDescriptor: () => PeerDescriptor;
    getOptions: () => NetworkOptions;
    getMetricsContext: () => MetricsContext;
    getDiagnosticInfo: () => Record<string, unknown>;
    hasStreamPart: (streamPartId: StreamPartID) => boolean;
    inspect(node: PeerDescriptor, streamPartId: StreamPartID): Promise<boolean>;
    isProxiedStreamPart(streamPartId: StreamPartID): boolean;
    setStreamPartEntryPoints: (streamPartId: StreamPartID, peerDescriptors: PeerDescriptor[]) => void;
}
export interface Events {
    start: () => void;
}
/**
 * The factory is used so that integration tests can replace the real network node with a fake instance
 */
export declare class NetworkNodeFactory {
    createNetworkNode(opts: NetworkOptions): NetworkNodeStub;
}
/**
 * Wrap a network node.
 * Lazily creates & starts node on first call to getNode().
 */
export declare class NetworkNodeFacade {
    private cachedNode?;
    private startNodeCalled;
    private startNodeComplete;
    private readonly networkNodeFactory;
    private readonly operatorRegistry;
    private readonly config;
    private readonly authentication;
    private readonly eventEmitter;
    private readonly destroySignal;
    constructor(networkNodeFactory: NetworkNodeFactory, operatorRegistry: OperatorRegistry, config: Pick<StrictStreamrClientConfig, 'network' | 'contracts'>, authentication: Authentication, destroySignal: DestroySignal);
    private assertNotDestroyed;
    private getNetworkOptions;
    private initNode;
    /**
     * Stop network node, or wait for it to stop if already stopping.
     * Subsequent calls to getNode/start will fail.
     */
    private destroy;
    /**
     * Start network node, or wait for it to start if already started.
     */
    private startNodeTask;
    startNode: () => Promise<unknown>;
    getNode: () => Promise<NetworkNodeStub>;
    getNodeId(): Promise<DhtAddress>;
    /**
     * Calls publish on node after starting it.
     * Basically a wrapper around: (await getNode()).publish(…)
     * but will be sync in case that node is already started.
     * Zalgo intentional. See below.
     */
    publishToNode(streamMessage: StreamMessage): Promise<void>;
    inspect(node: NetworkPeerDescriptor, streamPartId: StreamPartID): Promise<boolean>;
    setProxies(streamPartId: StreamPartID, nodes: NetworkPeerDescriptor[], direction: ProxyDirection, connectionCount?: number): Promise<void>;
    setStreamPartEntryPoints(streamPartId: StreamPartID, nodeDescriptors: NetworkPeerDescriptor[]): Promise<void>;
    private isStarting;
    once<E extends keyof Events>(eventName: E, listener: Events[E]): void;
    private getEntryPoints;
}
