js-waku/packages/interfaces/src/peer_exchange.ts
Danish Arora a20b797c5b
chore: refactor peer-exchange according to nwaku 0.15.0 (#1193)
* merge with master: adhere acc to updated API

* bump go-waku to 0.5.2
2023-03-14 13:56:15 +05:30

29 lines
723 B
TypeScript

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