import { NostrPrefix } from "@snort/shared"; import { EventKind, type NostrEvent, type TaggedNostrEvent } from "."; /** * An object which can be stored in a nostr event as a tag */ export interface ToNostrEventTag { toEventTag(): Array | undefined; equals(other: ToNostrEventTag): boolean; } /** * A hashtag ["t", ... ] tag */ export declare class NostrHashtagLink implements ToNostrEventTag { readonly tag: string; constructor(tag: string); static isInstance(obj: unknown): obj is NostrHashtagLink; equals(other: ToNostrEventTag): boolean; toEventTag(): string[]; } /** * A generic tag which could not be specifically parsed */ export declare class UnknownTag implements ToNostrEventTag { readonly value: Array; constructor(value: Array); static isInstance(obj: unknown): obj is UnknownTag; equals(other: ToNostrEventTag): boolean; toEventTag(): string[] | undefined; } /** * Link scope for reply tags */ export declare enum LinkScope { /** * Link points to the root note of the thread */ Root = "root", /** * Link points to the note being replied to */ Reply = "reply", /** * Link mentions another object without directly replying */ Mention = "mention", /** * Link mentions another object (`q` tag) */ Quote = "quote" } /** * A link to another object on Nostr */ export declare class NostrLink implements ToNostrEventTag { readonly type: NostrPrefix; readonly id: string; readonly author?: string | undefined; readonly relays?: Array | undefined; /** * A nostr kind number (only a hint) */ kind?: EventKind; /** * Link scope for tagging */ scope?: LinkScope; static isInstance(obj: unknown): obj is NostrLink; constructor(type: NostrPrefix, id: string, kind?: number, author?: string | undefined, relays?: Array | undefined, scope?: LinkScope | string); /** * Encode the link into a [NIP-19](https://github.com/nostr-protocol/nips/blob/master/19.md) entity */ encode(type?: NostrPrefix): string; /** * Gets a string identifier for this link * * Works similarly to EventExt.keyOf */ get tagKey(): string; /** * Create an event tag for this link (Uses Nip10) */ toEventTag(): string[]; matchesEvent(ev: NostrEvent): boolean; /** * Is the supplied event a reply to this link */ isReplyToThis(ev: NostrEvent): boolean; /** * Does the supplied event contain a tag matching this link */ referencesThis(ev: NostrEvent): boolean; equals(other: NostrLink): boolean; static fromTag(tag: Array, author?: string, kind?: number): NostrLink; static tryFromTag(tag: Array, author?: string, kind?: number): NostrLink | undefined; static fromTags(tags: ReadonlyArray>): NostrLink[]; /** * Parse all tags even if they are unknown */ static fromAllTags(tags: ReadonlyArray>): Array; /** * Return all tags which are replies */ static replyTags(tags: ReadonlyArray>): Array; /** * Create an event link from an existing nostr event */ static fromEvent(ev: TaggedNostrEvent | NostrEvent): NostrLink; static profile(pk: string, relays?: Array): NostrLink; static publicKey(pk: string, relays?: Array): NostrLink; } export declare function tryParseNostrLink(link: string, prefixHint?: NostrPrefix): NostrLink | undefined; export declare function isNostrLink(link: string): boolean; export declare function trimNostrLink(link: string): string; export declare function parseNostrLink(link: string, prefixHint?: NostrPrefix): NostrLink; //# sourceMappingURL=nostr-link.d.ts.map