Optional
ndk: defaultOptional
event: NostrEventOptional
created_Encodes a bech32 id.
Rest
...args: []Rest
...args: []Rest
...args: []Rest
...args: []Optional
kindOptional
ndkThe relays that this event was received from and/or successfully published to.
The relay that this event was first received from.
Optional
sigGets 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.
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: numberA promise that resolves to the relays the event was published to.
Returns 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: booleanThe 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.
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.
Create a zap request for an existing event
The amount to zap in millisatoshis
Optional
comment: stringA comment to add to the zap request
Optional
extraTags: NDKTag[]Extra tags to add to the zap request
Optional
recipient: NDKUserThe zap recipient (optional for events)
Optional
signer: NDKSignerThe signer to use (will default to the NDK instance's signer)
Generated using TypeDoc
NDKEvent is the basic building block of NDK; most things you do with NDK will revolve around writing or consuming NDKEvents.