UNPKG

rx-nostr

Version:

A library based on RxJS, which allows Nostr applications to easily communicate with relays.

53 lines 1.86 kB
import * as Nostr from "nostr-typedef"; /** * This is used by rx-nostr to access NIP-11 relay information. * rx-nostr works adaptively to the [`limitation`](https://github.com/nostr-protocol/nips/blob/master/11.md#server-limitations) defined by NIP-11. * * If you `set()` or `setDefault()` NIP-11 relay information in advance, * rx-nostr will use them instead of fetching even if `skipFetchNip11` is enabled. */ export declare class Nip11Registry { private static cache; private static default; static getValue<T>(url: string, getter: (data: Nostr.Nip11.RelayInfo) => T, options?: { skipFetch?: boolean; skipCache?: boolean; }): Promise<T>; /** * Return cached or `set()`'ed NIP-11 information. */ static get(url: string): Nostr.Nip11.RelayInfo | undefined; /** * Cache fetched information then return it. */ static fetch(url: string): Promise<Nostr.Nip11.RelayInfo>; /** * Return cached or `set()`'ed NIP-11 information, * or cache fetched information then return it. */ static getOrFetch(url: string): Promise<Nostr.Nip11.RelayInfo>; /** * Set NIP-11 information manually for given relay URL. */ static set(url: string, nip11: Nostr.Nip11.RelayInfo): void; /** * Get NIP-11 information for fallback. */ static getDefault(): Nostr.Nip11.RelayInfo; /** * Set NIP-11 information for fallback. */ static setDefault(nip11: Nostr.Nip11.RelayInfo): void; /** * Forget cached NIP-11 information for given relay URL. */ static forget(url: string): void; /** * Forget all cached NIP-11 information. * * This doesn't erase `setDefault()`'ed value. * If you want it, you can `setDefault({})` instead. */ static forgetAll(): void; } //# sourceMappingURL=nip11.d.ts.map