mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-03 06:13:08 +00:00
- Replace exception pattern with a result pattern as it better fits the usage. - merge few maps to prefer chaining to assign var after var. - Make `isDefined` type helper a common util function
29 lines
735 B
TypeScript
29 lines
735 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[] | 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;
|
|
}
|