@bsv/overlay 0.1.0-alpha.8 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/package.json +2 -1
- package/dist/cjs/src/Engine.js +573 -42
- package/dist/cjs/src/Engine.js.map +1 -1
- package/dist/cjs/src/GASP/OverlayGASPRemote.js +96 -0
- package/dist/cjs/src/GASP/OverlayGASPRemote.js.map +1 -0
- package/dist/cjs/src/GASP/OverlayGASPStorage.js +221 -0
- package/dist/cjs/src/GASP/OverlayGASPStorage.js.map +1 -0
- package/dist/cjs/src/SyncConfiguration.js +3 -0
- package/dist/cjs/src/SyncConfiguration.js.map +1 -0
- package/dist/cjs/src/storage/knex/KnexStorage.js +26 -6
- package/dist/cjs/src/storage/knex/KnexStorage.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/Engine.js +575 -42
- package/dist/esm/src/Engine.js.map +1 -1
- package/dist/esm/src/GASP/OverlayGASPRemote.js +93 -0
- package/dist/esm/src/GASP/OverlayGASPRemote.js.map +1 -0
- package/dist/esm/src/GASP/OverlayGASPStorage.js +219 -0
- package/dist/esm/src/GASP/OverlayGASPStorage.js.map +1 -0
- package/dist/esm/src/SyncConfiguration.js +2 -0
- package/dist/esm/src/SyncConfiguration.js.map +1 -0
- package/dist/esm/src/storage/knex/KnexStorage.js +26 -6
- package/dist/esm/src/storage/knex/KnexStorage.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/mod.d.ts +1 -1
- package/dist/types/mod.d.ts.map +1 -1
- package/dist/types/src/Engine.d.ts +169 -13
- package/dist/types/src/Engine.d.ts.map +1 -1
- package/dist/types/src/GASP/OverlayGASPRemote.d.ts +23 -0
- package/dist/types/src/GASP/OverlayGASPRemote.d.ts.map +1 -0
- package/dist/types/src/GASP/OverlayGASPStorage.d.ts +68 -0
- package/dist/types/src/GASP/OverlayGASPStorage.d.ts.map +1 -0
- package/dist/types/src/SyncConfiguration.d.ts +20 -0
- package/dist/types/src/SyncConfiguration.d.ts.map +1 -0
- package/dist/types/src/TopicManager.d.ts +8 -0
- package/dist/types/src/TopicManager.d.ts.map +1 -1
- package/dist/types/src/storage/Storage.d.ts +7 -0
- package/dist/types/src/storage/Storage.d.ts.map +1 -1
- package/dist/types/src/storage/knex/KnexStorage.d.ts +1 -0
- package/dist/types/src/storage/knex/KnexStorage.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/mod.ts +2 -2
- package/package.json +2 -1
- package/src/Engine.ts +652 -47
- package/src/SyncConfiguration.ts +19 -0
- package/src/TopicManager.ts +6 -0
- package/src/__tests/Engine.test.ts +151 -25
- package/src/__tests/OverlayGASPRemote.test.ts +132 -0
- package/src/__tests/OverlayGASPStorage.test.ts +166 -0
- package/src/storage/Storage.ts +8 -0
- package/src/storage/knex/KnexStorage.ts +34 -5
|
@@ -8,6 +8,8 @@ import { LookupQuestion } from './LookupQuestion.js';
|
|
|
8
8
|
import { LookupAnswer } from './LookupAnswer.js';
|
|
9
9
|
import { ChainTracker, MerklePath, Broadcaster } from '@bsv/sdk';
|
|
10
10
|
import { Advertiser } from './Advertiser.js';
|
|
11
|
+
import { GASPInitialReply, GASPInitialRequest, GASPInitialResponse, GASPNode, GASPNodeResponse, GASPRemote, GASPStorage } from '@bsv/gasp';
|
|
12
|
+
import { SyncConfiguration } from './SyncConfiguration.js';
|
|
11
13
|
/**
|
|
12
14
|
* Am engine for running BSV Overlay Services (topic managers and lookup services).
|
|
13
15
|
*/
|
|
@@ -20,34 +22,41 @@ export declare class Engine {
|
|
|
20
22
|
};
|
|
21
23
|
storage: Storage;
|
|
22
24
|
chainTracker: ChainTracker;
|
|
23
|
-
hostingURL
|
|
25
|
+
hostingURL?: string | undefined;
|
|
24
26
|
shipTrackers?: string[] | undefined;
|
|
25
27
|
slapTrackers?: string[] | undefined;
|
|
26
28
|
broadcaster?: Broadcaster | undefined;
|
|
27
29
|
advertiser?: Advertiser | undefined;
|
|
30
|
+
syncConfiguration?: SyncConfiguration | undefined;
|
|
28
31
|
/**
|
|
29
32
|
* Creates a new Overlay Services Engine
|
|
30
33
|
* @param {[key: string]: TopicManager} managers - manages topic admittance
|
|
31
34
|
* @param {[key: string]: LookupService} lookupServices - manages UTXO lookups
|
|
32
35
|
* @param {Storage} storage - for interacting with internally-managed persistent data
|
|
33
36
|
* @param {ChainTracker} chainTracker - Verifies SPV data associated with transactions
|
|
34
|
-
* @param {string} hostingURL
|
|
37
|
+
* @param {string} [hostingURL] - The URL this engine is hosted at. Required if going to support peer-discovery with an advertiser.
|
|
35
38
|
* @param {Broadcaster} [Broadcaster] - broadcaster used for broadcasting the incoming transaction
|
|
36
39
|
* @param {Advertiser} [Advertiser] - handles SHIP and SLAP advertisements for peer-discovery
|
|
37
40
|
* @param {string} shipTrackers - SHIP domains we know to bootstrap the system
|
|
38
|
-
* @param {string} slapTrackers -
|
|
41
|
+
* @param {string} slapTrackers - SLAP domains we know to bootstrap the system
|
|
42
|
+
* @param {Record<string, string[] | 'SHIP'>} syncConfiguration — Configuration object describing historical synchronization of topics.
|
|
39
43
|
*/
|
|
40
44
|
constructor(managers: {
|
|
41
45
|
[key: string]: TopicManager;
|
|
42
46
|
}, lookupServices: {
|
|
43
47
|
[key: string]: LookupService;
|
|
44
|
-
}, storage: Storage, chainTracker: ChainTracker, hostingURL
|
|
48
|
+
}, storage: Storage, chainTracker: ChainTracker, hostingURL?: string | undefined, shipTrackers?: string[] | undefined, slapTrackers?: string[] | undefined, broadcaster?: Broadcaster | undefined, advertiser?: Advertiser | undefined, syncConfiguration?: SyncConfiguration | undefined);
|
|
45
49
|
/**
|
|
46
50
|
* Submits a transaction for processing by Overlay Services.
|
|
47
|
-
* @param taggedBEEF
|
|
48
|
-
* @
|
|
51
|
+
* @param {TaggedBEEF} taggedBEEF - The transaction to process
|
|
52
|
+
* @param {function(STEAK): void} [onSTEAKReady] - Optional callback function invoked when the STEAK is ready.
|
|
53
|
+
* @param {string} mode — Indicates the submission behavior, whether historical or current. Historical transactions are not broadcast or propagated.
|
|
54
|
+
*
|
|
55
|
+
* The optional callback function should be used to get STEAK when ready, and avoid waiting for broadcast and transaction propagation to complete.
|
|
56
|
+
*
|
|
57
|
+
* @returns {Promise<STEAK>} The submitted transaction execution acknowledgement
|
|
49
58
|
*/
|
|
50
|
-
submit(taggedBEEF: TaggedBEEF): Promise<STEAK>;
|
|
59
|
+
submit(taggedBEEF: TaggedBEEF, onSteakReady?: (steak: STEAK) => void, mode?: 'historical-tx' | 'current-tx'): Promise<STEAK>;
|
|
51
60
|
/**
|
|
52
61
|
* Submit a lookup question to the Overlay Services Engine, and receive bakc a Lookup Answer
|
|
53
62
|
* @param LookupQuestion — The question to ask the Overlay Services Engine
|
|
@@ -74,6 +83,36 @@ export declare class Engine {
|
|
|
74
83
|
* @returns {Promise<void>} A promise that resolves when the synchronization process is complete.
|
|
75
84
|
*/
|
|
76
85
|
syncAdvertisements(): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* This method goes through each topic that we support syncing and attempts to sync with each endpoint
|
|
88
|
+
* associated with that topic. If the sync configuration is 'SHIP', it will sync to all peers that support
|
|
89
|
+
* the topic.
|
|
90
|
+
*
|
|
91
|
+
* @throws Error if the overlay service engine is not configured for topical synchronization.
|
|
92
|
+
*/
|
|
93
|
+
startGASPSync(): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Given a GASP request, create an initial response.
|
|
96
|
+
*
|
|
97
|
+
* This method processes an initial synchronization request by finding the relevant UTXOs for the given topic
|
|
98
|
+
* since the provided (TODO: timestamp or block height, we need to decide on sync timing semantics) in the request. It constructs a response that includes a list of these UTXOs
|
|
99
|
+
* and the (timestamp or block height, TODO...) from the initial request.
|
|
100
|
+
*
|
|
101
|
+
* @param initialRequest - The GASP initial request containing the version and the (timestamp or block height, TODO...) since the last sync.
|
|
102
|
+
* @param topic - The topic for which UTXOs are being requested.
|
|
103
|
+
* @returns A promise that resolves to a GASPInitialResponse containing the list of UTXOs and the provided timestamp.
|
|
104
|
+
*/
|
|
105
|
+
provideForeignSyncResponse(initialRequest: GASPInitialRequest, topic: string): Promise<GASPInitialResponse>;
|
|
106
|
+
/**
|
|
107
|
+
* Provides a GASPNode for the given graphID, transaction ID, and output index.
|
|
108
|
+
*
|
|
109
|
+
* @param graphID - The identifier for the graph to which this node belongs (in the format txid.outputIndex).
|
|
110
|
+
* @param txid - The transaction ID for the requested output from somewhere within the graph's history.
|
|
111
|
+
* @param outputIndex - The index of the output in the transaction.
|
|
112
|
+
* @returns A promise that resolves to a GASPNode containing the raw transaction and other optional data.
|
|
113
|
+
* @throws An error if no output is found for the given transaction ID and output index.
|
|
114
|
+
*/
|
|
115
|
+
provideForeignGASPNode(graphID: string, txid: string, outputIndex: number): Promise<GASPNode>;
|
|
77
116
|
/**
|
|
78
117
|
* Traverse and return the history of a UTXO.
|
|
79
118
|
*
|
|
@@ -97,13 +136,23 @@ export declare class Engine {
|
|
|
97
136
|
*/
|
|
98
137
|
private deleteUTXODeep;
|
|
99
138
|
/**
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
139
|
+
* Given a new transaction proof (txid, proof),
|
|
140
|
+
*
|
|
141
|
+
* update tx.merklePath if appropriate,
|
|
142
|
+
*
|
|
143
|
+
* and if not, recurse through all input sourceTransactions.
|
|
144
|
+
*
|
|
145
|
+
* @param tx transaction which may benefit from new proof.
|
|
146
|
+
* @param txid BE hex string double hash of transaction proven by proof.
|
|
147
|
+
* @param proof for txid
|
|
148
|
+
*/
|
|
149
|
+
private updateInputProofs;
|
|
150
|
+
/**
|
|
151
|
+
* Recursively updates beefs (merkle proofs) of this output and its consumedBy lineage.
|
|
103
152
|
*
|
|
104
|
-
* @param output -
|
|
105
|
-
* @param
|
|
106
|
-
* @param
|
|
153
|
+
* @param output - An output derived from txid which may benefit from new proof.
|
|
154
|
+
* @param txid - The txid for which proof is a valid merkle path.
|
|
155
|
+
* @param proof - The merklePath proving txid is a mined transaction hash
|
|
107
156
|
*/
|
|
108
157
|
private updateMerkleProof;
|
|
109
158
|
/**
|
|
@@ -138,4 +187,111 @@ export declare class Engine {
|
|
|
138
187
|
*/
|
|
139
188
|
getDocumentationForLookupServiceProvider(provider: any): Promise<string>;
|
|
140
189
|
}
|
|
190
|
+
export declare class OverlayGASPRemote implements GASPRemote {
|
|
191
|
+
endpointURL: string;
|
|
192
|
+
topic: string;
|
|
193
|
+
constructor(endpointURL: string, topic: string);
|
|
194
|
+
/**
|
|
195
|
+
* Given an outgoing initial request, sends the request to the foreign instance and obtains their initial response.
|
|
196
|
+
* @param request
|
|
197
|
+
* @returns
|
|
198
|
+
*/
|
|
199
|
+
getInitialResponse(request: GASPInitialRequest): Promise<GASPInitialResponse>;
|
|
200
|
+
/**
|
|
201
|
+
* Given an outgoing txid, outputIndex and optional metadata, request the associated GASP node from the foreign instance.
|
|
202
|
+
* @param graphID
|
|
203
|
+
* @param txid
|
|
204
|
+
* @param outputIndex
|
|
205
|
+
* @param metadata
|
|
206
|
+
* @returns
|
|
207
|
+
*/
|
|
208
|
+
requestNode(graphID: string, txid: string, outputIndex: number, metadata: boolean): Promise<GASPNode>;
|
|
209
|
+
getInitialReply(response: GASPInitialResponse): Promise<GASPInitialReply>;
|
|
210
|
+
submitNode(node: GASPNode): Promise<void | GASPNodeResponse>;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Represents a node in the temporary graph.
|
|
214
|
+
*/
|
|
215
|
+
export interface GraphNode {
|
|
216
|
+
txid: string;
|
|
217
|
+
time: number;
|
|
218
|
+
graphID: string;
|
|
219
|
+
rawTx: string;
|
|
220
|
+
outputIndex: number;
|
|
221
|
+
spentBy?: string;
|
|
222
|
+
proof?: string;
|
|
223
|
+
txMetadata?: string;
|
|
224
|
+
outputMetadata?: string;
|
|
225
|
+
inputs?: Record<string, {
|
|
226
|
+
hash: string;
|
|
227
|
+
}> | undefined;
|
|
228
|
+
children: GraphNode[];
|
|
229
|
+
parent?: GraphNode;
|
|
230
|
+
}
|
|
231
|
+
export declare class OverlayGASPStorage implements GASPStorage {
|
|
232
|
+
topic: string;
|
|
233
|
+
engine: Engine;
|
|
234
|
+
maxNodesInGraph?: number | undefined;
|
|
235
|
+
readonly temporaryGraphNodeRefs: Record<string, GraphNode>;
|
|
236
|
+
constructor(topic: string, engine: Engine, maxNodesInGraph?: number | undefined);
|
|
237
|
+
/**
|
|
238
|
+
*
|
|
239
|
+
* @param since
|
|
240
|
+
* @returns
|
|
241
|
+
*/
|
|
242
|
+
findKnownUTXOs(since: number): Promise<Array<{
|
|
243
|
+
txid: string;
|
|
244
|
+
outputIndex: number;
|
|
245
|
+
}>>;
|
|
246
|
+
hydrateGASPNode(graphID: string, txid: string, outputIndex: number, metadata: boolean): Promise<GASPNode>;
|
|
247
|
+
/**
|
|
248
|
+
* For a given node, returns the inputs needed to complete the graph, including whether updated metadata is requested for those inputs.
|
|
249
|
+
* @param tx The node for which needed inputs should be found.
|
|
250
|
+
* @returns A promise for a mapping of requested input transactions and whether metadata should be provided for each.
|
|
251
|
+
*/
|
|
252
|
+
findNeededInputs(tx: GASPNode): Promise<GASPNodeResponse | undefined>;
|
|
253
|
+
/**
|
|
254
|
+
* Ensures that no inputs are requested from foreign nodes before sending any GASP response
|
|
255
|
+
* Also terminates graphs if the response would be empty.
|
|
256
|
+
*/
|
|
257
|
+
private stripAlreadyKnownInputs;
|
|
258
|
+
/**
|
|
259
|
+
* Appends a new node to a temporary graph.
|
|
260
|
+
* @param tx The node to append to this graph.
|
|
261
|
+
* @param spentBy 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.
|
|
262
|
+
* @throws 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.
|
|
263
|
+
*/
|
|
264
|
+
appendToGraph(tx: GASPNode, spentBy?: string | undefined): Promise<void>;
|
|
265
|
+
/**
|
|
266
|
+
* 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.
|
|
267
|
+
* 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,
|
|
268
|
+
* while considering any coins which the Manager had previously indicated were either valid or invalid.
|
|
269
|
+
*
|
|
270
|
+
* 1. Confirm that we are well anchored (according to the rules of SPV)
|
|
271
|
+
* 2. Is there some sequence of nodes that will result in the admittance of the root node into the topic
|
|
272
|
+
* 3. If there is some spend chain that, when executed in order to the root node, leads to a valid admittance, we are good to go.
|
|
273
|
+
* a) For each node in the chain we need to check topical admittance (such that all relevant inputs to any given node are executed before the node in question).
|
|
274
|
+
* b) Once previous nodes are validated, they are taken into account as previous coins to their direct spenders.
|
|
275
|
+
*
|
|
276
|
+
* @param graphID The TXID and output index (in 36-byte format) for the UTXO at the tip of this graph.
|
|
277
|
+
* @throws If the graph is not well-anchored, according to the rules of Bitcoin or the rules of the Overlay Topic Manager.
|
|
278
|
+
*/
|
|
279
|
+
validateGraphAnchor(graphID: string): Promise<void>;
|
|
280
|
+
/**
|
|
281
|
+
* Deletes all data associated with a temporary graph that has failed to sync, if the graph exists.
|
|
282
|
+
* @param graphID The TXID and output index (in 36-byte format) for the UTXO at the tip of this graph.
|
|
283
|
+
*/
|
|
284
|
+
discardGraph(graphID: string): Promise<void>;
|
|
285
|
+
/**
|
|
286
|
+
* Finalizes a graph, solidifying the new UTXO and its ancestors so that it will appear in the list of known UTXOs.
|
|
287
|
+
* @param graphID The TXID and output index (in 36-byte format) for the UTXO at the root of this graph.
|
|
288
|
+
*/
|
|
289
|
+
finalizeGraph(graphID: string): Promise<void>;
|
|
290
|
+
/**
|
|
291
|
+
* Computes a full BEEF for a given graph node, based on the temporary graph store.
|
|
292
|
+
* @param node Graph node for which BEEF is needed.
|
|
293
|
+
* @returns BEEF array, including all proofs on inputs.
|
|
294
|
+
*/
|
|
295
|
+
private getBEEFForNode;
|
|
296
|
+
}
|
|
141
297
|
//# sourceMappingURL=Engine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Engine.d.ts","sourceRoot":"","sources":["../../../src/Engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAE9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,OAAO,EAAe,YAAY,EAAE,UAAU,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"Engine.d.ts","sourceRoot":"","sources":["../../../src/Engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAE9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,OAAO,EAAe,YAAY,EAAE,UAAU,EAAE,WAAW,EAAsB,MAAM,UAAU,CAAA;AACjG,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,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F;;;;OAIG;IACG,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IASpF,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;IAI/G;;;;MAIE;IACI,gBAAgB,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAwD3E;;;OAGG;YACW,uBAAuB;IAgBrC;;;;;MAKE;IACI,aAAa,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IA4C9E;;;;;;;;;;;;;QAaI;IACE,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA2EzD;;;OAGG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUlD;;;OAGG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA+BnD;;;;OAIG;IACH,OAAO,CAAC,cAAc;CAuBvB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { GASPInitialReply, GASPInitialRequest, GASPInitialResponse, GASPNode, GASPNodeResponse, GASPRemote } from '@bsv/gasp';
|
|
2
|
+
export declare class OverlayGASPRemote implements GASPRemote {
|
|
3
|
+
endpointURL: string;
|
|
4
|
+
constructor(endpointURL: string);
|
|
5
|
+
/**
|
|
6
|
+
* Given an outgoing initial request, sends the request to the foreign instance and obtains their initial response.
|
|
7
|
+
* @param request
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
getInitialResponse(request: GASPInitialRequest): Promise<GASPInitialResponse>;
|
|
11
|
+
/**
|
|
12
|
+
* Given an outgoing txid, outputIndex and optional metadata, request the associated GASP node from the foreign instance.
|
|
13
|
+
* @param graphID
|
|
14
|
+
* @param txid
|
|
15
|
+
* @param outputIndex
|
|
16
|
+
* @param metadata
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
requestNode(graphID: string, txid: string, outputIndex: number, metadata: boolean): Promise<GASPNode>;
|
|
20
|
+
getInitialReply(response: GASPInitialResponse): Promise<GASPInitialReply>;
|
|
21
|
+
submitNode(node: GASPNode): Promise<void | GASPNodeResponse>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=OverlayGASPRemote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OverlayGASPRemote.d.ts","sourceRoot":"","sources":["../../../../src/GASP/OverlayGASPRemote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE7H,qBAAa,iBAAkB,YAAW,UAAU;IAC9B,WAAW,EAAE,MAAM;gBAAnB,WAAW,EAAE,MAAM;IAEvC;;;;OAIG;IACG,kBAAkB,CAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAiCpF;;;;;;;OAOG;IACG,WAAW,CAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;IA6CtG,eAAe,CAAE,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAM1E,UAAU,CAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,GAAG,gBAAgB,CAAC;CAGpE"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { GASPNode, GASPNodeResponse, GASPStorage } from '@bsv/gasp';
|
|
2
|
+
import { Engine } from '../Engine.js';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a node in the temporary graph.
|
|
5
|
+
*/
|
|
6
|
+
export interface GraphNode {
|
|
7
|
+
txid: string;
|
|
8
|
+
time: number;
|
|
9
|
+
graphID: string;
|
|
10
|
+
rawTx: string;
|
|
11
|
+
outputIndex: number;
|
|
12
|
+
spentBy?: string;
|
|
13
|
+
proof?: string;
|
|
14
|
+
txMetadata?: string;
|
|
15
|
+
outputMetadata?: string;
|
|
16
|
+
inputs?: Record<string, {
|
|
17
|
+
hash: string;
|
|
18
|
+
}> | undefined;
|
|
19
|
+
children: GraphNode[];
|
|
20
|
+
parent?: GraphNode;
|
|
21
|
+
}
|
|
22
|
+
export declare class OverlayGASPStorage implements GASPStorage {
|
|
23
|
+
topic: string;
|
|
24
|
+
engine: Engine;
|
|
25
|
+
maxNodesInGraph?: number | undefined;
|
|
26
|
+
readonly temporaryGraphNodeRefs: Record<string, GraphNode>;
|
|
27
|
+
constructor(topic: string, engine: Engine, maxNodesInGraph?: number | undefined);
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param since
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
findKnownUTXOs(since: number): Promise<Array<{
|
|
34
|
+
txid: string;
|
|
35
|
+
outputIndex: number;
|
|
36
|
+
}>>;
|
|
37
|
+
hydrateGASPNode(graphID: string, txid: string, outputIndex: number, metadata: boolean): Promise<GASPNode>;
|
|
38
|
+
/**
|
|
39
|
+
* For a given node, returns the inputs needed to complete the graph, including whether updated metadata is requested for those inputs.
|
|
40
|
+
* @param tx The node for which needed inputs should be found.
|
|
41
|
+
* @returns A promise for a mapping of requested input transactions and whether metadata should be provided for each.
|
|
42
|
+
*/
|
|
43
|
+
findNeededInputs(tx: GASPNode): Promise<GASPNodeResponse | undefined>;
|
|
44
|
+
/**
|
|
45
|
+
* Appends a new node to a temporary graph.
|
|
46
|
+
* @param tx The node to append to this graph.
|
|
47
|
+
* @param spentBy 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.
|
|
48
|
+
* @throws 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.
|
|
49
|
+
*/
|
|
50
|
+
appendToGraph(tx: GASPNode, spentBy?: string | undefined): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* 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.
|
|
53
|
+
* @param graphID The TXID and output index (in 36-byte format) for the UTXO at the tip of this graph.
|
|
54
|
+
* @throws If the graph is not well-anchored.
|
|
55
|
+
*/
|
|
56
|
+
validateGraphAnchor(graphID: string): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Deletes all data associated with a temporary graph that has failed to sync, if the graph exists.
|
|
59
|
+
* @param graphID The TXID and output index (in 36-byte format) for the UTXO at the tip of this graph.
|
|
60
|
+
*/
|
|
61
|
+
discardGraph(graphID: string): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Finalizes a graph, solidifying the new UTXO and its ancestors so that it will appear in the list of known UTXOs.
|
|
64
|
+
* @param graphID The TXID and output index (in 36-byte format) for the UTXO at the tip of this graph.
|
|
65
|
+
*/
|
|
66
|
+
finalizeGraph(graphID: string): Promise<void>;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=OverlayGASPStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OverlayGASPStorage.d.ts","sourceRoot":"","sources":["../../../../src/GASP/OverlayGASPStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEnE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAA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IAgD9E;;;;QAII;IACE,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwEzD;;;OAGG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUlD;;;OAGG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGpD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for synchronizing supported topic managers.
|
|
3
|
+
*
|
|
4
|
+
* This configuration determines which topics should support synchronization and specifies the mode of synchronization.
|
|
5
|
+
*
|
|
6
|
+
* There are two synchronization modes:
|
|
7
|
+
* 1. Sync to predefined hardcoded peers for the specified topic, including associated hosting URLs.
|
|
8
|
+
* 2. Use SHIP (Service Host Interconnect Protocol) to sync with all known peers that support the specified topic.
|
|
9
|
+
*
|
|
10
|
+
* Each entry in the configuration object maps a topic to either an array of overlay service peers (hardcoded URLs) or the string 'SHIP' (for dynamic syncing using SHIP).
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // Example usage of SyncConfiguration
|
|
14
|
+
* const config: SyncConfiguration = {
|
|
15
|
+
* "topicManager1": ["http://peer1.com", "http://peer2.com"],
|
|
16
|
+
* "topicManager2": "SHIP"
|
|
17
|
+
* }
|
|
18
|
+
*/
|
|
19
|
+
export type SyncConfiguration = Record<string, string[] | 'SHIP'>;
|
|
20
|
+
//# sourceMappingURL=SyncConfiguration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SyncConfiguration.d.ts","sourceRoot":"","sources":["../../../src/SyncConfiguration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,CAAA"}
|
|
@@ -9,6 +9,14 @@ export interface TopicManager {
|
|
|
9
9
|
* 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.
|
|
10
10
|
*/
|
|
11
11
|
identifyAdmissibleOutputs: (beef: number[], previousCoins: number[]) => Promise<AdmittanceInstructions>;
|
|
12
|
+
/**
|
|
13
|
+
* Identifies and returns the inputs needed to anchor any topical outputs from this transaction to their associated previous history.
|
|
14
|
+
* @throws - if there are no potentially valid topical outputs in this transaction
|
|
15
|
+
*/
|
|
16
|
+
identifyNeededInputs?: (beef: number[]) => Promise<Array<{
|
|
17
|
+
txid: string;
|
|
18
|
+
outputIndex: number;
|
|
19
|
+
}>>;
|
|
12
20
|
/**
|
|
13
21
|
* Returns a Markdown-formatted documentation string for the topic manager.
|
|
14
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TopicManager.d.ts","sourceRoot":"","sources":["../../../src/TopicManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,yBAAyB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAA;IAEvG;;MAEE;IACF,gBAAgB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;IAEvC;;OAEG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC;QACzB,IAAI,EAAE,MAAM,CAAA;QACZ,gBAAgB,EAAE,MAAM,CAAA;QACxB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,cAAc,CAAC,EAAE,MAAM,CAAA;KACxB,CAAC,CAAA;CACH"}
|
|
1
|
+
{"version":3,"file":"TopicManager.d.ts","sourceRoot":"","sources":["../../../src/TopicManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,yBAAyB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAA;IAEvG;;;OAGG;IACH,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAA;IAEhG;;MAEE;IACF,gBAAgB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;IAEvC;;OAEG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC;QACzB,IAAI,EAAE,MAAM,CAAA;QACZ,gBAAgB,EAAE,MAAM,CAAA;QACxB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,cAAc,CAAC,EAAE,MAAM,CAAA;KACxB,CAAC,CAAA;CACH"}
|
|
@@ -30,6 +30,13 @@ export interface Storage {
|
|
|
30
30
|
* @param txid — TXID of the outputs to find
|
|
31
31
|
*/
|
|
32
32
|
findOutputsForTransaction: (txid: string) => Promise<Output[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Finds current UTXOs that have been admitted into a given topic
|
|
35
|
+
* @param topic - The topic for which we want to find Unspent Transaction Outputs (UTXOs).
|
|
36
|
+
* @param since - Optional parameter indicating the minimum date (timestamp? block height?) to retrieve matching UTXOs from. TODO: We need to decide about which time format to use for synchronization.
|
|
37
|
+
* @returns A promise that resolves to an array of matching UTXOs.
|
|
38
|
+
*/
|
|
39
|
+
findUTXOsForTopic: (topic: string, since?: number) => Promise<Output[]>;
|
|
33
40
|
/**
|
|
34
41
|
* Deletes an output from storage
|
|
35
42
|
* @param txid — The TXID of the output to delete
|
|
@@ -1 +1 @@
|
|
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AE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAEjF;;;;;MAKE;IACF,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAEpF;;;;;;MAME;IACF,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC;QACrF,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAEpB;;;;;;OAMG;IACH,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAErG;;;OAGG;IACH,wBAAwB,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAEnE;;;;OAIG;IACH,2BAA2B,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAC1E"}
|
|
@@ -6,6 +6,7 @@ export declare class KnexStorage implements Storage {
|
|
|
6
6
|
constructor(knex: Knex);
|
|
7
7
|
findOutput(txid: string, outputIndex: number, topic?: string, spent?: boolean): Promise<Output | null>;
|
|
8
8
|
findOutputsForTransaction(txid: string): Promise<Output[]>;
|
|
9
|
+
findUTXOsForTopic(topic: string, since?: number): Promise<Output[]>;
|
|
9
10
|
deleteOutput(txid: string, outputIndex: number, topic: string): Promise<void>;
|
|
10
11
|
insertOutput(output: Output): Promise<void>;
|
|
11
12
|
markUTXOAsSpent(txid: string, outputIndex: number, topic?: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KnexStorage.d.ts","sourceRoot":"","sources":["../../../../../src/storage/knex/KnexStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAE7C,qBAAa,WAAY,YAAW,OAAO;IACzC,IAAI,EAAE,IAAI,CAAA;gBAEE,IAAI,EAAE,IAAI;IAIhB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IA4BtG,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"KnexStorage.d.ts","sourceRoot":"","sources":["../../../../../src/storage/knex/KnexStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAE7C,qBAAa,WAAY,YAAW,OAAO;IACzC,IAAI,EAAE,IAAI,CAAA;gBAEE,IAAI,EAAE,IAAI;IAIhB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IA4BtG,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAmB1D,iBAAiB,CAAC,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