Danish Arora 9ac2a3f363
feat: metadata protocol (#1732)
* 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
2023-12-05 19:26:52 +05:30

9 lines
265 B
TypeScript

import type { PeerId } from "@libp2p/interface/peer-id";
import type { ShardInfo } from "./enr.js";
import type { IBaseProtocol } from "./protocols.js";
export interface IMetadata extends IBaseProtocol {
query(peerId: PeerId): Promise<ShardInfo | undefined>;
}