UNPKG

nostr-tools

Version:
393 lines (392 loc) 19.3 kB
import { NostrEvent } from './pure.ts'; /** Events are **regular**, which means they're all expected to be stored by relays. */ export declare function isRegularKind(kind: number): boolean; /** Events are **replaceable**, which means that, for each combination of `pubkey` and `kind`, only the latest event is expected to (SHOULD) be stored by relays, older versions are expected to be discarded. */ export declare function isReplaceableKind(kind: number): boolean; /** Events are **ephemeral**, which means they are not expected to be stored by relays. */ export declare function isEphemeralKind(kind: number): boolean; /** Events are **addressable**, which means that, for each combination of `pubkey`, `kind` and the `d` tag, only the latest event is expected to be stored by relays, older versions are expected to be discarded. */ export declare function isAddressableKind(kind: number): boolean; /** Classification of the event kind. */ export type KindClassification = 'regular' | 'replaceable' | 'ephemeral' | 'parameterized' | 'unknown'; /** Determine the classification of this kind of event if known, or `unknown`. */ export declare function classifyKind(kind: number): KindClassification; export declare function isKind<T extends number>(event: unknown, kind: T | Array<T>): event is NostrEvent & { kind: T; }; export declare const Metadata = 0; export type Metadata = typeof Metadata; export declare const ShortTextNote = 1; export type ShortTextNote = typeof ShortTextNote; export declare const RecommendRelay = 2; export type RecommendRelay = typeof RecommendRelay; export declare const Contacts = 3; export type Contacts = typeof Contacts; export declare const EncryptedDirectMessage = 4; export type EncryptedDirectMessage = typeof EncryptedDirectMessage; export declare const EventDeletion = 5; export type EventDeletion = typeof EventDeletion; export declare const Repost = 6; export type Repost = typeof Repost; export declare const Reaction = 7; export type Reaction = typeof Reaction; export declare const BadgeAward = 8; export type BadgeAward = typeof BadgeAward; export declare const ChatMessage = 9; export type ChatMessage = typeof ChatMessage; export declare const SimpleGroupThreadedReply = 10; export type SimpleGroupThreadedReply = typeof SimpleGroupThreadedReply; export declare const ForumThread = 11; export type ForumThread = typeof ForumThread; export declare const SimpleGroupReply = 12; export type SimpleGroupReply = typeof SimpleGroupReply; export declare const Seal = 13; export type Seal = typeof Seal; export declare const PrivateDirectMessage = 14; export type PrivateDirectMessage = typeof PrivateDirectMessage; export declare const FileMessage = 15; export type FileMessage = typeof FileMessage; export declare const GenericRepost = 16; export type GenericRepost = typeof GenericRepost; export declare const ReactionToWebsite = 17; export type ReactionToWebsite = typeof ReactionToWebsite; export declare const Photo = 20; export type Photo = typeof Photo; export declare const NormalVideo = 21; export type NormalVideo = typeof NormalVideo; export declare const ShortVideo = 22; export type ShortVideo = typeof ShortVideo; export declare const PublicMessage = 24; export type PublicMessage = typeof PublicMessage; export declare const ChannelCreation = 40; export type ChannelCreation = typeof ChannelCreation; export declare const ChannelMetadata = 41; export type ChannelMetadata = typeof ChannelMetadata; export declare const ChannelMessage = 42; export type ChannelMessage = typeof ChannelMessage; export declare const ChannelHideMessage = 43; export type ChannelHideMessage = typeof ChannelHideMessage; export declare const ChannelMuteUser = 44; export type ChannelMuteUser = typeof ChannelMuteUser; export declare const PodcastEpisode = 54; export type PodcastEpisode = typeof PodcastEpisode; export declare const Chess = 64; export type Chess = typeof Chess; export declare const MergeRequests = 818; export type MergeRequests = typeof MergeRequests; export declare const PollResponse = 1018; export type PollResponse = typeof PollResponse; export declare const Bid = 1021; export type Bid = typeof Bid; export declare const BidConfirmation = 1022; export type BidConfirmation = typeof BidConfirmation; export declare const OpenTimestamps = 1040; export type OpenTimestamps = typeof OpenTimestamps; export declare const GiftWrap = 1059; export type GiftWrap = typeof GiftWrap; export declare const FileMetadata = 1063; export type FileMetadata = typeof FileMetadata; export declare const Poll = 1068; export type Poll = typeof Poll; export declare const Comment = 1111; export type Comment = typeof Comment; export declare const Voice = 1222; export type Voice = typeof Voice; export declare const Scroll = 1227; export type Scroll = typeof Scroll; export declare const VoiceComment = 1244; export type VoiceComment = typeof VoiceComment; export declare const LiveChatMessage = 1311; export type LiveChatMessage = typeof LiveChatMessage; export declare const CodeSnippet = 1337; export type CodeSnippet = typeof CodeSnippet; export declare const Patch = 1617; export type Patch = typeof Patch; export declare const GitPullRequest = 1618; export type GitPullRequest = typeof GitPullRequest; export declare const GitPullRequestUpdate = 1619; export type GitPullRequestUpdate = typeof GitPullRequestUpdate; export declare const Issue = 1621; export type Issue = typeof Issue; export declare const Reply = 1622; export type Reply = typeof Reply; export declare const StatusOpen = 1630; export type StatusOpen = typeof StatusOpen; export declare const StatusApplied = 1631; export type StatusApplied = typeof StatusApplied; export declare const StatusClosed = 1632; export type StatusClosed = typeof StatusClosed; export declare const StatusDraft = 1633; export type StatusDraft = typeof StatusDraft; export declare const ProblemTracker = 1971; export type ProblemTracker = typeof ProblemTracker; export declare const Report = 1984; export type Report = typeof Report; export declare const Reporting = 1984; export type Reporting = typeof Reporting; export declare const Label = 1985; export type Label = typeof Label; export declare const RelayReviews = 1986; export type RelayReviews = typeof RelayReviews; export declare const AIEmbeddings = 1987; export type AIEmbeddings = typeof AIEmbeddings; export declare const Torrent = 2003; export type Torrent = typeof Torrent; export declare const TorrentComment = 2004; export type TorrentComment = typeof TorrentComment; export declare const CoinjoinPool = 2022; export type CoinjoinPool = typeof CoinjoinPool; export declare const DecoupledKeyClientAnnouncement = 4454; export type DecoupledKeyClientAnnouncement = typeof DecoupledKeyClientAnnouncement; export declare const DecoupledEncryptionKeyDistribution = 4455; export type DecoupledEncryptionKeyDistribution = typeof DecoupledEncryptionKeyDistribution; export declare const CommunityPostApproval = 4550; export type CommunityPostApproval = typeof CommunityPostApproval; export declare const JobRequest = 5999; export type JobRequest = typeof JobRequest; export declare const JobResult = 6999; export type JobResult = typeof JobResult; export declare const JobFeedback = 7000; export type JobFeedback = typeof JobFeedback; export declare const ReservedCashuWalletTokens = 7374; export type ReservedCashuWalletTokens = typeof ReservedCashuWalletTokens; export declare const CashuWalletTokens = 7375; export type CashuWalletTokens = typeof CashuWalletTokens; export declare const CashuWalletHistory = 7376; export type CashuWalletHistory = typeof CashuWalletHistory; export declare const GeocacheLog = 7516; export type GeocacheLog = typeof GeocacheLog; export declare const GeocacheProofOfFind = 7517; export type GeocacheProofOfFind = typeof GeocacheProofOfFind; export declare const SimpleGroupPutUser = 9000; export type SimpleGroupPutUser = typeof SimpleGroupPutUser; export declare const SimpleGroupRemoveUser = 9001; export type SimpleGroupRemoveUser = typeof SimpleGroupRemoveUser; export declare const SimpleGroupEditMetadata = 9002; export type SimpleGroupEditMetadata = typeof SimpleGroupEditMetadata; export declare const SimpleGroupDeleteEvent = 9005; export type SimpleGroupDeleteEvent = typeof SimpleGroupDeleteEvent; export declare const SimpleGroupCreateGroup = 9007; export type SimpleGroupCreateGroup = typeof SimpleGroupCreateGroup; export declare const SimpleGroupDeleteGroup = 9008; export type SimpleGroupDeleteGroup = typeof SimpleGroupDeleteGroup; export declare const SimpleGroupCreateInvite = 9009; export type SimpleGroupCreateInvite = typeof SimpleGroupCreateInvite; export declare const SimpleGroupJoinRequest = 9021; export type SimpleGroupJoinRequest = typeof SimpleGroupJoinRequest; export declare const SimpleGroupLeaveRequest = 9022; export type SimpleGroupLeaveRequest = typeof SimpleGroupLeaveRequest; export declare const ZapGoal = 9041; export type ZapGoal = typeof ZapGoal; export declare const NutZap = 9321; export type NutZap = typeof NutZap; export declare const TidalLogin = 9467; export type TidalLogin = typeof TidalLogin; export declare const ZapRequest = 9734; export type ZapRequest = typeof ZapRequest; export declare const Zap = 9735; export type Zap = typeof Zap; export declare const Highlights = 9802; export type Highlights = typeof Highlights; export declare const Mutelist = 10000; export type Mutelist = typeof Mutelist; export declare const Pinlist = 10001; export type Pinlist = typeof Pinlist; export declare const RelayList = 10002; export type RelayList = typeof RelayList; export declare const BookmarkList = 10003; export type BookmarkList = typeof BookmarkList; export declare const CommunitiesList = 10004; export type CommunitiesList = typeof CommunitiesList; export declare const PublicChatsList = 10005; export type PublicChatsList = typeof PublicChatsList; export declare const BlockedRelaysList = 10006; export type BlockedRelaysList = typeof BlockedRelaysList; export declare const SearchRelaysList = 10007; export type SearchRelaysList = typeof SearchRelaysList; export declare const SimpleGroupList = 10009; export type SimpleGroupList = typeof SimpleGroupList; export declare const FavoriteRelays = 10012; export type FavoriteRelays = typeof FavoriteRelays; export declare const PrivateEventRelayList = 10013; export type PrivateEventRelayList = typeof PrivateEventRelayList; export declare const InterestsList = 10015; export type InterestsList = typeof InterestsList; export declare const NutZapInfo = 10019; export type NutZapInfo = typeof NutZapInfo; export declare const MediaFollows = 10020; export type MediaFollows = typeof MediaFollows; export declare const UserEmojiList = 10030; export type UserEmojiList = typeof UserEmojiList; export declare const DecoupledKeyAnnouncement = 10044; export type DecoupledKeyAnnouncement = typeof DecoupledKeyAnnouncement; export declare const DirectMessageRelaysList = 10050; export type DirectMessageRelaysList = typeof DirectMessageRelaysList; export declare const FavoritePodcasts = 10054; export type FavoritePodcasts = typeof FavoritePodcasts; export declare const BlossomServerList = 10063; export type BlossomServerList = typeof BlossomServerList; export declare const FileServerPreference = 10096; export type FileServerPreference = typeof FileServerPreference; export declare const GoodWikiAuthorList = 10101; export type GoodWikiAuthorList = typeof GoodWikiAuthorList; export declare const GoodWikiRelayList = 10102; export type GoodWikiRelayList = typeof GoodWikiRelayList; export declare const PodcastMetadata = 10154; export type PodcastMetadata = typeof PodcastMetadata; export declare const AuthoredPodcasts = 10164; export type AuthoredPodcasts = typeof AuthoredPodcasts; export declare const RelayMonitorAnnouncement = 10166; export type RelayMonitorAnnouncement = typeof RelayMonitorAnnouncement; export declare const RoomPresence = 10312; export type RoomPresence = typeof RoomPresence; export declare const UserGraspList = 10317; export type UserGraspList = typeof UserGraspList; export declare const ProxyAnnouncement = 10377; export type ProxyAnnouncement = typeof ProxyAnnouncement; export declare const TransportMethodAnnouncement = 11111; export type TransportMethodAnnouncement = typeof TransportMethodAnnouncement; export declare const NWCWalletInfo = 13194; export type NWCWalletInfo = typeof NWCWalletInfo; export declare const NsiteRoot = 15128; export type NsiteRoot = typeof NsiteRoot; export declare const CashuWalletEvent = 17375; export type CashuWalletEvent = typeof CashuWalletEvent; export declare const LightningPubRPC = 21000; export type LightningPubRPC = typeof LightningPubRPC; export declare const ClientAuth = 22242; export type ClientAuth = typeof ClientAuth; export declare const NWCWalletRequest = 23194; export type NWCWalletRequest = typeof NWCWalletRequest; export declare const NWCWalletResponse = 23195; export type NWCWalletResponse = typeof NWCWalletResponse; export declare const NostrConnect = 24133; export type NostrConnect = typeof NostrConnect; export declare const BlobsAuth = 24242; export type BlobsAuth = typeof BlobsAuth; export declare const HTTPAuth = 27235; export type HTTPAuth = typeof HTTPAuth; export declare const Followsets = 30000; export type Followsets = typeof Followsets; export declare const Genericlists = 30001; export type Genericlists = typeof Genericlists; export declare const Relaysets = 30002; export type Relaysets = typeof Relaysets; export declare const Bookmarksets = 30003; export type Bookmarksets = typeof Bookmarksets; export declare const Curationsets = 30004; export type Curationsets = typeof Curationsets; export declare const CuratedVideoSets = 30005; export type CuratedVideoSets = typeof CuratedVideoSets; export declare const MuteSets = 30007; export type MuteSets = typeof MuteSets; export declare const ProfileBadges = 30008; export type ProfileBadges = typeof ProfileBadges; export declare const BadgeDefinition = 30009; export type BadgeDefinition = typeof BadgeDefinition; export declare const Interestsets = 30015; export type Interestsets = typeof Interestsets; export declare const CreateOrUpdateStall = 30017; export type CreateOrUpdateStall = typeof CreateOrUpdateStall; export declare const CreateOrUpdateProduct = 30018; export type CreateOrUpdateProduct = typeof CreateOrUpdateProduct; export declare const MarketplaceUI = 30019; export type MarketplaceUI = typeof MarketplaceUI; export declare const ProductSoldAsAuction = 30020; export type ProductSoldAsAuction = typeof ProductSoldAsAuction; export declare const LongFormArticle = 30023; export type LongFormArticle = typeof LongFormArticle; export declare const DraftLong = 30024; export type DraftLong = typeof DraftLong; export declare const Emojisets = 30030; export type Emojisets = typeof Emojisets; export declare const ModularArticleHeader = 30040; export type ModularArticleHeader = typeof ModularArticleHeader; export declare const ModularArticleContent = 30041; export type ModularArticleContent = typeof ModularArticleContent; export declare const ReleaseArtifactSets = 30063; export type ReleaseArtifactSets = typeof ReleaseArtifactSets; export declare const Application = 30078; export type Application = typeof Application; export declare const RelayDiscovery = 30166; export type RelayDiscovery = typeof RelayDiscovery; export declare const AppCurationSet = 30267; export type AppCurationSet = typeof AppCurationSet; export declare const LiveEvent = 30311; export type LiveEvent = typeof LiveEvent; export declare const InteractiveRoom = 30312; export type InteractiveRoom = typeof InteractiveRoom; export declare const ConferenceEvent = 30313; export type ConferenceEvent = typeof ConferenceEvent; export declare const UserStatuses = 30315; export type UserStatuses = typeof UserStatuses; export declare const SlideSet = 30388; export type SlideSet = typeof SlideSet; export declare const ClassifiedListing = 30402; export type ClassifiedListing = typeof ClassifiedListing; export declare const DraftClassifiedListing = 30403; export type DraftClassifiedListing = typeof DraftClassifiedListing; export declare const RepositoryAnnouncement = 30617; export type RepositoryAnnouncement = typeof RepositoryAnnouncement; export declare const RepositoryState = 30618; export type RepositoryState = typeof RepositoryState; export declare const WikiArticle = 30818; export type WikiArticle = typeof WikiArticle; export declare const Redirects = 30819; export type Redirects = typeof Redirects; export declare const DraftEvent = 31234; export type DraftEvent = typeof DraftEvent; export declare const LinkSet = 31388; export type LinkSet = typeof LinkSet; export declare const Feed = 31890; export type Feed = typeof Feed; export declare const Date = 31922; export type Date = typeof Date; export declare const Time = 31923; export type Time = typeof Time; export declare const Calendar = 31924; export type Calendar = typeof Calendar; export declare const CalendarEventRSVP = 31925; export type CalendarEventRSVP = typeof CalendarEventRSVP; export declare const RelayReview = 31987; export type RelayReview = typeof RelayReview; export declare const Handlerrecommendation = 31989; export type Handlerrecommendation = typeof Handlerrecommendation; export declare const Handlerinformation = 31990; export type Handlerinformation = typeof Handlerinformation; export declare const SoftwareApplication = 32267; export type SoftwareApplication = typeof SoftwareApplication; export declare const LegacyNsiteFile = 34128; export type LegacyNsiteFile = typeof LegacyNsiteFile; export declare const VideoViewEvent = 34237; export type VideoViewEvent = typeof VideoViewEvent; export declare const CommunityDefinition = 34550; export type CommunityDefinition = typeof CommunityDefinition; export declare const NsiteNamed = 35128; export type NsiteNamed = typeof NsiteNamed; export declare const GeocacheListing = 37515; export type GeocacheListing = typeof GeocacheListing; export declare const GeocacheLogEntry = 37516; export type GeocacheLogEntry = typeof GeocacheLogEntry; export declare const CashuMintAnnouncement = 38172; export type CashuMintAnnouncement = typeof CashuMintAnnouncement; export declare const FedimintAnnouncement = 38173; export type FedimintAnnouncement = typeof FedimintAnnouncement; export declare const PeerToPeerOrderEvents = 38383; export type PeerToPeerOrderEvents = typeof PeerToPeerOrderEvents; export declare const GroupMetadata = 39000; export type GroupMetadata = typeof GroupMetadata; export declare const SimpleGroupAdmins = 39001; export type SimpleGroupAdmins = typeof SimpleGroupAdmins; export declare const SimpleGroupMembers = 39002; export type SimpleGroupMembers = typeof SimpleGroupMembers; export declare const SimpleGroupRoles = 39003; export type SimpleGroupRoles = typeof SimpleGroupRoles; export declare const SimpleGroupLiveKitParticipants = 39004; export type SimpleGroupLiveKitParticipants = typeof SimpleGroupLiveKitParticipants; export declare const StarterPacks = 39089; export type StarterPacks = typeof StarterPacks; export declare const MediaStarterPacks = 39092; export type MediaStarterPacks = typeof MediaStarterPacks; export declare const WebBookmarks = 39701; export type WebBookmarks = typeof WebBookmarks;