import type { PeerScoreStatsDump } from "@libp2p/gossipsub/score";
import type { PublishOpts } from "@libp2p/gossipsub/types";
import type { Connection, PrivateKey } from "@libp2p/interface";
import { routes } from "@lodestar/api";
import { BeaconConfig } from "@lodestar/config";
import type { LoggerNode } from "@lodestar/logger/node";
import { ResponseIncoming } from "@lodestar/reqresp";
import { Status } from "@lodestar/types";
import { RegistryMetricCreator } from "../../metrics/index.js";
import { IClock } from "../../util/clock.js";
import { PeerIdStr } from "../../util/peerId.js";
import { NetworkEventBus } from "../events.js";
import { Eth2Gossipsub } from "../gossip/index.js";
import { Libp2p } from "../interface.js";
import { MetadataController } from "../metadata.js";
import { NetworkConfig } from "../networkConfig.js";
import { NetworkOptions } from "../options.js";
import { PeerAction, PeerScoreStats } from "../peers/index.js";
import { PeerManager } from "../peers/peerManager.js";
import { PeersData } from "../peers/peersData.js";
import { ReqRespBeaconNode } from "../reqresp/ReqRespBeaconNode.js";
import { GetReqRespHandlerFn, OutgoingRequestArgs } from "../reqresp/types.js";
import { LocalStatusCache } from "../statusCache.js";
import { CommitteeSubscription, IAttnetsService } from "../subnets/interface.js";
import { SyncnetsService } from "../subnets/syncnetsService.js";
import { NetworkCoreMetrics } from "./metrics.js";
import { INetworkCore, MultiaddrStr } from "./types.js";
type Mods = {
    libp2p: Libp2p;
    gossip: Eth2Gossipsub;
    reqResp: ReqRespBeaconNode;
    attnetsService: IAttnetsService;
    syncnetsService: SyncnetsService;
    peerManager: PeerManager;
    networkConfig: NetworkConfig;
    peersData: PeersData;
    metadata: MetadataController;
    logger: LoggerNode;
    config: BeaconConfig;
    clock: IClock;
    statusCache: LocalStatusCache;
    metrics: NetworkCoreMetrics | null;
    opts: NetworkOptions;
};
export type BaseNetworkInit = {
    opts: NetworkOptions;
    config: BeaconConfig;
    privateKey: PrivateKey;
    peerStoreDir: string | undefined;
    logger: LoggerNode;
    metricsRegistry: RegistryMetricCreator | null;
    clock: IClock;
    events: NetworkEventBus;
    getReqRespHandler: GetReqRespHandlerFn;
    activeValidatorCount: number;
    initialStatus: Status;
    initialCustodyGroupCount: number;
};
/**
 * This class is meant to work both:
 * - In a libp2p worker
 * - In the main thread
 *
 * libp2p holds the reference to the TCP transport socket. libp2p is in a worker, what components
 * must be in a worker too?
 * - MetadataController: Read by ReqRespBeaconNode, written by AttnetsService + SyncnetsService
 * - PeerRpcScoreStore
 * - ReqRespBeaconNode: Must be in worker, depends on libp2p
 * - Eth2Gossipsub: Must be in worker, depends on libp2p
 * - AttnetsService
 * - SyncnetsService
 * - PeerManager
 * - NetworkProcessor: Must be in the main thread, depends on chain
 */
export declare class NetworkCore implements INetworkCore {
    private readonly libp2p;
    private readonly attnetsService;
    private readonly syncnetsService;
    private readonly peerManager;
    private readonly networkConfig;
    private readonly peersData;
    private readonly reqResp;
    private readonly gossip;
    private readonly metadata;
    private readonly logger;
    private readonly config;
    private readonly clock;
    private readonly statusCache;
    private readonly metrics;
    private readonly opts;
    private readonly forkBoundariesByEpoch;
    private closed;
    constructor(modules: Mods);
    static init({ opts, config, privateKey, peerStoreDir, logger, metricsRegistry, events, clock, getReqRespHandler, activeValidatorCount, initialStatus, initialCustodyGroupCount }: BaseNetworkInit): Promise<NetworkCore>;
    /** Destroy this instance. Can only be called once. */
    close(): Promise<void>;
    getNetworkConfig(): NetworkConfig;
    scrapeMetrics(): Promise<string>;
    updateStatus(status: Status): Promise<void>;
    reportPeer(peer: PeerIdStr, action: PeerAction, actionName: string): Promise<void>;
    reStatusPeers(peers: PeerIdStr[]): Promise<void>;
    /**
     * Request att subnets up `toSlot`. Network will ensure to mantain some peers for each
     */
    prepareBeaconCommitteeSubnets(subscriptions: CommitteeSubscription[]): Promise<void>;
    prepareSyncCommitteeSubnets(subscriptions: CommitteeSubscription[]): Promise<void>;
    /**
     * Subscribe to all gossip events. Safe to call multiple times
     */
    subscribeGossipCoreTopics(): Promise<void>;
    /**
     * Unsubscribe from all gossip events. Safe to call multiple times
     */
    unsubscribeGossipCoreTopics(): Promise<void>;
    isSubscribedToGossipCoreTopics(): Promise<boolean>;
    sendReqRespRequest(data: OutgoingRequestArgs): AsyncIterable<ResponseIncoming>;
    publishGossip(topic: string, data: Uint8Array, opts?: PublishOpts | undefined): Promise<number>;
    /**
     * Handler of ChainEvent.updateTargetCustodyGroupCount event
     * Updates the target custody group count in the network config and metadata.
     * Also subscribes to new data_column_sidecar subnet topics for the new custody group count.
     */
    setTargetGroupCount(count: number): Promise<void>;
    getNetworkIdentity(): Promise<routes.node.NetworkIdentity>;
    getConnectionsByPeer(): Map<string, Connection[]>;
    getConnectedPeers(): Promise<PeerIdStr[]>;
    getConnectedPeerCount(): Promise<number>;
    connectToPeer(peerIdStr: PeerIdStr, multiaddrStrArr: MultiaddrStr[]): Promise<void>;
    disconnectPeer(peerIdStr: PeerIdStr): Promise<void>;
    addDirectPeer(peer: routes.lodestar.DirectPeer): Promise<string | null>;
    removeDirectPeer(peerIdStr: PeerIdStr): Promise<boolean>;
    getDirectPeers(): Promise<string[]>;
    private _dumpPeer;
    dumpPeer(peerIdStr: string): Promise<routes.lodestar.LodestarNodePeer | undefined>;
    dumpPeers(): Promise<routes.lodestar.LodestarNodePeer[]>;
    dumpPeerScoreStats(): Promise<PeerScoreStats>;
    dumpGossipPeerScoreStats(): Promise<PeerScoreStatsDump>;
    dumpDiscv5KadValues(): Promise<string[]>;
    dumpMeshPeers(): Promise<Record<string, string[]>>;
    writeNetworkThreadProfile(): Promise<string>;
    writeDiscv5Profile(durationMs: number, dirpath: string): Promise<string>;
    writeNetworkHeapSnapshot(): Promise<string>;
    writeDiscv5HeapSnapshot(prefix: string, dirpath: string): Promise<string>;
    /**
     * Handle subscriptions through fork boundary transitions, @see FORK_EPOCH_LOOKAHEAD
     */
    private onEpoch;
    private subscribeCoreTopicsAtBoundary;
    private unsubscribeCoreTopicsAtBoundary;
}
export {};
//# sourceMappingURL=networkCore.d.ts.map