@bsv/overlay 2.0.3 → 2.0.4

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.
Files changed (86) hide show
  1. package/README.md +226 -106
  2. package/dist/cjs/mod.js +6 -1
  3. package/dist/cjs/mod.js.map +1 -1
  4. package/dist/cjs/package.json +13 -11
  5. package/dist/cjs/src/BASM.js +92 -0
  6. package/dist/cjs/src/BASM.js.map +1 -0
  7. package/dist/cjs/src/BASMRemote.js +43 -0
  8. package/dist/cjs/src/BASMRemote.js.map +1 -0
  9. package/dist/cjs/src/Engine.js +649 -47
  10. package/dist/cjs/src/Engine.js.map +1 -1
  11. package/dist/cjs/src/GASP/OverlayGASPRemote.js +2 -2
  12. package/dist/cjs/src/GASP/OverlayGASPRemote.js.map +1 -1
  13. package/dist/cjs/src/GASP/OverlayGASPStorage.js +18 -25
  14. package/dist/cjs/src/GASP/OverlayGASPStorage.js.map +1 -1
  15. package/dist/cjs/src/storage/knex/KnexStorage.js +329 -12
  16. package/dist/cjs/src/storage/knex/KnexStorage.js.map +1 -1
  17. package/dist/cjs/src/storage/knex/all-migrations.js +3 -1
  18. package/dist/cjs/src/storage/knex/all-migrations.js.map +1 -1
  19. package/dist/cjs/src/storage/knex/migrations/2025-05-28-001-enlarge.js +2 -24
  20. package/dist/cjs/src/storage/knex/migrations/2025-05-28-001-enlarge.js.map +1 -1
  21. package/dist/cjs/src/storage/knex/migrations/2026-05-29-001-brc136-basm.js +114 -0
  22. package/dist/cjs/src/storage/knex/migrations/2026-05-29-001-brc136-basm.js.map +1 -0
  23. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  24. package/dist/esm/mod.js +1 -0
  25. package/dist/esm/mod.js.map +1 -1
  26. package/dist/esm/src/BASM.js +85 -0
  27. package/dist/esm/src/BASM.js.map +1 -0
  28. package/dist/esm/src/BASMRemote.js +42 -0
  29. package/dist/esm/src/BASMRemote.js.map +1 -0
  30. package/dist/esm/src/Engine.js +637 -46
  31. package/dist/esm/src/Engine.js.map +1 -1
  32. package/dist/esm/src/GASP/OverlayGASPRemote.js +2 -2
  33. package/dist/esm/src/GASP/OverlayGASPRemote.js.map +1 -1
  34. package/dist/esm/src/GASP/OverlayGASPStorage.js +18 -25
  35. package/dist/esm/src/GASP/OverlayGASPStorage.js.map +1 -1
  36. package/dist/esm/src/storage/knex/KnexStorage.js +323 -12
  37. package/dist/esm/src/storage/knex/KnexStorage.js.map +1 -1
  38. package/dist/esm/src/storage/knex/all-migrations.js +3 -1
  39. package/dist/esm/src/storage/knex/all-migrations.js.map +1 -1
  40. package/dist/esm/src/storage/knex/migrations/2025-05-28-001-enlarge.js +2 -24
  41. package/dist/esm/src/storage/knex/migrations/2025-05-28-001-enlarge.js.map +1 -1
  42. package/dist/esm/src/storage/knex/migrations/2026-05-29-001-brc136-basm.js +109 -0
  43. package/dist/esm/src/storage/knex/migrations/2026-05-29-001-brc136-basm.js.map +1 -0
  44. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  45. package/dist/types/mod.d.ts +2 -0
  46. package/dist/types/mod.d.ts.map +1 -1
  47. package/dist/types/src/BASM.d.ts +110 -0
  48. package/dist/types/src/BASM.d.ts.map +1 -0
  49. package/dist/types/src/BASMRemote.d.ts +14 -0
  50. package/dist/types/src/BASMRemote.d.ts.map +1 -0
  51. package/dist/types/src/Engine.d.ts +78 -1
  52. package/dist/types/src/Engine.d.ts.map +1 -1
  53. package/dist/types/src/GASP/OverlayGASPStorage.d.ts +1 -1
  54. package/dist/types/src/GASP/OverlayGASPStorage.d.ts.map +1 -1
  55. package/dist/types/src/LookupService.d.ts.map +1 -1
  56. package/dist/types/src/storage/Storage.d.ts +118 -0
  57. package/dist/types/src/storage/Storage.d.ts.map +1 -1
  58. package/dist/types/src/storage/knex/KnexStorage.d.ts +38 -6
  59. package/dist/types/src/storage/knex/KnexStorage.d.ts.map +1 -1
  60. package/dist/types/src/storage/knex/all-migrations.d.ts.map +1 -1
  61. package/dist/types/src/storage/knex/migrations/2025-05-28-001-enlarge.d.ts.map +1 -1
  62. package/dist/types/src/storage/knex/migrations/2026-05-29-001-brc136-basm.d.ts +4 -0
  63. package/dist/types/src/storage/knex/migrations/2026-05-29-001-brc136-basm.d.ts.map +1 -0
  64. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  65. package/docs/API.md +72 -580
  66. package/docs/BRC-136-BASM.md +285 -0
  67. package/docs/README.md +2 -0
  68. package/docs/Synchronization.md +10 -1
  69. package/docs/examples/README.md +2 -2
  70. package/docs/examples/gs-wip.md +68 -76
  71. package/mod.ts +25 -1
  72. package/package.json +25 -23
  73. package/src/BASM.ts +208 -0
  74. package/src/BASMRemote.ts +54 -0
  75. package/src/Engine.ts +762 -47
  76. package/src/GASP/OverlayGASPRemote.ts +2 -2
  77. package/src/GASP/OverlayGASPStorage.ts +17 -22
  78. package/src/LookupService.ts +2 -1
  79. package/src/__tests/BASM.test.ts +44 -0
  80. package/src/__tests/BASMChain.test.ts +290 -0
  81. package/src/__tests/Engine.test.ts +3 -4
  82. package/src/storage/Storage.ts +127 -0
  83. package/src/storage/knex/KnexStorage.ts +376 -14
  84. package/src/storage/knex/all-migrations.ts +3 -1
  85. package/src/storage/knex/migrations/2025-05-28-001-enlarge.ts +2 -22
  86. package/src/storage/knex/migrations/2026-05-29-001-brc136-basm.ts +123 -0
package/docs/API.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # API
2
2
 
3
+ [🏠 Home](./README.md) | [📚 API](./API.md) | [💡 Concepts](./concepts/README.md) | [📖 Examples](./examples/README.md) | [⚙️ Internal](./internal/README.md)
4
+
5
+ ---
6
+
3
7
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
4
8
 
5
9
  ## Interfaces
@@ -65,48 +69,6 @@ export interface Advertiser {
65
69
 
66
70
  See also: [Advertisement](#interface-advertisement), [AdvertisementData](#interface-advertisementdata)
67
71
 
68
- <details>
69
-
70
- <summary>Interface Advertiser Details</summary>
71
-
72
- #### Property createAdvertisements
73
-
74
- Creates a new SHIP/SLAP advertisement for a given topic.
75
-
76
- ```ts
77
- createAdvertisements: (adsData: AdvertisementData[]) => Promise<TaggedBEEF>
78
- ```
79
- See also: [AdvertisementData](#interface-advertisementdata)
80
-
81
- #### Property findAllAdvertisements
82
-
83
- Finds all SHIP/SLAP advertisements.
84
-
85
- ```ts
86
- findAllAdvertisements: (protocol: "SHIP" | "SLAP") => Promise<Advertisement[]>
87
- ```
88
- See also: [Advertisement](#interface-advertisement)
89
-
90
- #### Property parseAdvertisement
91
-
92
- Parses an output script to extract an advertisement.
93
-
94
- ```ts
95
- parseAdvertisement: (outputScript: Script) => Advertisement
96
- ```
97
- See also: [Advertisement](#interface-advertisement)
98
-
99
- #### Property revokeAdvertisements
100
-
101
- Revokes an existing advertisement, either SHIP or SLAP.
102
-
103
- ```ts
104
- revokeAdvertisements: (advertisements: Advertisement[]) => Promise<TaggedBEEF>
105
- ```
106
- See also: [Advertisement](#interface-advertisement)
107
-
108
- </details>
109
-
110
72
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
111
73
 
112
74
  ---
@@ -121,28 +83,6 @@ export interface AppliedTransaction {
121
83
  }
122
84
  ```
123
85
 
124
- <details>
125
-
126
- <summary>Interface AppliedTransaction Details</summary>
127
-
128
- #### Property topic
129
-
130
- Output index of the applied transaction
131
-
132
- ```ts
133
- topic: string
134
- ```
135
-
136
- #### Property txid
137
-
138
- TXID of the applied transaction
139
-
140
- ```ts
141
- txid: string
142
- ```
143
-
144
- </details>
145
-
146
86
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
147
87
 
148
88
  ---
@@ -189,52 +129,6 @@ export interface LookupService {
189
129
 
190
130
  See also: [AdmissionMode](#type-admissionmode), [LookupFormula](#type-lookupformula), [LookupServiceMetaData](#interface-lookupservicemetadata), [OutputAdmittedByTopic](#type-outputadmittedbytopic), [OutputSpent](#type-outputspent), [SpendNotificationMode](#type-spendnotificationmode)
191
131
 
192
- <details>
193
-
194
- <summary>Interface LookupService Details</summary>
195
-
196
- #### Property outputAdmittedByTopic
197
-
198
- Invoked when a Topic Manager admits a new UTXO.
199
- The payload shape depends on this.admissionMode.
200
-
201
- ```ts
202
- outputAdmittedByTopic: (payload: OutputAdmittedByTopic) => Promise<void> | void
203
- ```
204
- See also: [OutputAdmittedByTopic](#type-outputadmittedbytopic)
205
-
206
- #### Property outputEvicted
207
-
208
- LEGAL EVICTION:
209
- Permanently remove the referenced UTXO from all indices maintained by the
210
- Lookup Service. After eviction the service MUST NOT reference the output
211
- in any future lookup answer.
212
-
213
- ```ts
214
- outputEvicted: (txid: string, outputIndex: number) => Promise<void> | void
215
- ```
216
-
217
- #### Property outputNoLongerRetainedInHistory
218
-
219
- Called when a Topic Manager decides that **historical retention** of the
220
- specified UTXO is no longer required.
221
-
222
- ```ts
223
- outputNoLongerRetainedInHistory?: (txid: string, outputIndex: number, topic: string) => Promise<void> | void
224
- ```
225
-
226
- #### Property outputSpent
227
-
228
- Invoked when a previously-admitted UTXO is spent.
229
- The payload shape depends on this.spendNotificationMode.
230
-
231
- ```ts
232
- outputSpent?: (payload: OutputSpent) => Promise<void> | void
233
- ```
234
- See also: [OutputSpent](#type-outputspent)
235
-
236
- </details>
237
-
238
132
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
239
133
 
240
134
  ---
@@ -279,90 +173,6 @@ export interface Output {
279
173
  }
280
174
  ```
281
175
 
282
- <details>
283
-
284
- <summary>Interface Output Details</summary>
285
-
286
- #### Property beef
287
-
288
- The transaction data for the output
289
-
290
- ```ts
291
- beef?: number[]
292
- ```
293
-
294
- #### Property consumedBy
295
-
296
- Outputs consuming this output
297
-
298
- ```ts
299
- consumedBy: Array<{
300
- txid: string;
301
- outputIndex: number;
302
- }>
303
- ```
304
-
305
- #### Property outputIndex
306
-
307
- index of the output
308
-
309
- ```ts
310
- outputIndex: number
311
- ```
312
-
313
- #### Property outputScript
314
-
315
- script of the output
316
-
317
- ```ts
318
- outputScript: number[]
319
- ```
320
-
321
- #### Property outputsConsumed
322
-
323
- Outputs consumed by the transaction associated with the output
324
-
325
- ```ts
326
- outputsConsumed: Array<{
327
- txid: string;
328
- outputIndex: number;
329
- }>
330
- ```
331
-
332
- #### Property satoshis
333
-
334
- number of satoshis in the output
335
-
336
- ```ts
337
- satoshis: number
338
- ```
339
-
340
- #### Property spent
341
-
342
- Whether the output is spent
343
-
344
- ```ts
345
- spent: boolean
346
- ```
347
-
348
- #### Property topic
349
-
350
- topic to which the output belongs
351
-
352
- ```ts
353
- topic: string
354
- ```
355
-
356
- #### Property txid
357
-
358
- TXID of the output
359
-
360
- ```ts
361
- txid: string
362
- ```
363
-
364
- </details>
365
-
366
176
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
367
177
 
368
178
  ---
@@ -374,10 +184,6 @@ Defines the Storage Engine interface used internally by the Overlay Services Eng
374
184
  export interface Storage {
375
185
  insertOutput: (utxo: Output) => Promise<void>;
376
186
  findOutput: (txid: string, outputIndex: number, topic?: string, spent?: boolean, includeBEEF?: boolean) => Promise<Output | null>;
377
- findOutputsByOutpoints?: (outpoints: Array<{
378
- txid: string;
379
- outputIndex: number;
380
- }>, includeBEEF?: boolean) => Promise<Output[]>;
381
187
  findOutputsForTransaction: (txid: string, includeBEEF?: boolean) => Promise<Output[]>;
382
188
  findUTXOsForTopic: (topic: string, since?: number, limit?: number, includeBEEF?: boolean) => Promise<Output[]>;
383
189
  deleteOutput: (txid: string, outputIndex: number, topic: string) => Promise<void>;
@@ -397,138 +203,6 @@ export interface Storage {
397
203
 
398
204
  See also: [AppliedTransaction](#interface-appliedtransaction), [Output](#interface-output)
399
205
 
400
- <details>
401
-
402
- <summary>Interface Storage Details</summary>
403
-
404
- #### Property deleteOutput
405
-
406
- Deletes an output from storage
407
-
408
- ```ts
409
- deleteOutput: (txid: string, outputIndex: number, topic: string) => Promise<void>
410
- ```
411
-
412
- #### Property doesAppliedTransactionExist
413
-
414
- Checks if a duplicate transaction exists
415
-
416
- ```ts
417
- doesAppliedTransactionExist: (tx: AppliedTransaction) => Promise<boolean>
418
- ```
419
- See also: [AppliedTransaction](#interface-appliedtransaction)
420
-
421
- #### Property findOutput
422
-
423
- Finds an output from storage
424
-
425
- ```ts
426
- findOutput: (txid: string, outputIndex: number, topic?: string, spent?: boolean, includeBEEF?: boolean) => Promise<Output | null>
427
- ```
428
- See also: [Output](#interface-output)
429
-
430
- #### Property findOutputsByOutpoints
431
-
432
- Finds multiple outputs from storage by txid/output index pairs.
433
- Implementations can use this to collapse many point lookups into a single query.
434
-
435
- ```ts
436
- findOutputsByOutpoints?: (outpoints: Array<{
437
- txid: string;
438
- outputIndex: number;
439
- }>, includeBEEF?: boolean) => Promise<Output[]>
440
- ```
441
- See also: [Output](#interface-output)
442
-
443
- #### Property findOutputsForTransaction
444
-
445
- Finds outputs with a matching transaction ID from storage
446
-
447
- ```ts
448
- findOutputsForTransaction: (txid: string, includeBEEF?: boolean) => Promise<Output[]>
449
- ```
450
- See also: [Output](#interface-output)
451
-
452
- #### Property findUTXOsForTopic
453
-
454
- Finds current UTXOs that have been admitted into a given topic
455
-
456
- ```ts
457
- findUTXOsForTopic: (topic: string, since?: number, limit?: number, includeBEEF?: boolean) => Promise<Output[]>
458
- ```
459
- See also: [Output](#interface-output)
460
-
461
- #### Property getLastInteraction
462
-
463
- Retrieves the last interaction score for a given host and topic
464
-
465
- ```ts
466
- getLastInteraction: (host: string, topic: string) => Promise<number>
467
- ```
468
-
469
- #### Property insertAppliedTransaction
470
-
471
- Inserts record of the applied transaction
472
-
473
- ```ts
474
- insertAppliedTransaction: (tx: AppliedTransaction) => Promise<void>
475
- ```
476
- See also: [AppliedTransaction](#interface-appliedtransaction)
477
-
478
- #### Property insertOutput
479
-
480
- Adds a new output to storage
481
-
482
- ```ts
483
- insertOutput: (utxo: Output) => Promise<void>
484
- ```
485
- See also: [Output](#interface-output)
486
-
487
- #### Property markUTXOAsSpent
488
-
489
- Updates a UTXO as spent
490
-
491
- ```ts
492
- markUTXOAsSpent: (txid: string, outputIndex: number, topic: string) => Promise<void>
493
- ```
494
-
495
- #### Property updateConsumedBy
496
-
497
- Updates which outputs are consumed by this output
498
-
499
- ```ts
500
- updateConsumedBy: (txid: string, outputIndex: number, topic: string, consumedBy: Array<{
501
- txid: string;
502
- outputIndex: number;
503
- }>) => Promise<void>
504
- ```
505
-
506
- #### Property updateLastInteraction
507
-
508
- Updates the last interaction score for a given host and topic
509
-
510
- ```ts
511
- updateLastInteraction: (host: string, topic: string, since: number) => Promise<void>
512
- ```
513
-
514
- #### Property updateOutputBlockHeight
515
-
516
- Updates the block height on an output
517
-
518
- ```ts
519
- updateOutputBlockHeight?: (txid: string, outputIndex: number, topic: string, blockHeight: number) => Promise<void>
520
- ```
521
-
522
- #### Property updateTransactionBEEF
523
-
524
- Updates the beef data for a transaction
525
-
526
- ```ts
527
- updateTransactionBEEF: (txid: string, beef: number[]) => Promise<void>
528
- ```
529
-
530
- </details>
531
-
532
206
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
533
207
 
534
208
  ---
@@ -554,55 +228,6 @@ export interface TopicManager {
554
228
  }
555
229
  ```
556
230
 
557
- <details>
558
-
559
- <summary>Interface TopicManager Details</summary>
560
-
561
- #### Property getDocumentation
562
-
563
- Returns a Markdown-formatted documentation string for the topic manager.
564
-
565
- ```ts
566
- getDocumentation: () => Promise<string>
567
- ```
568
-
569
- #### Property getMetaData
570
-
571
- Returns a metadata object that can be used to identify the topic manager.
572
-
573
- ```ts
574
- getMetaData: () => Promise<{
575
- name: string;
576
- shortDescription: string;
577
- iconURL?: string;
578
- version?: string;
579
- informationURL?: string;
580
- }>
581
- ```
582
-
583
- #### Property identifyAdmissibleOutputs
584
-
585
- Returns instructions that denote which outputs from the provided transaction to admit into the topic, and which previous coins should be retained.
586
- Accepts the transaction in BEEF format and an array of those input indices which spend previously-admitted outputs from the same topic.
587
- The transaction's BEEF structure will always contain the transactions associated with previous coins for reference (if any), regardless of whether the current transaction was directly proven.
588
-
589
- ```ts
590
- identifyAdmissibleOutputs: (beef: number[], previousCoins: number[], offChainValues?: number[], mode?: "historical-tx" | "current-tx" | "historical-tx-no-spv") => Promise<AdmittanceInstructions>
591
- ```
592
-
593
- #### Property identifyNeededInputs
594
-
595
- Identifies and returns the inputs needed to anchor any topical outputs from this transaction to their associated previous history.
596
-
597
- ```ts
598
- identifyNeededInputs?: (beef: number[], offChainValues?: number[]) => Promise<Array<{
599
- txid: string;
600
- outputIndex: number;
601
- }>>
602
- ```
603
-
604
- </details>
605
-
606
231
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
607
232
 
608
233
  ---
@@ -629,31 +254,31 @@ export class Engine {
629
254
  [key: string]: TopicManager;
630
255
  }, public lookupServices: {
631
256
  [key: string]: LookupService;
632
- }, public storage: Storage, public chainTracker: ChainTracker | "scripts only", public hostingURL?: string, public shipTrackers?: string[], public slapTrackers?: string[], public broadcaster?: Broadcaster, public advertiser?: Advertiser, public syncConfiguration?: SyncConfiguration, public logTime = false, public logPrefix = "[OVERLAY_ENGINE] ", public throwOnBroadcastFailure = false, public overlayBroadcastFacilitator: OverlayBroadcastFacilitator = new HTTPSOverlayBroadcastFacilitator(), public logger: typeof console = console, public suppressDefaultSyncAdvertisements = true)
633
- async submit(taggedBEEF: TaggedBEEF, onSteakReady?: (steak: STEAK) => void, mode: "historical-tx" | "current-tx" | "historical-tx-no-spv" = "current-tx", offChainValues?: number[]): Promise<STEAK>
634
- async lookup(lookupQuestion: LookupQuestion): Promise<LookupAnswer>
635
- async syncAdvertisements(): Promise<void>
636
- async startGASPSync(): Promise<void>
637
- async provideForeignSyncResponse(initialRequest: GASPInitialRequest, topic: string): Promise<GASPInitialResponse>
638
- async provideForeignGASPNode(graphID: string, txid: string, outputIndex: number): Promise<GASPNode>
639
- async getUTXOHistory(output: Output, historySelector?: ((beef: number[], outputIndex: number, currentDepth: number) => Promise<boolean>) | number, currentDepth = 0, context: UTXOHistoryHydrationContext = this.createUTXOHistoryHydrationContext()): Promise<Output | undefined>
640
- async handleNewMerkleProof(txid: string, proof: MerklePath, blockHeight?: number): Promise<void>
257
+ }, public storage: Storage, public chainTracker: ChainTracker | "scripts only", public hostingURL?: string, public shipTrackers?: string[], public slapTrackers?: string[], public broadcaster?: Broadcaster, public advertiser?: Advertiser, public syncConfiguration?: SyncConfiguration, public logTime = false, public logPrefix = "[OVERLAY_ENGINE] ", public throwOnBroadcastFailure = false, public overlayBroadcastFacilitator: OverlayBroadcastFacilitator = new HTTPSOverlayBroadcastFacilitator(), public logger: typeof console = console, public suppressDefaultSyncAdvertisements = true)
258
+ async submit(taggedBEEF: TaggedBEEF, onSteakReady?: (steak: STEAK) => void, mode: "historical-tx" | "current-tx" | "historical-tx-no-spv" = "current-tx", offChainValues?: number[]): Promise<STEAK>
259
+ async lookup(lookupQuestion: LookupQuestion): Promise<LookupAnswer>
260
+ async syncAdvertisements(): Promise<void>
261
+ async startGASPSync(): Promise<void>
262
+ async provideForeignSyncResponse(initialRequest: GASPInitialRequest, topic: string): Promise<GASPInitialResponse>
263
+ async provideForeignGASPNode(graphID: string, txid: string, outputIndex: number): Promise<GASPNode>
264
+ async getUTXOHistory(output: Output, historySelector?: ((beef: number[], outputIndex: number, currentDepth: number) => Promise<boolean>) | number, currentDepth = 0, context: UTXOHistoryHydrationContext = this.createUTXOHistoryHydrationContext()): Promise<Output | undefined>
265
+ async handleNewMerkleProof(txid: string, proof: MerklePath, blockHeight?: number): Promise<void>
641
266
  async listTopicManagers(): Promise<Record<string, {
642
267
  name: string;
643
268
  shortDescription: string;
644
269
  iconURL?: string;
645
270
  version?: string;
646
271
  informationURL?: string;
647
- }>>
272
+ }>>
648
273
  async listLookupServiceProviders(): Promise<Record<string, {
649
274
  name: string;
650
275
  shortDescription: string;
651
276
  iconURL?: string;
652
277
  version?: string;
653
278
  informationURL?: string;
654
- }>>
655
- async getDocumentationForTopicManager(manager: any): Promise<string>
656
- async getDocumentationForLookupServiceProvider(provider: any): Promise<string>
279
+ }>>
280
+ async getDocumentationForTopicManager(manager: any): Promise<string>
281
+ async getDocumentationForLookupServiceProvider(provider: any): Promise<string>
657
282
  }
658
283
  ```
659
284
 
@@ -672,7 +297,7 @@ constructor(public managers: {
672
297
  [key: string]: TopicManager;
673
298
  }, public lookupServices: {
674
299
  [key: string]: LookupService;
675
- }, public storage: Storage, public chainTracker: ChainTracker | "scripts only", public hostingURL?: string, public shipTrackers?: string[], public slapTrackers?: string[], public broadcaster?: Broadcaster, public advertiser?: Advertiser, public syncConfiguration?: SyncConfiguration, public logTime = false, public logPrefix = "[OVERLAY_ENGINE] ", public throwOnBroadcastFailure = false, public overlayBroadcastFacilitator: OverlayBroadcastFacilitator = new HTTPSOverlayBroadcastFacilitator(), public logger: typeof console = console, public suppressDefaultSyncAdvertisements = true)
300
+ }, public storage: Storage, public chainTracker: ChainTracker | "scripts only", public hostingURL?: string, public shipTrackers?: string[], public slapTrackers?: string[], public broadcaster?: Broadcaster, public advertiser?: Advertiser, public syncConfiguration?: SyncConfiguration, public logTime = false, public logPrefix = "[OVERLAY_ENGINE] ", public throwOnBroadcastFailure = false, public overlayBroadcastFacilitator: OverlayBroadcastFacilitator = new HTTPSOverlayBroadcastFacilitator(), public logger: typeof console = console, public suppressDefaultSyncAdvertisements = true)
676
301
  ```
677
302
  See also: [Advertiser](#interface-advertiser), [LookupService](#interface-lookupservice), [Storage](#interface-storage), [SyncConfiguration](#type-syncconfiguration), [TopicManager](#interface-topicmanager)
678
303
 
@@ -716,7 +341,7 @@ Argument Details
716
341
  Run a query to get the documentation for a particular lookup service
717
342
 
718
343
  ```ts
719
- async getDocumentationForLookupServiceProvider(provider: any): Promise<string>
344
+ async getDocumentationForLookupServiceProvider(provider: any): Promise<string>
720
345
  ```
721
346
 
722
347
  Returns
@@ -728,7 +353,7 @@ Returns
728
353
  Run a query to get the documentation for a particular topic manager
729
354
 
730
355
  ```ts
731
- async getDocumentationForTopicManager(manager: any): Promise<string>
356
+ async getDocumentationForTopicManager(manager: any): Promise<string>
732
357
  ```
733
358
 
734
359
  Returns
@@ -743,7 +368,7 @@ This method traverses the history of a given Unspent Transaction Output (UTXO) a
743
368
  its historical data based on the provided history selector and current depth.
744
369
 
745
370
  ```ts
746
- async getUTXOHistory(output: Output, historySelector?: ((beef: number[], outputIndex: number, currentDepth: number) => Promise<boolean>) | number, currentDepth = 0, context: UTXOHistoryHydrationContext = this.createUTXOHistoryHydrationContext()): Promise<Output | undefined>
371
+ async getUTXOHistory(output: Output, historySelector?: ((beef: number[], outputIndex: number, currentDepth: number) => Promise<boolean>) | number, currentDepth = 0, context: UTXOHistoryHydrationContext = this.createUTXOHistoryHydrationContext()): Promise<Output | undefined>
747
372
  ```
748
373
  See also: [Output](#interface-output)
749
374
 
@@ -768,7 +393,7 @@ returning a promise that resolves to a boolean indicating whether to include the
768
393
  Recursively prune UTXOs when an incoming Merkle Proof is received.
769
394
 
770
395
  ```ts
771
- async handleNewMerkleProof(txid: string, proof: MerklePath, blockHeight?: number): Promise<void>
396
+ async handleNewMerkleProof(txid: string, proof: MerklePath, blockHeight?: number): Promise<void>
772
397
  ```
773
398
 
774
399
  Argument Details
@@ -791,7 +416,7 @@ async listLookupServiceProviders(): Promise<Record<string, {
791
416
  iconURL?: string;
792
417
  version?: string;
793
418
  informationURL?: string;
794
- }>>
419
+ }>>
795
420
  ```
796
421
 
797
422
  Returns
@@ -809,7 +434,7 @@ async listTopicManagers(): Promise<Record<string, {
809
434
  iconURL?: string;
810
435
  version?: string;
811
436
  informationURL?: string;
812
- }>>
437
+ }>>
813
438
  ```
814
439
 
815
440
  Returns
@@ -821,7 +446,7 @@ Returns
821
446
  Submit a lookup question to the Overlay Services Engine, and receive back a Lookup Answer
822
447
 
823
448
  ```ts
824
- async lookup(lookupQuestion: LookupQuestion): Promise<LookupAnswer>
449
+ async lookup(lookupQuestion: LookupQuestion): Promise<LookupAnswer>
825
450
  ```
826
451
 
827
452
  Returns
@@ -838,7 +463,7 @@ Argument Details
838
463
  Provides a GASPNode for the given graphID, transaction ID, and output index.
839
464
 
840
465
  ```ts
841
- async provideForeignGASPNode(graphID: string, txid: string, outputIndex: number): Promise<GASPNode>
466
+ async provideForeignGASPNode(graphID: string, txid: string, outputIndex: number): Promise<GASPNode>
842
467
  ```
843
468
 
844
469
  Returns
@@ -867,7 +492,7 @@ since the provided block height in the request. It constructs a response that in
867
492
  and the min block height from the initial request.
868
493
 
869
494
  ```ts
870
- async provideForeignSyncResponse(initialRequest: GASPInitialRequest, topic: string): Promise<GASPInitialResponse>
495
+ async provideForeignSyncResponse(initialRequest: GASPInitialRequest, topic: string): Promise<GASPInitialResponse>
871
496
  ```
872
497
 
873
498
  Returns
@@ -888,7 +513,7 @@ associated with that topic. If the sync configuration is 'SHIP', it will sync to
888
513
  the topic.
889
514
 
890
515
  ```ts
891
- async startGASPSync(): Promise<void>
516
+ async startGASPSync(): Promise<void>
892
517
  ```
893
518
 
894
519
  Throws
@@ -900,7 +525,7 @@ Error if the overlay service engine is not configured for topical synchronizatio
900
525
  Submits a transaction for processing by Overlay Services.
901
526
 
902
527
  ```ts
903
- async submit(taggedBEEF: TaggedBEEF, onSteakReady?: (steak: STEAK) => void, mode: "historical-tx" | "current-tx" | "historical-tx-no-spv" = "current-tx", offChainValues?: number[]): Promise<STEAK>
528
+ async submit(taggedBEEF: TaggedBEEF, onSteakReady?: (steak: STEAK) => void, mode: "historical-tx" | "current-tx" | "historical-tx-no-spv" = "current-tx", offChainValues?: number[]): Promise<STEAK>
904
529
  ```
905
530
 
906
531
  Returns
@@ -938,7 +563,7 @@ The function uses the `Advertiser` methods to create or revoke advertisements an
938
563
  submitted to the SHIP/SLAP overlay networks using the engine's `submit()` method.
939
564
 
940
565
  ```ts
941
- async syncAdvertisements(): Promise<void>
566
+ async syncAdvertisements(): Promise<void>
942
567
  ```
943
568
 
944
569
  Returns
@@ -959,33 +584,29 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
959
584
  ```ts
960
585
  export class KnexStorage implements Storage {
961
586
  knex: Knex;
962
- constructor(knex: Knex)
963
- async findOutput(txid: string, outputIndex: number, topic?: string, spent?: boolean, includeBEEF: boolean = false): Promise<Output | null>
964
- async findOutputsByOutpoints(outpoints: Array<{
965
- txid: string;
966
- outputIndex: number;
967
- }>, includeBEEF: boolean = false): Promise<Output[]>
968
- async findOutputsForTransaction(txid: string, includeBEEF: boolean = false): Promise<Output[]>
969
- async findUTXOsForTopic(topic: string, since?: number, limit?: number, includeBEEF: boolean = false): Promise<Output[]>
970
- async deleteOutput(txid: string, outputIndex: number, _: string): Promise<void>
971
- async insertOutput(output: Output): Promise<void>
972
- async markUTXOAsSpent(txid: string, outputIndex: number, topic?: string): Promise<void>
587
+ constructor(knex: Knex)
588
+ async findOutput(txid: string, outputIndex: number, topic?: string, spent?: boolean, includeBEEF: boolean = false): Promise<Output | null>
589
+ async findOutputsForTransaction(txid: string, includeBEEF: boolean = false): Promise<Output[]>
590
+ async findUTXOsForTopic(topic: string, since?: number, limit?: number, includeBEEF: boolean = false): Promise<Output[]>
591
+ async deleteOutput(txid: string, outputIndex: number, _: string): Promise<void>
592
+ async insertOutput(output: Output): Promise<void>
593
+ async markUTXOAsSpent(txid: string, outputIndex: number, topic?: string): Promise<void>
973
594
  async updateConsumedBy(txid: string, outputIndex: number, topic: string, consumedBy: Array<{
974
595
  txid: string;
975
596
  outputIndex: number;
976
- }>): Promise<void>
977
- async updateTransactionBEEF(txid: string, beef: number[]): Promise<void>
978
- async updateOutputBlockHeight(txid: string, outputIndex: number, topic: string, blockHeight: number): Promise<void>
597
+ }>): Promise<void>
598
+ async updateTransactionBEEF(txid: string, beef: number[]): Promise<void>
599
+ async updateOutputBlockHeight(txid: string, outputIndex: number, topic: string, blockHeight: number): Promise<void>
979
600
  async insertAppliedTransaction(tx: {
980
601
  txid: string;
981
602
  topic: string;
982
- }): Promise<void>
603
+ }): Promise<void>
983
604
  async doesAppliedTransactionExist(tx: {
984
605
  txid: string;
985
606
  topic: string;
986
- }): Promise<boolean>
987
- async updateLastInteraction(host: string, topic: string, since: number): Promise<void>
988
- async getLastInteraction(host: string, topic: string): Promise<number>
607
+ }): Promise<boolean>
608
+ async updateLastInteraction(host: string, topic: string, since: number): Promise<void>
609
+ async getLastInteraction(host: string, topic: string): Promise<number>
989
610
  }
990
611
  ```
991
612
 
@@ -998,11 +619,11 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
998
619
 
999
620
  ```ts
1000
621
  export class OverlayGASPRemote implements GASPRemote {
1001
- constructor(public endpointURL: string, public topic: string)
1002
- async getInitialResponse(request: GASPInitialRequest): Promise<GASPInitialResponse>
1003
- async requestNode(graphID: string, txid: string, outputIndex: number, metadata: boolean): Promise<GASPNode>
1004
- async getInitialReply(response: GASPInitialResponse): Promise<GASPInitialReply>
1005
- async submitNode(node: GASPNode): Promise<GASPNodeResponse | undefined>
622
+ constructor(public endpointURL: string, public topic: string)
623
+ async getInitialResponse(request: GASPInitialRequest): Promise<GASPInitialResponse>
624
+ async requestNode(graphID: string, txid: string, outputIndex: number, metadata: boolean): Promise<GASPNode>
625
+ async getInitialReply(response: GASPInitialResponse): Promise<GASPInitialReply>
626
+ async submitNode(node: GASPNode): Promise<GASPNodeResponse | undefined>
1006
627
  }
1007
628
  ```
1008
629
 
@@ -1015,7 +636,7 @@ export class OverlayGASPRemote implements GASPRemote {
1015
636
  Given an outgoing initial request, sends the request to the foreign instance and obtains their initial response.
1016
637
 
1017
638
  ```ts
1018
- async getInitialResponse(request: GASPInitialRequest): Promise<GASPInitialResponse>
639
+ async getInitialResponse(request: GASPInitialRequest): Promise<GASPInitialResponse>
1019
640
  ```
1020
641
 
1021
642
  #### Method requestNode
@@ -1023,7 +644,7 @@ async getInitialResponse(request: GASPInitialRequest): Promise<GASPInitialRespon
1023
644
  Given an outgoing txid, outputIndex and optional metadata, request the associated GASP node from the foreign instance.
1024
645
 
1025
646
  ```ts
1026
- async requestNode(graphID: string, txid: string, outputIndex: number, metadata: boolean): Promise<GASPNode>
647
+ async requestNode(graphID: string, txid: string, outputIndex: number, metadata: boolean): Promise<GASPNode>
1027
648
  ```
1028
649
 
1029
650
  </details>
@@ -1036,14 +657,14 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
1036
657
  ```ts
1037
658
  export class OverlayGASPStorage implements GASPStorage {
1038
659
  readonly temporaryGraphNodeRefs: Record<string, GraphNode> = {};
1039
- constructor(public topic: string, public engine: Engine, public maxNodesInGraph?: number)
1040
- async findKnownUTXOs(since: number): Promise<GASPOutput[]>
1041
- async hydrateGASPNode(graphID: string, txid: string, outputIndex: number, metadata: boolean): Promise<GASPNode>
1042
- async findNeededInputs(tx: GASPNode): Promise<GASPNodeResponse | undefined>
1043
- async appendToGraph(tx: GASPNode, spentBy?: string | undefined): Promise<void>
1044
- async validateGraphAnchor(graphID: string): Promise<void>
1045
- async discardGraph(graphID: string): Promise<void>
1046
- async finalizeGraph(graphID: string): Promise<void>
660
+ constructor(public topic: string, public engine: Engine, public maxNodesInGraph?: number)
661
+ async findKnownUTXOs(since: number): Promise<GASPOutput[]>
662
+ async hydrateGASPNode(graphID: string, txid: string, outputIndex: number, metadata: boolean): Promise<GASPNode>
663
+ async findNeededInputs(tx: GASPNode): Promise<GASPNodeResponse | undefined>
664
+ async appendToGraph(tx: GASPNode, spentBy?: string | undefined): Promise<void>
665
+ async validateGraphAnchor(graphID: string): Promise<void>
666
+ async discardGraph(graphID: string): Promise<void>
667
+ async finalizeGraph(graphID: string): Promise<void>
1047
668
  }
1048
669
  ```
1049
670
 
@@ -1058,7 +679,7 @@ See also: [Engine](#class-engine), [GraphNode](#interface-graphnode)
1058
679
  Appends a new node to a temporary graph.
1059
680
 
1060
681
  ```ts
1061
- async appendToGraph(tx: GASPNode, spentBy?: string | undefined): Promise<void>
682
+ async appendToGraph(tx: GASPNode, spentBy?: string | undefined): Promise<void>
1062
683
  ```
1063
684
 
1064
685
  Argument Details
@@ -1077,7 +698,7 @@ If the node cannot be appended to the graph, either because the graph ID is for
1077
698
  Deletes all data associated with a temporary graph that has failed to sync, if the graph exists.
1078
699
 
1079
700
  ```ts
1080
- async discardGraph(graphID: string): Promise<void>
701
+ async discardGraph(graphID: string): Promise<void>
1081
702
  ```
1082
703
 
1083
704
  Argument Details
@@ -1090,7 +711,7 @@ Argument Details
1090
711
  Finalizes a graph, solidifying the new UTXO and its ancestors so that it will appear in the list of known UTXOs.
1091
712
 
1092
713
  ```ts
1093
- async finalizeGraph(graphID: string): Promise<void>
714
+ async finalizeGraph(graphID: string): Promise<void>
1094
715
  ```
1095
716
 
1096
717
  Argument Details
@@ -1103,7 +724,7 @@ Argument Details
1103
724
  For a given node, returns the inputs needed to complete the graph, including whether updated metadata is requested for those inputs.
1104
725
 
1105
726
  ```ts
1106
- async findNeededInputs(tx: GASPNode): Promise<GASPNodeResponse | undefined>
727
+ async findNeededInputs(tx: GASPNode): Promise<GASPNodeResponse | undefined>
1107
728
  ```
1108
729
 
1109
730
  Returns
@@ -1120,7 +741,7 @@ Argument Details
1120
741
  For a given txid and output index, returns the associated transaction, a merkle proof if the transaction is in a block, and metadata if if requested. If no metadata is requested, metadata hashes on inputs are not returned.
1121
742
 
1122
743
  ```ts
1123
- async hydrateGASPNode(graphID: string, txid: string, outputIndex: number, metadata: boolean): Promise<GASPNode>
744
+ async hydrateGASPNode(graphID: string, txid: string, outputIndex: number, metadata: boolean): Promise<GASPNode>
1124
745
  ```
1125
746
 
1126
747
  #### Method validateGraphAnchor
@@ -1130,7 +751,7 @@ Additionally, in a breadth-first manner (ensuring that all inputs for any given
1130
751
  while considering any coins which the Manager had previously indicated were either valid or invalid.
1131
752
 
1132
753
  ```ts
1133
- async validateGraphAnchor(graphID: string): Promise<void>
754
+ async validateGraphAnchor(graphID: string): Promise<void>
1134
755
  ```
1135
756
 
1136
757
  Argument Details
@@ -1149,84 +770,15 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
1149
770
  ---
1150
771
  ## Functions
1151
772
 
1152
- | | |
1153
- | --- | --- |
1154
- | [down](#function-down) | [up](#function-up) |
1155
- | [down](#function-down) | [up](#function-up) |
1156
- | [down](#function-down) | [up](#function-up) |
1157
- | [down](#function-down) | [up](#function-up) |
1158
- | [down](#function-down) | [up](#function-up) |
1159
- | [down](#function-down) | [up](#function-up) |
1160
- | [down](#function-down) | [up](#function-up) |
1161
- | [down](#function-down) | [up](#function-up) |
1162
-
1163
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1164
-
1165
- ---
1166
-
1167
- ### Function: down
1168
-
1169
- ```ts
1170
- export async function down(knex: Knex): Promise<void>
1171
- ```
1172
-
1173
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1174
-
1175
- ---
1176
- ### Function: down
1177
-
1178
- ```ts
1179
- export async function down(knex: Knex): Promise<void>
1180
- ```
1181
-
1182
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1183
-
1184
- ---
1185
- ### Function: down
1186
-
1187
- ```ts
1188
- export async function down(knex: Knex): Promise<void>
1189
- ```
1190
-
1191
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1192
-
1193
- ---
1194
- ### Function: down
1195
-
1196
- ```ts
1197
- export async function down(knex: Knex): Promise<void>
1198
- ```
1199
-
1200
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1201
-
1202
- ---
1203
- ### Function: down
1204
-
1205
- ```ts
1206
- export async function down(knex: Knex): Promise<void>
1207
- ```
773
+ | |
774
+ | --- |
775
+ | [down](#function-down) |
776
+ | [up](#function-up) |
1208
777
 
1209
778
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1210
779
 
1211
780
  ---
1212
- ### Function: down
1213
781
 
1214
- ```ts
1215
- export async function down(knex: Knex): Promise<void>
1216
- ```
1217
-
1218
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1219
-
1220
- ---
1221
- ### Function: down
1222
-
1223
- ```ts
1224
- export async function down(knex: Knex): Promise<void>
1225
- ```
1226
-
1227
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1228
-
1229
- ---
1230
782
  ### Function: down
1231
783
 
1232
784
  ```ts
@@ -1238,69 +790,6 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
1238
790
  ---
1239
791
  ### Function: up
1240
792
 
1241
- ```ts
1242
- export async function up(knex: Knex): Promise<void>
1243
- ```
1244
-
1245
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1246
-
1247
- ---
1248
- ### Function: up
1249
-
1250
- ```ts
1251
- export async function up(knex: Knex): Promise<void>
1252
- ```
1253
-
1254
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1255
-
1256
- ---
1257
- ### Function: up
1258
-
1259
- ```ts
1260
- export async function up(knex: Knex): Promise<void>
1261
- ```
1262
-
1263
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1264
-
1265
- ---
1266
- ### Function: up
1267
-
1268
- ```ts
1269
- export async function up(knex: Knex): Promise<void>
1270
- ```
1271
-
1272
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1273
-
1274
- ---
1275
- ### Function: up
1276
-
1277
- ```ts
1278
- export async function up(knex: Knex): Promise<void>
1279
- ```
1280
-
1281
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1282
-
1283
- ---
1284
- ### Function: up
1285
-
1286
- ```ts
1287
- export async function up(knex: Knex): Promise<void>
1288
- ```
1289
-
1290
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1291
-
1292
- ---
1293
- ### Function: up
1294
-
1295
- ```ts
1296
- export async function up(knex: Knex): Promise<void>
1297
- ```
1298
-
1299
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1300
-
1301
- ---
1302
- ### Function: up
1303
-
1304
793
  Adds optimized index for findUTXOsForTopic queries.
1305
794
  This query pattern is: WHERE topic = ? AND spent = false ORDER BY score
1306
795
  The composite index (topic, spent, score) enables efficient range scans.
@@ -1450,3 +939,6 @@ export type SyncConfiguration = Record<string, string[] | "SHIP" | false>
1450
939
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1451
940
 
1452
941
  ---
942
+
943
+ [🏠 Home](./README.md) | [📚 API](./API.md) | [💡 Concepts](./concepts/README.md) | [📖 Examples](./examples/README.md) | [⚙️ Internal](./internal/README.md)
944
+