Helpers
applesauce-core
comes with a bunch of methods to get data from events
WARNING
Some helper methods my throw errors. so make sure to have error handling and use the isValid*
helpers to filter out invalid events
Events
isEvent
Checks if an object is a nostr eventmarkFromCache
Marks an event as being from the cacheisFromCache
Checks if an event is marked from cachegetTagValue
Gets the value of the first tag matching the namegetIndexableTags
Get aSet
of all indexable tags on the event
Profiles
getProfileContent
Returns the parsed profile content for a kind 0 eventisValidProfile
Checks if the content of the kind 0 event is valid JSON
Mailboxes
getInboxes
Gets the inbox relays from a10002
eventgetOutboxes
Gets the outbox relays from a10002
event
Event relays
addSeenRelay
Adds a relay to the list of relay the event was seen ongetSeenRelays
Get the list of relays this event was seen on
Zaps
isValidZap
Checks if an event is a valid zap and can be parsedgetZapSender
Gets the senders pubkeygetZapRecipient
Gets the pubkey of the user who received the zapgetZapPayment
Gets the parsed bolt11 invoicegetZapAddressPointer
Gets the address pointer of the zapgetZapEventPointer
Gets the event pointer of the zapgetZapRequest
Gets the zap request event inside the zap event
Lightning
parseBolt11
Parses a bolt11 lightning invoiceparseLNURLOrAddress
Parses a LNURL or lightning address into a LNURLp
Pointers
getEventPointerFromTag
Creates anEventPointer
from a standard "e" taggetAddressPointerFromTag
Creates anAddressPointer
from a standard "a" taggetProfilePointerFromTag
Creates anProfilePointer
from a standard "p" tag
Delete events
getDeleteIds
Gets a list of referenced event idsgetDeleteCoordinates
Get the list of replaceable event coordinates the event is referencingcreateDeleteEvent
Creates a draft delete event for a list of events
Emojis
getPackName
Gets the emoji pack namegetEmojis
Get all emojis in an emoji packgetEmojiTag
CGets an "emoji" tag that matches an emoji code
URLs
getURLFilename
returns the filename part fo the path in a URLisAudioURL
Checks if the URL ends with a audio file extensionisVideoURL
Checks if the URL ends with a video file extensionisImageURL
Checks if the URL ends with a image file extensionisStreamURL
Checks if the URL ends with a stream file extension
Tags
isETag
Checks if tag is an "e" tag and has at least one valueisATag
Checks if tag is an "a" tag and has at least one valueisPTag
Checks if tag is an "p" tag and has at least one valueisDTag
Checks if tag is an "d" tag and has at least one valueisRTag
Checks if tag is an "r" tag and has at least one valueisTTag
Checks if tag is an "t" tag and has at least one value
Hidden Tags
Hidden tags are used in NIP-51 lists and NIP-60 wallets
canHaveHiddenTags
Checks if a given event kind can have hidden tagshasHiddenTags
Checks if an event has hidden tagsgetHiddenTags
Returns the hidden tags for an event if they are unlockedisHiddenTagsLocked
Checks if the hidden tags are lockedunlockHiddenTags
Unlocks the hidden tags using asigner
overrideHiddenTags
Replaces an events hidden tagsmodifyEventTags
Modifies an events public or hidden tags
Filters
isFilterEqual
Check if two filters are equal
Time
unixNow
Returns the current unix timestamp