Optional
rawEvent: NDKEvent | 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
signatureStatic
kindStatic
kindsGets 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.
Returns the amount for this tier
Gets the NIP-33 "d" tag of the event.
Sets the NIP-33 "d" tag of the event.
Getter for the article image.
Setter for the article image.
The image to set for the article.
Checks if this tier is valid
Returns perks for this tier
Getter for the article's publication timestamp.
Setter for the article's publication timestamp.
The Unix timestamp to set for the article's publication date.
Sets a relay where content related to this tier can be found
URL of the relay
Returns the relay URLs for this tier
Getter for the article title.
Setter for the article title.
The title to set for the article.
Getter for the article's URL.
Setter for the article's URL.
The URL to set for the article.
Gets the verifier pubkey for this tier. This is the pubkey that will generate subscription payment receipts
Sets the verifier pubkey for this tier.
Adds an amount to this tier
Amount in the smallest unit of the currency (e.g. cents, msats)
Currency code. Use msat for millisatoshis
One of daily, weekly, monthly, quarterly, yearly
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
fromCreates a new NDKSubscriptionTier from an event
NDKSubscriptionTier
Description
Implements NIP-88 (TBD)'s subscription tiers
This class will validate that incoming events are valid subscription tiers. Incomplete or invalid amounts will be ignored.
Example