js-waku/packages/interfaces/src/peer_exchange.ts
2024-01-17 11:59:08 -08:00

29 lines
691 B
TypeScript

import type { PeerId } from "@libp2p/interface";
import type { PeerStore } from "@libp2p/interface";
import type { ConnectionManager } from "@libp2p/interface-internal";
import { IEnr } from "./enr.js";
import { IBaseProtocol } from "./protocols.js";
export interface IPeerExchange extends IBaseProtocol {
query(params: PeerExchangeQueryParams): Promise<PeerInfo[] | undefined>;
}
export interface PeerExchangeQueryParams {
numPeers: number;
peerId: PeerId;
}
export interface PeerExchangeResponse {
peerInfos: PeerInfo[];
}
export interface PeerInfo {
ENR?: IEnr;
}
export interface PeerExchangeComponents {
connectionManager: ConnectionManager;
peerStore: PeerStore;
}