@bsv/overlay 0.4.4 → 0.4.5

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/docs/API.md CHANGED
@@ -12,6 +12,8 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
12
12
  | [AppliedTransaction](#interface-appliedtransaction) |
13
13
  | [GraphNode](#interface-graphnode) |
14
14
  | [LookupService](#interface-lookupservice) |
15
+ | [LookupServiceMetaData](#interface-lookupservicemetadata) |
16
+ | [Output](#interface-output) |
15
17
  | [Storage](#interface-storage) |
16
18
  | [TopicManager](#interface-topicmanager) |
17
19
 
@@ -19,73 +21,124 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
19
21
 
20
22
  ---
21
23
 
22
- ### Interface: TopicManager
24
+ ### Interface: Advertisement
23
25
 
24
- Defines a Topic Manager interface that can be implemented for specific use-cases
26
+ ```ts
27
+ export interface Advertisement {
28
+ protocol: "SHIP" | "SLAP";
29
+ identityKey: string;
30
+ domain: string;
31
+ topicOrService: string;
32
+ beef?: number[];
33
+ outputIndex?: number;
34
+ }
35
+ ```
36
+
37
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
38
+
39
+ ---
40
+ ### Interface: AdvertisementData
25
41
 
26
42
  ```ts
27
- export interface TopicManager {
28
- identifyAdmissibleOutputs: (beef: number[], previousCoins: number[]) => Promise<AdmittanceInstructions>;
29
- identifyNeededInputs?: (beef: number[]) => Promise<Array<{
30
- txid: string;
31
- outputIndex: number;
32
- }>>;
33
- getDocumentation: () => Promise<string>;
34
- getMetaData: () => Promise<{
35
- name: string;
36
- shortDescription: string;
37
- iconURL?: string;
38
- version?: string;
39
- informationURL?: string;
40
- }>;
43
+ export interface AdvertisementData {
44
+ protocol: "SHIP" | "SLAP";
45
+ topicOrServiceName: string;
46
+ }
47
+ ```
48
+
49
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
50
+
51
+ ---
52
+ ### Interface: Advertiser
53
+
54
+ Interface for managing SHIP and SLAP advertisements.
55
+ Provides methods for creating, finding, and revoking advertisements.
56
+
57
+ ```ts
58
+ export interface Advertiser {
59
+ createAdvertisements: (adsData: AdvertisementData[]) => Promise<TaggedBEEF>;
60
+ findAllAdvertisements: (protocol: "SHIP" | "SLAP") => Promise<Advertisement[]>;
61
+ revokeAdvertisements: (advertisements: Advertisement[]) => Promise<TaggedBEEF>;
62
+ parseAdvertisement: (outputScript: Script) => Advertisement;
41
63
  }
42
64
  ```
43
65
 
66
+ See also: [Advertisement](#interface-advertisement), [AdvertisementData](#interface-advertisementdata)
67
+
44
68
  <details>
45
69
 
46
- <summary>Interface TopicManager Details</summary>
70
+ <summary>Interface Advertiser Details</summary>
47
71
 
48
- #### Property getDocumentation
72
+ #### Property createAdvertisements
49
73
 
50
- Returns a Markdown-formatted documentation string for the topic manager.
74
+ Creates a new SHIP/SLAP advertisement for a given topic.
51
75
 
52
76
  ```ts
53
- getDocumentation: () => Promise<string>
77
+ createAdvertisements: (adsData: AdvertisementData[]) => Promise<TaggedBEEF>
54
78
  ```
79
+ See also: [AdvertisementData](#interface-advertisementdata)
55
80
 
56
- #### Property getMetaData
81
+ #### Property findAllAdvertisements
57
82
 
58
- Returns a metadata object that can be used to identify the topic manager.
83
+ Finds all SHIP/SLAP advertisements.
59
84
 
60
85
  ```ts
61
- getMetaData: () => Promise<{
62
- name: string;
63
- shortDescription: string;
64
- iconURL?: string;
65
- version?: string;
66
- informationURL?: string;
67
- }>
86
+ findAllAdvertisements: (protocol: "SHIP" | "SLAP") => Promise<Advertisement[]>
68
87
  ```
88
+ See also: [Advertisement](#interface-advertisement)
69
89
 
70
- #### Property identifyAdmissibleOutputs
90
+ #### Property parseAdvertisement
71
91
 
72
- Returns instructions that denote which outputs from the provided transaction to admit into the topic, and which previous coins should be retained.
73
- Accepts the transaction in BEEF format and an array of those input indices which spend previously-admitted outputs from the same topic.
74
- 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.
92
+ Parses an output script to extract an advertisement.
75
93
 
76
94
  ```ts
77
- identifyAdmissibleOutputs: (beef: number[], previousCoins: number[]) => Promise<AdmittanceInstructions>
95
+ parseAdvertisement: (outputScript: Script) => Advertisement
78
96
  ```
97
+ See also: [Advertisement](#interface-advertisement)
79
98
 
80
- #### Property identifyNeededInputs
99
+ #### Property revokeAdvertisements
81
100
 
82
- Identifies and returns the inputs needed to anchor any topical outputs from this transaction to their associated previous history.
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
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
111
+
112
+ ---
113
+ ### Interface: AppliedTransaction
114
+
115
+ Represents a transaction that has been applied to a topic.
83
116
 
84
117
  ```ts
85
- identifyNeededInputs?: (beef: number[]) => Promise<Array<{
118
+ export interface AppliedTransaction {
86
119
  txid: string;
87
- outputIndex: number;
88
- }>>
120
+ topic: string;
121
+ }
122
+ ```
123
+
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
89
142
  ```
90
143
 
91
144
  </details>
@@ -93,108 +146,208 @@ identifyNeededInputs?: (beef: number[]) => Promise<Array<{
93
146
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
94
147
 
95
148
  ---
96
- ### Interface: LookupService
149
+ ### Interface: GraphNode
150
+
151
+ Represents a node in the temporary graph.
152
+
153
+ ```ts
154
+ export interface GraphNode {
155
+ txid: string;
156
+ graphID: string;
157
+ rawTx: string;
158
+ outputIndex: number;
159
+ spentBy?: string;
160
+ proof?: string;
161
+ txMetadata?: string;
162
+ outputMetadata?: string;
163
+ inputs?: Record<string, {
164
+ hash: string;
165
+ }> | undefined;
166
+ children: GraphNode[];
167
+ parent?: GraphNode;
168
+ }
169
+ ```
170
+
171
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
97
172
 
98
- Defines a Lookup Service interface to be implemented for specific use-cases
173
+ ---
174
+ ### Interface: LookupService
99
175
 
100
176
  ```ts
101
177
  export interface LookupService {
102
- outputAdded?: (txid: string, outputIndex: number, outputScript: Script, topic: string) => Promise<void>;
103
- outputSpent?: (txid: string, outputIndex: number, topic: string) => Promise<void>;
104
- outputDeleted?: (txid: string, outputIndex: number, topic: string) => Promise<void>;
105
- lookup: (question: LookupQuestion) => Promise<LookupAnswer | LookupFormula>;
178
+ readonly admissionMode: AdmissionMode;
179
+ readonly spendNotificationMode: SpendNotificationMode;
180
+ outputAdmittedByTopic: (payload: OutputAdmittedByTopic) => Promise<void> | void;
181
+ outputSpent?: (payload: OutputSpent) => Promise<void> | void;
182
+ outputNoLongerRetainedInHistory?: (txid: string, outputIndex: number, topic: string) => Promise<void> | void;
183
+ outputEvicted: (txid: string, outputIndex: number) => Promise<void> | void;
184
+ lookup: (question: LookupQuestion) => Promise<LookupFormula>;
106
185
  getDocumentation: () => Promise<string>;
107
- getMetaData: () => Promise<{
108
- name: string;
109
- shortDescription: string;
110
- iconURL?: string;
111
- version?: string;
112
- informationURL?: string;
113
- }>;
186
+ getMetaData: () => Promise<LookupServiceMetaData>;
114
187
  }
115
188
  ```
116
189
 
190
+ See also: [AdmissionMode](#type-admissionmode), [LookupFormula](#type-lookupformula), [LookupServiceMetaData](#interface-lookupservicemetadata), [OutputAdmittedByTopic](#type-outputadmittedbytopic), [OutputSpent](#type-outputspent), [SpendNotificationMode](#type-spendnotificationmode)
191
+
117
192
  <details>
118
193
 
119
194
  <summary>Interface LookupService Details</summary>
120
195
 
121
- #### Property getDocumentation
196
+ #### Property outputAdmittedByTopic
122
197
 
123
- Returns a Markdown-formatted documentation string for the lookup service.
198
+ Invoked when a Topic Manager admits a new UTXO.
199
+ The payload shape depends on this.admissionMode.
124
200
 
125
201
  ```ts
126
- getDocumentation: () => Promise<string>
202
+ outputAdmittedByTopic: (payload: OutputAdmittedByTopic) => Promise<void> | void
127
203
  ```
204
+ See also: [OutputAdmittedByTopic](#type-outputadmittedbytopic)
128
205
 
129
- #### Property getMetaData
206
+ #### Property outputEvicted
130
207
 
131
- Returns a metadata object that can be used to identify the lookup service.
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.
132
212
 
133
213
  ```ts
134
- getMetaData: () => Promise<{
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
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
239
+
240
+ ---
241
+ ### Interface: LookupServiceMetaData
242
+
243
+ ```ts
244
+ export interface LookupServiceMetaData {
135
245
  name: string;
136
246
  shortDescription: string;
137
247
  iconURL?: string;
138
248
  version?: string;
139
249
  informationURL?: string;
140
- }>
250
+ }
141
251
  ```
142
252
 
143
- #### Property lookup
253
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
254
+
255
+ ---
256
+ ### Interface: Output
144
257
 
145
- Queries the lookup service for information
258
+ Represents an output to be tracked by the Overlay Services Engine
146
259
 
147
260
  ```ts
148
- lookup: (question: LookupQuestion) => Promise<LookupAnswer | LookupFormula>
261
+ export interface Output {
262
+ txid: string;
263
+ outputIndex: number;
264
+ outputScript: number[];
265
+ satoshis: number;
266
+ topic: string;
267
+ spent: boolean;
268
+ outputsConsumed: Array<{
269
+ txid: string;
270
+ outputIndex: number;
271
+ }>;
272
+ consumedBy: Array<{
273
+ txid: string;
274
+ outputIndex: number;
275
+ }>;
276
+ beef?: number[];
277
+ blockHeight?: number;
278
+ score?: number;
279
+ }
149
280
  ```
150
281
 
151
- #### Property outputAdded
282
+ <details>
283
+
284
+ <summary>Interface Output Details</summary>
285
+
286
+ #### Property beef
152
287
 
153
- Process the event when a new UTXO is let into a topic
288
+ The transaction data for the output
154
289
 
155
290
  ```ts
156
- outputAdded?: (txid: string, outputIndex: number, outputScript: Script, topic: string) => Promise<void>
291
+ beef?: number[]
157
292
  ```
158
293
 
159
- #### Property outputDeleted
294
+ #### Property consumedBy
160
295
 
161
- Processes the deletion event for a UTXO.
296
+ Outputs consuming this output
162
297
 
163
298
  ```ts
164
- outputDeleted?: (txid: string, outputIndex: number, topic: string) => Promise<void>
299
+ consumedBy: Array<{
300
+ txid: string;
301
+ outputIndex: number;
302
+ }>
165
303
  ```
166
304
 
167
- #### Property outputSpent
305
+ #### Property outputIndex
168
306
 
169
- Processes the spend event for a UTXO.
307
+ index of the output
170
308
 
171
309
  ```ts
172
- outputSpent?: (txid: string, outputIndex: number, topic: string) => Promise<void>
310
+ outputIndex: number
173
311
  ```
174
312
 
175
- </details>
313
+ #### Property outputScript
176
314
 
177
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
315
+ script of the output
178
316
 
179
- ---
180
- ### Interface: AppliedTransaction
317
+ ```ts
318
+ outputScript: number[]
319
+ ```
181
320
 
182
- Represents a transaction that has been applied to a topic.
321
+ #### Property outputsConsumed
322
+
323
+ Outputs consumed by the transaction associated with the output
183
324
 
184
325
  ```ts
185
- export interface AppliedTransaction {
326
+ outputsConsumed: Array<{
186
327
  txid: string;
187
- topic: string;
188
- }
328
+ outputIndex: number;
329
+ }>
189
330
  ```
190
331
 
191
- <details>
332
+ #### Property satoshis
192
333
 
193
- <summary>Interface AppliedTransaction Details</summary>
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
+ ```
194
347
 
195
348
  #### Property topic
196
349
 
197
- Output index of the applied transaction
350
+ topic to which the output belongs
198
351
 
199
352
  ```ts
200
353
  topic: string
@@ -202,7 +355,7 @@ topic: string
202
355
 
203
356
  #### Property txid
204
357
 
205
- TXID of the applied transaction
358
+ TXID of the output
206
359
 
207
360
  ```ts
208
361
  txid: string
@@ -222,7 +375,7 @@ export interface Storage {
222
375
  insertOutput: (utxo: Output) => Promise<void>;
223
376
  findOutput: (txid: string, outputIndex: number, topic?: string, spent?: boolean, includeBEEF?: boolean) => Promise<Output | null>;
224
377
  findOutputsForTransaction: (txid: string, includeBEEF?: boolean) => Promise<Output[]>;
225
- findUTXOsForTopic: (topic: string, since?: number, includeBEEF?: boolean) => Promise<Output[]>;
378
+ findUTXOsForTopic: (topic: string, since?: number, limit?: number, includeBEEF?: boolean) => Promise<Output[]>;
226
379
  deleteOutput: (txid: string, outputIndex: number, topic: string) => Promise<void>;
227
380
  markUTXOAsSpent: (txid: string, outputIndex: number, topic: string) => Promise<void>;
228
381
  updateConsumedBy: (txid: string, outputIndex: number, topic: string, consumedBy: Array<{
@@ -233,9 +386,13 @@ export interface Storage {
233
386
  updateOutputBlockHeight?: (txid: string, outputIndex: number, topic: string, blockHeight: number) => Promise<void>;
234
387
  insertAppliedTransaction: (tx: AppliedTransaction) => Promise<void>;
235
388
  doesAppliedTransactionExist: (tx: AppliedTransaction) => Promise<boolean>;
389
+ updateLastInteraction: (host: string, topic: string, since: number) => Promise<void>;
390
+ getLastInteraction: (host: string, topic: string) => Promise<number>;
236
391
  }
237
392
  ```
238
393
 
394
+ See also: [AppliedTransaction](#interface-appliedtransaction), [Output](#interface-output)
395
+
239
396
  <details>
240
397
 
241
398
  <summary>Interface Storage Details</summary>
@@ -255,6 +412,7 @@ Checks if a duplicate transaction exists
255
412
  ```ts
256
413
  doesAppliedTransactionExist: (tx: AppliedTransaction) => Promise<boolean>
257
414
  ```
415
+ See also: [AppliedTransaction](#interface-appliedtransaction)
258
416
 
259
417
  #### Property findOutput
260
418
 
@@ -263,6 +421,7 @@ Finds an output from storage
263
421
  ```ts
264
422
  findOutput: (txid: string, outputIndex: number, topic?: string, spent?: boolean, includeBEEF?: boolean) => Promise<Output | null>
265
423
  ```
424
+ See also: [Output](#interface-output)
266
425
 
267
426
  #### Property findOutputsForTransaction
268
427
 
@@ -271,13 +430,23 @@ Finds outputs with a matching transaction ID from storage
271
430
  ```ts
272
431
  findOutputsForTransaction: (txid: string, includeBEEF?: boolean) => Promise<Output[]>
273
432
  ```
433
+ See also: [Output](#interface-output)
274
434
 
275
435
  #### Property findUTXOsForTopic
276
436
 
277
437
  Finds current UTXOs that have been admitted into a given topic
278
438
 
279
439
  ```ts
280
- findUTXOsForTopic: (topic: string, since?: number, includeBEEF?: boolean) => Promise<Output[]>
440
+ findUTXOsForTopic: (topic: string, since?: number, limit?: number, includeBEEF?: boolean) => Promise<Output[]>
441
+ ```
442
+ See also: [Output](#interface-output)
443
+
444
+ #### Property getLastInteraction
445
+
446
+ Retrieves the last interaction score for a given host and topic
447
+
448
+ ```ts
449
+ getLastInteraction: (host: string, topic: string) => Promise<number>
281
450
  ```
282
451
 
283
452
  #### Property insertAppliedTransaction
@@ -287,6 +456,7 @@ Inserts record of the applied transaction
287
456
  ```ts
288
457
  insertAppliedTransaction: (tx: AppliedTransaction) => Promise<void>
289
458
  ```
459
+ See also: [AppliedTransaction](#interface-appliedtransaction)
290
460
 
291
461
  #### Property insertOutput
292
462
 
@@ -295,6 +465,7 @@ Adds a new output to storage
295
465
  ```ts
296
466
  insertOutput: (utxo: Output) => Promise<void>
297
467
  ```
468
+ See also: [Output](#interface-output)
298
469
 
299
470
  #### Property markUTXOAsSpent
300
471
 
@@ -315,6 +486,14 @@ updateConsumedBy: (txid: string, outputIndex: number, topic: string, consumedBy:
315
486
  }>) => Promise<void>
316
487
  ```
317
488
 
489
+ #### Property updateLastInteraction
490
+
491
+ Updates the last interaction score for a given host and topic
492
+
493
+ ```ts
494
+ updateLastInteraction: (host: string, topic: string, since: number) => Promise<void>
495
+ ```
496
+
318
497
  #### Property updateOutputBlockHeight
319
498
 
320
499
  Updates the block height on an output
@@ -336,111 +515,77 @@ updateTransactionBEEF: (txid: string, beef: number[]) => Promise<void>
336
515
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
337
516
 
338
517
  ---
339
- ### Interface: Advertisement
518
+ ### Interface: TopicManager
519
+
520
+ Defines a Topic Manager interface that can be implemented for specific use-cases
340
521
 
341
522
  ```ts
342
- export interface Advertisement {
343
- protocol: "SHIP" | "SLAP";
344
- identityKey: string;
345
- domain: string;
346
- topicOrService: string;
347
- beef?: number[];
348
- outputIndex?: number;
349
- }
350
- ```
351
-
352
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
353
-
354
- ---
355
- ### Interface: AdvertisementData
356
-
357
- ```ts
358
- export interface AdvertisementData {
359
- protocol: "SHIP" | "SLAP";
360
- topicOrServiceName: string;
361
- }
362
- ```
363
-
364
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
365
-
366
- ---
367
- ### Interface: Advertiser
368
-
369
- Interface for managing SHIP and SLAP advertisements.
370
- Provides methods for creating, finding, and revoking advertisements.
371
-
372
- ```ts
373
- export interface Advertiser {
374
- createAdvertisements: (adsData: AdvertisementData[]) => Promise<TaggedBEEF>;
375
- findAllAdvertisements: (protocol: "SHIP" | "SLAP") => Promise<Advertisement[]>;
376
- revokeAdvertisements: (advertisements: Advertisement[]) => Promise<TaggedBEEF>;
377
- parseAdvertisement: (outputScript: Script) => Advertisement;
523
+ export interface TopicManager {
524
+ identifyAdmissibleOutputs: (beef: number[], previousCoins: number[], offChainValues?: number[]) => Promise<AdmittanceInstructions>;
525
+ identifyNeededInputs?: (beef: number[], offChainValues?: number[]) => Promise<Array<{
526
+ txid: string;
527
+ outputIndex: number;
528
+ }>>;
529
+ getDocumentation: () => Promise<string>;
530
+ getMetaData: () => Promise<{
531
+ name: string;
532
+ shortDescription: string;
533
+ iconURL?: string;
534
+ version?: string;
535
+ informationURL?: string;
536
+ }>;
378
537
  }
379
538
  ```
380
539
 
381
540
  <details>
382
541
 
383
- <summary>Interface Advertiser Details</summary>
384
-
385
- #### Property createAdvertisements
386
-
387
- Creates a new SHIP/SLAP advertisement for a given topic.
388
-
389
- ```ts
390
- createAdvertisements: (adsData: AdvertisementData[]) => Promise<TaggedBEEF>
391
- ```
542
+ <summary>Interface TopicManager Details</summary>
392
543
 
393
- #### Property findAllAdvertisements
544
+ #### Property getDocumentation
394
545
 
395
- Finds all SHIP/SLAP advertisements.
546
+ Returns a Markdown-formatted documentation string for the topic manager.
396
547
 
397
548
  ```ts
398
- findAllAdvertisements: (protocol: "SHIP" | "SLAP") => Promise<Advertisement[]>
549
+ getDocumentation: () => Promise<string>
399
550
  ```
400
551
 
401
- #### Property parseAdvertisement
552
+ #### Property getMetaData
402
553
 
403
- Parses an output script to extract an advertisement.
554
+ Returns a metadata object that can be used to identify the topic manager.
404
555
 
405
556
  ```ts
406
- parseAdvertisement: (outputScript: Script) => Advertisement
557
+ getMetaData: () => Promise<{
558
+ name: string;
559
+ shortDescription: string;
560
+ iconURL?: string;
561
+ version?: string;
562
+ informationURL?: string;
563
+ }>
407
564
  ```
408
565
 
409
- #### Property revokeAdvertisements
566
+ #### Property identifyAdmissibleOutputs
410
567
 
411
- Revokes an existing advertisement, either SHIP or SLAP.
568
+ Returns instructions that denote which outputs from the provided transaction to admit into the topic, and which previous coins should be retained.
569
+ Accepts the transaction in BEEF format and an array of those input indices which spend previously-admitted outputs from the same topic.
570
+ 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.
412
571
 
413
572
  ```ts
414
- revokeAdvertisements: (advertisements: Advertisement[]) => Promise<TaggedBEEF>
573
+ identifyAdmissibleOutputs: (beef: number[], previousCoins: number[], offChainValues?: number[]) => Promise<AdmittanceInstructions>
415
574
  ```
416
575
 
417
- </details>
418
-
419
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
420
-
421
- ---
422
- ### Interface: GraphNode
576
+ #### Property identifyNeededInputs
423
577
 
424
- Represents a node in the temporary graph.
578
+ Identifies and returns the inputs needed to anchor any topical outputs from this transaction to their associated previous history.
425
579
 
426
580
  ```ts
427
- export interface GraphNode {
581
+ identifyNeededInputs?: (beef: number[], offChainValues?: number[]) => Promise<Array<{
428
582
  txid: string;
429
- graphID: string;
430
- rawTx: string;
431
583
  outputIndex: number;
432
- spentBy?: string;
433
- proof?: string;
434
- txMetadata?: string;
435
- outputMetadata?: string;
436
- inputs?: Record<string, {
437
- hash: string;
438
- }> | undefined;
439
- children: GraphNode[];
440
- parent?: GraphNode;
441
- }
584
+ }>>
442
585
  ```
443
586
 
587
+ </details>
588
+
444
589
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
445
590
 
446
591
  ---
@@ -457,160 +602,6 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
457
602
 
458
603
  ---
459
604
 
460
- ### Class: OverlayGASPRemote
461
-
462
- ```ts
463
- export class OverlayGASPRemote implements GASPRemote {
464
- constructor(public endpointURL: string, public topic: string)
465
- async getInitialResponse(request: GASPInitialRequest): Promise<GASPInitialResponse>
466
- async requestNode(graphID: string, txid: string, outputIndex: number, metadata: boolean): Promise<GASPNode>
467
- async getInitialReply(response: GASPInitialResponse): Promise<GASPInitialReply>
468
- async submitNode(node: GASPNode): Promise<void | GASPNodeResponse>
469
- }
470
- ```
471
-
472
- <details>
473
-
474
- <summary>Class OverlayGASPRemote Details</summary>
475
-
476
- #### Method getInitialResponse
477
-
478
- Given an outgoing initial request, sends the request to the foreign instance and obtains their initial response.
479
-
480
- ```ts
481
- async getInitialResponse(request: GASPInitialRequest): Promise<GASPInitialResponse>
482
- ```
483
-
484
- #### Method requestNode
485
-
486
- Given an outgoing txid, outputIndex and optional metadata, request the associated GASP node from the foreign instance.
487
-
488
- ```ts
489
- async requestNode(graphID: string, txid: string, outputIndex: number, metadata: boolean): Promise<GASPNode>
490
- ```
491
-
492
- </details>
493
-
494
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
495
-
496
- ---
497
- ### Class: OverlayGASPStorage
498
-
499
- ```ts
500
- export class OverlayGASPStorage implements GASPStorage {
501
- readonly temporaryGraphNodeRefs: Record<string, GraphNode> = {};
502
- constructor(public topic: string, public engine: Engine, public maxNodesInGraph?: number)
503
- async findKnownUTXOs(since: number): Promise<Array<{
504
- txid: string;
505
- outputIndex: number;
506
- }>>
507
- async hydrateGASPNode(graphID: string, txid: string, outputIndex: number, metadata: boolean): Promise<GASPNode>
508
- async findNeededInputs(tx: GASPNode): Promise<GASPNodeResponse | undefined>
509
- async appendToGraph(tx: GASPNode, spentBy?: string | undefined): Promise<void>
510
- async validateGraphAnchor(graphID: string): Promise<void>
511
- async discardGraph(graphID: string): Promise<void>
512
- async finalizeGraph(graphID: string): Promise<void>
513
- }
514
- ```
515
-
516
- <details>
517
-
518
- <summary>Class OverlayGASPStorage Details</summary>
519
-
520
- #### Method appendToGraph
521
-
522
- Appends a new node to a temporary graph.
523
-
524
- ```ts
525
- async appendToGraph(tx: GASPNode, spentBy?: string | undefined): Promise<void>
526
- ```
527
-
528
- Argument Details
529
-
530
- + **tx**
531
- + The node to append to this graph.
532
- + **spentBy**
533
- + Unless this is the same node identified by the graph ID, denotes the TXID and input index for the node which spent this one, in 36-byte format.
534
-
535
- Throws
536
-
537
- If the node cannot be appended to the graph, either because the graph ID is for a graph the recipient does not want or because the graph has grown to be too large before being finalized.
538
-
539
- #### Method discardGraph
540
-
541
- Deletes all data associated with a temporary graph that has failed to sync, if the graph exists.
542
-
543
- ```ts
544
- async discardGraph(graphID: string): Promise<void>
545
- ```
546
-
547
- Argument Details
548
-
549
- + **graphID**
550
- + The TXID and output index (in 36-byte format) for the UTXO at the tip of this graph.
551
-
552
- #### Method finalizeGraph
553
-
554
- Finalizes a graph, solidifying the new UTXO and its ancestors so that it will appear in the list of known UTXOs.
555
-
556
- ```ts
557
- async finalizeGraph(graphID: string): Promise<void>
558
- ```
559
-
560
- Argument Details
561
-
562
- + **graphID**
563
- + The TXID and output index (in 36-byte format) for the UTXO at the root of this graph.
564
-
565
- #### Method findNeededInputs
566
-
567
- For a given node, returns the inputs needed to complete the graph, including whether updated metadata is requested for those inputs.
568
-
569
- ```ts
570
- async findNeededInputs(tx: GASPNode): Promise<GASPNodeResponse | undefined>
571
- ```
572
-
573
- Returns
574
-
575
- A promise for a mapping of requested input transactions and whether metadata should be provided for each.
576
-
577
- Argument Details
578
-
579
- + **tx**
580
- + The node for which needed inputs should be found.
581
-
582
- #### Method hydrateGASPNode
583
-
584
- 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.
585
-
586
- ```ts
587
- async hydrateGASPNode(graphID: string, txid: string, outputIndex: number, metadata: boolean): Promise<GASPNode>
588
- ```
589
-
590
- #### Method validateGraphAnchor
591
-
592
- Checks whether the given graph, in its current state, makes reference only to transactions that are proven in the blockchain, or already known by the recipient to be valid.
593
- Additionally, in a breadth-first manner (ensuring that all inputs for any given node are processed before nodes that spend them), it ensures that the root node remains valid according to the rules of the overlay's topic manager,
594
- while considering any coins which the Manager had previously indicated were either valid or invalid.
595
-
596
- ```ts
597
- async validateGraphAnchor(graphID: string): Promise<void>
598
- ```
599
-
600
- Argument Details
601
-
602
- + **graphID**
603
- + The TXID and output index (in 36-byte format) for the UTXO at the tip of this graph.
604
-
605
- Throws
606
-
607
- If the graph is not well-anchored, according to the rules of Bitcoin or the rules of the Overlay Topic Manager.
608
-
609
- </details>
610
-
611
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
612
-
613
- ---
614
605
  ### Class: Engine
615
606
 
616
607
  An engine for running BSV Overlay Services (topic managers and lookup services).
@@ -621,8 +612,8 @@ export class Engine {
621
612
  [key: string]: TopicManager;
622
613
  }, public lookupServices: {
623
614
  [key: string]: LookupService;
624
- }, 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)
625
- async submit(taggedBEEF: TaggedBEEF, onSteakReady?: (steak: STEAK) => void, mode: "historical-tx" | "current-tx" = "current-tx"): Promise<STEAK>
615
+ }, 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)
616
+ async submit(taggedBEEF: TaggedBEEF, onSteakReady?: (steak: STEAK) => void, mode: "historical-tx" | "current-tx" = "current-tx", offChainValues?: number[]): Promise<STEAK>
626
617
  async lookup(lookupQuestion: LookupQuestion): Promise<LookupAnswer>
627
618
  async syncAdvertisements(): Promise<void>
628
619
  async startGASPSync(): Promise<void>
@@ -649,6 +640,8 @@ export class Engine {
649
640
  }
650
641
  ```
651
642
 
643
+ See also: [Advertiser](#interface-advertiser), [LookupService](#interface-lookupservice), [Output](#interface-output), [Storage](#interface-storage), [SyncConfiguration](#type-syncconfiguration), [TopicManager](#interface-topicmanager)
644
+
652
645
  <details>
653
646
 
654
647
  <summary>Class Engine Details</summary>
@@ -662,8 +655,9 @@ constructor(public managers: {
662
655
  [key: string]: TopicManager;
663
656
  }, public lookupServices: {
664
657
  [key: string]: LookupService;
665
- }, 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)
658
+ }, 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)
666
659
  ```
660
+ See also: [Advertiser](#interface-advertiser), [LookupService](#interface-lookupservice), [Storage](#interface-storage), [SyncConfiguration](#type-syncconfiguration), [TopicManager](#interface-topicmanager)
667
661
 
668
662
  Argument Details
669
663
 
@@ -697,6 +691,8 @@ Argument Details
697
691
  + Facilitator for propagation to other Overlay Services.
698
692
  + **logger**
699
693
  + The place where log entries are written.
694
+ + **suppressDefaultSyncAdvertisements**
695
+ + Whether to suppress the default (SHIP/SLAP) sync advertisements.
700
696
 
701
697
  #### Method getDocumentationForLookupServiceProvider
702
698
 
@@ -732,6 +728,7 @@ its historical data based on the provided history selector and current depth.
732
728
  ```ts
733
729
  async getUTXOHistory(output: Output, historySelector?: ((beef: number[], outputIndex: number, currentDepth: number) => Promise<boolean>) | number, currentDepth = 0): Promise<Output | undefined>
734
730
  ```
731
+ See also: [Output](#interface-output)
735
732
 
736
733
  Returns
737
734
 
@@ -886,7 +883,7 @@ Error if the overlay service engine is not configured for topical synchronizatio
886
883
  Submits a transaction for processing by Overlay Services.
887
884
 
888
885
  ```ts
889
- async submit(taggedBEEF: TaggedBEEF, onSteakReady?: (steak: STEAK) => void, mode: "historical-tx" | "current-tx" = "current-tx"): Promise<STEAK>
886
+ async submit(taggedBEEF: TaggedBEEF, onSteakReady?: (steak: STEAK) => void, mode: "historical-tx" | "current-tx" = "current-tx", offChainValues?: number[]): Promise<STEAK>
890
887
  ```
891
888
 
892
889
  Returns
@@ -901,12 +898,14 @@ Argument Details
901
898
  + Optional callback function invoked when the STEAK is ready.
902
899
  + **mode**
903
900
  + — Indicates the submission behavior, whether historical or current. Historical transactions are not broadcast or propagated.
901
+ + **offChainValues**
902
+ + — Values necessary to evaluate topical admittance that are not stored on-chain.
904
903
 
905
904
  The optional callback function should be used to get STEAK when ready, and avoid waiting for broadcast and transaction propagation to complete.
906
905
 
907
906
  #### Method syncAdvertisements
908
907
 
909
- Ensures alignment between the current SHIP/SLAP advertisements and the
908
+ Ensures alignment between the current SHIP/SLAP advertisements and the
910
909
  configured Topic Managers and Lookup Services in the engine.
911
910
 
912
911
  This method performs the following actions:
@@ -946,7 +945,7 @@ export class KnexStorage implements Storage {
946
945
  constructor(knex: Knex)
947
946
  async findOutput(txid: string, outputIndex: number, topic?: string, spent?: boolean, includeBEEF: boolean = false): Promise<Output | null>
948
947
  async findOutputsForTransaction(txid: string, includeBEEF: boolean = false): Promise<Output[]>
949
- async findUTXOsForTopic(topic: string, since?: number, includeBEEF: boolean = false): Promise<Output[]>
948
+ async findUTXOsForTopic(topic: string, since?: number, limit?: number, includeBEEF: boolean = false): Promise<Output[]>
950
949
  async deleteOutput(txid: string, outputIndex: number, topic: string): Promise<void>
951
950
  async insertOutput(output: Output): Promise<void>
952
951
  async markUTXOAsSpent(txid: string, outputIndex: number, topic?: string): Promise<void>
@@ -964,33 +963,189 @@ export class KnexStorage implements Storage {
964
963
  txid: string;
965
964
  topic: string;
966
965
  }): Promise<boolean>
966
+ async updateLastInteraction(host: string, topic: string, since: number): Promise<void>
967
+ async getLastInteraction(host: string, topic: string): Promise<number>
967
968
  }
968
969
  ```
969
970
 
971
+ See also: [Output](#interface-output), [Storage](#interface-storage)
972
+
970
973
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
971
974
 
972
975
  ---
973
- ## Functions
976
+ ### Class: OverlayGASPRemote
974
977
 
975
- | |
976
- | --- |
977
- | [down](#function-down) |
978
- | [down](#function-down) |
979
- | [down](#function-down) |
980
- | [down](#function-down) |
981
- | [up](#function-up) |
982
- | [up](#function-up) |
983
- | [up](#function-up) |
984
- | [up](#function-up) |
978
+ ```ts
979
+ export class OverlayGASPRemote implements GASPRemote {
980
+ constructor(public endpointURL: string, public topic: string)
981
+ async getInitialResponse(request: GASPInitialRequest): Promise<GASPInitialResponse>
982
+ async requestNode(graphID: string, txid: string, outputIndex: number, metadata: boolean): Promise<GASPNode>
983
+ async getInitialReply(response: GASPInitialResponse): Promise<GASPInitialReply>
984
+ async submitNode(node: GASPNode): Promise<GASPNodeResponse | undefined>
985
+ }
986
+ ```
987
+
988
+ <details>
989
+
990
+ <summary>Class OverlayGASPRemote Details</summary>
991
+
992
+ #### Method getInitialResponse
993
+
994
+ Given an outgoing initial request, sends the request to the foreign instance and obtains their initial response.
995
+
996
+ ```ts
997
+ async getInitialResponse(request: GASPInitialRequest): Promise<GASPInitialResponse>
998
+ ```
999
+
1000
+ #### Method requestNode
1001
+
1002
+ Given an outgoing txid, outputIndex and optional metadata, request the associated GASP node from the foreign instance.
1003
+
1004
+ ```ts
1005
+ async requestNode(graphID: string, txid: string, outputIndex: number, metadata: boolean): Promise<GASPNode>
1006
+ ```
1007
+
1008
+ </details>
985
1009
 
986
1010
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
987
1011
 
988
1012
  ---
1013
+ ### Class: OverlayGASPStorage
989
1014
 
990
- ### Function: up
1015
+ ```ts
1016
+ export class OverlayGASPStorage implements GASPStorage {
1017
+ readonly temporaryGraphNodeRefs: Record<string, GraphNode> = {};
1018
+ constructor(public topic: string, public engine: Engine, public maxNodesInGraph?: number)
1019
+ async findKnownUTXOs(since: number): Promise<GASPOutput[]>
1020
+ async hydrateGASPNode(graphID: string, txid: string, outputIndex: number, metadata: boolean): Promise<GASPNode>
1021
+ async findNeededInputs(tx: GASPNode): Promise<GASPNodeResponse | undefined>
1022
+ async appendToGraph(tx: GASPNode, spentBy?: string | undefined): Promise<void>
1023
+ async validateGraphAnchor(graphID: string): Promise<void>
1024
+ async discardGraph(graphID: string): Promise<void>
1025
+ async finalizeGraph(graphID: string): Promise<void>
1026
+ }
1027
+ ```
1028
+
1029
+ See also: [Engine](#class-engine), [GraphNode](#interface-graphnode)
1030
+
1031
+ <details>
1032
+
1033
+ <summary>Class OverlayGASPStorage Details</summary>
1034
+
1035
+ #### Method appendToGraph
1036
+
1037
+ Appends a new node to a temporary graph.
991
1038
 
992
1039
  ```ts
993
- export async function up(knex: Knex): Promise<void>
1040
+ async appendToGraph(tx: GASPNode, spentBy?: string | undefined): Promise<void>
1041
+ ```
1042
+
1043
+ Argument Details
1044
+
1045
+ + **tx**
1046
+ + The node to append to this graph.
1047
+ + **spentBy**
1048
+ + Unless this is the same node identified by the graph ID, denotes the TXID and input index for the node which spent this one, in 36-byte format.
1049
+
1050
+ Throws
1051
+
1052
+ If the node cannot be appended to the graph, either because the graph ID is for a graph the recipient does not want or because the graph has grown to be too large before being finalized.
1053
+
1054
+ #### Method discardGraph
1055
+
1056
+ Deletes all data associated with a temporary graph that has failed to sync, if the graph exists.
1057
+
1058
+ ```ts
1059
+ async discardGraph(graphID: string): Promise<void>
1060
+ ```
1061
+
1062
+ Argument Details
1063
+
1064
+ + **graphID**
1065
+ + The TXID and output index (in 36-byte format) for the UTXO at the tip of this graph.
1066
+
1067
+ #### Method finalizeGraph
1068
+
1069
+ Finalizes a graph, solidifying the new UTXO and its ancestors so that it will appear in the list of known UTXOs.
1070
+
1071
+ ```ts
1072
+ async finalizeGraph(graphID: string): Promise<void>
1073
+ ```
1074
+
1075
+ Argument Details
1076
+
1077
+ + **graphID**
1078
+ + The TXID and output index (in 36-byte format) for the UTXO at the root of this graph.
1079
+
1080
+ #### Method findNeededInputs
1081
+
1082
+ For a given node, returns the inputs needed to complete the graph, including whether updated metadata is requested for those inputs.
1083
+
1084
+ ```ts
1085
+ async findNeededInputs(tx: GASPNode): Promise<GASPNodeResponse | undefined>
1086
+ ```
1087
+
1088
+ Returns
1089
+
1090
+ A promise for a mapping of requested input transactions and whether metadata should be provided for each.
1091
+
1092
+ Argument Details
1093
+
1094
+ + **tx**
1095
+ + The node for which needed inputs should be found.
1096
+
1097
+ #### Method hydrateGASPNode
1098
+
1099
+ 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.
1100
+
1101
+ ```ts
1102
+ async hydrateGASPNode(graphID: string, txid: string, outputIndex: number, metadata: boolean): Promise<GASPNode>
1103
+ ```
1104
+
1105
+ #### Method validateGraphAnchor
1106
+
1107
+ Checks whether the given graph, in its current state, makes reference only to transactions that are proven in the blockchain, or already known by the recipient to be valid.
1108
+ Additionally, in a breadth-first manner (ensuring that all inputs for any given node are processed before nodes that spend them), it ensures that the root node remains valid according to the rules of the overlay's topic manager,
1109
+ while considering any coins which the Manager had previously indicated were either valid or invalid.
1110
+
1111
+ ```ts
1112
+ async validateGraphAnchor(graphID: string): Promise<void>
1113
+ ```
1114
+
1115
+ Argument Details
1116
+
1117
+ + **graphID**
1118
+ + The TXID and output index (in 36-byte format) for the UTXO at the tip of this graph.
1119
+
1120
+ Throws
1121
+
1122
+ If the graph is not well-anchored, according to the rules of Bitcoin or the rules of the Overlay Topic Manager.
1123
+
1124
+ </details>
1125
+
1126
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1127
+
1128
+ ---
1129
+ ## Functions
1130
+
1131
+ | | |
1132
+ | --- | --- |
1133
+ | [down](#function-down) | [up](#function-up) |
1134
+ | [down](#function-down) | [up](#function-up) |
1135
+ | [down](#function-down) | [up](#function-up) |
1136
+ | [down](#function-down) | [up](#function-up) |
1137
+ | [down](#function-down) | [up](#function-up) |
1138
+ | [down](#function-down) | [up](#function-up) |
1139
+ | [down](#function-down) | [up](#function-up) |
1140
+
1141
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1142
+
1143
+ ---
1144
+
1145
+ ### Function: down
1146
+
1147
+ ```ts
1148
+ export async function down(knex: Knex): Promise<void>
994
1149
  ```
995
1150
 
996
1151
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
@@ -1005,10 +1160,10 @@ export async function down(knex: Knex): Promise<void>
1005
1160
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1006
1161
 
1007
1162
  ---
1008
- ### Function: up
1163
+ ### Function: down
1009
1164
 
1010
1165
  ```ts
1011
- export async function up(knex: Knex): Promise<void>
1166
+ export async function down(knex: Knex): Promise<void>
1012
1167
  ```
1013
1168
 
1014
1169
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
@@ -1023,10 +1178,19 @@ export async function down(knex: Knex): Promise<void>
1023
1178
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1024
1179
 
1025
1180
  ---
1026
- ### Function: up
1181
+ ### Function: down
1027
1182
 
1028
1183
  ```ts
1029
- export async function up(knex: Knex): Promise<void>
1184
+ export async function down(knex: Knex): Promise<void>
1185
+ ```
1186
+
1187
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1188
+
1189
+ ---
1190
+ ### Function: down
1191
+
1192
+ ```ts
1193
+ export async function down(knex: Knex): Promise<void>
1030
1194
  ```
1031
1195
 
1032
1196
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
@@ -1050,10 +1214,55 @@ export async function up(knex: Knex): Promise<void>
1050
1214
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1051
1215
 
1052
1216
  ---
1053
- ### Function: down
1217
+ ### Function: up
1054
1218
 
1055
1219
  ```ts
1056
- export async function down(knex: Knex): Promise<void>
1220
+ export async function up(knex: Knex): Promise<void>
1221
+ ```
1222
+
1223
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1224
+
1225
+ ---
1226
+ ### Function: up
1227
+
1228
+ ```ts
1229
+ export async function up(knex: Knex): Promise<void>
1230
+ ```
1231
+
1232
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1233
+
1234
+ ---
1235
+ ### Function: up
1236
+
1237
+ ```ts
1238
+ export async function up(knex: Knex): Promise<void>
1239
+ ```
1240
+
1241
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1242
+
1243
+ ---
1244
+ ### Function: up
1245
+
1246
+ ```ts
1247
+ export async function up(knex: Knex): Promise<void>
1248
+ ```
1249
+
1250
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1251
+
1252
+ ---
1253
+ ### Function: up
1254
+
1255
+ ```ts
1256
+ export async function up(knex: Knex): Promise<void>
1257
+ ```
1258
+
1259
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1260
+
1261
+ ---
1262
+ ### Function: up
1263
+
1264
+ ```ts
1265
+ export async function up(knex: Knex): Promise<void>
1057
1266
  ```
1058
1267
 
1059
1268
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
@@ -1063,14 +1272,26 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
1063
1272
 
1064
1273
  | |
1065
1274
  | --- |
1275
+ | [AdmissionMode](#type-admissionmode) |
1066
1276
  | [LookupFormula](#type-lookupformula) |
1067
- | [Output](#type-output) |
1277
+ | [OutputAdmittedByTopic](#type-outputadmittedbytopic) |
1278
+ | [OutputSpent](#type-outputspent) |
1279
+ | [SpendNotificationMode](#type-spendnotificationmode) |
1068
1280
  | [SyncConfiguration](#type-syncconfiguration) |
1069
1281
 
1070
1282
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1071
1283
 
1072
1284
  ---
1073
1285
 
1286
+ ### Type: AdmissionMode
1287
+
1288
+ ```ts
1289
+ export type AdmissionMode = "locking-script" | "whole-tx"
1290
+ ```
1291
+
1292
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1293
+
1294
+ ---
1074
1295
  ### Type: LookupFormula
1075
1296
 
1076
1297
  The formula that will be used by the Overlay Services Engine to compute the Lookup Answer. Can be returned by Lookup Services in response to a Lookup Question.
@@ -1080,39 +1301,81 @@ export type LookupFormula = Array<{
1080
1301
  txid: string;
1081
1302
  outputIndex: number;
1082
1303
  history?: ((beef: number[], outputIndex: number, currentDepth: number) => Promise<boolean>) | number;
1304
+ context?: number[];
1083
1305
  }>
1084
1306
  ```
1085
1307
 
1086
1308
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1087
1309
 
1088
1310
  ---
1089
- ### Type: Output
1090
-
1091
- Represents an output to be tracked by the Overlay Services Engine
1311
+ ### Type: OutputAdmittedByTopic
1092
1312
 
1093
1313
  ```ts
1094
- export type Output = {
1314
+ export type OutputAdmittedByTopic = {
1315
+ mode: "locking-script";
1095
1316
  txid: string;
1096
1317
  outputIndex: number;
1097
- outputScript: number[];
1318
+ topic: string;
1098
1319
  satoshis: number;
1320
+ lockingScript: Script;
1321
+ offChainValues?: number[];
1322
+ } | {
1323
+ mode: "whole-tx";
1324
+ atomicBEEF: number[];
1325
+ outputIndex: number;
1099
1326
  topic: string;
1100
- spent: boolean;
1101
- outputsConsumed: Array<{
1102
- txid: string;
1103
- outputIndex: number;
1104
- }>;
1105
- consumedBy: Array<{
1106
- txid: string;
1107
- outputIndex: number;
1108
- }>;
1109
- beef?: number[];
1110
- blockHeight?: number;
1327
+ offChainValues?: number[];
1328
+ }
1329
+ ```
1330
+
1331
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1332
+
1333
+ ---
1334
+ ### Type: OutputSpent
1335
+
1336
+ ```ts
1337
+ export type OutputSpent = {
1338
+ mode: "none";
1339
+ txid: string;
1340
+ outputIndex: number;
1341
+ topic: string;
1342
+ } | {
1343
+ mode: "txid";
1344
+ txid: string;
1345
+ outputIndex: number;
1346
+ topic: string;
1347
+ spendingTxid: string;
1348
+ } | {
1349
+ mode: "script";
1350
+ txid: string;
1351
+ outputIndex: number;
1352
+ topic: string;
1353
+ spendingTxid: string;
1354
+ inputIndex: number;
1355
+ unlockingScript: Script;
1356
+ sequenceNumber: number;
1357
+ offChainValues?: number[];
1358
+ } | {
1359
+ mode: "whole-tx";
1360
+ txid: string;
1361
+ outputIndex: number;
1362
+ topic: string;
1363
+ spendingAtomicBEEF: number[];
1364
+ offChainValues?: number[];
1111
1365
  }
1112
1366
  ```
1113
1367
 
1114
1368
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1115
1369
 
1370
+ ---
1371
+ ### Type: SpendNotificationMode
1372
+
1373
+ ```ts
1374
+ export type SpendNotificationMode = "none" | "txid" | "script" | "whole-tx"
1375
+ ```
1376
+
1377
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types)
1378
+
1116
1379
  ---
1117
1380
  ### Type: SyncConfiguration
1118
1381