mirror of
https://github.com/logos-messaging/logos-messaging-js.git
synced 2026-01-13 21:43:07 +00:00
* add proto * add rpc and interfaces * add protocol implementation * update faulty proto def * add rpc and interfaces * refactor implementation & write test * setup the metadata protocol as a service * fix cases where metadata service needs to be undefined * remove redundant catch block * remove addressed TODO * update import path * log errors * remove redundant code from handling incoming metadata request * update tests * add test to check for active connections * change expects * save remote peer's shard info after successful connection
33 lines
971 B
TypeScript
33 lines
971 B
TypeScript
import type { GossipSub } from "@chainsafe/libp2p-gossipsub";
|
|
import type { Libp2p as BaseLibp2p } from "@libp2p/interface";
|
|
import type { Libp2pInit, Libp2pOptions } from "libp2p";
|
|
import type { identifyService } from "libp2p/identify";
|
|
import type { PingService } from "libp2p/ping";
|
|
|
|
import { IMetadata } from "./metadata";
|
|
|
|
export type Libp2pServices = {
|
|
ping: PingService;
|
|
metadata?: IMetadata;
|
|
pubsub?: GossipSub;
|
|
identify: ReturnType<ReturnType<typeof identifyService>>;
|
|
};
|
|
|
|
// TODO: Get libp2p to export this.
|
|
export type Libp2pComponents = Parameters<
|
|
Exclude<Libp2pInit["metrics"], undefined>
|
|
>[0];
|
|
|
|
// thought components are not defined on the Libp2p interface they are present on Libp2pNode class
|
|
export type Libp2p = BaseLibp2p<Libp2pServices> & {
|
|
components: Libp2pComponents;
|
|
};
|
|
|
|
export type CreateLibp2pOptions = Libp2pOptions & {
|
|
/**
|
|
* Hides WebSocket info message in console.
|
|
* @default false
|
|
*/
|
|
hideWebSocketInfo?: boolean;
|
|
};
|