Optional
ndk: defaultOptional
event: NostrEventOptional
created_Encodes a bech32 id.
Rest
...args: []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.
Rest
...args: [tag: string, marker?: string]The fetched event or null if no event was found, undefined if no matching tag was found in the event *
const replyEvent = await ndk.fetchEvent("nevent1qqs8x8vnycyha73grv380gmvlury4wtmx0nr9a5ds2dngqwgu87wn6gpzemhxue69uhhyetvv9ujuurjd9kkzmpwdejhgq3ql2vyh47mk2p0qlsku7hg0vn29faehy9hy34ygaclpn66ukqp3afqz4cwjd")
const originalEvent = await replyEvent.fetchTaggedEvent("e", "reply");
console.log(replyEvent.encode() + " is a reply to event " + originalEvent?.encode());
Rest
...args: []Rest
...args: []Rest
...args: []Rest
...args: []Optional
kindOptional
ndkThe relays that this event was received from and/or successfully published to.
Optional
publishOptional
publishThe status of the publish operation.
The relay that this event was first received from.
Rest
...args: [includeSig: boolean, includeId: boolean]Optional
sigOptional
signatureRest
...args: []Rest
...args: [persist: boolean]Gets 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.
Provides the filter that will return matching events for this event.
The filter that will return matching events for this event
event = new NDKEvent(ndk, { kind: 30000, pubkey: 'pubkey', tags: [ ["d", "d-code"] ] });
event.filter(); // { "#a": ["30000:pubkey:d-code"] }
event = new NDKEvent(ndk, { kind: 1, pubkey: 'pubkey', id: "eventid" });
event.filter(); // { "#e": ["eventid"] }
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
event = new NDKEvent(ndk, { kind: 30000, pubkey: 'pubkey', tags: [ ["d", "d-code"] ] });
event.referenceTags(); // [["a", "30000:pubkey:d-code"], ["e", "parent-id"]]
event = new NDKEvent(ndk, { kind: 1, pubkey: 'pubkey', id: "eventid" });
event.referenceTags(); // [["e", "parent-id"]]
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.
The user to tag.
Optional
marker: stringThe marker to use in the tag.
Tag a user with an optional marker.
The user to tag.
Optional
marker: stringThe marker to use in the tag.
Tag a user with an optional marker.
The event to tag.
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.
reply.tag(opEvent, "reply");
// reply.tags => [["e", <id>, <relay>, "reply"]]
Get the tag that can be used to reference this event from another event.
Consider using referenceTags() instead (unless you have a good reason to use this)
Optional
marker: stringThe NDKTag object referencing this event
event = new NDKEvent(ndk, { kind: 30000, pubkey: 'pubkey', tags: [ ["d", "d-code"] ] });
event.tagReference(); // ["a", "30000:pubkey:d-code"]
event = new NDKEvent(ndk, { kind: 1, pubkey: 'pubkey', id: "eventid" });
event.tagReference(); // ["e", "eventid"]
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
fromGenerated using TypeDoc
This event is published by Data Vending Machines when they have finished processing a job.