keymaster-api-protocol 0.0.0-stage → 0.1.1
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/LICENSE +661 -0
- package/dist/envelope.d.ts +75 -0
- package/dist/envelope.js +55 -0
- package/dist/errors.d.ts +48 -0
- package/dist/errors.js +105 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/methods.gen.d.ts +65 -0
- package/dist/methods.gen.js +261 -0
- package/dist/types.gen.d.ts +580 -0
- package/dist/types.gen.js +3 -0
- package/dist/ws.d.ts +100 -0
- package/dist/ws.js +635 -0
- package/package.json +28 -4
- package/README.md +0 -3
|
@@ -0,0 +1,580 @@
|
|
|
1
|
+
export interface AddRootRequest {
|
|
2
|
+
path: string;
|
|
3
|
+
revision: number;
|
|
4
|
+
}
|
|
5
|
+
export interface AddRootResponse {
|
|
6
|
+
id: string;
|
|
7
|
+
path: string;
|
|
8
|
+
revision: number;
|
|
9
|
+
}
|
|
10
|
+
export interface AppDisplay {
|
|
11
|
+
description: string;
|
|
12
|
+
icon: string;
|
|
13
|
+
name: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ArbitrationService {
|
|
16
|
+
address?: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
publicKeyHex?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface BrowseEntry {
|
|
21
|
+
name: string;
|
|
22
|
+
path: string;
|
|
23
|
+
}
|
|
24
|
+
export interface BrowseRequest {
|
|
25
|
+
path?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface BrowseView {
|
|
28
|
+
dirs: BrowseEntry[];
|
|
29
|
+
parent?: string;
|
|
30
|
+
path: string;
|
|
31
|
+
}
|
|
32
|
+
export interface CatalogRefreshRequest {
|
|
33
|
+
force?: boolean;
|
|
34
|
+
rootId?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface CatalogRefreshResponse {
|
|
37
|
+
refreshed?: Record<string, unknown>[];
|
|
38
|
+
}
|
|
39
|
+
export interface CollectorConfigRequest {
|
|
40
|
+
collectors?: CollectorEntry[];
|
|
41
|
+
earlyTriggerCount?: number;
|
|
42
|
+
retryBaseMs?: number;
|
|
43
|
+
retryCapMs?: number;
|
|
44
|
+
revision: number;
|
|
45
|
+
submitIntervalMs?: number;
|
|
46
|
+
}
|
|
47
|
+
export interface CollectorDescriptionRequest {
|
|
48
|
+
description: string;
|
|
49
|
+
seedHash: string;
|
|
50
|
+
}
|
|
51
|
+
export interface CollectorEntry {
|
|
52
|
+
enabled: boolean;
|
|
53
|
+
endpoint?: string;
|
|
54
|
+
id: string;
|
|
55
|
+
name?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface CollectorFlushResponse {
|
|
58
|
+
triggered: string[];
|
|
59
|
+
}
|
|
60
|
+
export interface CollectorHistory {
|
|
61
|
+
submissions: CollectorSubmission[];
|
|
62
|
+
}
|
|
63
|
+
export interface CollectorRetryResponse {
|
|
64
|
+
retried: string[];
|
|
65
|
+
}
|
|
66
|
+
export interface CollectorSettings {
|
|
67
|
+
collectors: CollectorEntry[];
|
|
68
|
+
earlyTriggerCount: number;
|
|
69
|
+
retryBaseMs: number;
|
|
70
|
+
retryCapMs: number;
|
|
71
|
+
submitIntervalMs: number;
|
|
72
|
+
}
|
|
73
|
+
export interface CollectorStatus {
|
|
74
|
+
collectors: CollectorStatusEntry[];
|
|
75
|
+
intervals: Record<string, unknown>;
|
|
76
|
+
officialEndpoint?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface CollectorStatusEntry {
|
|
79
|
+
confirmedCount: number;
|
|
80
|
+
enabled: boolean;
|
|
81
|
+
endpoint?: string;
|
|
82
|
+
id: string;
|
|
83
|
+
inflight: boolean;
|
|
84
|
+
lastError?: string;
|
|
85
|
+
lastSuccessAt?: number;
|
|
86
|
+
name?: string;
|
|
87
|
+
pendingCount: number;
|
|
88
|
+
}
|
|
89
|
+
export interface CollectorSubmission {
|
|
90
|
+
archiveId: string;
|
|
91
|
+
at: number;
|
|
92
|
+
collectorId: string;
|
|
93
|
+
count: number;
|
|
94
|
+
trigger: string;
|
|
95
|
+
}
|
|
96
|
+
export interface CollectorUpdate {
|
|
97
|
+
collectors?: CollectorEntry[];
|
|
98
|
+
earlyTriggerCount?: number;
|
|
99
|
+
retryBaseMs?: number;
|
|
100
|
+
retryCapMs?: number;
|
|
101
|
+
submitIntervalMs?: number;
|
|
102
|
+
}
|
|
103
|
+
export interface ConnectApprovalDecideRequest {
|
|
104
|
+
approvalId: string;
|
|
105
|
+
decision: string;
|
|
106
|
+
grantAuto?: boolean;
|
|
107
|
+
}
|
|
108
|
+
export interface ConnectApprovalDecideResponse {
|
|
109
|
+
ok: boolean;
|
|
110
|
+
}
|
|
111
|
+
export interface ConnectApprovalsView {
|
|
112
|
+
approvals: Record<string, unknown>[];
|
|
113
|
+
}
|
|
114
|
+
export interface ConnectAppsView {
|
|
115
|
+
applications: Record<string, unknown>[];
|
|
116
|
+
}
|
|
117
|
+
export interface ConnectAuthRevokeRequest {
|
|
118
|
+
appPublicKeyHex: string;
|
|
119
|
+
}
|
|
120
|
+
export interface ConnectAuthView {
|
|
121
|
+
authorizations: ConnectAuthorization[];
|
|
122
|
+
}
|
|
123
|
+
export interface ConnectAuthorization {
|
|
124
|
+
appPublicKeyHex?: string;
|
|
125
|
+
authorizationId: string;
|
|
126
|
+
createdAt?: number;
|
|
127
|
+
generation?: string;
|
|
128
|
+
network: string;
|
|
129
|
+
origin: string;
|
|
130
|
+
walletPublicKey?: string;
|
|
131
|
+
}
|
|
132
|
+
export interface ConnectBindingsView {
|
|
133
|
+
bindings: ConnectAuthorization[];
|
|
134
|
+
}
|
|
135
|
+
export interface ConnectConnectionPauseRequest {
|
|
136
|
+
authorizationId: string;
|
|
137
|
+
}
|
|
138
|
+
export interface ConnectDeployment {
|
|
139
|
+
appPublicKeyHex: string;
|
|
140
|
+
deploymentId: string;
|
|
141
|
+
iconUrl?: string;
|
|
142
|
+
indexseedhashhex: string;
|
|
143
|
+
origin?: string;
|
|
144
|
+
status: string;
|
|
145
|
+
}
|
|
146
|
+
export interface ConnectDeploymentInstallRequest {
|
|
147
|
+
indexseedhashhex: string;
|
|
148
|
+
}
|
|
149
|
+
export interface ConnectDeploymentInstallResponse {
|
|
150
|
+
appPublicKeyHex: string;
|
|
151
|
+
deploymentId: string;
|
|
152
|
+
indexseedhashhex: string;
|
|
153
|
+
}
|
|
154
|
+
export interface ConnectDeploymentStartRequest {
|
|
155
|
+
deploymentId: string;
|
|
156
|
+
}
|
|
157
|
+
export interface ConnectDeploymentStartResponse {
|
|
158
|
+
appPublicKeyHex: string;
|
|
159
|
+
deploymentId: string;
|
|
160
|
+
iconUrl?: string;
|
|
161
|
+
indexseedhashhex: string;
|
|
162
|
+
origin: string;
|
|
163
|
+
url: string;
|
|
164
|
+
}
|
|
165
|
+
export interface ConnectDeploymentStopRequest {
|
|
166
|
+
deploymentId: string;
|
|
167
|
+
}
|
|
168
|
+
export interface ConnectDeploymentView {
|
|
169
|
+
deployments: ConnectDeployment[];
|
|
170
|
+
}
|
|
171
|
+
export interface ConnectDirectoryAddRequest {
|
|
172
|
+
description?: string;
|
|
173
|
+
icon?: string;
|
|
174
|
+
indexseedhashhex?: string;
|
|
175
|
+
name?: string;
|
|
176
|
+
url?: string;
|
|
177
|
+
}
|
|
178
|
+
export interface ConnectDirectoryEntry {
|
|
179
|
+
appPublicKeyHex: string;
|
|
180
|
+
description?: string;
|
|
181
|
+
favorite: boolean;
|
|
182
|
+
files: ConnectDirectoryFilesEntry[];
|
|
183
|
+
icon?: string;
|
|
184
|
+
local: boolean;
|
|
185
|
+
marketListed: boolean;
|
|
186
|
+
name?: string;
|
|
187
|
+
selected?: ConnectDirectorySelection;
|
|
188
|
+
urls: ConnectDirectoryURLEntry[];
|
|
189
|
+
}
|
|
190
|
+
export interface ConnectDirectoryFavoriteRequest {
|
|
191
|
+
appPublicKeyHex: string;
|
|
192
|
+
favorite: boolean;
|
|
193
|
+
}
|
|
194
|
+
export interface ConnectDirectoryFilesEntry {
|
|
195
|
+
display: AppDisplay;
|
|
196
|
+
indexseedhashhex: string;
|
|
197
|
+
verifiedAt?: number;
|
|
198
|
+
}
|
|
199
|
+
export interface ConnectDirectoryPendingEntry {
|
|
200
|
+
description?: string;
|
|
201
|
+
error?: string;
|
|
202
|
+
icon?: string;
|
|
203
|
+
indexseedhashhex?: string;
|
|
204
|
+
name?: string;
|
|
205
|
+
pendingId: string;
|
|
206
|
+
url?: string;
|
|
207
|
+
}
|
|
208
|
+
export interface ConnectDirectoryRemoveRequest {
|
|
209
|
+
appPublicKeyHex?: string;
|
|
210
|
+
pendingId?: string;
|
|
211
|
+
}
|
|
212
|
+
export interface ConnectDirectorySelectRequest {
|
|
213
|
+
appPublicKeyHex: string;
|
|
214
|
+
indexseedhashhex?: string;
|
|
215
|
+
url?: string;
|
|
216
|
+
}
|
|
217
|
+
export interface ConnectDirectorySelection {
|
|
218
|
+
indexseedhashhex?: string;
|
|
219
|
+
url?: string;
|
|
220
|
+
}
|
|
221
|
+
export interface ConnectDirectoryURLEntry {
|
|
222
|
+
display: AppDisplay;
|
|
223
|
+
origin: string;
|
|
224
|
+
url: string;
|
|
225
|
+
verifiedAt?: number;
|
|
226
|
+
}
|
|
227
|
+
export interface ConnectDirectoryView {
|
|
228
|
+
entries: ConnectDirectoryEntry[];
|
|
229
|
+
marketError?: string;
|
|
230
|
+
pending: ConnectDirectoryPendingEntry[];
|
|
231
|
+
}
|
|
232
|
+
export interface ConnectExecRequest {
|
|
233
|
+
approvalId?: string;
|
|
234
|
+
authorizationId?: string;
|
|
235
|
+
method?: string;
|
|
236
|
+
origin?: string;
|
|
237
|
+
params?: Record<string, unknown>;
|
|
238
|
+
requestId?: string;
|
|
239
|
+
}
|
|
240
|
+
export interface ConnectHistoryListRequest {
|
|
241
|
+
applicationKey?: string;
|
|
242
|
+
limit?: number;
|
|
243
|
+
}
|
|
244
|
+
export interface ConnectHistoryView {
|
|
245
|
+
events: Record<string, unknown>[];
|
|
246
|
+
}
|
|
247
|
+
export interface ConnectLaunchIssueRequest {
|
|
248
|
+
deploymentId?: string;
|
|
249
|
+
expectedAppPublicKeyHex?: string;
|
|
250
|
+
origin: string;
|
|
251
|
+
url?: string;
|
|
252
|
+
}
|
|
253
|
+
export interface ConnectLaunchIssueResponse {
|
|
254
|
+
expiresAt: number;
|
|
255
|
+
launchToken: string;
|
|
256
|
+
}
|
|
257
|
+
export interface ConnectPermissionsListRequest {
|
|
258
|
+
applicationKey?: string;
|
|
259
|
+
}
|
|
260
|
+
export interface ConnectPermissionsRevokeRequest {
|
|
261
|
+
applicationKey: string;
|
|
262
|
+
method: string;
|
|
263
|
+
}
|
|
264
|
+
export interface ConnectPermissionsView {
|
|
265
|
+
permissions: Record<string, unknown>[];
|
|
266
|
+
}
|
|
267
|
+
export interface CreateTaskRequest {
|
|
268
|
+
seedHashHex: string;
|
|
269
|
+
}
|
|
270
|
+
export interface EventEnvelope {
|
|
271
|
+
data?: Record<string, unknown>;
|
|
272
|
+
entityId?: string;
|
|
273
|
+
instanceId: string;
|
|
274
|
+
protocolVersion: string;
|
|
275
|
+
revision?: number;
|
|
276
|
+
seq: number;
|
|
277
|
+
topic: string;
|
|
278
|
+
}
|
|
279
|
+
export interface EventsSubscribeRequest {
|
|
280
|
+
topics?: string[];
|
|
281
|
+
}
|
|
282
|
+
export interface FileView {
|
|
283
|
+
blockPrice: string;
|
|
284
|
+
blocks?: number;
|
|
285
|
+
error?: string;
|
|
286
|
+
name: string;
|
|
287
|
+
override: boolean;
|
|
288
|
+
path: string;
|
|
289
|
+
rootId: string;
|
|
290
|
+
seedHash: string;
|
|
291
|
+
seedPrice: string;
|
|
292
|
+
size?: number;
|
|
293
|
+
state: string;
|
|
294
|
+
}
|
|
295
|
+
export interface FilesView {
|
|
296
|
+
files: FileView[];
|
|
297
|
+
}
|
|
298
|
+
export interface Info {
|
|
299
|
+
address: string;
|
|
300
|
+
allocatedSats?: number;
|
|
301
|
+
availableSats?: number;
|
|
302
|
+
cached?: boolean;
|
|
303
|
+
connected: boolean;
|
|
304
|
+
error?: string;
|
|
305
|
+
locked: boolean;
|
|
306
|
+
network: string;
|
|
307
|
+
queryTime?: string;
|
|
308
|
+
totalSats?: number;
|
|
309
|
+
}
|
|
310
|
+
export interface JsonValue {
|
|
311
|
+
}
|
|
312
|
+
export interface Ok {
|
|
313
|
+
ok: boolean;
|
|
314
|
+
}
|
|
315
|
+
export interface PricingBatchRequest {
|
|
316
|
+
blockPrice: string;
|
|
317
|
+
mode: string;
|
|
318
|
+
path?: string;
|
|
319
|
+
rootId: string;
|
|
320
|
+
seedPrice: string;
|
|
321
|
+
}
|
|
322
|
+
export interface PricingBatchResponse {
|
|
323
|
+
updated: number;
|
|
324
|
+
}
|
|
325
|
+
export interface PricingClearRequest {
|
|
326
|
+
path: string;
|
|
327
|
+
rootId: string;
|
|
328
|
+
}
|
|
329
|
+
export interface PricingClearResponse {
|
|
330
|
+
cleared: string;
|
|
331
|
+
}
|
|
332
|
+
export interface PricingDefaultsRequest {
|
|
333
|
+
blockPrice: string;
|
|
334
|
+
revision: number;
|
|
335
|
+
seedPrice: string;
|
|
336
|
+
}
|
|
337
|
+
export interface PricingDefaultsResponse {
|
|
338
|
+
blockPrice: string;
|
|
339
|
+
revision: number;
|
|
340
|
+
seedPrice: string;
|
|
341
|
+
}
|
|
342
|
+
export interface PricingFileRequest {
|
|
343
|
+
blockPrice: string;
|
|
344
|
+
path: string;
|
|
345
|
+
rootId: string;
|
|
346
|
+
seedPrice: string;
|
|
347
|
+
}
|
|
348
|
+
export interface PricingFileResponse {
|
|
349
|
+
updated: string;
|
|
350
|
+
}
|
|
351
|
+
export interface PublicationFile {
|
|
352
|
+
mime: string;
|
|
353
|
+
path: string;
|
|
354
|
+
seedhashhex: string;
|
|
355
|
+
size: number;
|
|
356
|
+
}
|
|
357
|
+
export interface PublicationFilesChannel {
|
|
358
|
+
entrySeedhashhex: string;
|
|
359
|
+
files: PublicationFile[];
|
|
360
|
+
icon: string;
|
|
361
|
+
}
|
|
362
|
+
export interface PublicationProof {
|
|
363
|
+
publication: PublicationRecord;
|
|
364
|
+
signatureHex: string;
|
|
365
|
+
}
|
|
366
|
+
export interface PublicationRecord {
|
|
367
|
+
appPublicKeyHex: string;
|
|
368
|
+
description: string;
|
|
369
|
+
files?: PublicationFilesChannel;
|
|
370
|
+
kind: string;
|
|
371
|
+
name: string;
|
|
372
|
+
url?: PublicationURLChannel;
|
|
373
|
+
version: number;
|
|
374
|
+
}
|
|
375
|
+
export interface PublicationURLChannel {
|
|
376
|
+
address: string;
|
|
377
|
+
icon: string;
|
|
378
|
+
}
|
|
379
|
+
export interface RevisionRequest {
|
|
380
|
+
revision: number;
|
|
381
|
+
}
|
|
382
|
+
export interface RevisionedOk {
|
|
383
|
+
ok: boolean;
|
|
384
|
+
revision: number;
|
|
385
|
+
}
|
|
386
|
+
export interface Root {
|
|
387
|
+
id: string;
|
|
388
|
+
path: string;
|
|
389
|
+
}
|
|
390
|
+
export interface RootRemoveRequest {
|
|
391
|
+
id: string;
|
|
392
|
+
revision: number;
|
|
393
|
+
}
|
|
394
|
+
export interface RootView {
|
|
395
|
+
accessible: boolean;
|
|
396
|
+
error?: string;
|
|
397
|
+
id: string;
|
|
398
|
+
path: string;
|
|
399
|
+
}
|
|
400
|
+
export interface RootsView {
|
|
401
|
+
defaultDownloadRootID?: string;
|
|
402
|
+
revision: number;
|
|
403
|
+
roots: RootView[];
|
|
404
|
+
}
|
|
405
|
+
export interface SchedulerSettings {
|
|
406
|
+
floatingSeats: number;
|
|
407
|
+
maxBlockPriceSatoshis: string;
|
|
408
|
+
poolBlocks: number;
|
|
409
|
+
requestTimeoutMs: number;
|
|
410
|
+
totalSeats: number;
|
|
411
|
+
}
|
|
412
|
+
export interface SchedulerUpdate {
|
|
413
|
+
floatingSeats?: number;
|
|
414
|
+
maxBlockPriceSatoshis?: string;
|
|
415
|
+
poolBlocks?: number;
|
|
416
|
+
requestTimeoutMs?: number;
|
|
417
|
+
totalSeats?: number;
|
|
418
|
+
}
|
|
419
|
+
export interface ServerDefaults {
|
|
420
|
+
arbiterPublicKeys?: string[];
|
|
421
|
+
collector: CollectorSettings;
|
|
422
|
+
defaultFullBlockPriceSatoshis: string;
|
|
423
|
+
defaultSeedPriceSatoshis: string;
|
|
424
|
+
}
|
|
425
|
+
export interface ServerUpdate {
|
|
426
|
+
arbiterPublicKeys?: string[];
|
|
427
|
+
collector?: CollectorUpdate;
|
|
428
|
+
defaultFullBlockPriceSatoshis?: string;
|
|
429
|
+
defaultSeedPriceSatoshis?: string;
|
|
430
|
+
}
|
|
431
|
+
export interface Services {
|
|
432
|
+
arbitrationServices?: ArbitrationService[];
|
|
433
|
+
satSuppliers: Supplier[];
|
|
434
|
+
}
|
|
435
|
+
export interface SetDefaultRootRequest {
|
|
436
|
+
id: string;
|
|
437
|
+
revision: number;
|
|
438
|
+
}
|
|
439
|
+
export interface Settings {
|
|
440
|
+
applicationOpenMode: string;
|
|
441
|
+
feeRateSatoshisPerKb: number;
|
|
442
|
+
language: string;
|
|
443
|
+
port: number;
|
|
444
|
+
revision: number;
|
|
445
|
+
scheduler: SchedulerSettings;
|
|
446
|
+
server: ServerDefaults;
|
|
447
|
+
services: Services;
|
|
448
|
+
theme: string;
|
|
449
|
+
version: number;
|
|
450
|
+
wocApiKey: string;
|
|
451
|
+
}
|
|
452
|
+
export interface SettingsUpdate {
|
|
453
|
+
applicationOpenMode?: string;
|
|
454
|
+
feeRateSatoshisPerKb?: number;
|
|
455
|
+
language?: string;
|
|
456
|
+
port?: number;
|
|
457
|
+
revision: number;
|
|
458
|
+
scheduler?: SchedulerUpdate;
|
|
459
|
+
server?: ServerUpdate;
|
|
460
|
+
theme?: string;
|
|
461
|
+
wocApiKey?: string;
|
|
462
|
+
}
|
|
463
|
+
export interface SnapshotEvent {
|
|
464
|
+
instanceId: string;
|
|
465
|
+
protocolVersion: string;
|
|
466
|
+
revisions?: Record<string, unknown>;
|
|
467
|
+
state?: Record<string, unknown>;
|
|
468
|
+
topics: string[];
|
|
469
|
+
}
|
|
470
|
+
export interface Status {
|
|
471
|
+
address?: string;
|
|
472
|
+
apiVersion: string;
|
|
473
|
+
initialized: boolean;
|
|
474
|
+
locked?: boolean;
|
|
475
|
+
network?: string;
|
|
476
|
+
product: string;
|
|
477
|
+
publicKey?: string;
|
|
478
|
+
state: string;
|
|
479
|
+
}
|
|
480
|
+
export interface StorageDeleteRequest {
|
|
481
|
+
appPublicKeyHex: string;
|
|
482
|
+
network: string;
|
|
483
|
+
origin?: string;
|
|
484
|
+
path: string;
|
|
485
|
+
walletPublicKey: string;
|
|
486
|
+
}
|
|
487
|
+
export interface StorageGetRequest {
|
|
488
|
+
appPublicKeyHex: string;
|
|
489
|
+
ifMatch?: string;
|
|
490
|
+
length?: number;
|
|
491
|
+
network: string;
|
|
492
|
+
offset?: number;
|
|
493
|
+
origin?: string;
|
|
494
|
+
path: string;
|
|
495
|
+
walletPublicKey: string;
|
|
496
|
+
}
|
|
497
|
+
export interface StorageGetResponse {
|
|
498
|
+
eof?: boolean;
|
|
499
|
+
mime?: string;
|
|
500
|
+
offset?: number;
|
|
501
|
+
revision: number;
|
|
502
|
+
totalSize?: number;
|
|
503
|
+
}
|
|
504
|
+
export interface StorageListRequest {
|
|
505
|
+
appPublicKeyHex: string;
|
|
506
|
+
cursor?: string;
|
|
507
|
+
limit?: number;
|
|
508
|
+
network: string;
|
|
509
|
+
origin?: string;
|
|
510
|
+
prefix: string;
|
|
511
|
+
walletPublicKey: string;
|
|
512
|
+
}
|
|
513
|
+
export interface StorageListResponse {
|
|
514
|
+
entries: Record<string, unknown>[];
|
|
515
|
+
nextCursor?: string;
|
|
516
|
+
}
|
|
517
|
+
export interface StoragePutRequest {
|
|
518
|
+
appPublicKeyHex: string;
|
|
519
|
+
ifNoneMatch?: string;
|
|
520
|
+
mime?: string;
|
|
521
|
+
network: string;
|
|
522
|
+
origin?: string;
|
|
523
|
+
path: string;
|
|
524
|
+
walletPublicKey: string;
|
|
525
|
+
}
|
|
526
|
+
export interface StoragePutResponse {
|
|
527
|
+
revision: number;
|
|
528
|
+
updatedAt?: number;
|
|
529
|
+
}
|
|
530
|
+
export interface Supplier {
|
|
531
|
+
enabled: boolean;
|
|
532
|
+
id: string;
|
|
533
|
+
multiaddrs: string[];
|
|
534
|
+
name: string;
|
|
535
|
+
publicKeyHex: string;
|
|
536
|
+
}
|
|
537
|
+
export interface Task {
|
|
538
|
+
blocksDone: number;
|
|
539
|
+
blocksTotal: number;
|
|
540
|
+
bytes?: number;
|
|
541
|
+
createdAt: string;
|
|
542
|
+
detail?: string;
|
|
543
|
+
error?: string;
|
|
544
|
+
finalPath?: string;
|
|
545
|
+
paidSats?: string;
|
|
546
|
+
recommended?: string[];
|
|
547
|
+
rootID: string;
|
|
548
|
+
seedHashHex: string;
|
|
549
|
+
state: string;
|
|
550
|
+
updatedAt: string;
|
|
551
|
+
}
|
|
552
|
+
export interface TaskCancelRequest {
|
|
553
|
+
seedHashHex: string;
|
|
554
|
+
}
|
|
555
|
+
export interface TaskGetRequest {
|
|
556
|
+
seedHashHex: string;
|
|
557
|
+
}
|
|
558
|
+
export interface TaskList {
|
|
559
|
+
tasks: Task[];
|
|
560
|
+
}
|
|
561
|
+
export interface TaskSubscribeRequest {
|
|
562
|
+
seedHashHex: string;
|
|
563
|
+
}
|
|
564
|
+
export interface UnlockRequest {
|
|
565
|
+
password: string;
|
|
566
|
+
}
|
|
567
|
+
export interface WalletCreateRequest {
|
|
568
|
+
network: string;
|
|
569
|
+
password: string;
|
|
570
|
+
}
|
|
571
|
+
export interface WalletCreateResponse {
|
|
572
|
+
ok: boolean;
|
|
573
|
+
}
|
|
574
|
+
export interface WalletImportRequest {
|
|
575
|
+
keyMaterial: string;
|
|
576
|
+
password: string;
|
|
577
|
+
}
|
|
578
|
+
export interface WalletImportResponse {
|
|
579
|
+
ok: boolean;
|
|
580
|
+
}
|
package/dist/ws.d.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { type ClientInfo } from "./envelope.js";
|
|
2
|
+
export interface SnapshotMsg {
|
|
3
|
+
type: string;
|
|
4
|
+
id?: string;
|
|
5
|
+
instanceId: string;
|
|
6
|
+
topics: string[];
|
|
7
|
+
revisions?: Record<string, unknown>;
|
|
8
|
+
state?: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
export interface EventMsg {
|
|
11
|
+
type: string;
|
|
12
|
+
instanceId: string;
|
|
13
|
+
seq: number;
|
|
14
|
+
topic: string;
|
|
15
|
+
entityId?: string;
|
|
16
|
+
revision?: number;
|
|
17
|
+
data?: Record<string, unknown>;
|
|
18
|
+
}
|
|
19
|
+
/** 单 WS 连接:串行写入、并发请求关联、超时/取消/关闭清理。 */
|
|
20
|
+
export declare class KmWSClient {
|
|
21
|
+
private ws;
|
|
22
|
+
private pending;
|
|
23
|
+
private inflight;
|
|
24
|
+
private closed;
|
|
25
|
+
private instanceId;
|
|
26
|
+
private connectionId;
|
|
27
|
+
private limits;
|
|
28
|
+
private subs;
|
|
29
|
+
private writeQueue;
|
|
30
|
+
private connStatus;
|
|
31
|
+
private statusListeners;
|
|
32
|
+
private constructor();
|
|
33
|
+
/** 订阅连接状态变化;立即以当前状态回调一次,返回取消订阅函数。 */
|
|
34
|
+
onConnectionChange(fn: (s: 'connecting' | 'connected' | 'disconnected') => void): () => void;
|
|
35
|
+
getStatus(): 'connecting' | 'connected' | 'disconnected';
|
|
36
|
+
private setStatus;
|
|
37
|
+
static connect(baseURL: string, client: ClientInfo): Promise<KmWSClient>;
|
|
38
|
+
getInstanceId(): string;
|
|
39
|
+
getConnectionId(): string;
|
|
40
|
+
private sendJSON;
|
|
41
|
+
private sendBinary;
|
|
42
|
+
/**
|
|
43
|
+
* 带二进制附件的调用:先发送 request,再逐个发送 AttachBegin + 二进制帧。
|
|
44
|
+
* 服务端先回 AttachBegin/二进制,最后回 Response;收集齐后以
|
|
45
|
+
* `{ result, binaries }` 形式返回。附件较大时超时放宽到 45 秒。
|
|
46
|
+
*/
|
|
47
|
+
callWithBinary(ctx: {
|
|
48
|
+
signal?: AbortSignal;
|
|
49
|
+
} | undefined, method: string, params: unknown, attachments?: Record<string, Uint8Array>): Promise<{
|
|
50
|
+
result: unknown;
|
|
51
|
+
binaries: Record<string, Uint8Array>;
|
|
52
|
+
}>;
|
|
53
|
+
call(ctx: {
|
|
54
|
+
signal?: AbortSignal;
|
|
55
|
+
} | undefined, method: string, params?: unknown): Promise<unknown>;
|
|
56
|
+
subscribeEvents(topics: string[], handlers: {
|
|
57
|
+
onSnapshot?: (s: SnapshotMsg) => void;
|
|
58
|
+
onEvent?: (e: EventMsg) => boolean | void;
|
|
59
|
+
onResync?: () => void;
|
|
60
|
+
}, opts?: {
|
|
61
|
+
signal?: AbortSignal;
|
|
62
|
+
}): () => void;
|
|
63
|
+
close(): void;
|
|
64
|
+
status(): Promise<import("./types.gen.js").Status>;
|
|
65
|
+
info(): Promise<import("./types.gen.js").Info>;
|
|
66
|
+
unlock(password: string): Promise<import("./types.gen.js").Ok>;
|
|
67
|
+
listRoots(): Promise<import("./types.gen.js").RootsView>;
|
|
68
|
+
addRoot(path: string, revision: number): Promise<import("./types.gen.js").AddRootResponse>;
|
|
69
|
+
removeRoot(id: string, revision: number): Promise<import("./types.gen.js").RevisionedOk>;
|
|
70
|
+
setDefaultRoot(id: string, revision: number): Promise<import("./types.gen.js").RevisionedOk>;
|
|
71
|
+
listFiles(): Promise<import("./types.gen.js").FilesView>;
|
|
72
|
+
browse(path: string): Promise<import("./types.gen.js").BrowseView>;
|
|
73
|
+
getSettings(): Promise<import("./types.gen.js").Settings>;
|
|
74
|
+
updateSettings(params: unknown): Promise<import("./types.gen.js").Settings>;
|
|
75
|
+
resetSettings(revision: number): Promise<import("./types.gen.js").Settings>;
|
|
76
|
+
refreshCatalog(rootId?: string, force?: boolean): Promise<unknown>;
|
|
77
|
+
collectorStatus(): Promise<import("./types.gen.js").CollectorStatus>;
|
|
78
|
+
collectorHistory(): Promise<import("./types.gen.js").CollectorHistory>;
|
|
79
|
+
collectorDescribe(seedHash: string, description: string): Promise<import("./types.gen.js").Ok>;
|
|
80
|
+
collectorFlush(): Promise<import("./types.gen.js").CollectorFlushResponse>;
|
|
81
|
+
collectorRetry(): Promise<import("./types.gen.js").CollectorRetryResponse>;
|
|
82
|
+
listTasks(): Promise<import("./types.gen.js").TaskList>;
|
|
83
|
+
createTask(seedHashHex: string): Promise<import("./types.gen.js").Task>;
|
|
84
|
+
cancelTask(seedHashHex: string): Promise<import("./types.gen.js").Ok>;
|
|
85
|
+
approvalsList(): Promise<unknown>;
|
|
86
|
+
approvalsDecide(approvalId: string, decision: string, grantAuto?: boolean): Promise<unknown>;
|
|
87
|
+
bindingsList(): Promise<unknown>;
|
|
88
|
+
authList(): Promise<unknown>;
|
|
89
|
+
authRevoke(origin: string, appPublicKey: string, appId: string): Promise<unknown>;
|
|
90
|
+
permissionsList(applicationKey?: string): Promise<unknown>;
|
|
91
|
+
permissionsRevoke(applicationKey: string, method: string): Promise<unknown>;
|
|
92
|
+
historyList(applicationKey?: string, limit?: number): Promise<unknown>;
|
|
93
|
+
appsList(): Promise<unknown>;
|
|
94
|
+
connectionPause(authorizationId: string): Promise<unknown>;
|
|
95
|
+
connectExec(params: unknown): Promise<unknown>;
|
|
96
|
+
walletCreate(password: string, network: string): Promise<unknown>;
|
|
97
|
+
walletImport(password: string, keyMaterial: string): Promise<unknown>;
|
|
98
|
+
private onMessage;
|
|
99
|
+
private failAll;
|
|
100
|
+
}
|