import type { Stream } from "@libp2p/interface-connection"; import type { PeerId } from "@libp2p/interface-peer-id"; import type { Multiaddr } from "@multiformats/multiaddr"; import type { Libp2p } from "libp2p"; import { Waku } from "./interfaces"; import { WakuFilter } from "./waku_filter"; import { WakuLightPush } from "./waku_light_push"; import { WakuRelay } from "./waku_relay"; import { WakuStore } from "./waku_store"; export declare const DefaultPingKeepAliveValueSecs = 0; export declare const DefaultRelayKeepAliveValueSecs: number; export declare enum Protocols { Relay = "relay", Store = "store", LightPush = "lightpush", Filter = "filter" } export interface WakuOptions { /** * Set keep alive frequency in seconds: Waku will send a `/ipfs/ping/1.0.0` * request to each peer after the set number of seconds. Set to 0 to disable. * * @default {@link DefaultPingKeepAliveValueSecs} */ pingKeepAlive?: number; /** * Set keep alive frequency in seconds: Waku will send a ping message over * relay to each peer after the set number of seconds. Set to 0 to disable. * * @default {@link DefaultRelayKeepAliveValueSecs} */ relayKeepAlive?: number; } export declare class WakuNode implements Waku { libp2p: Libp2p; relay?: WakuRelay; store?: WakuStore; filter?: WakuFilter; lightPush?: WakuLightPush; private pingKeepAliveTimers; private relayKeepAliveTimers; constructor(options: WakuOptions, libp2p: Libp2p, store?: WakuStore, lightPush?: WakuLightPush, filter?: WakuFilter); /** * Dials to the provided peer. * * @param peer The peer to dial * @param protocols Waku protocols we expect from the peer; Default to Relay */ dial(peer: PeerId | Multiaddr, protocols?: Protocols[]): Promise; /** * Add peer to address book, it will be auto-dialed in the background. */ addPeerToAddressBook(peerId: PeerId | string, multiaddrs: Multiaddr[] | string[]): Promise; start(): Promise; stop(): Promise; isStarted(): boolean; /** * Return the local multiaddr with peer id on which libp2p is listening. * * @throws if libp2p is not listening on localhost. */ getLocalMultiaddrWithID(): string; private startKeepAlive; private stopKeepAlive; private stopAllKeepAlives; }