Danish Arora 87717981eb
chore: upgrade libp2p and related deps (#1482)
* chore: update noise

* update: package.lock

* update: @chainsafe/libp2p-gossipsub

* rm unwanted libp2p interface deps & bump up libp2p

* refactor code for new deps

* update: new package.lock

* setup prettier, refactor eslint  and rm trailing commas

* update package.lock

* fix build

* import type for interface

* fix imports for merge

* update typedoc exports

* add: CustomEvent import

* use new libp2p interface

* add aegir as dev dep for tests
2023-08-16 20:18:13 +05:30

21 lines
905 B
TypeScript

import type { GossipSub } from "@chainsafe/libp2p-gossipsub";
import type { PeerIdStr, TopicStr } from "@chainsafe/libp2p-gossipsub/types";
import { IReceiver } from "./receiver.js";
import type { ISender } from "./sender.js";
/**
* Interface representing the Relay API, providing control and information about the GossipSub protocol.
*
* @property gossipSub - The GossipSub instance used for managing pub/sub behavior.
* @property start - Function to start the relay, returning a Promise that resolves when initialization is complete.
* @property getMeshPeers - Function to retrieve the mesh peers for a given topic or all topics if none is specified. Returns an array of peer IDs as strings.
*/
export interface IRelayAPI {
readonly gossipSub: GossipSub;
start: () => Promise<void>;
getMeshPeers: (topic?: TopicStr) => PeerIdStr[];
}
export type IRelay = IRelayAPI & ISender & IReceiver;