@waku/core
Version:
TypeScript implementation of the Waku v2 protocol
23 lines (22 loc) • 967 B
TypeScript
import { type Peer, type PeerId } from "@libp2p/interface";
import { Multiaddr, MultiaddrInput } from "@multiformats/multiaddr";
/**
* Reads peer's metadata and retrieves ping value.
* @param peer Peer or null
* @returns -1 if no ping attached, otherwise returns ping value
*/
export declare const getPeerPing: (peer: Peer | null) => number;
/**
* Maps a PeerId or MultiaddrInput to a PeerId or Multiaddr.
* @param input - The PeerId or MultiaddrInput to map.
* @returns The PeerId or Multiaddr.
* @throws {Error} If the input is not a valid PeerId or MultiaddrInput.
*/
export declare const mapToPeerIdOrMultiaddr: (input: PeerId | MultiaddrInput) => PeerId | Multiaddr;
/**
* Maps a PeerId or MultiaddrInput to a PeerId.
* @param input - The PeerId or MultiaddrInput to map.
* @returns The PeerId.
* @throws {Error} If the input is not a valid PeerId or MultiaddrInput.
*/
export declare const mapToPeerId: (input: PeerId | MultiaddrInput) => PeerId;