import { AddressPointer, DecodedResult, EventPointer, NAddr, NEvent, NProfile, NPub, ProfilePointer } from "nostr-tools/nip19"; export type { AddressPointer, EventPointer, ProfilePointer } from "nostr-tools/nip19"; export { decode as decodePointer, naddrEncode, neventEncode, noteEncode, nprofileEncode, npubEncode, nsecEncode, } from "nostr-tools/nip19"; export type { NAddr, NEvent, NProfile, NPub } from "nostr-tools/nip19"; import { NostrEvent } from "./event.js"; export type DecodeResult = DecodedResult; /** Decodes any NIP-19 encoded string into a ProfilePointer. Returns null if the string cannot be decoded. */ export declare function decodeProfilePointer(str: string): ProfilePointer | null; /** Decodes an encoded NIP-19 naddr string to an AddressPointer. Returns null if the string cannot be decoded. */ export declare function decodeAddressPointer(str: string): AddressPointer | null; /** Decodes an encoded NIP-19 note1 or nevent string to an EventPointer. Returns null if the string cannot be decoded. */ export declare function decodeEventPointer(str: string): EventPointer | null; export type AddressPointerWithoutD = Omit & { identifier?: string; }; /** Parses the value of an "a" tag into an AddressPointer. Returns null if the address cannot be parsed. */ export declare function parseReplaceableAddress(address: string, requireIdentifier?: boolean): AddressPointer | null; /** Extracts a pubkey from the result of nip19.decode Returns undefined if the decode result does not have a pubkey */ export declare function getPubkeyFromDecodeResult(result?: DecodeResult): string | undefined; /** Extracts the relays from a decode result */ export declare function getRelaysFromDecodeResult(result?: DecodeResult): string[] | undefined; /** Encodes the result of nip19.decode to a NIP-19 string. Returns an empty string if the result cannot be encoded. */ export declare function encodeDecodeResult(result: DecodeResult): "" | `nevent1${string}` | `nprofile1${string}` | `naddr1${string}` | `nsec1${string}` | `npub1${string}` | `note1${string}`; /** Encodes a pointer to a NIP-19 string. Returns an empty string if the pointer cannot be encoded. */ export declare function encodePointer(pointer: AddressPointer | EventPointer | ProfilePointer): string; /** Parses a common "e" tag into an EventPointer. Returns null if the tag cannot be parsed. */ export declare function getEventPointerFromETag(tag: string[]): EventPointer | null; /** Parses a common "q" tag into an EventPointer. Returns null if the tag cannot be parsed. */ export declare function getEventPointerFromQTag(tag: string[]): EventPointer | null; /** Parses a common "a" tag into an AddressPointer. Returns null if the tag cannot be parsed. */ export declare function getAddressPointerFromATag(tag: string[]): AddressPointer | null; /** Parses a common "p" tag into a ProfilePointer. Returns null if the tag cannot be parsed. */ export declare function getProfilePointerFromPTag(tag: string[]): ProfilePointer | null; /** Checks if a pointer object is an AddressPointer */ export declare function isAddressPointer(pointer: any): pointer is AddressPointer; /** Checks if a pointer object is a ProfilePointer */ export declare function isProfilePointer(pointer: any): pointer is ProfilePointer; /** Checks if a pointer object is an EventPointer */ export declare function isEventPointer(pointer: any): pointer is EventPointer; /** Returns the stringified NIP-19 encoded naddr address pointer for an AddressPointer. */ export declare function getReplaceableAddressFromPointer(pointer: AddressPointer): string; /** Returns the replaceable coordinate for a replaceable event ( used for "a" tags to reference replaceable events ). */ export declare function getReplaceableAddressForEvent(event: NostrEvent): string | null; /** Returns an AddressPointer for a replaceable event. Returns null if the event is not addressable or replaceable. */ export declare function getAddressPointerForEvent(event: NostrEvent, relays?: string[]): AddressPointer | null; /** Returns an EventPointer for an event */ export declare function getEventPointerForEvent(event: NostrEvent, relays?: string[]): EventPointer; /** Returns a pointer for a given event */ export declare function getPointerForEvent(event: NostrEvent, relays?: string[]): DecodeResult; /** Adds relay hints to a pointer object that has a relays array */ export declare function addRelayHintsToPointer(pointer: T, relays?: Iterable): T; /** Parses any nip-19 encoded string into a hex pubkey. Returns null if the string is not a valid pubkey. */ export declare function normalizeToPubkey(str: NPub): string; export declare function normalizeToPubkey(str: string): string | null; /** Parses any nip-19 encoded string into a ProfilePointer. Returns null if the string cannot be parsed. */ export declare function normalizeToProfilePointer(str: NProfile): ProfilePointer; export declare function normalizeToProfilePointer(str: NPub): ProfilePointer; export declare function normalizeToProfilePointer(str: string): ProfilePointer | null; /** Parses any nip-19 encoded string into an AddressPointer. Returns null if the string cannot be parsed. */ export declare function normalizeToAddressPointer(str: NAddr): AddressPointer; export declare function normalizeToAddressPointer(str: string): AddressPointer | null; /** Parses any nip-19 encoded string into an EventPointer. Returns null if the string cannot be parsed. */ export declare function normalizeToEventPointer(str: NEvent): EventPointer; export declare function normalizeToEventPointer(str: string): EventPointer | null; /** Returns all NIP-19 pointers in a content string */ export declare function getContentPointers(content: string): DecodeResult[]; /** * Merges two event points and keeps all relays * @throws if the ids are different */ export declare function mergeEventPointers(a: EventPointer, b: EventPointer): EventPointer; /** * Merges two address pointers and keeps all relays * @throws if the kinds, pubkeys, or identifiers are different */ export declare function mergeAddressPointers(a: AddressPointer, b: AddressPointer): AddressPointer; /** * Merges two profile pointers and keeps all relays * @throws if the pubkeys are different */ export declare function mergeProfilePointers(a: ProfilePointer, b: ProfilePointer): ProfilePointer; /** Checks if two address pointers refer to the same addressable event. Ignores relays. */ export declare function isAddressPointerSame(a: AddressPointer, b: AddressPointer): boolean; /** Checks if two event pointers refer to the same event. Ignores relays. */ export declare function isEventPointerSame(a: EventPointer, b: EventPointer): boolean; /** Checks if an event matches a pointer */ export declare function eventMatchesPointer(event: NostrEvent, pointer: EventPointer | AddressPointer | AddressPointerWithoutD): boolean;