nostr-tools 2.23.8 → 2.23.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/abstract-pool.js +128 -4
- package/lib/cjs/abstract-pool.js.map +4 -4
- package/lib/cjs/abstract-relay.js +29 -4
- package/lib/cjs/abstract-relay.js.map +2 -2
- package/lib/cjs/filter.js.map +1 -1
- package/lib/cjs/index.js +377 -61
- package/lib/cjs/index.js.map +4 -4
- package/lib/cjs/kinds.js +196 -4
- package/lib/cjs/kinds.js.map +2 -2
- package/lib/cjs/nip17.js.map +2 -2
- package/lib/cjs/nip18.js.map +2 -2
- package/lib/cjs/nip25.js.map +1 -1
- package/lib/cjs/nip28.js.map +2 -2
- package/lib/cjs/nip42.js.map +2 -2
- package/lib/cjs/nip45.js +183 -0
- package/lib/cjs/nip45.js.map +7 -0
- package/lib/cjs/nip46.js +128 -4
- package/lib/cjs/nip46.js.map +4 -4
- package/lib/cjs/nip47.js.map +2 -2
- package/lib/cjs/nip57.js.map +1 -1
- package/lib/cjs/nip58.js.map +2 -2
- package/lib/cjs/nip59.js.map +2 -2
- package/lib/cjs/nip75.js.map +2 -2
- package/lib/cjs/nip94.js.map +2 -2
- package/lib/cjs/nip98.js.map +2 -2
- package/lib/cjs/nip99.js.map +2 -2
- package/lib/cjs/nipb0.js +1064 -0
- package/lib/cjs/nipb0.js.map +7 -0
- package/lib/cjs/pool.js +128 -4
- package/lib/cjs/pool.js.map +4 -4
- package/lib/cjs/relay.js +29 -4
- package/lib/cjs/relay.js.map +2 -2
- package/lib/esm/abstract-pool.js +128 -4
- package/lib/esm/abstract-pool.js.map +4 -4
- package/lib/esm/abstract-relay.js +29 -4
- package/lib/esm/abstract-relay.js.map +2 -2
- package/lib/esm/filter.js.map +1 -1
- package/lib/esm/index.js +353 -37
- package/lib/esm/index.js.map +4 -4
- package/lib/esm/kinds.js +196 -4
- package/lib/esm/kinds.js.map +2 -2
- package/lib/esm/nip17.js.map +2 -2
- package/lib/esm/nip18.js.map +2 -2
- package/lib/esm/nip25.js.map +1 -1
- package/lib/esm/nip28.js.map +2 -2
- package/lib/esm/nip42.js.map +2 -2
- package/lib/esm/nip45.js +162 -0
- package/lib/esm/nip45.js.map +7 -0
- package/lib/esm/nip46.js +128 -4
- package/lib/esm/nip46.js.map +4 -4
- package/lib/esm/nip47.js.map +2 -2
- package/lib/esm/nip57.js.map +1 -1
- package/lib/esm/nip58.js.map +2 -2
- package/lib/esm/nip59.js.map +2 -2
- package/lib/esm/nip75.js.map +2 -2
- package/lib/esm/nip94.js.map +2 -2
- package/lib/esm/nip98.js.map +2 -2
- package/lib/esm/nip99.js.map +2 -2
- package/lib/esm/nipb0.js +1049 -0
- package/lib/esm/nipb0.js.map +7 -0
- package/lib/esm/pool.js +128 -4
- package/lib/esm/pool.js.map +4 -4
- package/lib/esm/relay.js +29 -4
- package/lib/esm/relay.js.map +2 -2
- package/lib/nostr.bundle.js +326 -12
- package/lib/nostr.bundle.js.map +4 -4
- package/lib/types/abstract-pool.d.ts +9 -0
- package/lib/types/abstract-relay.d.ts +10 -1
- package/lib/types/kinds.d.ts +200 -8
- package/lib/types/nip45.d.ts +13 -0
- package/lib/types/nip45.test.d.ts +1 -0
- package/lib/types/nipb0.d.ts +129 -0
- package/package.json +13 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AbstractRelay as AbstractRelay, SubscriptionParams, type AbstractRelayConstructorOptions } from './abstract-relay.ts';
|
|
2
2
|
import type { Event, EventTemplate, Nostr, VerifiedEvent } from './core.ts';
|
|
3
3
|
import { type Filter } from './filter.ts';
|
|
4
|
+
import { type CountManyDirective } from './nip45.ts';
|
|
4
5
|
export type SubCloser = {
|
|
5
6
|
close: (reason?: string) => void;
|
|
6
7
|
};
|
|
@@ -49,6 +50,14 @@ export declare class AbstractSimplePool {
|
|
|
49
50
|
subscribeManyEose(relays: string[], filter: Filter, params: Pick<SubscribeManyParams, 'label' | 'id' | 'onevent' | 'oninvalidevent' | 'onclose' | 'maxWait' | 'onauth'>): SubCloser;
|
|
50
51
|
querySync(relays: string[], filter: Filter, params?: Pick<SubscribeManyParams, 'label' | 'id' | 'maxWait'>): Promise<Event[]>;
|
|
51
52
|
get(relays: string[], filter: Filter, params?: Pick<SubscribeManyParams, 'label' | 'id' | 'maxWait'>): Promise<Event | null>;
|
|
53
|
+
countMany(relays: string[], target: string, directive: CountManyDirective, params?: {
|
|
54
|
+
id?: string | null;
|
|
55
|
+
maxWait?: number;
|
|
56
|
+
abort?: AbortSignal;
|
|
57
|
+
}): Promise<{
|
|
58
|
+
count: number;
|
|
59
|
+
hll?: string;
|
|
60
|
+
}>;
|
|
52
61
|
publish(relays: string[], event: Event, params?: {
|
|
53
62
|
onauth?: (evt: EventTemplate) => Promise<VerifiedEvent>;
|
|
54
63
|
maxWait?: number;
|
|
@@ -57,6 +57,12 @@ export declare class AbstractRelay {
|
|
|
57
57
|
count(filters: Filter[], params: {
|
|
58
58
|
id?: string | null;
|
|
59
59
|
}): Promise<number>;
|
|
60
|
+
countWithHLL(filters: Filter[], params: {
|
|
61
|
+
id?: string | null;
|
|
62
|
+
}): Promise<{
|
|
63
|
+
count: number;
|
|
64
|
+
hll?: string;
|
|
65
|
+
}>;
|
|
60
66
|
subscribe(filters: Filter[], params: Partial<SubscriptionParams> & {
|
|
61
67
|
label?: string;
|
|
62
68
|
id?: string;
|
|
@@ -100,7 +106,10 @@ export type SubscriptionParams = {
|
|
|
100
106
|
abort?: AbortSignal;
|
|
101
107
|
};
|
|
102
108
|
export type CountResolver = {
|
|
103
|
-
resolve: (
|
|
109
|
+
resolve: (payload: {
|
|
110
|
+
count: number;
|
|
111
|
+
hll?: string;
|
|
112
|
+
}) => void;
|
|
104
113
|
reject: (err: Error) => void;
|
|
105
114
|
};
|
|
106
115
|
export type EventPublishResolver = {
|
package/lib/types/kinds.d.ts
CHANGED
|
@@ -34,8 +34,12 @@ export declare const BadgeAward = 8;
|
|
|
34
34
|
export type BadgeAward = typeof BadgeAward;
|
|
35
35
|
export declare const ChatMessage = 9;
|
|
36
36
|
export type ChatMessage = typeof ChatMessage;
|
|
37
|
+
export declare const SimpleGroupThreadedReply = 10;
|
|
38
|
+
export type SimpleGroupThreadedReply = typeof SimpleGroupThreadedReply;
|
|
37
39
|
export declare const ForumThread = 11;
|
|
38
40
|
export type ForumThread = typeof ForumThread;
|
|
41
|
+
export declare const SimpleGroupReply = 12;
|
|
42
|
+
export type SimpleGroupReply = typeof SimpleGroupReply;
|
|
39
43
|
export declare const Seal = 13;
|
|
40
44
|
export type Seal = typeof Seal;
|
|
41
45
|
export declare const PrivateDirectMessage = 14;
|
|
@@ -44,12 +48,16 @@ export declare const FileMessage = 15;
|
|
|
44
48
|
export type FileMessage = typeof FileMessage;
|
|
45
49
|
export declare const GenericRepost = 16;
|
|
46
50
|
export type GenericRepost = typeof GenericRepost;
|
|
51
|
+
export declare const ReactionToWebsite = 17;
|
|
52
|
+
export type ReactionToWebsite = typeof ReactionToWebsite;
|
|
47
53
|
export declare const Photo = 20;
|
|
48
54
|
export type Photo = typeof Photo;
|
|
49
55
|
export declare const NormalVideo = 21;
|
|
50
56
|
export type NormalVideo = typeof NormalVideo;
|
|
51
57
|
export declare const ShortVideo = 22;
|
|
52
58
|
export type ShortVideo = typeof ShortVideo;
|
|
59
|
+
export declare const PublicMessage = 24;
|
|
60
|
+
export type PublicMessage = typeof PublicMessage;
|
|
53
61
|
export declare const ChannelCreation = 40;
|
|
54
62
|
export type ChannelCreation = typeof ChannelCreation;
|
|
55
63
|
export declare const ChannelMetadata = 41;
|
|
@@ -60,22 +68,56 @@ export declare const ChannelHideMessage = 43;
|
|
|
60
68
|
export type ChannelHideMessage = typeof ChannelHideMessage;
|
|
61
69
|
export declare const ChannelMuteUser = 44;
|
|
62
70
|
export type ChannelMuteUser = typeof ChannelMuteUser;
|
|
71
|
+
export declare const PodcastEpisode = 54;
|
|
72
|
+
export type PodcastEpisode = typeof PodcastEpisode;
|
|
73
|
+
export declare const Chess = 64;
|
|
74
|
+
export type Chess = typeof Chess;
|
|
75
|
+
export declare const MergeRequests = 818;
|
|
76
|
+
export type MergeRequests = typeof MergeRequests;
|
|
77
|
+
export declare const PollResponse = 1018;
|
|
78
|
+
export type PollResponse = typeof PollResponse;
|
|
79
|
+
export declare const Bid = 1021;
|
|
80
|
+
export type Bid = typeof Bid;
|
|
81
|
+
export declare const BidConfirmation = 1022;
|
|
82
|
+
export type BidConfirmation = typeof BidConfirmation;
|
|
63
83
|
export declare const OpenTimestamps = 1040;
|
|
64
84
|
export type OpenTimestamps = typeof OpenTimestamps;
|
|
65
85
|
export declare const GiftWrap = 1059;
|
|
66
86
|
export type GiftWrap = typeof GiftWrap;
|
|
67
|
-
export declare const Poll = 1068;
|
|
68
|
-
export type Poll = typeof Poll;
|
|
69
87
|
export declare const FileMetadata = 1063;
|
|
70
88
|
export type FileMetadata = typeof FileMetadata;
|
|
89
|
+
export declare const Poll = 1068;
|
|
90
|
+
export type Poll = typeof Poll;
|
|
71
91
|
export declare const Comment = 1111;
|
|
72
92
|
export type Comment = typeof Comment;
|
|
73
|
-
export declare const LiveChatMessage = 1311;
|
|
74
|
-
export type LiveChatMessage = typeof LiveChatMessage;
|
|
75
93
|
export declare const Voice = 1222;
|
|
76
94
|
export type Voice = typeof Voice;
|
|
95
|
+
export declare const Scroll = 1227;
|
|
96
|
+
export type Scroll = typeof Scroll;
|
|
77
97
|
export declare const VoiceComment = 1244;
|
|
78
98
|
export type VoiceComment = typeof VoiceComment;
|
|
99
|
+
export declare const LiveChatMessage = 1311;
|
|
100
|
+
export type LiveChatMessage = typeof LiveChatMessage;
|
|
101
|
+
export declare const CodeSnippet = 1337;
|
|
102
|
+
export type CodeSnippet = typeof CodeSnippet;
|
|
103
|
+
export declare const Patch = 1617;
|
|
104
|
+
export type Patch = typeof Patch;
|
|
105
|
+
export declare const GitPullRequest = 1618;
|
|
106
|
+
export type GitPullRequest = typeof GitPullRequest;
|
|
107
|
+
export declare const GitPullRequestUpdate = 1619;
|
|
108
|
+
export type GitPullRequestUpdate = typeof GitPullRequestUpdate;
|
|
109
|
+
export declare const Issue = 1621;
|
|
110
|
+
export type Issue = typeof Issue;
|
|
111
|
+
export declare const Reply = 1622;
|
|
112
|
+
export type Reply = typeof Reply;
|
|
113
|
+
export declare const StatusOpen = 1630;
|
|
114
|
+
export type StatusOpen = typeof StatusOpen;
|
|
115
|
+
export declare const StatusApplied = 1631;
|
|
116
|
+
export type StatusApplied = typeof StatusApplied;
|
|
117
|
+
export declare const StatusClosed = 1632;
|
|
118
|
+
export type StatusClosed = typeof StatusClosed;
|
|
119
|
+
export declare const StatusDraft = 1633;
|
|
120
|
+
export type StatusDraft = typeof StatusDraft;
|
|
79
121
|
export declare const ProblemTracker = 1971;
|
|
80
122
|
export type ProblemTracker = typeof ProblemTracker;
|
|
81
123
|
export declare const Report = 1984;
|
|
@@ -84,6 +126,20 @@ export declare const Reporting = 1984;
|
|
|
84
126
|
export type Reporting = typeof Reporting;
|
|
85
127
|
export declare const Label = 1985;
|
|
86
128
|
export type Label = typeof Label;
|
|
129
|
+
export declare const RelayReviews = 1986;
|
|
130
|
+
export type RelayReviews = typeof RelayReviews;
|
|
131
|
+
export declare const AIEmbeddings = 1987;
|
|
132
|
+
export type AIEmbeddings = typeof AIEmbeddings;
|
|
133
|
+
export declare const Torrent = 2003;
|
|
134
|
+
export type Torrent = typeof Torrent;
|
|
135
|
+
export declare const TorrentComment = 2004;
|
|
136
|
+
export type TorrentComment = typeof TorrentComment;
|
|
137
|
+
export declare const CoinjoinPool = 2022;
|
|
138
|
+
export type CoinjoinPool = typeof CoinjoinPool;
|
|
139
|
+
export declare const DecoupledKeyClientAnnouncement = 4454;
|
|
140
|
+
export type DecoupledKeyClientAnnouncement = typeof DecoupledKeyClientAnnouncement;
|
|
141
|
+
export declare const DecoupledEncryptionKeyDistribution = 4455;
|
|
142
|
+
export type DecoupledEncryptionKeyDistribution = typeof DecoupledEncryptionKeyDistribution;
|
|
87
143
|
export declare const CommunityPostApproval = 4550;
|
|
88
144
|
export type CommunityPostApproval = typeof CommunityPostApproval;
|
|
89
145
|
export declare const JobRequest = 5999;
|
|
@@ -92,16 +148,46 @@ export declare const JobResult = 6999;
|
|
|
92
148
|
export type JobResult = typeof JobResult;
|
|
93
149
|
export declare const JobFeedback = 7000;
|
|
94
150
|
export type JobFeedback = typeof JobFeedback;
|
|
151
|
+
export declare const ReservedCashuWalletTokens = 7374;
|
|
152
|
+
export type ReservedCashuWalletTokens = typeof ReservedCashuWalletTokens;
|
|
153
|
+
export declare const CashuWalletTokens = 7375;
|
|
154
|
+
export type CashuWalletTokens = typeof CashuWalletTokens;
|
|
155
|
+
export declare const CashuWalletHistory = 7376;
|
|
156
|
+
export type CashuWalletHistory = typeof CashuWalletHistory;
|
|
157
|
+
export declare const GeocacheLog = 7516;
|
|
158
|
+
export type GeocacheLog = typeof GeocacheLog;
|
|
159
|
+
export declare const GeocacheProofOfFind = 7517;
|
|
160
|
+
export type GeocacheProofOfFind = typeof GeocacheProofOfFind;
|
|
161
|
+
export declare const SimpleGroupPutUser = 9000;
|
|
162
|
+
export type SimpleGroupPutUser = typeof SimpleGroupPutUser;
|
|
163
|
+
export declare const SimpleGroupRemoveUser = 9001;
|
|
164
|
+
export type SimpleGroupRemoveUser = typeof SimpleGroupRemoveUser;
|
|
165
|
+
export declare const SimpleGroupEditMetadata = 9002;
|
|
166
|
+
export type SimpleGroupEditMetadata = typeof SimpleGroupEditMetadata;
|
|
167
|
+
export declare const SimpleGroupDeleteEvent = 9005;
|
|
168
|
+
export type SimpleGroupDeleteEvent = typeof SimpleGroupDeleteEvent;
|
|
169
|
+
export declare const SimpleGroupCreateGroup = 9007;
|
|
170
|
+
export type SimpleGroupCreateGroup = typeof SimpleGroupCreateGroup;
|
|
171
|
+
export declare const SimpleGroupDeleteGroup = 9008;
|
|
172
|
+
export type SimpleGroupDeleteGroup = typeof SimpleGroupDeleteGroup;
|
|
173
|
+
export declare const SimpleGroupCreateInvite = 9009;
|
|
174
|
+
export type SimpleGroupCreateInvite = typeof SimpleGroupCreateInvite;
|
|
175
|
+
export declare const SimpleGroupJoinRequest = 9021;
|
|
176
|
+
export type SimpleGroupJoinRequest = typeof SimpleGroupJoinRequest;
|
|
177
|
+
export declare const SimpleGroupLeaveRequest = 9022;
|
|
178
|
+
export type SimpleGroupLeaveRequest = typeof SimpleGroupLeaveRequest;
|
|
95
179
|
export declare const ZapGoal = 9041;
|
|
96
180
|
export type ZapGoal = typeof ZapGoal;
|
|
181
|
+
export declare const NutZap = 9321;
|
|
182
|
+
export type NutZap = typeof NutZap;
|
|
183
|
+
export declare const TidalLogin = 9467;
|
|
184
|
+
export type TidalLogin = typeof TidalLogin;
|
|
97
185
|
export declare const ZapRequest = 9734;
|
|
98
186
|
export type ZapRequest = typeof ZapRequest;
|
|
99
187
|
export declare const Zap = 9735;
|
|
100
188
|
export type Zap = typeof Zap;
|
|
101
189
|
export declare const Highlights = 9802;
|
|
102
190
|
export type Highlights = typeof Highlights;
|
|
103
|
-
export declare const PollResponse = 1018;
|
|
104
|
-
export type PollResponse = typeof PollResponse;
|
|
105
191
|
export declare const Mutelist = 10000;
|
|
106
192
|
export type Mutelist = typeof Mutelist;
|
|
107
193
|
export declare const Pinlist = 10001;
|
|
@@ -118,20 +204,54 @@ export declare const BlockedRelaysList = 10006;
|
|
|
118
204
|
export type BlockedRelaysList = typeof BlockedRelaysList;
|
|
119
205
|
export declare const SearchRelaysList = 10007;
|
|
120
206
|
export type SearchRelaysList = typeof SearchRelaysList;
|
|
207
|
+
export declare const SimpleGroupList = 10009;
|
|
208
|
+
export type SimpleGroupList = typeof SimpleGroupList;
|
|
121
209
|
export declare const FavoriteRelays = 10012;
|
|
122
210
|
export type FavoriteRelays = typeof FavoriteRelays;
|
|
211
|
+
export declare const PrivateEventRelayList = 10013;
|
|
212
|
+
export type PrivateEventRelayList = typeof PrivateEventRelayList;
|
|
123
213
|
export declare const InterestsList = 10015;
|
|
124
214
|
export type InterestsList = typeof InterestsList;
|
|
215
|
+
export declare const NutZapInfo = 10019;
|
|
216
|
+
export type NutZapInfo = typeof NutZapInfo;
|
|
217
|
+
export declare const MediaFollows = 10020;
|
|
218
|
+
export type MediaFollows = typeof MediaFollows;
|
|
125
219
|
export declare const UserEmojiList = 10030;
|
|
126
220
|
export type UserEmojiList = typeof UserEmojiList;
|
|
221
|
+
export declare const DecoupledKeyAnnouncement = 10044;
|
|
222
|
+
export type DecoupledKeyAnnouncement = typeof DecoupledKeyAnnouncement;
|
|
127
223
|
export declare const DirectMessageRelaysList = 10050;
|
|
128
224
|
export type DirectMessageRelaysList = typeof DirectMessageRelaysList;
|
|
129
|
-
export declare const
|
|
130
|
-
export type
|
|
225
|
+
export declare const FavoritePodcasts = 10054;
|
|
226
|
+
export type FavoritePodcasts = typeof FavoritePodcasts;
|
|
131
227
|
export declare const BlossomServerList = 10063;
|
|
132
228
|
export type BlossomServerList = typeof BlossomServerList;
|
|
229
|
+
export declare const FileServerPreference = 10096;
|
|
230
|
+
export type FileServerPreference = typeof FileServerPreference;
|
|
231
|
+
export declare const GoodWikiAuthorList = 10101;
|
|
232
|
+
export type GoodWikiAuthorList = typeof GoodWikiAuthorList;
|
|
233
|
+
export declare const GoodWikiRelayList = 10102;
|
|
234
|
+
export type GoodWikiRelayList = typeof GoodWikiRelayList;
|
|
235
|
+
export declare const PodcastMetadata = 10154;
|
|
236
|
+
export type PodcastMetadata = typeof PodcastMetadata;
|
|
237
|
+
export declare const AuthoredPodcasts = 10164;
|
|
238
|
+
export type AuthoredPodcasts = typeof AuthoredPodcasts;
|
|
239
|
+
export declare const RelayMonitorAnnouncement = 10166;
|
|
240
|
+
export type RelayMonitorAnnouncement = typeof RelayMonitorAnnouncement;
|
|
241
|
+
export declare const RoomPresence = 10312;
|
|
242
|
+
export type RoomPresence = typeof RoomPresence;
|
|
243
|
+
export declare const UserGraspList = 10317;
|
|
244
|
+
export type UserGraspList = typeof UserGraspList;
|
|
245
|
+
export declare const ProxyAnnouncement = 10377;
|
|
246
|
+
export type ProxyAnnouncement = typeof ProxyAnnouncement;
|
|
247
|
+
export declare const TransportMethodAnnouncement = 11111;
|
|
248
|
+
export type TransportMethodAnnouncement = typeof TransportMethodAnnouncement;
|
|
133
249
|
export declare const NWCWalletInfo = 13194;
|
|
134
250
|
export type NWCWalletInfo = typeof NWCWalletInfo;
|
|
251
|
+
export declare const NsiteRoot = 15128;
|
|
252
|
+
export type NsiteRoot = typeof NsiteRoot;
|
|
253
|
+
export declare const CashuWalletEvent = 17375;
|
|
254
|
+
export type CashuWalletEvent = typeof CashuWalletEvent;
|
|
135
255
|
export declare const LightningPubRPC = 21000;
|
|
136
256
|
export type LightningPubRPC = typeof LightningPubRPC;
|
|
137
257
|
export declare const ClientAuth = 22242;
|
|
@@ -142,6 +262,8 @@ export declare const NWCWalletResponse = 23195;
|
|
|
142
262
|
export type NWCWalletResponse = typeof NWCWalletResponse;
|
|
143
263
|
export declare const NostrConnect = 24133;
|
|
144
264
|
export type NostrConnect = typeof NostrConnect;
|
|
265
|
+
export declare const BlobsAuth = 24242;
|
|
266
|
+
export type BlobsAuth = typeof BlobsAuth;
|
|
145
267
|
export declare const HTTPAuth = 27235;
|
|
146
268
|
export type HTTPAuth = typeof HTTPAuth;
|
|
147
269
|
export declare const Followsets = 30000;
|
|
@@ -154,6 +276,10 @@ export declare const Bookmarksets = 30003;
|
|
|
154
276
|
export type Bookmarksets = typeof Bookmarksets;
|
|
155
277
|
export declare const Curationsets = 30004;
|
|
156
278
|
export type Curationsets = typeof Curationsets;
|
|
279
|
+
export declare const CuratedVideoSets = 30005;
|
|
280
|
+
export type CuratedVideoSets = typeof CuratedVideoSets;
|
|
281
|
+
export declare const MuteSets = 30007;
|
|
282
|
+
export type MuteSets = typeof MuteSets;
|
|
157
283
|
export declare const ProfileBadges = 30008;
|
|
158
284
|
export type ProfileBadges = typeof ProfileBadges;
|
|
159
285
|
export declare const BadgeDefinition = 30009;
|
|
@@ -164,22 +290,56 @@ export declare const CreateOrUpdateStall = 30017;
|
|
|
164
290
|
export type CreateOrUpdateStall = typeof CreateOrUpdateStall;
|
|
165
291
|
export declare const CreateOrUpdateProduct = 30018;
|
|
166
292
|
export type CreateOrUpdateProduct = typeof CreateOrUpdateProduct;
|
|
293
|
+
export declare const MarketplaceUI = 30019;
|
|
294
|
+
export type MarketplaceUI = typeof MarketplaceUI;
|
|
295
|
+
export declare const ProductSoldAsAuction = 30020;
|
|
296
|
+
export type ProductSoldAsAuction = typeof ProductSoldAsAuction;
|
|
167
297
|
export declare const LongFormArticle = 30023;
|
|
168
298
|
export type LongFormArticle = typeof LongFormArticle;
|
|
169
299
|
export declare const DraftLong = 30024;
|
|
170
300
|
export type DraftLong = typeof DraftLong;
|
|
171
301
|
export declare const Emojisets = 30030;
|
|
172
302
|
export type Emojisets = typeof Emojisets;
|
|
303
|
+
export declare const ModularArticleHeader = 30040;
|
|
304
|
+
export type ModularArticleHeader = typeof ModularArticleHeader;
|
|
305
|
+
export declare const ModularArticleContent = 30041;
|
|
306
|
+
export type ModularArticleContent = typeof ModularArticleContent;
|
|
307
|
+
export declare const ReleaseArtifactSets = 30063;
|
|
308
|
+
export type ReleaseArtifactSets = typeof ReleaseArtifactSets;
|
|
173
309
|
export declare const Application = 30078;
|
|
174
310
|
export type Application = typeof Application;
|
|
311
|
+
export declare const RelayDiscovery = 30166;
|
|
312
|
+
export type RelayDiscovery = typeof RelayDiscovery;
|
|
313
|
+
export declare const AppCurationSet = 30267;
|
|
314
|
+
export type AppCurationSet = typeof AppCurationSet;
|
|
175
315
|
export declare const LiveEvent = 30311;
|
|
176
316
|
export type LiveEvent = typeof LiveEvent;
|
|
317
|
+
export declare const InteractiveRoom = 30312;
|
|
318
|
+
export type InteractiveRoom = typeof InteractiveRoom;
|
|
319
|
+
export declare const ConferenceEvent = 30313;
|
|
320
|
+
export type ConferenceEvent = typeof ConferenceEvent;
|
|
177
321
|
export declare const UserStatuses = 30315;
|
|
178
322
|
export type UserStatuses = typeof UserStatuses;
|
|
323
|
+
export declare const SlideSet = 30388;
|
|
324
|
+
export type SlideSet = typeof SlideSet;
|
|
179
325
|
export declare const ClassifiedListing = 30402;
|
|
180
326
|
export type ClassifiedListing = typeof ClassifiedListing;
|
|
181
327
|
export declare const DraftClassifiedListing = 30403;
|
|
182
328
|
export type DraftClassifiedListing = typeof DraftClassifiedListing;
|
|
329
|
+
export declare const RepositoryAnnouncement = 30617;
|
|
330
|
+
export type RepositoryAnnouncement = typeof RepositoryAnnouncement;
|
|
331
|
+
export declare const RepositoryState = 30618;
|
|
332
|
+
export type RepositoryState = typeof RepositoryState;
|
|
333
|
+
export declare const WikiArticle = 30818;
|
|
334
|
+
export type WikiArticle = typeof WikiArticle;
|
|
335
|
+
export declare const Redirects = 30819;
|
|
336
|
+
export type Redirects = typeof Redirects;
|
|
337
|
+
export declare const DraftEvent = 31234;
|
|
338
|
+
export type DraftEvent = typeof DraftEvent;
|
|
339
|
+
export declare const LinkSet = 31388;
|
|
340
|
+
export type LinkSet = typeof LinkSet;
|
|
341
|
+
export declare const Feed = 31890;
|
|
342
|
+
export type Feed = typeof Feed;
|
|
183
343
|
export declare const Date = 31922;
|
|
184
344
|
export type Date = typeof Date;
|
|
185
345
|
export declare const Time = 31923;
|
|
@@ -194,7 +354,39 @@ export declare const Handlerrecommendation = 31989;
|
|
|
194
354
|
export type Handlerrecommendation = typeof Handlerrecommendation;
|
|
195
355
|
export declare const Handlerinformation = 31990;
|
|
196
356
|
export type Handlerinformation = typeof Handlerinformation;
|
|
357
|
+
export declare const SoftwareApplication = 32267;
|
|
358
|
+
export type SoftwareApplication = typeof SoftwareApplication;
|
|
359
|
+
export declare const LegacyNsiteFile = 34128;
|
|
360
|
+
export type LegacyNsiteFile = typeof LegacyNsiteFile;
|
|
361
|
+
export declare const VideoViewEvent = 34237;
|
|
362
|
+
export type VideoViewEvent = typeof VideoViewEvent;
|
|
197
363
|
export declare const CommunityDefinition = 34550;
|
|
198
364
|
export type CommunityDefinition = typeof CommunityDefinition;
|
|
365
|
+
export declare const NsiteNamed = 35128;
|
|
366
|
+
export type NsiteNamed = typeof NsiteNamed;
|
|
367
|
+
export declare const GeocacheListing = 37515;
|
|
368
|
+
export type GeocacheListing = typeof GeocacheListing;
|
|
369
|
+
export declare const GeocacheLogEntry = 37516;
|
|
370
|
+
export type GeocacheLogEntry = typeof GeocacheLogEntry;
|
|
371
|
+
export declare const CashuMintAnnouncement = 38172;
|
|
372
|
+
export type CashuMintAnnouncement = typeof CashuMintAnnouncement;
|
|
373
|
+
export declare const FedimintAnnouncement = 38173;
|
|
374
|
+
export type FedimintAnnouncement = typeof FedimintAnnouncement;
|
|
375
|
+
export declare const PeerToPeerOrderEvents = 38383;
|
|
376
|
+
export type PeerToPeerOrderEvents = typeof PeerToPeerOrderEvents;
|
|
199
377
|
export declare const GroupMetadata = 39000;
|
|
200
378
|
export type GroupMetadata = typeof GroupMetadata;
|
|
379
|
+
export declare const SimpleGroupAdmins = 39001;
|
|
380
|
+
export type SimpleGroupAdmins = typeof SimpleGroupAdmins;
|
|
381
|
+
export declare const SimpleGroupMembers = 39002;
|
|
382
|
+
export type SimpleGroupMembers = typeof SimpleGroupMembers;
|
|
383
|
+
export declare const SimpleGroupRoles = 39003;
|
|
384
|
+
export type SimpleGroupRoles = typeof SimpleGroupRoles;
|
|
385
|
+
export declare const SimpleGroupLiveKitParticipants = 39004;
|
|
386
|
+
export type SimpleGroupLiveKitParticipants = typeof SimpleGroupLiveKitParticipants;
|
|
387
|
+
export declare const StarterPacks = 39089;
|
|
388
|
+
export type StarterPacks = typeof StarterPacks;
|
|
389
|
+
export declare const MediaStarterPacks = 39092;
|
|
390
|
+
export type MediaStarterPacks = typeof MediaStarterPacks;
|
|
391
|
+
export declare const WebBookmarks = 39701;
|
|
392
|
+
export type WebBookmarks = typeof WebBookmarks;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Event } from './core.ts';
|
|
2
|
+
import type { Filter } from './filter.ts';
|
|
3
|
+
export type CountManyDirective = 'reactions' | 'reposts' | 'quotes' | 'replies' | 'comments' | 'followers';
|
|
4
|
+
export declare function getCountManyFilter(target: string, directive: CountManyDirective): Filter;
|
|
5
|
+
export declare function newHll(): Uint8Array;
|
|
6
|
+
export declare function hllDecode(hex: string): Uint8Array | undefined;
|
|
7
|
+
export declare function hllEncode(registers: Uint8Array): string;
|
|
8
|
+
export declare function computeOffset(filterFirstTagValue: string): number;
|
|
9
|
+
export declare function getFilterFirstTagValue(filter: Filter): string | undefined;
|
|
10
|
+
export declare function feedPubkey(hll: Uint8Array, pubkey: string, offset: number): Uint8Array;
|
|
11
|
+
export declare function feedEvent(hll: Uint8Array, event: Event, offset: number): Uint8Array;
|
|
12
|
+
export declare function mergeHll(target: Uint8Array, source: Uint8Array): Uint8Array;
|
|
13
|
+
export declare function estimateCount(hll: Uint8Array): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { EventTemplate } from './core.ts';
|
|
2
|
+
import type { Signer } from './signer.ts';
|
|
3
|
+
export type BlobDescriptor = {
|
|
4
|
+
url: string;
|
|
5
|
+
sha256: string;
|
|
6
|
+
size: number;
|
|
7
|
+
type: string;
|
|
8
|
+
uploaded: number;
|
|
9
|
+
};
|
|
10
|
+
export type UploadType = Blob | File | Buffer;
|
|
11
|
+
export type SignedEvent = EventTemplate & {
|
|
12
|
+
id: string;
|
|
13
|
+
sig: string;
|
|
14
|
+
pubkey: string;
|
|
15
|
+
};
|
|
16
|
+
export type AuthEventOptions = {
|
|
17
|
+
blobs?: string | string[];
|
|
18
|
+
servers?: string | string[];
|
|
19
|
+
message?: string;
|
|
20
|
+
expiration?: number;
|
|
21
|
+
};
|
|
22
|
+
export declare function isSha256(str: string): boolean;
|
|
23
|
+
export declare function getBlobSize(blob: UploadType): number;
|
|
24
|
+
export declare function getBlobType(blob: UploadType): string | undefined;
|
|
25
|
+
export declare function computeBlobSha256(blob: UploadType): Promise<string>;
|
|
26
|
+
export declare function encodeAuthorizationHeader(event: SignedEvent): string;
|
|
27
|
+
export declare function now(): number;
|
|
28
|
+
export declare function oneHour(): number;
|
|
29
|
+
export declare function getAuthTagValues(auth: SignedEvent, tagName: string): string[];
|
|
30
|
+
export declare function getAuthExpiration(auth: SignedEvent): number | undefined;
|
|
31
|
+
export declare function isAuthExpired(auth: SignedEvent, timestamp?: number): boolean;
|
|
32
|
+
export declare function normalizeServerTag(server: string | URL): string;
|
|
33
|
+
export declare function areServersEqual(a: string | URL, b: string | URL): boolean;
|
|
34
|
+
export declare function createAuthEvent(signer: (draft: EventTemplate) => Promise<SignedEvent>, type: 'upload' | 'list' | 'delete' | 'get' | 'media', options?: AuthEventOptions): Promise<SignedEvent>;
|
|
35
|
+
export type UploadAuthOptions = Omit<AuthEventOptions, 'blobs'> & {
|
|
36
|
+
type?: 'upload' | 'media';
|
|
37
|
+
};
|
|
38
|
+
export declare function createUploadAuth(signer: (draft: EventTemplate) => Promise<SignedEvent>, blobs: string | string[], options?: UploadAuthOptions): Promise<SignedEvent>;
|
|
39
|
+
export type DownloadAuthOptions = Omit<AuthEventOptions, 'blobs' | 'servers'>;
|
|
40
|
+
export declare function createDownloadAuth(signer: (draft: EventTemplate) => Promise<SignedEvent>, hash: string, options?: DownloadAuthOptions): Promise<SignedEvent>;
|
|
41
|
+
export type MirrorAuthOptions = Omit<AuthEventOptions, 'blobs'>;
|
|
42
|
+
export declare function createMirrorAuth(signer: (draft: EventTemplate) => Promise<SignedEvent>, hash: string, options?: MirrorAuthOptions): Promise<SignedEvent>;
|
|
43
|
+
export type ListAuthOptions = Omit<AuthEventOptions, 'blobs'>;
|
|
44
|
+
export declare function createListAuth(signer: (draft: EventTemplate) => Promise<SignedEvent>, options?: ListAuthOptions): Promise<SignedEvent>;
|
|
45
|
+
export type DeleteAuthOptions = Omit<AuthEventOptions, 'blobs'>;
|
|
46
|
+
export declare function createDeleteAuth(signer: (draft: EventTemplate) => Promise<SignedEvent>, hash: string, options?: DeleteAuthOptions): Promise<SignedEvent>;
|
|
47
|
+
export type BlossomURI = {
|
|
48
|
+
sha256: string;
|
|
49
|
+
ext: string;
|
|
50
|
+
servers: string[];
|
|
51
|
+
authors: string[];
|
|
52
|
+
size?: number;
|
|
53
|
+
};
|
|
54
|
+
export declare function parseBlossomURI(uri: string): BlossomURI;
|
|
55
|
+
export declare function buildBlossomURI(options: BlossomURI): string;
|
|
56
|
+
export declare function blossomURIToURL(uri: string | BlossomURI): URL;
|
|
57
|
+
export declare function blossomURIFromURL(url: URL): BlossomURI;
|
|
58
|
+
export declare function getExtension(mimetype: string): string;
|
|
59
|
+
export declare function getMIMEType(ext: string): string;
|
|
60
|
+
export declare function getServersFromServerListEvent(event: {
|
|
61
|
+
tags: string[][];
|
|
62
|
+
}): URL[];
|
|
63
|
+
export declare function getHashFromURL(url: string | URL): string | null;
|
|
64
|
+
export type UploadOptions = {
|
|
65
|
+
signal?: AbortSignal;
|
|
66
|
+
auth?: SignedEvent | boolean;
|
|
67
|
+
timeout?: number;
|
|
68
|
+
onAuth?: (server: string, sha256: string) => Promise<SignedEvent>;
|
|
69
|
+
};
|
|
70
|
+
export declare function uploadBlob(server: string, blob: Blob | File, opts?: UploadOptions): Promise<BlobDescriptor>;
|
|
71
|
+
export type DownloadOptions = {
|
|
72
|
+
signal?: AbortSignal;
|
|
73
|
+
auth?: SignedEvent | boolean;
|
|
74
|
+
timeout?: number;
|
|
75
|
+
onAuth?: (server: string, sha256: string) => Promise<SignedEvent>;
|
|
76
|
+
};
|
|
77
|
+
export declare function downloadBlob(server: string, hash: string, opts?: DownloadOptions): Promise<Response>;
|
|
78
|
+
export type ListOptions = {
|
|
79
|
+
signal?: AbortSignal;
|
|
80
|
+
auth?: SignedEvent | boolean;
|
|
81
|
+
timeout?: number;
|
|
82
|
+
onAuth?: (server: string) => Promise<SignedEvent>;
|
|
83
|
+
cursor?: string;
|
|
84
|
+
limit?: number;
|
|
85
|
+
since?: number;
|
|
86
|
+
until?: number;
|
|
87
|
+
};
|
|
88
|
+
export declare function listBlobs(server: string, pubkey: string, opts?: ListOptions): Promise<BlobDescriptor[]>;
|
|
89
|
+
export declare function iterateBlobs(server: string, pubkey: string, opts?: ListOptions): AsyncGenerator<BlobDescriptor[], void, void>;
|
|
90
|
+
export type DeleteOptions = {
|
|
91
|
+
signal?: AbortSignal;
|
|
92
|
+
auth?: SignedEvent | boolean;
|
|
93
|
+
timeout?: number;
|
|
94
|
+
onAuth?: (server: string, sha256: string) => Promise<SignedEvent>;
|
|
95
|
+
};
|
|
96
|
+
export declare function deleteBlob(server: string, hash: string, opts?: DeleteOptions): Promise<boolean>;
|
|
97
|
+
export type HasBlobOptions = {
|
|
98
|
+
signal?: AbortSignal;
|
|
99
|
+
timeout?: number;
|
|
100
|
+
};
|
|
101
|
+
export declare function hasBlob(server: string, hash: string, opts?: HasBlobOptions): Promise<boolean>;
|
|
102
|
+
export type MirrorOptions = {
|
|
103
|
+
signal?: AbortSignal;
|
|
104
|
+
auth?: SignedEvent | boolean;
|
|
105
|
+
timeout?: number;
|
|
106
|
+
onAuth?: (server: string, sha256: string) => Promise<SignedEvent>;
|
|
107
|
+
};
|
|
108
|
+
export declare function mirrorBlob(server: string, blob: BlobDescriptor, opts?: MirrorOptions): Promise<BlobDescriptor>;
|
|
109
|
+
export type ReportOptions = {
|
|
110
|
+
signal?: AbortSignal;
|
|
111
|
+
timeout?: number;
|
|
112
|
+
onError?: (server: string, error: Error) => void;
|
|
113
|
+
};
|
|
114
|
+
export declare function reportBlobs(servers: Iterable<string>, report: SignedEvent, opts?: ReportOptions): Promise<Map<string, boolean>>;
|
|
115
|
+
export declare class BlossomClient {
|
|
116
|
+
private signer;
|
|
117
|
+
private mediaserver;
|
|
118
|
+
constructor(mediaserver: string, signer: Signer);
|
|
119
|
+
getMediaServer(): string;
|
|
120
|
+
private authorizationHeader;
|
|
121
|
+
private httpCall;
|
|
122
|
+
uploadBlob(file: Blob | File, contentType?: string): Promise<BlobDescriptor>;
|
|
123
|
+
download(hash: string): Promise<ArrayBuffer>;
|
|
124
|
+
downloadAsBlob(hash: string): Promise<Blob>;
|
|
125
|
+
list(): Promise<BlobDescriptor[]>;
|
|
126
|
+
delete(hash: string): Promise<void>;
|
|
127
|
+
check(hash: string): Promise<void>;
|
|
128
|
+
mirror(remoteBlobURL: string): Promise<BlobDescriptor>;
|
|
129
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "nostr-tools",
|
|
4
|
-
"version": "2.23.
|
|
4
|
+
"version": "2.23.9",
|
|
5
5
|
"description": "Tools for making a Nostr client.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -198,6 +198,12 @@
|
|
|
198
198
|
"require": "./lib/cjs/nip44.js",
|
|
199
199
|
"types": "./lib/types/nip44.d.ts"
|
|
200
200
|
},
|
|
201
|
+
"./nip45": {
|
|
202
|
+
"source": "./nip45.ts",
|
|
203
|
+
"import": "./lib/esm/nip45.js",
|
|
204
|
+
"require": "./lib/cjs/nip45.js",
|
|
205
|
+
"types": "./lib/types/nip45.d.ts"
|
|
206
|
+
},
|
|
201
207
|
"./nip46": {
|
|
202
208
|
"source": "./nip46.ts",
|
|
203
209
|
"import": "./lib/esm/nip46.js",
|
|
@@ -258,6 +264,12 @@
|
|
|
258
264
|
"require": "./lib/cjs/nip99.js",
|
|
259
265
|
"types": "./lib/types/nip99.d.ts"
|
|
260
266
|
},
|
|
267
|
+
"./nipb0": {
|
|
268
|
+
"source": "./nipb0.ts",
|
|
269
|
+
"import": "./lib/esm/nipb0.js",
|
|
270
|
+
"require": "./lib/cjs/nipb0.js",
|
|
271
|
+
"types": "./lib/types/nipb0.d.ts"
|
|
272
|
+
},
|
|
261
273
|
"./nipb7": {
|
|
262
274
|
"source": "./nipb7.ts",
|
|
263
275
|
"import": "./lib/esm/nipb7.js",
|