import { kinds } from "nostr-tools"; import { isKind } from "nostr-tools/kinds"; import { isAddressableKind, isEphemeralKind, isRegularKind, isReplaceableKind } from "nostr-tools/kinds"; import { EventTemplate, NostrEvent, UnsignedEvent, VerifiedEvent } from "nostr-tools/pure"; import { IAsyncEventStore, IEventStore } from "../event-store/interface.js"; export { EventTemplate, finalizeEvent, getEventHash, NostrEvent, serializeEvent, UnsignedEvent, VerifiedEvent, verifiedSymbol, verifyEvent, } from "nostr-tools/pure"; export { binarySearch, bytesToHex, hexToBytes, insertEventIntoAscendingList, insertEventIntoDescendingList, } from "nostr-tools/utils"; export { isAddressableKind, isEphemeralKind, isRegularKind, isReplaceableKind, kinds, isKind }; /** An event with a known kind. this is used to know if events have been validated */ export type KnownEvent = Omit & { kind: K; }; /** An event template with a known kind. used in event factories */ export type KnownEventTemplate = Omit & { kind: K; }; /** An unsigned event with a known kind. used in event factories */ export type KnownUnsignedEvent = Omit & { kind: K; }; /** A symbol on an event that marks which event store its part of */ export declare const EventStoreSymbol: unique symbol; export declare const EventUIDSymbol: unique symbol; export declare const ReplaceableAddressSymbol: unique symbol; export declare const FromCacheSymbol: unique symbol; export declare const ReplaceableIdentifierSymbol: unique symbol; /** * Checks if an object is a nostr event * NOTE: does not validate the signature on the event */ export declare function isEvent(event: any): event is NostrEvent; /** * Returns if a kind is replaceable ( 10000 <= n < 20000 || n == 0 || n == 3 ) * or parameterized replaceable ( 30000 <= n < 40000 ) */ export declare function isReplaceable(kind: number): boolean; /** * Returns the events Unique ID * For normal or ephemeral events this is ( event.id ) * For replaceable events this is ( event.kind + ":" + event.pubkey + ":" ) * For parametrized replaceable events this is ( event.kind + ":" + event.pubkey + ":" + event.tags.d ) */ export declare function getEventUID(event: NostrEvent): string; /** Returns the replaceable event address for an addressable event */ export declare function getReplaceableAddress(event: NostrEvent): string | null; /** Creates a replaceable event address from a kind, pubkey, and identifier */ export declare function createReplaceableAddress(kind: number, pubkey: string, identifier?: string): string; /** @deprecated use createReplaceableAddress instead */ export declare const getReplaceableUID: typeof createReplaceableAddress; /** Method used to verify an events signature */ export type VerifyEventMethod = (event: NostrEvent) => event is VerifiedEvent; /** Sets the internal method used to verify events in helpers (zaps, gift-wraps, etc) */ export declare function setVerifyWrappedEventMethod(method: VerifyEventMethod): void; /** Verifies an internal (wrapped) event using the set internal verification method */ export declare function verifyWrappedEvent(event: NostrEvent): event is VerifiedEvent; /** Sets events verified flag without checking anything */ export declare function fakeVerifyEvent(event: NostrEvent): event is VerifiedEvent; /** Marks an event as being from a cache */ export declare function markFromCache(event: NostrEvent): void; /** Returns if an event was from a cache */ export declare function isFromCache(event: NostrEvent): boolean; /** Returns the EventStore of an event if its been added to one */ export declare function getParentEventStore(event: T): IEventStore | IAsyncEventStore | undefined; /** Notifies the events parent store that an event has been updated */ export declare function notifyEventUpdate(event: any): void; /** Returns the replaceable identifier for a replaceable event */ export declare function getReplaceableIdentifier(event: NostrEvent): string; /** Checks if an event is a NIP-70 protected event */ export declare function isProtectedEvent(event: NostrEvent): boolean; /** * Returns the second index ( tag[1] ) of the first tag that matches the name */ export declare function getTagValue(event: T, name: string): string | undefined; /** Checks if an event has a public name / value tag*/ export declare function hasNameValueTag(event: T, name: string, value: string): boolean;