@bsv/sdk 1.2.1 → 1.2.3
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/dist/cjs/package.json +2 -2
- package/dist/cjs/src/overlay-tools/LookupResolver.js +8 -5
- package/dist/cjs/src/overlay-tools/LookupResolver.js.map +1 -1
- package/dist/cjs/src/overlay-tools/SHIPBroadcaster.js +6 -4
- package/dist/cjs/src/overlay-tools/SHIPBroadcaster.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/overlay-tools/LookupResolver.js +8 -5
- package/dist/esm/src/overlay-tools/LookupResolver.js.map +1 -1
- package/dist/esm/src/overlay-tools/SHIPBroadcaster.js +6 -4
- package/dist/esm/src/overlay-tools/SHIPBroadcaster.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/overlay-tools/LookupResolver.d.ts +10 -3
- package/dist/types/src/overlay-tools/LookupResolver.d.ts.map +1 -1
- package/dist/types/src/overlay-tools/SHIPBroadcaster.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/umd/bundle.js +1 -1
- package/docs/compat.md +166 -135
- package/docs/messages.md +63 -55
- package/docs/overlay-tools.md +137 -92
- package/docs/primitives.md +4095 -3812
- package/docs/script.md +506 -467
- package/docs/totp.md +8 -0
- package/docs/transaction.md +822 -735
- package/docs/wallet.md +1025 -849
- package/package.json +2 -2
- package/src/overlay-tools/LookupResolver.ts +22 -6
- package/src/overlay-tools/SHIPBroadcaster.ts +7 -4
- package/src/overlay-tools/__tests/LookupResolver.test.ts +83 -42
- package/src/overlay-tools/__tests/SHIPBroadcaster.test.ts +9 -9
package/docs/overlay-tools.md
CHANGED
|
@@ -18,6 +18,42 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
21
|
+
### Interface: AdmittanceInstructions
|
|
22
|
+
|
|
23
|
+
Instructs the Overlay Services Engine about which outputs to admit and which previous outputs to retain. Returned by a Topic Manager.
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
export interface AdmittanceInstructions {
|
|
27
|
+
outputsToAdmit: number[];
|
|
28
|
+
coinsToRetain: number[];
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
<details>
|
|
33
|
+
|
|
34
|
+
<summary>Interface AdmittanceInstructions Details</summary>
|
|
35
|
+
|
|
36
|
+
#### Property coinsToRetain
|
|
37
|
+
|
|
38
|
+
The indices of all inputs from the provided transaction which spend previously-admitted outputs that should be retained for historical record-keeping.
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
coinsToRetain: number[]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
#### Property outputsToAdmit
|
|
45
|
+
|
|
46
|
+
The indices of all admissable outputs into the managed topic from the provided transaction.
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
outputsToAdmit: number[]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
</details>
|
|
53
|
+
|
|
54
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
55
|
+
|
|
56
|
+
---
|
|
21
57
|
### Interface: LookupQuestion
|
|
22
58
|
|
|
23
59
|
The question asked to the Overlay Services Engine when a consumer of state wishes to look up information.
|
|
@@ -68,6 +104,8 @@ export interface LookupResolverConfig {
|
|
|
68
104
|
}
|
|
69
105
|
```
|
|
70
106
|
|
|
107
|
+
See also: [OverlayLookupFacilitator](#interface-overlaylookupfacilitator)
|
|
108
|
+
|
|
71
109
|
<details>
|
|
72
110
|
|
|
73
111
|
<summary>Interface LookupResolverConfig Details</summary>
|
|
@@ -87,6 +125,7 @@ The facilitator used to make requests to Overlay Services hosts.
|
|
|
87
125
|
```ts
|
|
88
126
|
facilitator?: OverlayLookupFacilitator
|
|
89
127
|
```
|
|
128
|
+
See also: [OverlayLookupFacilitator](#interface-overlaylookupfacilitator)
|
|
90
129
|
|
|
91
130
|
#### Property hostOverrides
|
|
92
131
|
|
|
@@ -109,63 +148,45 @@ slapTrackers?: string[]
|
|
|
109
148
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
110
149
|
|
|
111
150
|
---
|
|
112
|
-
### Interface:
|
|
151
|
+
### Interface: OverlayBroadcastFacilitator
|
|
113
152
|
|
|
114
|
-
Facilitates
|
|
153
|
+
Facilitates transaction broadcasts that return STEAK.
|
|
115
154
|
|
|
116
155
|
```ts
|
|
117
|
-
export interface
|
|
118
|
-
|
|
156
|
+
export interface OverlayBroadcastFacilitator {
|
|
157
|
+
send: (url: string, taggedBEEF: TaggedBEEF) => Promise<STEAK>;
|
|
119
158
|
}
|
|
120
159
|
```
|
|
121
160
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
---
|
|
125
|
-
### Interface: TaggedBEEF
|
|
126
|
-
|
|
127
|
-
Tagged BEEF
|
|
128
|
-
|
|
129
|
-
```ts
|
|
130
|
-
export interface TaggedBEEF {
|
|
131
|
-
beef: number[];
|
|
132
|
-
topics: string[];
|
|
133
|
-
}
|
|
134
|
-
```
|
|
161
|
+
See also: [STEAK](#type-steak), [TaggedBEEF](#interface-taggedbeef)
|
|
135
162
|
|
|
136
163
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
137
164
|
|
|
138
165
|
---
|
|
139
|
-
### Interface:
|
|
166
|
+
### Interface: OverlayLookupFacilitator
|
|
140
167
|
|
|
141
|
-
|
|
168
|
+
Facilitates lookups to URLs that return answers.
|
|
142
169
|
|
|
143
170
|
```ts
|
|
144
|
-
export interface
|
|
145
|
-
|
|
146
|
-
coinsToRetain: number[];
|
|
171
|
+
export interface OverlayLookupFacilitator {
|
|
172
|
+
lookup: (url: string, question: LookupQuestion, timeout?: number) => Promise<LookupAnswer>;
|
|
147
173
|
}
|
|
148
174
|
```
|
|
149
175
|
|
|
176
|
+
See also: [LookupAnswer](#type-lookupanswer), [LookupQuestion](#interface-lookupquestion)
|
|
177
|
+
|
|
150
178
|
<details>
|
|
151
179
|
|
|
152
|
-
<summary>Interface
|
|
180
|
+
<summary>Interface OverlayLookupFacilitator Details</summary>
|
|
153
181
|
|
|
154
|
-
#### Property
|
|
182
|
+
#### Property lookup
|
|
155
183
|
|
|
156
|
-
|
|
184
|
+
Returns a lookup answer for a lookup question
|
|
157
185
|
|
|
158
186
|
```ts
|
|
159
|
-
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
#### Property outputsToAdmit
|
|
163
|
-
|
|
164
|
-
The indices of all admissable outputs into the managed topic from the provided transaction.
|
|
165
|
-
|
|
166
|
-
```ts
|
|
167
|
-
outputsToAdmit: number[]
|
|
187
|
+
lookup: (url: string, question: LookupQuestion, timeout?: number) => Promise<LookupAnswer>
|
|
168
188
|
```
|
|
189
|
+
See also: [LookupAnswer](#type-lookupanswer), [LookupQuestion](#interface-lookupquestion)
|
|
169
190
|
|
|
170
191
|
</details>
|
|
171
192
|
|
|
@@ -186,6 +207,8 @@ export interface SHIPBroadcasterConfig {
|
|
|
186
207
|
}
|
|
187
208
|
```
|
|
188
209
|
|
|
210
|
+
See also: [LookupResolver](#class-lookupresolver), [OverlayBroadcastFacilitator](#interface-overlaybroadcastfacilitator)
|
|
211
|
+
|
|
189
212
|
<details>
|
|
190
213
|
|
|
191
214
|
<summary>Interface SHIPBroadcasterConfig Details</summary>
|
|
@@ -197,6 +220,7 @@ The facilitator used to make requests to Overlay Services hosts.
|
|
|
197
220
|
```ts
|
|
198
221
|
facilitator?: OverlayBroadcastFacilitator
|
|
199
222
|
```
|
|
223
|
+
See also: [OverlayBroadcastFacilitator](#interface-overlaybroadcastfacilitator)
|
|
200
224
|
|
|
201
225
|
#### Property requireAcknowledgmentFromAllHostsForTopics
|
|
202
226
|
|
|
@@ -229,19 +253,21 @@ The resolver used to locate suitable hosts with SHIP
|
|
|
229
253
|
```ts
|
|
230
254
|
resolver: LookupResolver
|
|
231
255
|
```
|
|
256
|
+
See also: [LookupResolver](#class-lookupresolver)
|
|
232
257
|
|
|
233
258
|
</details>
|
|
234
259
|
|
|
235
260
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
236
261
|
|
|
237
262
|
---
|
|
238
|
-
### Interface:
|
|
263
|
+
### Interface: TaggedBEEF
|
|
239
264
|
|
|
240
|
-
|
|
265
|
+
Tagged BEEF
|
|
241
266
|
|
|
242
267
|
```ts
|
|
243
|
-
export interface
|
|
244
|
-
|
|
268
|
+
export interface TaggedBEEF {
|
|
269
|
+
beef: number[];
|
|
270
|
+
topics: string[];
|
|
245
271
|
}
|
|
246
272
|
```
|
|
247
273
|
|
|
@@ -262,6 +288,67 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
262
288
|
|
|
263
289
|
---
|
|
264
290
|
|
|
291
|
+
### Class: HTTPSOverlayBroadcastFacilitator
|
|
292
|
+
|
|
293
|
+
```ts
|
|
294
|
+
export class HTTPSOverlayBroadcastFacilitator implements OverlayBroadcastFacilitator {
|
|
295
|
+
httpClient: typeof fetch;
|
|
296
|
+
constructor(httpClient = fetch)
|
|
297
|
+
async send(url: string, taggedBEEF: TaggedBEEF): Promise<STEAK>
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
See also: [OverlayBroadcastFacilitator](#interface-overlaybroadcastfacilitator), [STEAK](#type-steak), [TaggedBEEF](#interface-taggedbeef)
|
|
302
|
+
|
|
303
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
### Class: HTTPSOverlayLookupFacilitator
|
|
307
|
+
|
|
308
|
+
```ts
|
|
309
|
+
export class HTTPSOverlayLookupFacilitator implements OverlayLookupFacilitator {
|
|
310
|
+
fetchClient: typeof fetch;
|
|
311
|
+
constructor(httpClient = fetch)
|
|
312
|
+
async lookup(url: string, question: LookupQuestion, timeout: number = 5000): Promise<LookupAnswer>
|
|
313
|
+
}
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
See also: [LookupAnswer](#type-lookupanswer), [LookupQuestion](#interface-lookupquestion), [OverlayLookupFacilitator](#interface-overlaylookupfacilitator)
|
|
317
|
+
|
|
318
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
### Class: LookupResolver
|
|
322
|
+
|
|
323
|
+
Represents an SHIP transaction broadcaster.
|
|
324
|
+
|
|
325
|
+
```ts
|
|
326
|
+
export default class LookupResolver {
|
|
327
|
+
constructor(config?: LookupResolverConfig)
|
|
328
|
+
async query(question: LookupQuestion, timeout?: number): Promise<LookupAnswer>
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
See also: [LookupAnswer](#type-lookupanswer), [LookupQuestion](#interface-lookupquestion), [LookupResolverConfig](#interface-lookupresolverconfig)
|
|
333
|
+
|
|
334
|
+
<details>
|
|
335
|
+
|
|
336
|
+
<summary>Class LookupResolver Details</summary>
|
|
337
|
+
|
|
338
|
+
#### Method query
|
|
339
|
+
|
|
340
|
+
Given a LookupQuestion, returns a LookupAnswer. Aggregates across multiple services and supports resiliency.
|
|
341
|
+
|
|
342
|
+
```ts
|
|
343
|
+
async query(question: LookupQuestion, timeout?: number): Promise<LookupAnswer>
|
|
344
|
+
```
|
|
345
|
+
See also: [LookupAnswer](#type-lookupanswer), [LookupQuestion](#interface-lookupquestion)
|
|
346
|
+
|
|
347
|
+
</details>
|
|
348
|
+
|
|
349
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
350
|
+
|
|
351
|
+
---
|
|
265
352
|
### Class: OverlayAdminTokenTemplate
|
|
266
353
|
|
|
267
354
|
Script template enabling the creation, unlocking, and decoding of SHIP and SLAP advertisements.
|
|
@@ -284,6 +371,8 @@ export default class OverlayAdminTokenTemplate implements ScriptTemplate {
|
|
|
284
371
|
}
|
|
285
372
|
```
|
|
286
373
|
|
|
374
|
+
See also: [LockingScript](#class-lockingscript), [PushDrop](#class-pushdrop), [ScriptTemplate](#interface-scripttemplate), [Transaction](#class-transaction), [UnlockingScript](#class-unlockingscript), [Wallet](#interface-wallet), [sign](#variable-sign)
|
|
375
|
+
|
|
287
376
|
<details>
|
|
288
377
|
|
|
289
378
|
<summary>Class OverlayAdminTokenTemplate Details</summary>
|
|
@@ -295,6 +384,7 @@ Constructs a new Overlay Admin template instance
|
|
|
295
384
|
```ts
|
|
296
385
|
constructor(wallet: Wallet)
|
|
297
386
|
```
|
|
387
|
+
See also: [Wallet](#interface-wallet)
|
|
298
388
|
|
|
299
389
|
Argument Details
|
|
300
390
|
|
|
@@ -313,6 +403,7 @@ static decode(script: LockingScript): {
|
|
|
313
403
|
topicOrService: string;
|
|
314
404
|
}
|
|
315
405
|
```
|
|
406
|
+
See also: [LockingScript](#class-lockingscript)
|
|
316
407
|
|
|
317
408
|
Returns
|
|
318
409
|
|
|
@@ -330,6 +421,7 @@ Creates a new advertisement locking script
|
|
|
330
421
|
```ts
|
|
331
422
|
async lock(protocol: "SHIP" | "SLAP", domain: string, topicOrService: string): Promise<LockingScript>
|
|
332
423
|
```
|
|
424
|
+
See also: [LockingScript](#class-lockingscript)
|
|
333
425
|
|
|
334
426
|
Returns
|
|
335
427
|
|
|
@@ -354,6 +446,7 @@ unlock(protocol: "SHIP" | "SLAP"): {
|
|
|
354
446
|
estimateLength: (tx: Transaction, inputIndex: number) => Promise<number>;
|
|
355
447
|
}
|
|
356
448
|
```
|
|
449
|
+
See also: [Transaction](#class-transaction), [UnlockingScript](#class-unlockingscript), [sign](#variable-sign)
|
|
357
450
|
|
|
358
451
|
Returns
|
|
359
452
|
|
|
@@ -368,60 +461,6 @@ Argument Details
|
|
|
368
461
|
|
|
369
462
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
370
463
|
|
|
371
|
-
---
|
|
372
|
-
### Class: HTTPSOverlayLookupFacilitator
|
|
373
|
-
|
|
374
|
-
```ts
|
|
375
|
-
export class HTTPSOverlayLookupFacilitator implements OverlayLookupFacilitator {
|
|
376
|
-
fetchClient: typeof fetch;
|
|
377
|
-
constructor(httpClient = fetch)
|
|
378
|
-
async lookup(url: string, question: LookupQuestion): Promise<LookupAnswer>
|
|
379
|
-
}
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
383
|
-
|
|
384
|
-
---
|
|
385
|
-
### Class: LookupResolver
|
|
386
|
-
|
|
387
|
-
Represents an SHIP transaction broadcaster.
|
|
388
|
-
|
|
389
|
-
```ts
|
|
390
|
-
export default class LookupResolver {
|
|
391
|
-
constructor(config?: LookupResolverConfig)
|
|
392
|
-
async query(question: LookupQuestion): Promise<LookupAnswer>
|
|
393
|
-
}
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
<details>
|
|
397
|
-
|
|
398
|
-
<summary>Class LookupResolver Details</summary>
|
|
399
|
-
|
|
400
|
-
#### Method query
|
|
401
|
-
|
|
402
|
-
Given a LookupQuestion, returns a LookupAnswer. Aggregates across multiple services and supports resiliency.
|
|
403
|
-
|
|
404
|
-
```ts
|
|
405
|
-
async query(question: LookupQuestion): Promise<LookupAnswer>
|
|
406
|
-
```
|
|
407
|
-
|
|
408
|
-
</details>
|
|
409
|
-
|
|
410
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
411
|
-
|
|
412
|
-
---
|
|
413
|
-
### Class: HTTPSOverlayBroadcastFacilitator
|
|
414
|
-
|
|
415
|
-
```ts
|
|
416
|
-
export class HTTPSOverlayBroadcastFacilitator implements OverlayBroadcastFacilitator {
|
|
417
|
-
httpClient: typeof fetch;
|
|
418
|
-
constructor(httpClient = fetch)
|
|
419
|
-
async send(url: string, taggedBEEF: TaggedBEEF): Promise<STEAK>
|
|
420
|
-
}
|
|
421
|
-
```
|
|
422
|
-
|
|
423
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
424
|
-
|
|
425
464
|
---
|
|
426
465
|
### Class: SHIPCast
|
|
427
466
|
|
|
@@ -434,6 +473,8 @@ export default class SHIPCast implements Broadcaster {
|
|
|
434
473
|
}
|
|
435
474
|
```
|
|
436
475
|
|
|
476
|
+
See also: [BroadcastFailure](#interface-broadcastfailure), [BroadcastResponse](#interface-broadcastresponse), [Broadcaster](#interface-broadcaster), [SHIPBroadcasterConfig](#interface-shipbroadcasterconfig), [Transaction](#class-transaction)
|
|
477
|
+
|
|
437
478
|
<details>
|
|
438
479
|
|
|
439
480
|
<summary>Class SHIPCast Details</summary>
|
|
@@ -445,6 +486,7 @@ Constructs an instance of the SHIP broadcaster.
|
|
|
445
486
|
```ts
|
|
446
487
|
constructor(topics: string[], config?: SHIPBroadcasterConfig)
|
|
447
488
|
```
|
|
489
|
+
See also: [SHIPBroadcasterConfig](#interface-shipbroadcasterconfig)
|
|
448
490
|
|
|
449
491
|
Argument Details
|
|
450
492
|
|
|
@@ -460,6 +502,7 @@ Broadcasts a transaction to Overlay Services via SHIP.
|
|
|
460
502
|
```ts
|
|
461
503
|
async broadcast(tx: Transaction): Promise<BroadcastResponse | BroadcastFailure>
|
|
462
504
|
```
|
|
505
|
+
See also: [BroadcastFailure](#interface-broadcastfailure), [BroadcastResponse](#interface-broadcastresponse), [Transaction](#class-transaction)
|
|
463
506
|
|
|
464
507
|
Returns
|
|
465
508
|
|
|
@@ -517,6 +560,8 @@ Submitted Transaction Execution AcKnowledgment
|
|
|
517
560
|
export type STEAK = Record<string, AdmittanceInstructions>
|
|
518
561
|
```
|
|
519
562
|
|
|
563
|
+
See also: [AdmittanceInstructions](#interface-admittanceinstructions)
|
|
564
|
+
|
|
520
565
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
521
566
|
|
|
522
567
|
---
|