UNPKG

@waku/core

Version:

TypeScript implementation of the Waku v2 protocol

29 lines (28 loc) 1.18 kB
import type { PeerId } from "@libp2p/interface"; import type { NetworkConfig, PubsubTopic, SingleShardInfo } from "@waku/interfaces"; import { Libp2p } from "libp2p"; type ShardReaderConstructorOptions = { libp2p: Libp2p; networkConfig: NetworkConfig; }; interface IShardReader { hasShardInfo(id: PeerId): Promise<boolean>; isPeerOnNetwork(id: PeerId): Promise<boolean>; isPeerOnShard(id: PeerId, shard: SingleShardInfo): Promise<boolean>; isPeerOnTopic(id: PeerId, pubsubTopic: PubsubTopic): Promise<boolean>; } /** * This class is responsible for reading the shard info from the libp2p peer store or from the current node's network config. */ export declare class ShardReader implements IShardReader { private readonly libp2p; private readonly staticShard; constructor(options: ShardReaderConstructorOptions); isPeerOnNetwork(id: PeerId): Promise<boolean>; hasShardInfo(id: PeerId): Promise<boolean>; isPeerOnTopic(id: PeerId, pubsubTopic: PubsubTopic): Promise<boolean>; isPeerOnShard(id: PeerId, shard: SingleShardInfo): Promise<boolean>; private getShardInfo; private getStaticShardFromNetworkConfig; } export {};