import type { PeerScoreStatsDump } from "@libp2p/gossipsub/score";
import type { PublishOpts } from "@libp2p/gossipsub/types";
import { routes } from "@lodestar/api";
import { SpecJson } from "@lodestar/config";
import { LoggerNodeOpts } from "@lodestar/logger/node";
import { ResponseIncoming } from "@lodestar/reqresp";
import { Status } from "@lodestar/types";
import { PeerIdStr } from "../../util/peerId.js";
import { NetworkOptions } from "../options.js";
import { PeerAction, PeerScoreStats } from "../peers/index.js";
import { OutgoingRequestArgs } from "../reqresp/types.js";
import { CommitteeSubscription } from "../subnets/interface.js";
export type MultiaddrStr = string;
export interface INetworkCorePublic {
    prepareBeaconCommitteeSubnets(subscriptions: CommitteeSubscription[]): Promise<void>;
    prepareSyncCommitteeSubnets(subscriptions: CommitteeSubscription[]): Promise<void>;
    getNetworkIdentity(): Promise<routes.node.NetworkIdentity>;
    subscribeGossipCoreTopics(): Promise<void>;
    unsubscribeGossipCoreTopics(): Promise<void>;
    connectToPeer(peer: PeerIdStr, multiaddr: MultiaddrStr[]): Promise<void>;
    disconnectPeer(peer: PeerIdStr): Promise<void>;
    addDirectPeer(peer: routes.lodestar.DirectPeer): Promise<string | null>;
    removeDirectPeer(peerId: PeerIdStr): Promise<boolean>;
    getDirectPeers(): Promise<string[]>;
    dumpPeers(): Promise<routes.lodestar.LodestarNodePeer[]>;
    dumpPeer(peerIdStr: PeerIdStr): Promise<routes.lodestar.LodestarNodePeer | undefined>;
    dumpPeerScoreStats(): Promise<PeerScoreStats>;
    dumpGossipPeerScoreStats(): Promise<PeerScoreStatsDump>;
    dumpDiscv5KadValues(): Promise<string[]>;
    dumpMeshPeers(): Promise<Record<string, string[]>>;
}
/**
 * Contains core network functionality (libp2p and dependent modules)
 *
 * All properties/methods should be async to allow for a worker implementation
 */
export interface INetworkCore extends INetworkCorePublic {
    reportPeer(peer: PeerIdStr, action: PeerAction, actionName: string): void;
    reStatusPeers(peers: PeerIdStr[]): Promise<void>;
    getConnectedPeers(): Promise<PeerIdStr[]>;
    getConnectedPeerCount(): Promise<number>;
    /** Chain must push status updates to the network core */
    updateStatus(status: Status): Promise<void>;
    setTargetGroupCount(count: number): Promise<void>;
    /** Opens stream to handle ReqResp outgoing request */
    sendReqRespRequest(data: OutgoingRequestArgs): AsyncIterable<ResponseIncoming>;
    /** Publish gossip message to peers */
    publishGossip(topic: string, data: Uint8Array, opts?: PublishOpts): Promise<number>;
    close(): Promise<void>;
    scrapeMetrics(): Promise<string>;
    writeNetworkThreadProfile(durationMs: number, dirpath: string): Promise<string>;
    writeDiscv5Profile(durationMs: number, dirpath: string): Promise<string>;
    writeNetworkHeapSnapshot(prefix: string, dirpath: string): Promise<string>;
    writeDiscv5HeapSnapshot(prefix: string, dirpath: string): Promise<string>;
}
/**
 * libp2p worker contructor (start-up) data
 */
export type NetworkWorkerData = {
    opts: NetworkOptions;
    chainConfigJson: SpecJson;
    genesisValidatorsRoot: Uint8Array;
    genesisTime: number;
    activeValidatorCount: number;
    initialStatus: Status;
    initialCustodyGroupCount: number;
    privateKeyProto: Uint8Array;
    localMultiaddrs: string[];
    metricsEnabled: boolean;
    peerStoreDir?: string;
    loggerOpts: LoggerNodeOpts;
};
/**
 * API exposed by the libp2p worker
 */
export type NetworkWorkerApi = INetworkCorePublic & {
    [string: string]: (...args: any[]) => Promise<any> | any;
    reportPeer(peer: PeerIdStr, action: PeerAction, actionName: string): Promise<void>;
    reStatusPeers(peers: PeerIdStr[]): Promise<void>;
    getConnectedPeers(): Promise<PeerIdStr[]>;
    getConnectedPeerCount(): Promise<number>;
    updateStatus(status: Status): Promise<void>;
    setTargetGroupCount(count: number): Promise<void>;
    publishGossip(topic: string, data: Uint8Array, opts?: PublishOpts): Promise<number>;
    close(): Promise<void>;
    scrapeMetrics(): Promise<string>;
    writeProfile(durationMs: number, dirpath: string): Promise<string>;
    writeDiscv5Profile(durationMs: number, dirpath: string): Promise<string>;
};
//# sourceMappingURL=types.d.ts.map