@bsv/overlay 0.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/LICENSE.txt +28 -0
  2. package/README.md +220 -0
  3. package/dist/cjs/mod.js +43 -0
  4. package/dist/cjs/mod.js.map +1 -0
  5. package/dist/cjs/package.json +53 -0
  6. package/dist/cjs/src/AdmittanceInstructions.js +3 -0
  7. package/dist/cjs/src/AdmittanceInstructions.js.map +1 -0
  8. package/dist/cjs/src/Engine.js +361 -0
  9. package/dist/cjs/src/Engine.js.map +1 -0
  10. package/dist/cjs/src/LookupAnswer.js +3 -0
  11. package/dist/cjs/src/LookupAnswer.js.map +1 -0
  12. package/dist/cjs/src/LookupFormula.js +3 -0
  13. package/dist/cjs/src/LookupFormula.js.map +1 -0
  14. package/dist/cjs/src/LookupQuestion.js +3 -0
  15. package/dist/cjs/src/LookupQuestion.js.map +1 -0
  16. package/dist/cjs/src/LookupService.js +3 -0
  17. package/dist/cjs/src/LookupService.js.map +1 -0
  18. package/dist/cjs/src/Output.js +3 -0
  19. package/dist/cjs/src/Output.js.map +1 -0
  20. package/dist/cjs/src/STEAK.js +3 -0
  21. package/dist/cjs/src/STEAK.js.map +1 -0
  22. package/dist/cjs/src/TaggedBEEF.js +3 -0
  23. package/dist/cjs/src/TaggedBEEF.js.map +1 -0
  24. package/dist/cjs/src/TopicManager.js +3 -0
  25. package/dist/cjs/src/TopicManager.js.map +1 -0
  26. package/dist/cjs/src/storage/Storage.js +3 -0
  27. package/dist/cjs/src/storage/Storage.js.map +1 -0
  28. package/dist/cjs/src/storage/knex/KnexStorage.js +76 -0
  29. package/dist/cjs/src/storage/knex/KnexStorage.js.map +1 -0
  30. package/dist/cjs/src/storage/knex/all-migrations.js +11 -0
  31. package/dist/cjs/src/storage/knex/all-migrations.js.map +1 -0
  32. package/dist/cjs/src/storage/knex/migrations/2024-05-18-001-initial.js +33 -0
  33. package/dist/cjs/src/storage/knex/migrations/2024-05-18-001-initial.js.map +1 -0
  34. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -0
  35. package/dist/esm/mod.js +17 -0
  36. package/dist/esm/mod.js.map +1 -0
  37. package/dist/esm/src/AdmittanceInstructions.js +2 -0
  38. package/dist/esm/src/AdmittanceInstructions.js.map +1 -0
  39. package/dist/esm/src/Engine.js +357 -0
  40. package/dist/esm/src/Engine.js.map +1 -0
  41. package/dist/esm/src/LookupAnswer.js +2 -0
  42. package/dist/esm/src/LookupAnswer.js.map +1 -0
  43. package/dist/esm/src/LookupFormula.js +2 -0
  44. package/dist/esm/src/LookupFormula.js.map +1 -0
  45. package/dist/esm/src/LookupQuestion.js +2 -0
  46. package/dist/esm/src/LookupQuestion.js.map +1 -0
  47. package/dist/esm/src/LookupService.js +2 -0
  48. package/dist/esm/src/LookupService.js.map +1 -0
  49. package/dist/esm/src/Output.js +2 -0
  50. package/dist/esm/src/Output.js.map +1 -0
  51. package/dist/esm/src/STEAK.js +2 -0
  52. package/dist/esm/src/STEAK.js.map +1 -0
  53. package/dist/esm/src/TaggedBEEF.js +2 -0
  54. package/dist/esm/src/TaggedBEEF.js.map +1 -0
  55. package/dist/esm/src/TopicManager.js +2 -0
  56. package/dist/esm/src/TopicManager.js.map +1 -0
  57. package/dist/esm/src/storage/Storage.js +2 -0
  58. package/dist/esm/src/storage/Storage.js.map +1 -0
  59. package/dist/esm/src/storage/knex/KnexStorage.js +74 -0
  60. package/dist/esm/src/storage/knex/KnexStorage.js.map +1 -0
  61. package/dist/esm/src/storage/knex/all-migrations.js +9 -0
  62. package/dist/esm/src/storage/knex/all-migrations.js.map +1 -0
  63. package/dist/esm/src/storage/knex/migrations/2024-05-18-001-initial.js +28 -0
  64. package/dist/esm/src/storage/knex/migrations/2024-05-18-001-initial.js.map +1 -0
  65. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -0
  66. package/dist/types/mod.d.ts +14 -0
  67. package/dist/types/mod.d.ts.map +1 -0
  68. package/dist/types/src/AdmittanceInstructions.d.ts +14 -0
  69. package/dist/types/src/AdmittanceInstructions.d.ts.map +1 -0
  70. package/dist/types/src/Engine.d.ts +92 -0
  71. package/dist/types/src/Engine.d.ts.map +1 -0
  72. package/dist/types/src/LookupAnswer.d.ts +15 -0
  73. package/dist/types/src/LookupAnswer.d.ts.map +1 -0
  74. package/dist/types/src/LookupFormula.d.ts +25 -0
  75. package/dist/types/src/LookupFormula.d.ts.map +1 -0
  76. package/dist/types/src/LookupQuestion.d.ts +15 -0
  77. package/dist/types/src/LookupQuestion.d.ts.map +1 -0
  78. package/dist/types/src/LookupService.d.ts +52 -0
  79. package/dist/types/src/LookupService.d.ts.map +1 -0
  80. package/dist/types/src/Output.d.ts +30 -0
  81. package/dist/types/src/Output.d.ts.map +1 -0
  82. package/dist/types/src/STEAK.d.ts +10 -0
  83. package/dist/types/src/STEAK.d.ts.map +1 -0
  84. package/dist/types/src/TaggedBEEF.d.ts +11 -0
  85. package/dist/types/src/TaggedBEEF.d.ts.map +1 -0
  86. package/dist/types/src/TopicManager.d.ts +27 -0
  87. package/dist/types/src/TopicManager.d.ts.map +1 -0
  88. package/dist/types/src/storage/Storage.d.ts +66 -0
  89. package/dist/types/src/storage/Storage.d.ts.map +1 -0
  90. package/dist/types/src/storage/knex/KnexStorage.d.ts +24 -0
  91. package/dist/types/src/storage/knex/KnexStorage.d.ts.map +1 -0
  92. package/dist/types/src/storage/knex/all-migrations.d.ts +10 -0
  93. package/dist/types/src/storage/knex/all-migrations.d.ts.map +1 -0
  94. package/dist/types/src/storage/knex/migrations/2024-05-18-001-initial.d.ts +4 -0
  95. package/dist/types/src/storage/knex/migrations/2024-05-18-001-initial.d.ts.map +1 -0
  96. package/dist/types/tsconfig.types.tsbuildinfo +1 -0
  97. package/docs/API.md +621 -0
  98. package/docs/README.md +8 -0
  99. package/docs/concepts/README.md +4 -0
  100. package/docs/examples/README.md +5 -0
  101. package/docs/examples/gs-wip.md +105 -0
  102. package/docs/internal/README.md +4 -0
  103. package/mod.ts +18 -0
  104. package/package.json +78 -0
  105. package/src/AdmittanceInstructions.ts +14 -0
  106. package/src/Engine.ts +419 -0
  107. package/src/LookupAnswer.ts +14 -0
  108. package/src/LookupFormula.ts +26 -0
  109. package/src/LookupQuestion.ts +15 -0
  110. package/src/LookupService.ts +52 -0
  111. package/src/Output.ts +29 -0
  112. package/src/STEAK.ts +10 -0
  113. package/src/TaggedBEEF.ts +10 -0
  114. package/src/TopicManager.ts +23 -0
  115. package/src/__tests/Engine.test.ts +792 -0
  116. package/src/storage/Storage.ts +72 -0
  117. package/src/storage/knex/KnexStorage.ts +90 -0
  118. package/src/storage/knex/all-migrations.ts +14 -0
  119. package/src/storage/knex/migrations/2024-05-18-001-initial.ts +30 -0
package/docs/API.md ADDED
@@ -0,0 +1,621 @@
1
+ # API
2
+
3
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Types](#types)
4
+
5
+ ## Interfaces
6
+
7
+ | |
8
+ | --- |
9
+ | [LookupService](#interface-lookupservice) |
10
+ | [Storage](#interface-storage) |
11
+ | [TopicManager](#interface-topicmanager) |
12
+
13
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Types](#types)
14
+
15
+ ---
16
+
17
+ ### Interface: TopicManager
18
+
19
+ Defines a Topic Manager interface that can be implemented for specific use-cases
20
+
21
+ ```ts
22
+ export default interface TopicManager {
23
+ identifyAdmissibleOutputs(beef: number[], previousCoins: number[]): Promise<AdmittanceInstructions>;
24
+ getDocumentation(): Promise<string>;
25
+ getMetaData(): Promise<{
26
+ name: string;
27
+ shortDescription: string;
28
+ iconURL?: string;
29
+ version?: string;
30
+ informationURL?: string;
31
+ }>;
32
+ }
33
+ ```
34
+
35
+ <details>
36
+
37
+ <summary>Interface TopicManager Details</summary>
38
+
39
+ #### Method getDocumentation
40
+
41
+ Returns a Markdown-formatted documentation string for the topic manager.
42
+
43
+ ```ts
44
+ getDocumentation(): Promise<string>
45
+ ```
46
+
47
+ #### Method getMetaData
48
+
49
+ Returns a metadata object that can be used to identify the topic manager.
50
+
51
+ ```ts
52
+ getMetaData(): Promise<{
53
+ name: string;
54
+ shortDescription: string;
55
+ iconURL?: string;
56
+ version?: string;
57
+ informationURL?: string;
58
+ }>
59
+ ```
60
+
61
+ #### Method identifyAdmissibleOutputs
62
+
63
+ Returns instructions that denote which outputs from the provided transaction to admit into the topic, and which previous coins should be retained.
64
+ Accepts the transaction in BEEF format and an array of those input indicies which spend previously-admitted outputs from the same topic.
65
+ 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.
66
+
67
+ ```ts
68
+ identifyAdmissibleOutputs(beef: number[], previousCoins: number[]): Promise<AdmittanceInstructions>
69
+ ```
70
+
71
+ </details>
72
+
73
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Types](#types)
74
+
75
+ ---
76
+ ### Interface: LookupService
77
+
78
+ Defines a Lookup Service interface to be implemented for specific use-cases
79
+
80
+ ```ts
81
+ export default interface LookupService {
82
+ outputAdded?(txid: string, outputIndex: number, outputScript: Script, topic: string): Promise<void>;
83
+ outputSpent?(txid: string, outputIndex: number, topic: string): Promise<void>;
84
+ outputDeleted?(txid: string, outputIndex: number, topic: string): Promise<void>;
85
+ lookup(question: LookupQuestion): Promise<LookupAnswer | LookupFormula>;
86
+ getDocumentation(): Promise<string>;
87
+ getMetaData(): Promise<{
88
+ name: string;
89
+ shortDescription: string;
90
+ iconURL?: string;
91
+ version?: string;
92
+ informationURL?: string;
93
+ }>;
94
+ }
95
+ ```
96
+
97
+ <details>
98
+
99
+ <summary>Interface LookupService Details</summary>
100
+
101
+ #### Method getDocumentation
102
+
103
+ Returns a Markdown-formatted documentation string for the lookup service.
104
+
105
+ ```ts
106
+ getDocumentation(): Promise<string>
107
+ ```
108
+
109
+ #### Method getMetaData
110
+
111
+ Returns a metadata object that can be used to identify the lookup service.
112
+
113
+ ```ts
114
+ getMetaData(): Promise<{
115
+ name: string;
116
+ shortDescription: string;
117
+ iconURL?: string;
118
+ version?: string;
119
+ informationURL?: string;
120
+ }>
121
+ ```
122
+
123
+ #### Method lookup
124
+
125
+ Queries the lookup service for information
126
+
127
+ ```ts
128
+ lookup(question: LookupQuestion): Promise<LookupAnswer | LookupFormula>
129
+ ```
130
+
131
+ Returns
132
+
133
+ — The Lookup Answer or Lookup Formula used to answer the question
134
+
135
+ Argument Details
136
+
137
+ + **question**
138
+ + — The question to be answered by the lookup service
139
+
140
+ #### Method outputAdded
141
+
142
+ Process the event when a new UTXO is let into a topic
143
+
144
+ ```ts
145
+ outputAdded?(txid: string, outputIndex: number, outputScript: Script, topic: string): Promise<void>
146
+ ```
147
+
148
+ #### Method outputDeleted
149
+
150
+ Process the deletion event for a UTXO
151
+
152
+ ```ts
153
+ outputDeleted?(txid: string, outputIndex: number, topic: string): Promise<void>
154
+ ```
155
+
156
+ #### Method outputSpent
157
+
158
+ Process the spend event for a UTXO
159
+
160
+ ```ts
161
+ outputSpent?(txid: string, outputIndex: number, topic: string): Promise<void>
162
+ ```
163
+
164
+ </details>
165
+
166
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Types](#types)
167
+
168
+ ---
169
+ ### Interface: Storage
170
+
171
+ Defines the Storage Engine interface used internally by the Overlay Services Engine.
172
+
173
+ ```ts
174
+ export default interface Storage {
175
+ insertOutput(utxo: Output): Promise<void>;
176
+ findOutput(txid: string, outputIndex: number, topic?: string, spent?: boolean): Promise<Output | null>;
177
+ deleteOutput(txid: string, outputIndex: number, topic: string): Promise<void>;
178
+ markUTXOAsSpent(txid: string, outputIndex: number, topic: string): Promise<void>;
179
+ updateConsumedBy(txid: string, outputIndex: number, topic: string, consumedBy: {
180
+ txid: string;
181
+ outputIndex: number;
182
+ }[]): Promise<void>;
183
+ insertAppliedTransaction(tx: AppliedTransaction): Promise<void>;
184
+ doesAppliedTransactionExist(tx: AppliedTransaction): Promise<boolean>;
185
+ }
186
+ ```
187
+
188
+ <details>
189
+
190
+ <summary>Interface Storage Details</summary>
191
+
192
+ #### Method deleteOutput
193
+
194
+ Deletes an output from storage
195
+
196
+ ```ts
197
+ deleteOutput(txid: string, outputIndex: number, topic: string): Promise<void>
198
+ ```
199
+
200
+ Argument Details
201
+
202
+ + **txid**
203
+ + — The TXID of the output to delete
204
+ + **outputIndex**
205
+ + — The index of the output to delete
206
+ + **topic**
207
+ + — The topic where the output should be deleted
208
+
209
+ #### Method doesAppliedTransactionExist
210
+
211
+ Checks if a duplicate transaction exists
212
+
213
+ ```ts
214
+ doesAppliedTransactionExist(tx: AppliedTransaction): Promise<boolean>
215
+ ```
216
+
217
+ Returns
218
+
219
+ Whether the transaction is already applied
220
+
221
+ Argument Details
222
+
223
+ + **tx**
224
+ + — Transaction to check
225
+
226
+ #### Method findOutput
227
+
228
+ Finds an output from storage
229
+
230
+ ```ts
231
+ findOutput(txid: string, outputIndex: number, topic?: string, spent?: boolean): Promise<Output | null>
232
+ ```
233
+
234
+ Argument Details
235
+
236
+ + **txid**
237
+ + — TXID of hte output to find
238
+ + **outputIndex**
239
+ + — Output index for the output to find
240
+ + **topic**
241
+ + — The topic in which the output is stored
242
+ + **spent**
243
+ + — Whether the output must be spent to be returned
244
+
245
+ #### Method insertAppliedTransaction
246
+
247
+ Inserts record of the applied transaction
248
+
249
+ ```ts
250
+ insertAppliedTransaction(tx: AppliedTransaction): Promise<void>
251
+ ```
252
+
253
+ Argument Details
254
+
255
+ + **tx**
256
+ + — The transaction to insert
257
+
258
+ #### Method insertOutput
259
+
260
+ Adds a new output to storage
261
+
262
+ ```ts
263
+ insertOutput(utxo: Output): Promise<void>
264
+ ```
265
+
266
+ Argument Details
267
+
268
+ + **utxo**
269
+ + — The output to add
270
+
271
+ #### Method markUTXOAsSpent
272
+
273
+ Updates a UTXO as spent
274
+
275
+ ```ts
276
+ markUTXOAsSpent(txid: string, outputIndex: number, topic: string): Promise<void>
277
+ ```
278
+
279
+ Argument Details
280
+
281
+ + **txid**
282
+ + — TXID of the output to update
283
+ + **outputIndex**
284
+ + — Index of the output to update
285
+ + **topic**
286
+ + — Topic in which the output should be updated
287
+
288
+ #### Method updateConsumedBy
289
+
290
+ Updates which outputs are consumed by this output
291
+
292
+ ```ts
293
+ updateConsumedBy(txid: string, outputIndex: number, topic: string, consumedBy: {
294
+ txid: string;
295
+ outputIndex: number;
296
+ }[]): Promise<void>
297
+ ```
298
+
299
+ Argument Details
300
+
301
+ + **txid**
302
+ + — TXID of the output to update
303
+ + **outputIndex**
304
+ + — Index of the output to update
305
+ + **topic**
306
+ + — Topic in which the output should be updated
307
+ + **consumedBy**
308
+ + — The new set of outputs consumed by this output
309
+
310
+ </details>
311
+
312
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Types](#types)
313
+
314
+ ---
315
+ ## Classes
316
+
317
+ | |
318
+ | --- |
319
+ | [Engine](#class-engine) |
320
+ | [KnexStorage](#class-knexstorage) |
321
+
322
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Types](#types)
323
+
324
+ ---
325
+
326
+ ### Class: Engine
327
+
328
+ Am engine for running BSV Overlay Services (topic managers and lookup services).
329
+
330
+ ```ts
331
+ export default class Engine {
332
+ constructor(public managers: {
333
+ [key: string]: TopicManager;
334
+ }, public lookupServices: {
335
+ [key: string]: LookupService;
336
+ }, public storage: Storage, public chainTracker: ChainTracker)
337
+ async submit(taggedBEEF: TaggedBEEF): Promise<STEAK>
338
+ async lookup(lookupQuestion: LookupQuestion): Promise<LookupAnswer>
339
+ async listTopicManagers(): Promise<string[]>
340
+ async listLookupServiceProviders(): Promise<string[]>
341
+ async getDocumentationForTopicManger(manager: any): Promise<string>
342
+ async getDocumentationForLookupServiceProvider(provider: any): Promise<string>
343
+ }
344
+ ```
345
+
346
+ <details>
347
+
348
+ <summary>Class Engine Details</summary>
349
+
350
+ #### Constructor
351
+
352
+ Creates a new Overlay Services Engine
353
+
354
+ ```ts
355
+ constructor(public managers: {
356
+ [key: string]: TopicManager;
357
+ }, public lookupServices: {
358
+ [key: string]: LookupService;
359
+ }, public storage: Storage, public chainTracker: ChainTracker)
360
+ ```
361
+
362
+ Argument Details
363
+
364
+ + ****
365
+ + : TopicManager} managers - manages topic admittance
366
+ + ****
367
+ + : LookupService} lookupServices - manages UTXO lookups
368
+ + **storage**
369
+ + for interacting with internally-managed persistent data
370
+ + **chainTracker**
371
+ + Verifies SPV data associated with transactions
372
+ + **proofNotifiers**
373
+ + proof notifier services coming soon!
374
+
375
+ #### Method getDocumentationForLookupServiceProvider
376
+
377
+ Run a query to get the documentation for a particular lookup service
378
+
379
+ ```ts
380
+ async getDocumentationForLookupServiceProvider(provider: any): Promise<string>
381
+ ```
382
+
383
+ Returns
384
+
385
+ - the documentation for the lookup service
386
+
387
+ #### Method getDocumentationForTopicManger
388
+
389
+ Run a query to get the documentation for a particular topic manager
390
+
391
+ ```ts
392
+ async getDocumentationForTopicManger(manager: any): Promise<string>
393
+ ```
394
+
395
+ Returns
396
+
397
+ - the documentation for the topic manager
398
+
399
+ #### Method listLookupServiceProviders
400
+
401
+ Find a list of supported lookup services
402
+
403
+ ```ts
404
+ async listLookupServiceProviders(): Promise<string[]>
405
+ ```
406
+
407
+ Returns
408
+
409
+ - array of supported lookup services
410
+
411
+ #### Method listTopicManagers
412
+
413
+ Find a list of supported topic managers
414
+
415
+ ```ts
416
+ async listTopicManagers(): Promise<string[]>
417
+ ```
418
+
419
+ Returns
420
+
421
+ - array of supported topic managers
422
+
423
+ #### Method lookup
424
+
425
+ Submit a lookup question to the Overlay Services Engine, and receive bakc a Lookup Answer
426
+
427
+ ```ts
428
+ async lookup(lookupQuestion: LookupQuestion): Promise<LookupAnswer>
429
+ ```
430
+
431
+ Returns
432
+
433
+ The answer to the question
434
+
435
+ Argument Details
436
+
437
+ + **LookupQuestion**
438
+ + — The question to ask the Overlay Services Engine
439
+
440
+ #### Method submit
441
+
442
+ Submits a transaction for processing by Overlay Services.
443
+
444
+ ```ts
445
+ async submit(taggedBEEF: TaggedBEEF): Promise<STEAK>
446
+ ```
447
+
448
+ Returns
449
+
450
+ The submitted transaction execution acknowledgement
451
+
452
+ Argument Details
453
+
454
+ + **taggedBEEF**
455
+ + — The transaction to process
456
+
457
+ </details>
458
+
459
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Types](#types)
460
+
461
+ ---
462
+ ### Class: KnexStorage
463
+
464
+ ```ts
465
+ export default class KnexStorage implements Storage {
466
+ knex: Knex;
467
+ constructor(knex: Knex)
468
+ async findOutput(txid: string, outputIndex: number, topic?: string, spent?: boolean): Promise<Output | null>
469
+ async deleteOutput(txid: string, outputIndex: number, topic: string): Promise<void>
470
+ async insertOutput(output: Output)
471
+ async markUTXOAsSpent(txid: string, outputIndex: number, topic?: string): Promise<void>
472
+ async updateConsumedBy(txid: string, outputIndex: number, topic: string, consumedBy: {
473
+ txid: string;
474
+ outputIndex: number;
475
+ }[])
476
+ async insertAppliedTransaction(tx: {
477
+ txid: string;
478
+ topic: string;
479
+ })
480
+ async doesAppliedTransactionExist(tx: {
481
+ txid: string;
482
+ topic: string;
483
+ }): Promise<boolean>
484
+ }
485
+ ```
486
+
487
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Types](#types)
488
+
489
+ ---
490
+ ## Types
491
+
492
+ | |
493
+ | --- |
494
+ | [AdmittanceInstructions](#type-admittanceinstructions) |
495
+ | [LookupAnswer](#type-lookupanswer) |
496
+ | [LookupFormula](#type-lookupformula) |
497
+ | [LookupQuestion](#type-lookupquestion) |
498
+ | [Output](#type-output) |
499
+ | [STEAK](#type-steak) |
500
+ | [TaggedBEEF](#type-taggedbeef) |
501
+
502
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Types](#types)
503
+
504
+ ---
505
+
506
+ ### Type: AdmittanceInstructions
507
+
508
+ Instructs the Overlay Services Engine about which outputs to admit and which previous outputs to retain. Returned by a Topic Manager.
509
+
510
+ ```ts
511
+ export type AdmittanceInstructions = {
512
+ outputsToAdmit: number[];
513
+ coinsToRetain: number[];
514
+ }
515
+ ```
516
+
517
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Types](#types)
518
+
519
+ ---
520
+ ### Type: LookupQuestion
521
+
522
+ The question asked to the Overlay Services Engine when a consumer of state wishes to look up information.
523
+
524
+ ```ts
525
+ export type LookupQuestion = {
526
+ service: string;
527
+ query: unknown;
528
+ }
529
+ ```
530
+
531
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Types](#types)
532
+
533
+ ---
534
+ ### Type: LookupFormula
535
+
536
+ 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.
537
+
538
+ ```ts
539
+ export type LookupFormula = {
540
+ txid: string;
541
+ outputIndex: number;
542
+ history?: ((beef: number[], outputIndex: number, currentDepth: number) => Promise<boolean>) | number;
543
+ }[]
544
+ ```
545
+
546
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Types](#types)
547
+
548
+ ---
549
+ ### Type: LookupAnswer
550
+
551
+ How the Overlay Services Engine responds to a Lookup Question.
552
+ It may comprise either an output list or a freeform response from the Lookup Service.
553
+
554
+ ```ts
555
+ export type LookupAnswer = {
556
+ type: "output-list";
557
+ outputs: Array<{
558
+ beef: number[];
559
+ outputIndex: number;
560
+ }>;
561
+ } | {
562
+ type: "freeform";
563
+ result: unknown;
564
+ }
565
+ ```
566
+
567
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Types](#types)
568
+
569
+ ---
570
+ ### Type: Output
571
+
572
+ Represents an output to be tracked by the Overlay Services Engine
573
+
574
+ ```ts
575
+ export type Output = {
576
+ txid: string;
577
+ outputIndex: number;
578
+ outputScript: number[];
579
+ satoshis: number;
580
+ topic: string;
581
+ spent: boolean;
582
+ beef: number[];
583
+ outputsConsumed: {
584
+ txid: string;
585
+ outputIndex: number;
586
+ }[];
587
+ consumedBy: {
588
+ txid: string;
589
+ outputIndex: number;
590
+ }[];
591
+ }
592
+ ```
593
+
594
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Types](#types)
595
+
596
+ ---
597
+ ### Type: TaggedBEEF
598
+
599
+ Tagged BEEF
600
+
601
+ ```ts
602
+ export type TaggedBEEF = {
603
+ beef: number[];
604
+ topics: string[];
605
+ }
606
+ ```
607
+
608
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Types](#types)
609
+
610
+ ---
611
+ ### Type: STEAK
612
+
613
+ Submitted Transaction Execution AcKnowledgment
614
+
615
+ ```ts
616
+ export type STEAK = Record<string, AdmittanceInstructions>
617
+ ```
618
+
619
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Types](#types)
620
+
621
+ ---
package/docs/README.md ADDED
@@ -0,0 +1,8 @@
1
+ # Overlay Services Engine Documentation
2
+
3
+ The documentation is split into various pages, each covering a set of related functionality. The pages are as follows:
4
+
5
+ - [API](./API.md) — How to interact with the Overlay Services Engine
6
+ - [Concepts](./concepts) — High-level concepts
7
+ - [Examples](./examples) — Guides, tutorials and examples of using the Engine
8
+ - [Internal](./internal) — References for working with internal system components
@@ -0,0 +1,4 @@
1
+ # Conceptual Topics
2
+
3
+ These documents cover high-level conceptual information that will augment developers' understanding of the code-level Overlay Services Engine documentation:
4
+
@@ -0,0 +1,5 @@
1
+ # Examples
2
+
3
+ Here, you will find documentation for common example usages of the Overlay Services Engine.
4
+
5
+ - [Getting Started (WIP)](./gs-wip.md)