mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-10 01:33:13 +00:00
32 lines
744 B
TypeScript
32 lines
744 B
TypeScript
import type { PeerId } from "@libp2p/interface-peer-id";
|
|
import type { Peer, PeerStore } from "@libp2p/interface-peer-store";
|
|
|
|
import type { Message } from "./message.js";
|
|
|
|
export enum Protocols {
|
|
Relay = "relay",
|
|
Store = "store",
|
|
LightPush = "lightpush",
|
|
Filter = "filter",
|
|
PeerExchange = "peer-exchange",
|
|
}
|
|
|
|
export interface PointToPointProtocol {
|
|
peerStore: PeerStore;
|
|
peers: () => Promise<Peer[]>;
|
|
}
|
|
|
|
export type ProtocolOptions = {
|
|
pubSubTopic?: string;
|
|
/**
|
|
* Optionally specify an PeerId for the protocol request. If not included, will use a random peer.
|
|
*/
|
|
peerId?: PeerId;
|
|
};
|
|
|
|
export type Callback<T extends Message> = (msg: T) => void | Promise<void>;
|
|
|
|
export interface SendResult {
|
|
recipients: PeerId[];
|
|
}
|