Optional
rawEvent: NostrEventOptional
created_Encodes a bech32 id.
Rest
...args: [maxRelayCount: number]Fetch the event the current event is replying to.
Rest
...args: [subOpts?: NDKSubscriptionOptions]The fetched reply event or null if no event was found
Fetch the root event of the current event.
Rest
...args: [subOpts?: NDKSubscriptionOptions]The fetched root event or null if no event was found
const replyEvent = await ndk.fetchEvent("nevent1qqs8x8vnycyha73grv380gmvlury4wtmx0nr9a5ds2dngqwgu87wn6gpzemhxue69uhhyetvv9ujuurjd9kkzmpwdejhgq3ql2vyh47mk2p0qlsku7hg0vn29faehy9hy34ygaclpn66ukqp3afqz4cwjd")
const rootEvent = await replyEvent.fetchRootEvent();
console.log(replyEvent.encode() + " is a reply in the thread " + rootEvent?.encode());
Fetch an event tagged with the given tag following relay hints if provided.
const replyEvent = await ndk.fetchEvent("nevent1qqs8x8vnycyha73grv380gmvlury4wtmx0nr9a5ds2dngqwgu87wn6gpzemhxue69uhhyetvv9ujuurjd9kkzmpwdejhgq3ql2vyh47mk2p0qlsku7hg0vn29faehy9hy34ygaclpn66ukqp3afqz4cwjd")
const originalEvent = await replyEvent.fetchTaggedEvent("e", "reply");
console.log(replyEvent.encode() + " is a reply to event " + originalEvent?.encode());
Optional
kindOptional
ndkOptional
publishOptional
publishThe status of the publish operation.
The relay that this event was first received from.
NIP-18 reposting event.
Optional
sigOptional
signatureGets the NIP-31 "alt" tag of the event.
Sets the NIP-31 "alt" tag of the event. Use this to set an alt tag so clients that don't handle a particular event kind can display something useful for users.
Gets the NIP-33 "d" tag of the event.
Sets the NIP-33 "d" tag of the event.
Checks whether the event is valid per underlying NIPs.
This method is meant to be overridden by subclasses that implement specific NIPs to allow the enforcement of NIP-specific validation rules.
Otherwise, it will only check for basic event properties.
Attempt to sign and then publish an NDKEvent to a given relaySet. If no relaySet is provided, the relaySet will be calculated by NDK.
Optional
relaySet: NDKRelaySet{NDKRelaySet} The relaySet to publish the even to.
Optional
timeoutMs: numberOptional
requiredRelayCount: numberThe number of relays that must receive the event for the publish to be considered successful.
A promise that resolves to the relays the event was published to.
Optional
relaySet: NDKRelaySetOptional
timeoutMs: numberOptional
requiredRelayCount: numberReturns the event as is.
Get the tags that can be used to reference this event from another event
Optional
marker: stringThe marker to use in the tag
Optional
skipAuthorTag: booleanWhether to explicitly skip adding the author tag of the event
Optional
forceTag: stringForce a specific tag to be used instead of the default "e" or "a" tag
The NDKTag object referencing this event
Sign the event if a signer is present.
It will generate tags. Repleacable events will have their created_at field set to the current time.
Optional
signer: NDKSigner{NDKSigner} The NDKSigner to use to sign the event
A Promise that resolves to the signature of the signed event.
Tag a user with an optional marker.
What is to be tagged. Can be an NDKUser, NDKEvent, or an NDKTag.
Optional
marker: stringThe marker to use in the tag.
Optional
skipAuthorTag: booleanWhether to explicitly skip adding the author tag of the event.
Optional
forceTag: stringForce a specific tag to be used instead of the default "e" or "a" tag.
NIP-73 tagging of external entities
to be tagged
of the entity
Optional
markerUrl: stringto be used as the marker URL
event.tagExternal("https://example.com/article/123#nostr", "url");
event.tags => [["i", "https://example.com/123"], ["k", "https://example.com"]]
Return a NostrEvent object, trying to fill in missing fields when possible, adding tags when necessary.
Optional
pubkey: string{string} The pubkey of the user who the event belongs to.
A promise that resolves to a NostrEvent.
Static
deserializeStatic
from
A subscription receipt event.
Example