mirror of
https://github.com/logos-messaging/logos-messaging-js.git
synced 2026-01-13 05:23:13 +00:00
* setup a generic protocol result type (DRY) * metadata: use generic * lightpush: use generic * peer-exchange: use error codes + generic + update tests * add issue link to skipped test * tests: improve while loop readability
31 lines
786 B
TypeScript
31 lines
786 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 { IBaseProtocolCore, ProtocolResult } from "./protocols.js";
|
|
|
|
export interface IPeerExchange extends IBaseProtocolCore {
|
|
query(params: PeerExchangeQueryParams): Promise<PeerExchangeResult>;
|
|
}
|
|
|
|
export type PeerExchangeResult = ProtocolResult<"peerInfos", 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;
|
|
}
|