2022-12-05 17:00:24 +11:00
|
|
|
import type { GossipSub } from "@chainsafe/libp2p-gossipsub";
|
|
|
|
|
|
2022-12-05 17:07:03 +11:00
|
|
|
import type {
|
|
|
|
|
IDecodedMessage,
|
|
|
|
|
IDecoder,
|
|
|
|
|
IEncoder,
|
|
|
|
|
IMessage,
|
|
|
|
|
} from "./message.js";
|
2022-12-05 17:00:24 +11:00
|
|
|
import type { Callback, SendResult } from "./protocols.js";
|
|
|
|
|
|
2022-12-06 12:36:29 +11:00
|
|
|
export interface IRelay extends GossipSub {
|
2022-12-05 17:07:03 +11:00
|
|
|
send: (encoder: IEncoder, message: IMessage) => Promise<SendResult>;
|
|
|
|
|
addObserver: <T extends IDecodedMessage>(
|
|
|
|
|
decoder: IDecoder<T>,
|
2022-12-05 17:00:24 +11:00
|
|
|
callback: Callback<T>
|
|
|
|
|
) => () => void;
|
|
|
|
|
getMeshPeers: () => string[];
|
|
|
|
|
}
|