@xo-cash/engine 0.0.1-development.14148570389 → 0.0.1-development.15965991683

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/index.d.mts CHANGED
@@ -5,7 +5,7 @@ import { generateTemplateIdentifier, parseTemplate } from "@xo-cash/utils";
5
5
  import { ChainStatus, ScriptHashUpdate } from "@electrum-cash/application";
6
6
  import { ScriptHashListUnspentResponse, TransactionHash } from "@electrum-cash/protocol";
7
7
  import { ElectrumServers } from "@electrum-cash/servers";
8
- import { XOInvitation, XOInvitationCommit, XOInvitationInput, XOInvitationOutput, XOInvitationRequirements, XOInvitationVariable, XOInvitationVariableValue, XOTemplate, XOTemplateAction, XOTemplateActionIntent, XOTemplateLockingScript, XOTemplateLockingScriptRole, XOTemplateLockingType, XOTemplateOutput, XOTemplateTransaction } from "@xo-cash/types";
8
+ import { XOInvitation, XOInvitationCommit, XOInvitationCommitIdentifier, XOInvitationEntityIdentifier, XOInvitationIdentifier, XOInvitationInput, XOInvitationOutput, XOInvitationVariable, XOInvitationVariableValue, XOTemplate, XOTemplateAction, XOTemplateActionIdentifier, XOTemplateActionIntent, XOTemplateIdentifier, XOTemplateInputIdentifier, XOTemplateLockingScript, XOTemplateLockingScriptIdentifier, XOTemplateLockingScriptRole, XOTemplateLockingType, XOTemplateOutput, XOTemplateOutputIdentifier, XOTemplateRoleIdentifier, XOTemplateScriptIdentifier, XOTemplateTransaction, XOTemplateTransactionIdentifier, XOTemplateVariableIdentifier } from "@xo-cash/types";
9
9
 
10
10
  //#region source/interfaces.d.ts
11
11
  /**
@@ -48,11 +48,11 @@ interface InvitationCreationParameters {
48
48
  /**
49
49
  * Identifier of the template to use for this invitation.
50
50
  */
51
- templateIdentifier: string;
51
+ templateIdentifier: XOTemplateIdentifier;
52
52
  /**
53
53
  * Identifier of the action within the template to initiate.
54
54
  */
55
- actionIdentifier: string;
55
+ actionIdentifier: XOTemplateActionIdentifier;
56
56
  }
57
57
  /**
58
58
  * Parameters for extending an invitation.
@@ -103,42 +103,53 @@ interface GetSpendableResourcesParameters {
103
103
  /**
104
104
  * Identifier of the template to use for resource selection.
105
105
  */
106
- templateIdentifier: string;
106
+ templateIdentifier: XOTemplateIdentifier;
107
107
  /**
108
108
  * Identifier of the output within the template.
109
109
  */
110
- outputIdentifier: string;
110
+ outputIdentifier: XOTemplateOutputIdentifier;
111
111
  }
112
- //#endregion
113
- //#region source/engine.d.ts
114
112
  /**
115
- * XO Engine class: Acts like an orchestrator for the XO system.
113
+ * Fallback locking parameters used when generating change and other locking bytecodes.
114
+ *
115
+ * Resolution order for locking bytecode generation is override, then template defaults, then these fallbacks.
116
116
  */
117
- declare class Engine {
118
- /**
119
- * The crypto instance.
120
- */
121
- private crypto;
117
+ interface FallbackLockingParameters {
122
118
  /**
123
- * The state instance.
119
+ * Identifier of the template to use as the fallback locking source.
124
120
  */
125
- private state;
121
+ templateIdentifier: XOTemplateIdentifier;
126
122
  /**
127
- * The blockchain monitor instance.
128
- */
129
- private blockchainMonitor;
130
- /**
131
- * The default template identifier.
132
- */
133
- private defaultTemplateIdentifier;
134
- /**
135
- * The default role identifier.
123
+ * Identifier of the output within the template.
136
124
  */
137
- private defaultRoleIdentifier;
125
+ outputIdentifier: XOTemplateOutputIdentifier;
138
126
  /**
139
- * The default output identifier.
127
+ * Identifier of the role to use for the fallback locking script.
140
128
  */
141
- private defaultOutputIdentifier;
129
+ roleIdentifier: XOTemplateRoleIdentifier;
130
+ }
131
+ /**
132
+ * Identifier lists for a single role's invitation requirements.
133
+ */
134
+ type InvitationRoleRequirementIdentifierLists = {
135
+ variables?: XOTemplateVariableIdentifier[];
136
+ inputs?: XOTemplateInputIdentifier[];
137
+ outputs?: XOTemplateOutputIdentifier[];
138
+ };
139
+ /**
140
+ * Identifier lists for invitation requirements.
141
+ * Template and invitation listing APIs compare by identifier strings, not full commit items.
142
+ */
143
+ type InvitationRequirementIdentifierLists = InvitationRoleRequirementIdentifierLists & {
144
+ roles?: Record<XOTemplateRoleIdentifier, InvitationRoleRequirementIdentifierLists>;
145
+ };
146
+ //#endregion
147
+ //#region source/engine.d.ts
148
+ /**
149
+ * XO Engine class: Acts like an orchestrator for the XO system.
150
+ */
151
+ declare class Engine {
152
+ #private;
142
153
  /**
143
154
  * Constructs a new instance of XO Engine.
144
155
  * @private
@@ -168,19 +179,19 @@ declare class Engine {
168
179
  getChainStatus(): Promise<ChainStatus>;
169
180
  /**
170
181
  * Retrieves a template by its identifier from the state.
171
- * @param {string} templateIdentifier - Template identifier.
182
+ * @param {XOTemplateIdentifier} templateIdentifier - Template identifier.
172
183
  * @returns {Promise<XOTemplate | undefined>} The template object.
173
184
  */
174
- getTemplate(templateIdentifier: string): Promise<XOTemplate | undefined>;
185
+ getTemplate(templateIdentifier: XOTemplateIdentifier): Promise<XOTemplate | undefined>;
175
186
  /**
176
187
  * Imports a template into the Engine after sanitization and validation.
177
188
  * @param {string | XOTemplate} untrustedJsonOrObject - JSON or object containing the untrusted template to import.
178
- * @returns {Promise<void>} Resolves when the template is imported.
189
+ * @returns {Promise<{ template: XOTemplate; templateIdentifier: XOTemplateIdentifier }>} The imported template and its identifier.
179
190
  * @throws {TemplateImportFailedError} If the template is invalid.
180
191
  */
181
192
  importTemplate(untrustedJsonOrObject: string | XOTemplate): Promise<{
182
193
  template: XOTemplate;
183
- templateIdentifier: string;
194
+ templateIdentifier: XOTemplateIdentifier;
184
195
  }>;
185
196
  /**
186
197
  * Lists all the imported templates.
@@ -189,43 +200,45 @@ declare class Engine {
189
200
  listImportedTemplates(): Promise<XOTemplate[]>;
190
201
  /**
191
202
  * Lists the starting actions available in a specified template.
192
- * @param {string} templateIdentifier - Template identifier.
203
+ * @param {XOTemplateIdentifier} templateIdentifier - Template identifier.
193
204
  * @returns {Promise<Array<XOTemplateActionIntent>>} The list of starting actions.
194
205
  */
195
- listStartingActions(templateIdentifier: string): Promise<Array<XOTemplateActionIntent>>;
206
+ listStartingActions(templateIdentifier: XOTemplateIdentifier): Promise<Array<XOTemplateActionIntent>>;
196
207
  /**
197
208
  * Update the unspent outputs for all of a templates lockingBytecodes.
198
209
  *
199
210
  * TODO: Make this an private/internal method.
200
211
  *
201
- * @param {string} templateIdentifier - Template identifier.
212
+ * @param {XOTemplateIdentifier} templateIdentifier - Template identifier.
202
213
  * @returns {Promise<void>} Resolves when the unspent outputs are updated.
203
214
  */
204
- updateUnspentOutputsForTemplate(templateIdentifier: string): Promise<void>;
215
+ updateUnspentOutputsForTemplate(templateIdentifier: XOTemplateIdentifier): Promise<void>;
205
216
  /**
206
217
  * Subscribe to the script hashes for a template.
207
218
  *
208
219
  * TODO: Make this a private/internal method. We may change how/where this is defined in the future.
209
220
  * We'd like to ensure events are propagated to the sync server with an ACK and that the states match between remote and local.
210
221
  *
211
- * @param {string} templateIdentifier - Template identifier.
222
+ * @param {XOTemplateIdentifier} templateIdentifier - Template identifier.
212
223
  * @returns {Promise<void>} Resolves when the script hashes are subscribed.
213
224
  */
214
- subscribeToScriptHashForTemplate(templateIdentifier: string): Promise<void>;
225
+ subscribeToScriptHashForTemplate(templateIdentifier: XOTemplateIdentifier): Promise<void>;
215
226
  /**
216
- * TENTATIVE METHOD: DEFAULT LOCKING STRATEGY UNKNOWN
227
+ * Sets the fallback locking parameters used for change and locking bytecode generation.
217
228
  *
218
- * Sets the default locking parameters (template, output, and role identifiers) for the engine.
219
- * TODO: The default identifiers exist as the strategy on how to create the change and default
220
- * unlocking conditions are unclear. This is likely to change in the future.
229
+ * Resolution order is override, then template defaults, then these fallbacks.
230
+ * If generation is required and no fallback exists, {@link FallbackLockingParametersMissingError} is thrown.
221
231
  *
222
- * @param {string} templateIdentifier - The identifier of the template to use as default.
223
- * @param {string} outputIdentifier - The identifier of the output within the specified template.
224
- * @param {string} roleIdentifier - The identifier of the role to use as default for this output.
225
- * @returns {Promise<void>} Resolves when the default parameters have been successfully set.
226
- * @throws {Error} If the template or output cannot be found.
232
+ * @param {FallbackLockingParameters} fallbackLockingParameters - Template, output, and role identifiers set together.
233
+ * @returns {Promise<void>} Resolves when the fallback parameters have been set.
234
+ * @throws {TemplateIdentifierInvalidInputTypeError} If the template identifier input type is invalid.
235
+ * @throws {TemplateIdentifierByteLengthInvalidError} If the template identifier byte length is invalid.
236
+ * @throws {TemplateIdentifierHexLengthInvalidError} If the template identifier hex length is invalid.
237
+ * @throws {TemplateIdentifierHexFormatInvalidError} If the template identifier hex format is invalid.
238
+ * @throws {TemplateIdentifierAllZeroesError} If the template identifier is all zeroes.
239
+ * @throws {TemplateIdentifierMaximumError} If the template identifier is all 0xFF bytes.
227
240
  */
228
- setDefaultLockingParameters(templateIdentifier: string, outputIdentifier: string, roleIdentifier: string): Promise<void>;
241
+ updateFallbackLockingParameters(fallbackLockingParameters: FallbackLockingParameters): Promise<void>;
229
242
  /**
230
243
  * TODO: Implement this.
231
244
  *
@@ -242,10 +255,10 @@ declare class Engine {
242
255
  * xo template are done using invitations.
243
256
  *
244
257
  * @param {InvitationCreationParameters} params - The parameters for invitation creation.
245
- * @param {string} params.templateIdentifier - Identifier for the template to use.
246
- * @param {string} params.actionIdentifier - Identifier for the action to initiate.
258
+ * @param {XOTemplateIdentifier} params.templateIdentifier - Identifier for the template to use.
259
+ * @param {XOTemplateActionIdentifier} params.actionIdentifier - Identifier for the action to initiate.
247
260
  * @returns {Promise<XOInvitation>} A promise that resolves to the constructed invitation.
248
- * @throws {TemplateNotFoundError} If the template is not found.
261
+ * @throws {TemplateNotFoundInStoreError} If the template is not found.
249
262
  * @throws {TemplateActionNotFoundError} If the action is not found.
250
263
  *
251
264
  * TODO: Add all the throws that happen during the execution of the method.
@@ -257,7 +270,7 @@ declare class Engine {
257
270
  * @param {XOInvitation} invitation - The invitation to be accepted.
258
271
  * @param {AcceptInvitationParameters} params - Optional parameters for accepting the invitation.
259
272
  * @returns {Promise<XOInvitation>} The updated XOInvitation instance.
260
- * @throws {TemplateNotFoundError} If the template is not found.
273
+ * @throws {TemplateNotFoundInStoreError} If the template is not found.
261
274
  * @throws {TemplateActionNotFoundError} If the action is not found.
262
275
  * @throws {InvalidEntityIdentifierError} If the entity identifiers are invalid.
263
276
  * @throws {InvalidRequirementsError} If the requirements are invalid.
@@ -267,27 +280,29 @@ declare class Engine {
267
280
  /**
268
281
  * Appends the invitation with the new information.
269
282
  *
270
- * @param {string} invitationIdentifier - The identifier of the invitation to append. The invitation must already exist in the store.
283
+ * @param {XOInvitationIdentifier} invitationIdentifier - The identifier of the invitation to append.
284
+ * The invitation must already exist in the store.
271
285
  * @param {AppendInvitationParameters} params - The parameters to append the invitation with.
272
286
  * @returns {Promise<XOInvitation>} The appended invitation.
273
287
  * @throws {InvitationNotFoundInStoreError} If the invitation is not found in the store.
274
288
  */
275
- appendInvitation(invitationIdentifier: string, params: AppendInvitationParameters): Promise<XOInvitation>;
289
+ appendInvitation(invitationIdentifier: XOInvitationIdentifier, params: AppendInvitationParameters): Promise<XOInvitation>;
276
290
  /**
277
291
  * Signs the provided invitation once all the resources are reserved and the invitation is complete.
278
292
  * This method is used to sign own inputs and provide unlocking data for them, this appends the
279
293
  * invitation and adds new commit with unlocking data.
280
294
  *
281
- * @param {string} invitationIdentifier - The identifier of the invitation to sign. The invitation must already exist in the store.
295
+ * @param {XOInvitationIdentifier} invitationIdentifier - The identifier of the invitation to sign.
296
+ * The invitation must already exist in the store.
282
297
  * @returns {Promise<XOInvitation>} Resolves when signing is complete.
283
298
  * @throws {InvitationNotFoundInStoreError} If the invitation is not found in the store.
284
299
  *
285
300
  * TODO: Add all the throws that happen during the execution of the method.
286
301
  */
287
- signInvitation(invitationIdentifier: string): Promise<XOInvitation>;
302
+ signInvitation(invitationIdentifier: XOInvitationIdentifier): Promise<XOInvitation>;
288
303
  /**
289
304
  * Executes an action for a given invitation.
290
- * @param {string} invitationIdentifier - The identifier of the invitation whose action to execute.
305
+ * @param {XOInvitationIdentifier} invitationIdentifier - The identifier of the invitation whose action to execute.
291
306
  * The invitation must already exist in the store.
292
307
  * @param {ExecuteActionParameters} params - Parameters for executing the action.
293
308
  * @returns {Promise<TransactionHash>} Resolves with the transaction hash when the action is executed.
@@ -295,13 +310,13 @@ declare class Engine {
295
310
  *
296
311
  * TODO: Add all the throws that happen during the execution of the method.
297
312
  */
298
- executeAction(invitationIdentifier: string, params: ExecuteActionParameters): Promise<TransactionHash>;
313
+ executeAction(invitationIdentifier: XOInvitationIdentifier, params: ExecuteActionParameters): Promise<TransactionHash>;
299
314
  /**
300
315
  * Lists available roles for the given invitation.
301
316
  *
302
317
  * @param {XOInvitation} invitation - The invitation to examine.
303
- * @returns {Promise<string[]>} The list of roles that still require data.
304
- * @throws {TemplateNotFoundError} If the template is not found.
318
+ * @returns {Promise<XOTemplateRoleIdentifier[]>} The list of roles that still require data.
319
+ * @throws {TemplateNotFoundInStoreError} If the template is not found.
305
320
  * @throws {TemplateActionNotFoundError} If the action is not found.
306
321
  */
307
322
  listAvailableRoles(invitation: XOInvitation): Promise<string[]>;
@@ -309,18 +324,19 @@ declare class Engine {
309
324
  * Lists requirements for the provided invitation.
310
325
  *
311
326
  * @param {XOInvitation} invitation - The invitation to analyze requirements for.
312
- * @returns {Promise<XOInvitationRequirements>} The requirements information.
327
+ * @returns {Promise<InvitationRequirementIdentifierLists>} The requirements information.
313
328
  *
314
329
  */
315
- listRequirements(invitation: XOInvitation): Promise<XOInvitationRequirements>;
330
+ listRequirements(invitation: XOInvitation): Promise<InvitationRequirementIdentifierLists>;
316
331
  /**
317
332
  * Lists missing requirements for the provided invitation.
318
333
  *
319
- * @param {string} invitationIdentifier - The identifier of the invitation to analyze. The invitation must already exist in the store.
320
- * @returns {Promise<XOInvitationRequirements>} The missing requirements.
334
+ * @param {XOInvitationIdentifier} invitationIdentifier - The identifier of the invitation to analyze.
335
+ * The invitation must already exist in the store.
336
+ * @returns {Promise<InvitationRequirementIdentifierLists>} The missing requirements.
321
337
  * @throws {InvitationNotFoundInStoreError} If the invitation is not found in the store.
322
338
  */
323
- listMissingRequirements(invitationIdentifier: string): Promise<XOInvitationRequirements>;
339
+ listMissingRequirements(invitationIdentifier: XOInvitationIdentifier): Promise<InvitationRequirementIdentifierLists>;
324
340
  /**
325
341
  * Lists all the unspent outputs.
326
342
  *
@@ -336,6 +352,7 @@ declare class Engine {
336
352
  * @param {XOInvitation} invitation - The invitation to find resources for.
337
353
  * @param {GetSpendableResourcesParameters} options - Parameters for finding suitable resources.
338
354
  * @returns {Promise<{ unspentOutputs: UnspentOutputData[] }>} The list of suitable resources.
355
+ * @throws {FallbackLockingParametersMissingError} If options are omitted and fallback locking parameters are unset.
339
356
  */
340
357
  getSpendableResources(invitation: XOInvitation, options?: GetSpendableResourcesParameters): Promise<{
341
358
  unspentOutputs: UnspentOutputData[];
@@ -343,10 +360,10 @@ declare class Engine {
343
360
  /**
344
361
  * Retrieves a list of script hash data stored for a given template identifier.
345
362
  *
346
- * @param {string} templateIdentifier - The identifier of the template.
363
+ * @param {XOTemplateIdentifier} templateIdentifier - The identifier of the template.
347
364
  * @returns {Promise<ScriptHashData[]>} An array of script hash data objects.
348
365
  */
349
- listScriptHashesForTemplate(templateIdentifier: string): Promise<ScriptHashData[]>;
366
+ listScriptHashesForTemplate(templateIdentifier: XOTemplateIdentifier): Promise<ScriptHashData[]>;
350
367
  /**
351
368
  * Gets all the script hashes from all the templates.
352
369
  *
@@ -381,40 +398,42 @@ declare class Engine {
381
398
  * TODO: If important to make this process faster, consider emitting an event and pushing process to the event loop.
382
399
  * TODO: Encrypt the new information, update the encrypted state servers.
383
400
  *
384
- * @param {string} templateIdentifier - Identifier of the template.
385
- * @param {string} outputIdentifier - Identifier of the output (from the template).
386
- * @param {string} roleIdentifier - Role identifier (corresponding to a role in the output's script).
401
+ * @param {XOTemplateIdentifier} templateIdentifier - Identifier of the template.
402
+ * @param {XOTemplateOutputIdentifier} outputIdentifier - Identifier of the output (from the template).
403
+ * @param {XOTemplateRoleIdentifier} roleIdentifier - Role identifier (corresponding to a role in the output's script).
387
404
  * @returns {Promise<string>} The generated locking bytecode as a hexadecimal string.
388
405
  * @throws {Error} If any required template, output, or configuration is not found, or if compilation fails.
389
406
  */
390
- generateLockingBytecode(templateIdentifier: string, outputIdentifier: string, roleIdentifier?: string): Promise<string>;
407
+ generateLockingBytecode(templateIdentifier: XOTemplateIdentifier, outputIdentifier: XOTemplateOutputIdentifier, roleIdentifier?: XOTemplateRoleIdentifier): Promise<string>;
391
408
  /**
392
- * Generates a locking bytecode using the engine's default template, output, and role identifiers.
409
+ * Generates a locking bytecode using the engine's fallback locking parameters.
393
410
  *
394
- * @returns A promise that resolves to the generated locking bytecode as a string.
411
+ * @returns {Promise<string>} The generated locking bytecode as a hexadecimal string.
412
+ * @throws {FallbackLockingParametersMissingError} If fallback locking parameters have not been set.
395
413
  */
396
- generateLockingBytecodeForDefaultParameters(): Promise<string>;
414
+ generateLockingBytecodeFromFallbackParameters(): Promise<string>;
397
415
  /**
398
416
  * Generate locking data and derivative index for P2PKH.
399
417
  */
400
- generateLockingDataForStandardP2PKH(templateIdentifier: string, outputIdentifier: string, roleIdentifier: string, lockingScriptForOutput: XOTemplateLockingScript): Promise<{
418
+ generateLockingDataForStandardP2PKH(templateIdentifier: XOTemplateIdentifier, roleIdentifier: XOTemplateRoleIdentifier, lockingScriptForOutput: XOTemplateLockingScript): Promise<{
401
419
  lockingData: PrivateKeyRecordForLibauthCompiler;
402
- derivativeIndex: string;
420
+ derivativeIndex: number;
421
+ secretIdentifiers: string[];
403
422
  }>;
404
423
  /**
405
424
  * Fetches a stored invitation by identifier
406
425
  *
407
- * @param {string} invitationIdentifier - The identifier to look up.
426
+ * @param {XOInvitationIdentifier} invitationIdentifier - The identifier to look up.
408
427
  * @returns {Promise<StoredInvitation | undefined>} The stored invitation, or undefined.
409
428
  */
410
- getInvitationOrThrow(invitationIdentifier: string): Promise<StoredInvitation>;
429
+ getInvitationOrThrow(invitationIdentifier: XOInvitationIdentifier): Promise<StoredInvitation>;
411
430
  /**
412
431
  * Fetches a stored template by identifier
413
432
  *
414
- * @param {string} templateIdentifier - The identifier to look up.
433
+ * @param {XOTemplateIdentifier} templateIdentifier - The identifier to look up.
415
434
  * @returns {Promise<XOTemplate>} The stored template.
416
435
  */
417
- getTemplateOrThrow(templateIdentifier: string): Promise<XOTemplate>;
436
+ getTemplateOrThrow(templateIdentifier: XOTemplateIdentifier): Promise<XOTemplate>;
418
437
  /**
419
438
  * Synchronizes the store of unspent outputs for a given script hash with the current state of the blockchain.
420
439
  *
@@ -426,39 +445,10 @@ declare class Engine {
426
445
  * 5. Adds any new unspent outputs found on the blockchain but missing from the store to the store.
427
446
  * 6. Removes any unspent outputs present in the store but no longer in the blockchain.
428
447
  *
429
- * @param scriptHash - The script hash for which to update the stored unspent outputs.
430
- * @throws If the script hash is not found in the store.
448
+ * @param {string} scriptHash - The script hash for which to update the stored unspent outputs.
449
+ * @throws {ScriptHashDataNotFoundError} If the script hash is not found in the store.
431
450
  */
432
451
  updateUnspentOutputsForScriptHashInStore(scriptHash: string): Promise<void>;
433
- /**
434
- * TODO: Internal function, move elsewhere.
435
- *
436
- * Finds own inputs and prepares a list for the lookup in the store.
437
- *
438
- * @param {XOInvitationInput[]} inputs - The inputs to find resources for.
439
- * @returns {Promise<XOInvitationInput[]>} The list of own inputs for reservation.
440
- */
441
- private findOwnResources;
442
- /**
443
- * Applies an invitation append operation to a stored invitation. Signs a new commit using the
444
- * engine's own entity, persists the updated invitation to the store, and returns the result.
445
- *
446
- * This is the shared implementation used by both the public {@link appendInvitation} method
447
- * and internal callers that already hold the stored invitation in memory.
448
- *
449
- * @param {StoredInvitation} storedInvitation - The stored invitation to append to.
450
- * @param {AppendInvitationParameters} params - The parameters to append.
451
- * @returns {Promise<XOInvitation>} The updated invitation after the new commit is applied.
452
- */
453
- private applyInvitationAppend;
454
- /**
455
- * Reserves utxos and store information in the storage.
456
- *
457
- * @param {XOInvitationInput[]} inputs - The inputs to reserve.
458
- * @param {string} invitationIdentifier - The identifier of the invitation for which the resources are being reserved.
459
- * @returns {Promise<void>} Resolves when the reservation is complete.
460
- */
461
- private reserveResources;
462
452
  }
463
453
  //#endregion
464
454
  //#region source/errors.d.ts
@@ -466,79 +456,73 @@ declare class Engine {
466
456
  * Error thrown when an action is not found in the template.
467
457
  */
468
458
  declare class TemplateActionNotFoundError extends Error {
469
- constructor(actionIdentifier: string);
459
+ constructor(actionIdentifier: XOTemplateActionIdentifier);
470
460
  }
471
461
  /**
472
462
  * Error thrown when an output is not found in the template.
473
463
  */
474
464
  declare class TemplateOutputNotFoundError extends Error {
475
- constructor(outputIdentifier: string);
476
- }
477
- /**
478
- * Error thrown when a template is not found.
479
- */
480
- declare class TemplateNotFoundError extends Error {
481
- constructor(templateIdentifier: string);
465
+ constructor(outputIdentifier: XOTemplateOutputIdentifier);
482
466
  }
483
467
  /**
484
468
  * Error thrown when a locking script is not found in the template.
485
469
  */
486
470
  declare class TemplateLockingScriptNotFoundError extends Error {
487
- constructor(lockingScriptIdentifier: string);
471
+ constructor(lockingScriptIdentifier: XOTemplateLockingScriptIdentifier);
488
472
  }
489
473
  /**
490
474
  * Error thrown when a locking script type is not found in the template.
491
475
  */
492
476
  declare class TemplateLockingScriptTypeNotFoundError extends Error {
493
- constructor(lockingScriptIdentifier: string);
477
+ constructor(lockingScriptIdentifier: XOTemplateLockingScriptIdentifier);
494
478
  }
495
479
  /**
496
480
  * Error thrown when an unlocking script is not found in the template.
497
481
  */
498
482
  declare class UnlockingScriptNotFoundError extends Error {
499
- constructor(unlockingScriptIdentifier?: string);
483
+ constructor(unlockingScriptIdentifier?: XOTemplateScriptIdentifier);
500
484
  }
501
485
  /**
502
- * Error thrown when a script is not found in the template.
486
+ * Error thrown when a transaction is not found in the template.
503
487
  */
504
- declare class ScriptNotFoundError extends Error {
505
- constructor(scriptIdentifier?: string);
488
+ declare class TemplateTransactionNotFoundError extends Error {
489
+ constructor(transactionIdentifier: XOTemplateTransactionIdentifier);
506
490
  }
507
491
  /**
508
- * Error thrown when a starting action is not found in the template.
492
+ * Error thrown when a role is not found on a locking script.
509
493
  */
510
- declare class StartingActionNotFoundError extends Error {
511
- constructor(templateIdentifier?: string);
494
+ declare class TemplateLockingScriptRoleNotFoundError extends Error {
495
+ constructor(lockingScriptIdentifier: XOTemplateLockingScriptIdentifier, roleIdentifier: XOTemplateRoleIdentifier);
512
496
  }
513
497
  /**
514
- * Error thrown when a transaction is not found in the template.
498
+ * Error thrown when an output does not have a locking script.
515
499
  */
516
- declare class TemplateTransactionNotFoundError extends Error {
517
- constructor(transactionIdentifier: string);
500
+ declare class TemplateLockingScriptInOutputNotFoundError extends Error {
501
+ constructor(outputIdentifier: XOTemplateOutputIdentifier);
518
502
  }
519
503
  /**
520
504
  * Error thrown when a commit entity identifier is not found.
521
505
  */
522
506
  declare class CommitEntityIdentifierNotFoundError extends Error {
523
- constructor(commitIdentifier?: string);
507
+ constructor(commitIdentifier?: XOInvitationCommitIdentifier);
524
508
  }
525
509
  /**
526
510
  * Error thrown when a commit is not signed.
527
511
  */
528
512
  declare class CommitNotSignedError extends Error {
529
- constructor(commitIdentifier?: string);
513
+ constructor(commitIdentifier?: XOInvitationCommitIdentifier);
530
514
  }
531
515
  /**
532
516
  * Error thrown when a commit is not found in the invitation.
533
517
  */
534
518
  declare class CommitNotFoundInInvitationError extends Error {
535
- constructor(commitIdentifier?: string);
519
+ constructor(commitIdentifier?: XOInvitationCommitIdentifier);
536
520
  }
537
521
  /**
538
522
  * Error thrown when one or more entity identifiers are invalid.
539
523
  */
540
524
  declare class InvalidEntityIdentifierError extends Error {
541
- constructor(entityIdentifiers?: string[]);
525
+ constructor(entityIdentifiers?: XOInvitationEntityIdentifier[]);
542
526
  }
543
527
  /**
544
528
  * Error thrown when one or more provided requirements were not expected by the template.
@@ -550,43 +534,13 @@ declare class InvalidRequirementsError extends Error {
550
534
  * Error thrown when one or more commit signatures are invalid.
551
535
  */
552
536
  declare class InvalidCommitSignaturesError extends Error {
553
- constructor(commitIdentifiers?: string[]);
554
- }
555
- /**
556
- * Error thrown when an invitation is not found in the store.
557
- */
558
- declare class InvitationNotFoundInStoreError extends Error {
559
- constructor(invitationIdentifier?: string);
560
- }
561
- /**
562
- * Error thrown when an invitation has already been accepted.
563
- */
564
- declare class InvitationAlreadyAcceptedError extends Error {
565
- constructor(invitationIdentifier?: string);
566
- }
567
- /**
568
- * Error thrown when an invitation was created in the future.
569
- */
570
- declare class InvitationCreatedInFutureError extends Error {
571
- constructor(invitationIdentifier?: string);
537
+ constructor(commitIdentifiers?: XOInvitationCommitIdentifier[]);
572
538
  }
573
539
  /**
574
540
  * Error thrown when an invitation has expired.
575
541
  */
576
542
  declare class InvitationExpiredError extends Error {
577
- constructor(invitationIdentifier?: string);
578
- }
579
- /**
580
- * Error thrown when an invitation has not been accepted.
581
- */
582
- declare class InvitationNotAcceptedError extends Error {
583
- constructor(invitationIdentifier?: string);
584
- }
585
- /**
586
- * Error thrown when an invitation is invalid.
587
- */
588
- declare class InvalidInvitationError extends Error {
589
- constructor(invitationIdentifier?: string);
543
+ constructor(invitationIdentifier?: XOInvitationIdentifier);
590
544
  }
591
545
  /**
592
546
  * Error thrown when a merged commit is not found.
@@ -600,17 +554,23 @@ declare class MergedCommitNotFoundError extends Error {
600
554
  declare class ScriptHashDataNotFoundError extends Error {
601
555
  constructor(scriptHash?: string);
602
556
  }
557
+ /**
558
+ * Error thrown when the entity identifier is not found in the invitation.
559
+ */
560
+ declare class EntityIdentifierNotFoundInInvitationError extends Error {
561
+ constructor(invitationIdentifier?: XOInvitationIdentifier);
562
+ }
603
563
  /**
604
564
  * Error thrown when the root commit for an entity cannot be found in the invitation.
605
565
  */
606
- declare class RootCommitNotFoundError extends Error {
607
- constructor(entityIdentifier?: string);
566
+ declare class RootCommitNotFoundInInvitationError extends Error {
567
+ constructor(invitationIdentifier?: XOInvitationIdentifier);
608
568
  }
609
569
  /**
610
570
  * Error thrown when a parent commit is not found.
611
571
  */
612
- declare class ParentCommitNotFoundError extends Error {
613
- constructor(parentCommitIdentifier: string, commitIdentifier: string);
572
+ declare class ParentCommitNotFoundInInvitationError extends Error {
573
+ constructor(parentCommitIdentifier: XOInvitationCommitIdentifier, commitIdentifier: XOInvitationCommitIdentifier);
614
574
  }
615
575
  /**
616
576
  * Error thrown when duplicate transactionIndex values are found.
@@ -622,25 +582,25 @@ declare class DuplicateTransactionIndexError extends Error {
622
582
  * Error thrown when a circular merge reference is detected.
623
583
  */
624
584
  declare class CircularMergeReferenceError extends Error {
625
- constructor(itemType: 'input' | 'output', mergeKey: string, commitIdentifier: string);
585
+ constructor(itemType: 'input' | 'output', mergeKey: string, commitIdentifier: XOInvitationCommitIdentifier);
626
586
  }
627
587
  /**
628
588
  * Error thrown when a mergesWith commit is not found.
629
589
  */
630
590
  declare class MergesWithCommitNotFoundError extends Error {
631
- constructor(mergesWithCommitIdentifier: string, currentCommitIdentifier: string);
591
+ constructor(mergesWithCommitIdentifier: XOInvitationCommitIdentifier, currentCommitIdentifier: XOInvitationCommitIdentifier);
632
592
  }
633
593
  /**
634
594
  * Error thrown when an item at a specific index is not found in a commit.
635
595
  */
636
596
  declare class ItemNotFoundInCommitError extends Error {
637
- constructor(itemType: 'input' | 'output', index: number, commitIdentifier: string);
597
+ constructor(itemType: 'input' | 'output', index: number, commitIdentifier: XOInvitationCommitIdentifier);
638
598
  }
639
599
  /**
640
600
  * Error thrown when locking bytecode is not found for an output.
641
601
  */
642
602
  declare class LockingBytecodeNotFoundForOutputError extends Error {
643
- constructor(outputIdentifier: string, transactionIndex?: number);
603
+ constructor(outputIdentifier: XOTemplateOutputIdentifier, transactionIndex?: number);
644
604
  }
645
605
  /**
646
606
  * Error thrown when transaction version is defined multiple times in commits.
@@ -658,115 +618,7 @@ declare class DuplicateTransactionLocktimeError extends Error {
658
618
  * Error thrown when the provided template's identifier does not match the invitation's template identifier.
659
619
  */
660
620
  declare class InvitationTemplateMismatchError extends Error {
661
- constructor(expectedTemplateIdentifier: string, receivedTemplateIdentifier: string);
662
- }
663
- /**
664
- * Error thrown when an unspent output is not found.
665
- */
666
- declare class UnspentOutputNotFoundError extends Error {
667
- constructor(outpointIdentifier?: string);
668
- }
669
- /**
670
- * Error thrown when a role is invalid.
671
- */
672
- declare class InvalidRoleError extends Error {
673
- constructor(roleIdentifier?: string);
674
- }
675
- /**
676
- * Error thrown when there are multiple roles for the starting action.
677
- */
678
- declare class MultipleRolesForStartingActionError extends Error {
679
- constructor(actionIdentifier?: string);
680
- }
681
- /**
682
- * Error thrown when no role is specified and multiple roles are available to be accepted.
683
- */
684
- declare class NoRoleSpecifiedAndMultipleRolesAvailableToBeAcceptedError extends Error {
685
- constructor();
686
- }
687
- /**
688
- * Error thrown when a role has already been accepted by another entity.
689
- */
690
- declare class RoleAlreadyAcceptedByAnotherEntityError extends Error {
691
- constructor(roleIdentifier?: string);
692
- }
693
- /**
694
- * Error thrown when a role cannot start an action.
695
- */
696
- declare class RoleCannotStartActionError extends Error {
697
- constructor(roleIdentifier?: string, actionIdentifier?: string);
698
- }
699
- /**
700
- * Error thrown when a role is not available to be accepted.
701
- */
702
- declare class RoleNotAvailableToBeAcceptedError extends Error {
703
- constructor(roleIdentifier?: string);
704
- }
705
- /**
706
- * Error thrown when a role is not defined for an action.
707
- */
708
- declare class RoleNotDefinedForActionError extends Error {
709
- constructor(roleIdentifier?: string, actionIdentifier?: string);
710
- }
711
- /**
712
- * Error thrown when a role is not found.
713
- */
714
- declare class TemplateLockingScriptRoleNotFoundError extends Error {
715
- constructor(lockingScriptIdentifier: string, roleIdentifier: string);
716
- }
717
- /**
718
- * Error thrown when a data type is invalid.
719
- */
720
- declare class InvalidDataTypeError extends Error {
721
- constructor();
722
- }
723
- /**
724
- * Error thrown when a variable type is invalid.
725
- */
726
- declare class InvalidVariableTypeError extends Error {
727
- constructor(variableKey: string, expectedType: string, actualType: string);
728
- }
729
- /**
730
- * Error thrown when a required variable is missing.
731
- */
732
- declare class MissingRequiredVariableError extends Error {
733
- constructor(variableNames?: string[]);
734
- }
735
- /**
736
- * Error thrown when an unknown variable is provided.
737
- */
738
- declare class UnknownVariableError extends Error {
739
- constructor(variableKey?: string);
740
- }
741
- /**
742
- * Error thrown when a variable is required but not provided.
743
- */
744
- declare class VariableRequiredError extends Error {
745
- constructor(variableKey?: string);
746
- }
747
- /**
748
- * Error thrown when a number variable value is not a valid integer for CashAssembly compilation.
749
- */
750
- declare class CashAssemblyVariableNotIntegerError extends Error {
751
- constructor(variableName: string, value: number);
752
- }
753
- /**
754
- * Error thrown when variable validation fails.
755
- */
756
- declare class VariableValidationFailedError extends Error {
757
- constructor(variableNames?: string[]);
758
- }
759
- /**
760
- * Error thrown when an action is invalid for an invitation.
761
- */
762
- declare class InvalidActionError extends Error {
763
- constructor(actionIdentifier?: string);
764
- }
765
- /**
766
- * Error thrown when cash assembly compilation fails.
767
- */
768
- declare class CashAssemblyCompilationFailedError extends Error {
769
- constructor(message?: string);
621
+ constructor(expectedTemplateIdentifier: XOTemplateIdentifier, receivedTemplateIdentifier: XOTemplateIdentifier);
770
622
  }
771
623
  /**
772
624
  * Error thrown when locking bytecode generation fails.
@@ -786,106 +638,46 @@ declare class LockingDataNotFoundError extends Error {
786
638
  declare class TransactionGenerationFailedError extends Error {
787
639
  constructor();
788
640
  }
789
- /**
790
- * Error thrown when the created by identifier is already set.
791
- */
792
- declare class CreatedByIdentifierAlreadySetError extends Error {
793
- constructor();
794
- }
795
- /**
796
- * Error thrown when the created by identifier signature is already set.
797
- */
798
- declare class CreatedByIdentifierSignatureAlreadySetError extends Error {
799
- constructor();
800
- }
801
- /**
802
- * Error thrown when data is not found in the template.
803
- */
804
- declare class DataNotFoundError extends Error {
805
- constructor();
806
- }
807
641
  /**
808
642
  * Error thrown when input is invalid.
809
643
  */
810
644
  declare class InvalidInputError extends Error {
811
645
  constructor();
812
646
  }
813
- /**
814
- * Error thrown when required data is missing.
815
- */
816
- declare class MissingRequiredDataError extends Error {
817
- constructor();
818
- }
819
- /**
820
- * Error thrown when a required field is missing.
821
- */
822
- declare class MissingRequiredFieldError extends Error {
823
- constructor(fieldName?: string);
824
- }
825
- /**
826
- * Error thrown when a required role for an entity is missing.
827
- */
828
- declare class MissingRequiredRoleForEntityError extends Error {
829
- constructor(roleIdentifier?: string, entityIdentifier?: string);
830
- }
831
- /**
832
- * Error thrown when a required signature by an entity is missing.
833
- */
834
- declare class MissingRequiredSignatureByEntityError extends Error {
835
- constructor(entityIdentifier?: string);
836
- }
837
- /**
838
- * Error thrown when resource reservation fails.
839
- */
840
- declare class ReserveResourcesFailedError extends Error {
841
- constructor();
842
- }
843
- /**
844
- * Error thrown when signature verification fails.
845
- */
846
- declare class SignatureVerificationFailedError extends Error {
847
- constructor();
848
- }
849
647
  /**
850
648
  * Error thrown when a variable definition is invalid.
851
649
  */
852
650
  declare class InvalidVariableDefinitionError extends Error {
853
- constructor(variableIdentifier: string);
854
- }
855
- /**
856
- * Error thrown when an output does not have a locking script.
857
- */
858
- declare class TemplateLockingScriptInOutputNotFoundError extends Error {
859
- constructor(outputIdentifier: string);
651
+ constructor(variableIdentifier: XOTemplateVariableIdentifier);
860
652
  }
861
653
  /**
862
654
  * Error thrown when a locking script has an invalid type.
863
655
  */
864
656
  declare class InvalidLockingScriptTypeError extends Error {
865
- constructor(outputIdentifier: string, expectedType: string, actualType: string);
657
+ constructor(outputIdentifier: XOTemplateOutputIdentifier, expectedType: string, actualType: string);
866
658
  }
867
659
  /**
868
660
  * Error thrown when a locking type is invalid.
869
661
  */
870
662
  declare class InvalidLockingTypeError extends Error {
871
- constructor(outputIdentifier: string, validTypes: string[], actualType: string | undefined);
663
+ constructor(outputIdentifier: XOTemplateOutputIdentifier, validTypes: string[], actualType: string | undefined);
872
664
  }
873
665
  /**
874
- * Error thrown when a derivative index has an invalid type.
666
+ * Error thrown when an electrum client is not found.
875
667
  */
876
- declare class InvalidDerivativeIndexTypeError extends Error {
877
- constructor(expectedType: string, actualType: string);
668
+ declare class ElectrumClientNotFoundError extends Error {
669
+ constructor();
878
670
  }
879
671
  /**
880
- * Error thrown when a template output valueSatoshis has an invalid type for CashAssembly expression.
672
+ * Error thrown when fallback locking parameters are missing for locking bytecode generation.
881
673
  */
882
- declare class InvalidTemplateOutputSatoshisTypeError extends Error {
883
- constructor(actualType: string);
674
+ declare class FallbackLockingParametersMissingError extends Error {
675
+ constructor();
884
676
  }
885
677
  /**
886
- * Error thrown when an electrum client is not found.
678
+ * Error thrown when a derivative index is required for a p2pkh locking type.
887
679
  */
888
- declare class ElectrumClientNotFoundError extends Error {
680
+ declare class P2PKHDerivativeIndexMissingError extends Error {
889
681
  constructor();
890
682
  }
891
683
  //#endregion
@@ -894,14 +686,7 @@ declare class ElectrumClientNotFoundError extends Error {
894
686
  * BlockchainMonitor class that provides blockchain monitoring operations.
895
687
  */
896
688
  declare class BlockchainMonitor {
897
- /**
898
- * The state instance for data persistence.
899
- */
900
- private state;
901
- /**
902
- * Flag indicating whether event listeners have been initialized.
903
- */
904
- private eventListenersInitialized;
689
+ #private;
905
690
  /**
906
691
  * Creates a new instance of BlockchainMonitor.
907
692
  *
@@ -945,50 +730,44 @@ declare class BlockchainMonitor {
945
730
  * Builder for the XOInvitation
946
731
  */
947
732
  declare class InvitationBuilder {
733
+ #private;
948
734
  /**
949
735
  * The identifier of the current invitation.
950
736
  *
951
737
  * TODO: Add validations and type checks to the identifier e.g length.
952
738
  */
953
- invitationIdentifier: string;
739
+ invitationIdentifier: XOInvitationIdentifier;
954
740
  /**
955
741
  * The identifier of the template for the invitation.
956
742
  *
957
743
  * TODO: Add validations and type checks to the identifier e.g it should be a 32 byte hex string, etc.
958
744
  */
959
- templateIdentifier: string;
745
+ templateIdentifier: XOTemplateIdentifier;
960
746
  /**
961
747
  * The identifier of the action for the invitation.
962
748
  */
963
- actionIdentifier: string;
964
- /**
965
- * The timestamp when the invitation is created.
966
- *
967
- */
968
- private createdAtTimestamp;
969
- /**
970
- * The commits in the invitation.
971
- */
972
- private commits;
749
+ actionIdentifier: XOTemplateActionIdentifier;
973
750
  /**
974
751
  * Create a new InvitationBuilder.
975
- * @param invitation Context for invitation creation.
752
+ * @param {InvitationCreationParameters} invitation - Context for invitation creation.
976
753
  */
977
754
  constructor(invitation: InvitationCreationParameters);
978
755
  /**
979
756
  * Create a builder from an existing invitation.
980
- * @param invitation An existing XOInvitation.
757
+ * @param {XOInvitation} invitation - An existing invitation.
758
+ * @returns {InvitationBuilder} A builder initialized from the invitation.
981
759
  */
982
760
  static fromInvitation(invitation: XOInvitation): InvitationBuilder;
983
761
  /**
984
- * Build the XOInvitation object to be shared.
985
- * @returns The built XOInvitation.
762
+ * Build the invitation object to be shared.
763
+ * @returns {XOInvitation} The built invitation.
986
764
  */
987
765
  build(): XOInvitation;
988
766
  /**
989
- * Fully validates a given XOInvitation.
767
+ * Fully validates a given invitation.
990
768
  *
991
- * @param template - The template to validate against.
769
+ * @param {XOTemplate} template - The template to validate against.
770
+ * @returns {this} The builder instance after validation.
992
771
  * @throws {InvitationExpiredError} If the invitation has expired.
993
772
  * @throws {InvalidEntityIdentifierError} If the entity identifiers are invalid.
994
773
  * @throws {InvalidRequirementsError} If the requirements are invalid.
@@ -997,32 +776,35 @@ declare class InvitationBuilder {
997
776
  validate(template: XOTemplate): this;
998
777
  /**
999
778
  * Add a commit to the invitation.
1000
- * @param commit The commit to add.
1001
- * @returns The builder instance.
779
+ * @param {XOInvitationCommit} commit - The commit to add.
780
+ * @returns {this} The builder instance.
781
+ * @throws {CommitNotSignedError} If the commit has no signature.
782
+ * @throws {CommitEntityIdentifierNotFoundError} If the commit has no entity identifier.
1002
783
  */
1003
784
  addCommit(commit: XOInvitationCommit): this;
1004
785
  /**
1005
- * Returns the commitIdentifier of the last commit in the invitation.
1006
- * @returns The commitIdentifier as a string, or undefined if there are no commits.
786
+ * Returns the commit identifier of the last commit in the invitation.
787
+ * @returns {XOInvitationCommitIdentifier | undefined} The last commit identifier, or undefined if there are no commits.
1007
788
  */
1008
- getLastCommitIdentifier(): string | undefined;
789
+ getLastCommitIdentifier(): XOInvitationCommitIdentifier | undefined;
1009
790
  /**
1010
- * Returns the last InvitationCommit in the invitation.
1011
- * @returns The last InvitationCommit object, or undefined if there are no commits.
791
+ * Returns the last commit in the invitation.
792
+ * @returns {XOInvitationCommit | undefined} The last commit, or undefined if there are no commits.
1012
793
  */
1013
794
  getLastCommit(): XOInvitationCommit | undefined;
1014
795
  /**
1015
796
  * Creates an unsigned commit without adding it to the invitation.
1016
797
  * This allows for atomic commit creation with signature.
1017
798
  *
1018
- * @param params - Parameters for creating the commit
1019
- * @param params.inputs - Optional array of inputs to add
1020
- * @param params.outputs - Optional array of outputs to add
1021
- * @param params.variables - Optional array of variables to add
1022
- * @param params.transactionVersion - Optional transaction version
1023
- * @param params.transactionLocktime - Optional transaction locktime
1024
- * @param params.expiresAtTimestamp - Optional expiration timestamp (defaults to now + DEFAULT_COMMIT_EXPIRATION_IN_MILLISECONDS)
1025
- * @returns The unsigned commit (without signature)
799
+ * @param {object} params - Parameters for creating the commit.
800
+ * @param {XOInvitationInput[]} [params.inputs] - Optional array of inputs to add.
801
+ * @param {XOInvitationOutput[]} [params.outputs] - Optional array of outputs to add.
802
+ * @param {XOInvitationVariable[]} [params.variables] - Optional array of variables to add.
803
+ * @param {number} [params.transactionVersion] - Optional transaction version.
804
+ * @param {number} [params.transactionLocktime] - Optional transaction locktime.
805
+ * @param {number} [params.expiresAtTimestamp] - Optional expiration timestamp.
806
+ * Defaults to now plus {@link DEFAULT_COMMIT_EXPIRATION_IN_MILLISECONDS}.
807
+ * @returns {Omit<XOInvitationCommit, 'signature' | 'entityIdentifier'>} The unsigned commit without signature.
1026
808
  */
1027
809
  createUnsignedCommit(params: {
1028
810
  inputs?: XOInvitationInput[];
@@ -1032,34 +814,24 @@ declare class InvitationBuilder {
1032
814
  transactionLocktime?: number;
1033
815
  expiresAtTimestamp?: number;
1034
816
  }): Omit<XOInvitationCommit, 'signature' | 'entityIdentifier'>;
1035
- /**
1036
- * Creates a new commit from the provided data.
1037
- * This is a private helper method that initializes the commit building logic.
1038
- */
1039
- private createCommit;
1040
- /**
1041
- * Validates mergesWith references for inputs and outputs.
1042
- * @private
1043
- */
1044
- private validateMergesWithReferences;
1045
817
  }
1046
818
  //#endregion
1047
819
  //#region source/invitation/commit.d.ts
1048
820
  /**
1049
- * Generates a random 16-byte commit identifier.
821
+ * Generates a random commit identifier.
1050
822
  *
1051
- * @returns {string} The generated commit identifier as a hex string.
823
+ * @returns {XOInvitationCommitIdentifier} The generated commit identifier as a hex string.
1052
824
  */
1053
- declare const generateCommitIdentifier: () => string;
825
+ declare const generateCommitIdentifier: () => XOInvitationCommitIdentifier;
1054
826
  /**
1055
827
  * Finds the root commit identifier for a given entity in an invitation. The root commit is
1056
828
  * the first commit the entity added to the invitation.
1057
829
  *
1058
- * @param {XOInvitation} invitation The invitation whose commits are searched.
1059
- * @param {string} entityIdentifier The entity identifier to search for among the invitation commits.
1060
- * @returns {string | undefined} The root commit identifier if the entity has a commit in the invitation, otherwise undefined.
830
+ * @param {XOInvitation} invitation - The invitation whose commits are searched.
831
+ * @param {XOInvitationEntityIdentifier} entityIdentifier - The entity identifier to search for among the invitation commits.
832
+ * @returns {XOInvitationCommitIdentifier | undefined} The root commit identifier if the entity has a commit in the invitation, otherwise undefined.
1061
833
  */
1062
- declare const findRootCommitIdentifierInInvitation: (invitation: XOInvitation, entityIdentifier: string) => string | undefined;
834
+ declare const findRootCommitIdentifierInInvitation: (invitation: XOInvitation, entityIdentifier: XOInvitationEntityIdentifier) => XOInvitationCommitIdentifier | undefined;
1063
835
  //#endregion
1064
836
  //#region source/invitation/merger.d.ts
1065
837
  /**
@@ -1076,16 +848,16 @@ type MergedInvitation = {
1076
848
  * Converts an array of XOInvitationVariable objects into an object,
1077
849
  * where each key is the variable's identifier and the value is the variable's value.
1078
850
  *
1079
- * @param variables - Array of XOInvitationVariable objects to convert.
1080
- * @returns An object mapping each variable identifier to its corresponding value.
851
+ * @param {XOInvitationVariable[]} variables - Array of invitation variables to convert.
852
+ * @returns {Record<string, XOInvitationVariableValue>} An object mapping each variable identifier to its corresponding value.
1081
853
  */
1082
854
  declare const convertCommitVariablesIntoObject: (variables: XOInvitationVariable[]) => Record<string, XOInvitationVariableValue>;
1083
855
  /**
1084
856
  * Merges invitation commits and transforms it into MergedInvitation structure.
1085
857
  *
1086
- * @param invitation - The invitation containing commits to merge.
1087
- * @param template - The template used for resolving output identifiers.
1088
- * @returns MergedInvitation structure, or null if no commits exist.
858
+ * @param {XOInvitation} invitation - The invitation containing commits to merge.
859
+ * @param {XOTemplate} template - The template used for resolving output identifiers.
860
+ * @returns {MergedInvitation | null} Merged invitation structure, or null if no commits exist.
1089
861
  * @throws {Error} If merge conflicts or missing references are detected.
1090
862
  */
1091
863
  declare const mergeInvitationCommits: (invitation: XOInvitation, template: XOTemplate) => MergedInvitation | null;
@@ -1096,22 +868,22 @@ declare const mergeInvitationCommits: (invitation: XOInvitation, template: XOTem
1096
868
  * Analyzes the template action to determine what variables, inputs, outputs, and role-specific
1097
869
  * requirements are needed to fulfill the action.
1098
870
  *
1099
- * @param template - The template.
1100
- * @param action - The action that has requirements.
1101
- * @returns {XOInvitationRequirements} An object containing all the requirements.
871
+ * @param {XOTemplate} template - The template.
872
+ * @param {XOTemplateAction} action - The action that has requirements.
873
+ * @returns {InvitationRequirementIdentifierLists} An object containing all the requirements.
1102
874
  */
1103
- declare const listRequirementsFromTemplate: (template: XOTemplate, action: XOTemplateAction) => XOInvitationRequirements;
875
+ declare const listRequirementsFromTemplate: (template: XOTemplate, action: XOTemplateAction) => InvitationRequirementIdentifierLists;
1104
876
  /**
1105
877
  * Lists all requirements that have been populated in the invitation by examining all commits.
1106
878
  * Extracts variable, input, and output identifiers from all commits in the invitation and
1107
879
  * organizes them into top-level and role-specific requirements.
1108
880
  *
1109
- * @param invitation - The invitation object to analyze for populated requirements.
1110
- * @returns An object containing all populated requirements found in the invitation's commits,
881
+ * @param {XOInvitation} invitation - The invitation object to analyze for populated requirements.
882
+ * @returns {InvitationRequirementIdentifierLists} An object containing all populated requirements found in the invitation's commits,
1111
883
  * including top-level requirements and role-specific requirements. Only includes roles
1112
884
  * that have at least one requirement populated.
1113
885
  */
1114
- declare const listPopulatedRequirementsInInvitation: (invitation: XOInvitation) => XOInvitationRequirements;
886
+ declare const listPopulatedRequirementsInInvitation: (invitation: XOInvitation) => InvitationRequirementIdentifierLists;
1115
887
  /**
1116
888
  * Lists all missing requirements for the invitation that have not yet been supplied.
1117
889
  * Compares the requirements expected from the template with what has been populated in the invitation
@@ -1119,57 +891,56 @@ declare const listPopulatedRequirementsInInvitation: (invitation: XOInvitation)
1119
891
  *
1120
892
  * Logic: `missing_requirements = requirements_from_template - populated_requirements_in_invitation`
1121
893
  *
1122
- * @param invitation - The invitation object to check for missing requirements.
1123
- * @param template - The template defining what requirements are expected.
1124
- * @param action - The template action being analyzed to determine required requirements.
1125
- * @returns An object containing all missing requirements, including top-level missing requirements
894
+ * @param {XOInvitation} invitation - The invitation object to check for missing requirements.
895
+ * @param {XOTemplate} template - The template defining what requirements are expected.
896
+ * @param {XOTemplateAction} action - The template action being analyzed to determine required requirements.
897
+ * @returns {InvitationRequirementIdentifierLists} An object containing all missing requirements, including top-level missing requirements
1126
898
  * and role-specific missing requirements. Only includes roles that have at least one missing requirement.
1127
899
  */
1128
- declare const listMissingRequirements: (invitation: XOInvitation, template: XOTemplate, action: XOTemplateAction) => XOInvitationRequirements;
900
+ declare const listMissingRequirements: (invitation: XOInvitation, template: XOTemplate, action: XOTemplateAction) => InvitationRequirementIdentifierLists;
1129
901
  /**
1130
902
  * Lists role identifiers for roles that still have capacity for additional participants.
1131
903
  * A role is considered available if the number of distinct entities that have filled it
1132
904
  * is less than the role's maximum slot count. If max is undefined, the role has unlimited capacity.
1133
905
  *
1134
- * @param invitation - The invitation object to check for available roles.
1135
- * @param template - The template defining the invitation structure and requirements.
1136
- * @param action - The template action being analyzed to determine which roles are expected.
1137
- * @returns Array of role identifier strings representing roles that can still accept participants.
906
+ * @param {XOInvitation} invitation - The invitation object to check for available roles.
907
+ * @param {XOTemplateAction} action - The template action being analyzed to determine which roles are expected.
908
+ * @returns {XOTemplateRoleIdentifier[]} Role identifiers for roles that can still accept participants.
1138
909
  * Returns an empty array if no roles are defined in the action.
1139
910
  */
1140
- declare const listAvailableRolesForInvitation: (invitation: XOInvitation, action: XOTemplateAction) => string[];
911
+ declare const listAvailableRolesForInvitation: (invitation: XOInvitation, action: XOTemplateAction) => XOTemplateRoleIdentifier[];
1141
912
  //#endregion
1142
913
  //#region source/invitation/validation.d.ts
1143
914
  /**
1144
915
  * Validates that the invitation has not expired for any of the commits.
1145
916
  *
1146
- * @param invitation - The XOInvitation object containing creation and expiration timestamps.
1147
- * @returns True if the invitation is expired, false if it is valid.
917
+ * @param {XOInvitation} invitation - The invitation containing creation and expiration timestamps.
918
+ * @returns {boolean} True if the invitation is expired, false if it is valid.
1148
919
  */
1149
920
  declare const hasInvitationExpired: (invitation: XOInvitation) => boolean;
1150
921
  /**
1151
- * Validates that all entity identifiers in the invitation are valid public keys.
922
+ * Validates that all entity identifiers in the invitation are valid extended public keys.
1152
923
  * Extracts unique entity identifiers from all commits.
1153
924
  *
1154
- * @param invitation - The invitation to validate.
1155
- * @returns True if all entities are valid, false otherwise.
925
+ * @param {XOInvitation} invitation - The invitation to validate.
926
+ * @returns {boolean} True if all entities are valid, false otherwise.
1156
927
  */
1157
928
  declare const validateInvitationEntities: (invitation: XOInvitation) => boolean;
1158
929
  /**
1159
930
  * Validates that all provided requirements in the invitation were expected by the template.
1160
931
  *
1161
- * @param invitation - The invitation to validate.
1162
- * @param template - The template to validate against.
1163
- * @param action - The action to validate against.
1164
- * @returns True if all requirements are expected, false otherwise.
932
+ * @param {XOInvitation} invitation - The invitation to validate.
933
+ * @param {XOTemplate} template - The template to validate against.
934
+ * @param {XOTemplateAction} action - The action to validate against.
935
+ * @returns {boolean} True if all requirements are expected, false otherwise.
1165
936
  */
1166
937
  declare const validateRoleRequirements: (invitation: XOInvitation, template: XOTemplate, action: XOTemplateAction) => boolean;
1167
938
  /**
1168
939
  * Validates commit signatures.
1169
940
  * Signature signs: stringify(data) + templateIdentifier + actionIdentifier + invitationIdentifier + commitIdentifier + previousCommitIdentifier
1170
941
  *
1171
- * @param invitation - The invitation containing commits to validate.
1172
- * @returns True if all commit signatures are valid, false otherwise.
942
+ * @param {XOInvitation} invitation - The invitation containing commits to validate.
943
+ * @returns {boolean} True if all commit signatures are valid, false otherwise.
1173
944
  */
1174
945
  declare const validateInvitationCommits: (invitation: XOInvitation) => boolean;
1175
946
  //#endregion
@@ -1178,10 +949,7 @@ declare const validateInvitationCommits: (invitation: XOInvitation) => boolean;
1178
949
  * Template class for accessing template data.
1179
950
  */
1180
951
  declare class Template {
1181
- /**
1182
- * The template object.
1183
- */
1184
- private readonly template;
952
+ #private;
1185
953
  /**
1186
954
  * Creates a Template class from a template object.
1187
955
  */
@@ -1197,201 +965,127 @@ declare class Template {
1197
965
  getStartingActions(): Array<XOTemplateActionIntent>;
1198
966
  /**
1199
967
  * Retrieves an output definition by identifier.
968
+ * @param {XOTemplateOutputIdentifier} outputIdentifier - The output identifier.
969
+ * @returns {XOTemplateOutput} The output definition associated with the specified output identifier.
1200
970
  * @throws {TemplateOutputNotFoundError} If the output is not found.
1201
971
  */
1202
- getOutputOrThrow(outputIdentifier: string): XOTemplateOutput;
972
+ getOutputOrThrow(outputIdentifier: XOTemplateOutputIdentifier): XOTemplateOutput;
1203
973
  /**
1204
974
  * Retrieves the locking script identifier from an output.
975
+ * @param {XOTemplateOutputIdentifier} outputIdentifier - The output identifier.
976
+ * @returns {XOTemplateLockingScriptIdentifier} The locking script identifier associated with the specified output.
1205
977
  * @throws {TemplateOutputNotFoundError} If the output is not found.
1206
978
  * @throws {TemplateLockingScriptInOutputNotFoundError} If the output has no locking script reference.
1207
979
  */
1208
- getLockingScriptIdentifierOrThrow(outputIdentifier: string): string;
980
+ getLockingScriptIdentifierOrThrow(outputIdentifier: XOTemplateOutputIdentifier): XOTemplateLockingScriptIdentifier;
1209
981
  /**
1210
982
  * Retrieves a locking script definition by identifier.
983
+ * @param {XOTemplateLockingScriptIdentifier} lockingScriptIdentifier - The locking script identifier.
984
+ * @returns {XOTemplateLockingScript} The locking script definition associated with the specified locking script identifier.
1211
985
  * @throws {TemplateLockingScriptNotFoundError} If the locking script is not found.
1212
986
  */
1213
- getLockingScriptOrThrow(lockingScriptIdentifier: string): XOTemplateLockingScript;
987
+ getLockingScriptOrThrow(lockingScriptIdentifier: XOTemplateLockingScriptIdentifier): XOTemplateLockingScript;
1214
988
  /**
1215
989
  * Retrieves the locking script for a given output.
990
+ * @param {XOTemplateOutputIdentifier} outputIdentifier - The output identifier.
991
+ * @returns {XOTemplateLockingScript} The locking script definition associated with the specified output.
1216
992
  * @throws {TemplateOutputNotFoundError} If the output is not found.
1217
993
  * @throws {TemplateLockingScriptInOutputNotFoundError} If the output has no locking script reference.
1218
994
  * @throws {TemplateLockingScriptNotFoundError} If the locking script definition is not found.
1219
995
  */
1220
- getLockingScriptForOutputOrThrow(outputIdentifier: string): XOTemplateLockingScript;
996
+ getLockingScriptForOutputOrThrow(outputIdentifier: XOTemplateOutputIdentifier): XOTemplateLockingScript;
1221
997
  /**
1222
998
  * Retrieves a role within a locking script.
1223
- * @param lockingScriptIdentifier - The locking script identifier.
1224
- * @param roleIdentifier - The role identifier.
999
+ * @param {XOTemplateLockingScriptIdentifier} lockingScriptIdentifier - The locking script identifier.
1000
+ * @param {XOTemplateRoleIdentifier} roleIdentifier - The role identifier.
1001
+ * @returns {XOTemplateLockingScriptRole} The role definition associated with the specified locking script and role identifiers.
1225
1002
  * @throws {TemplateLockingScriptNotFoundError} If the locking script is not found.
1226
1003
  * @throws {TemplateLockingScriptRoleNotFoundError} If the role is not found.
1227
1004
  */
1228
- getRoleOrThrow(lockingScriptIdentifier: string, roleIdentifier: string): XOTemplateLockingScriptRole;
1005
+ getRoleOrThrow(lockingScriptIdentifier: XOTemplateLockingScriptIdentifier, roleIdentifier: XOTemplateRoleIdentifier): XOTemplateLockingScriptRole;
1229
1006
  /**
1230
1007
  * Retrieves the first available role in a locking script, or throws if none exist.
1231
- * @param lockingScriptIdentifier - The locking script identifier.
1232
- * @returns A tuple of [roleIdentifier, role].
1008
+ * @param {XOTemplateLockingScriptIdentifier} lockingScriptIdentifier - The locking script identifier.
1009
+ * @returns {[XOTemplateRoleIdentifier, XOTemplateLockingScriptRole]} The first available role identifier and role definition
1010
+ * for the specified locking script.
1233
1011
  * @throws {TemplateLockingScriptNotFoundError} If the locking script is not found.
1234
1012
  * @throws {TemplateLockingScriptRoleNotFoundError} If no roles exist.
1235
1013
  */
1236
- getFirstRoleOrThrow(lockingScriptIdentifier: string): [string, XOTemplateLockingScriptRole];
1014
+ getFirstRoleOrThrow(lockingScriptIdentifier: XOTemplateLockingScriptIdentifier): [XOTemplateRoleIdentifier, XOTemplateLockingScriptRole];
1237
1015
  /**
1238
- * Retrieves secrets for a locking script.
1239
- * If roleIdentifier is provided, returns secrets from the role's state.
1240
- * Otherwise, returns secrets from the locking script itself.
1241
- * @param lockingScriptIdentifier - The locking script identifier.
1242
- * @param roleIdentifier - The role identifier (optional, if not provided uses locking script secrets).
1243
- * @returns Array of secret identifiers.
1016
+ * Retrieves the secret identifiers tracked for a locking script or one of its roles.
1017
+ * If roleIdentifier is provided, returns the secret identifiers tracked for that role within the locking script.
1018
+ * Otherwise, returns the secret identifiers tracked at the locking script level.
1019
+ * @param {XOTemplateLockingScriptIdentifier} lockingScriptIdentifier - The locking script identifier.
1020
+ * @param {XOTemplateRoleIdentifier} [roleIdentifier] - The role identifier. When omitted, locking script secrets are used.
1021
+ * @returns {string[]} Array of secret identifiers.
1244
1022
  * @throws {TemplateLockingScriptNotFoundError} If the locking script is not found.
1245
1023
  * @throws {TemplateLockingScriptRoleNotFoundError} If roleIdentifier is provided but the role is not found.
1246
1024
  */
1247
- getSecrets(lockingScriptIdentifier: string, roleIdentifier?: string): string[];
1025
+ getSecrets(lockingScriptIdentifier: XOTemplateLockingScriptIdentifier, roleIdentifier?: XOTemplateRoleIdentifier): string[];
1248
1026
  /**
1249
1027
  * Retrieves an action definition by identifier.
1250
- * @param actionIdentifier - The identifier of the action.
1028
+ * @param {XOTemplateActionIdentifier} actionIdentifier - The identifier of the action.
1029
+ * @returns {XOTemplateAction} The action definition associated with the specified action identifier.
1251
1030
  * @throws {TemplateActionNotFoundError} If the action is not found.
1252
1031
  */
1253
- getActionOrThrow(actionIdentifier: string): XOTemplateAction;
1032
+ getActionOrThrow(actionIdentifier: XOTemplateActionIdentifier): XOTemplateAction;
1254
1033
  /**
1255
1034
  * Retrieves a transaction definition by identifier.
1256
- * @param transactionIdentifier - The identifier of the transaction.
1035
+ * @param {XOTemplateTransactionIdentifier} transactionIdentifier - The identifier of the transaction.
1036
+ * @returns {XOTemplateTransaction} The transaction definition associated with the specified transaction identifier.
1257
1037
  * @throws {TemplateTransactionNotFoundError} If the transaction is not found.
1258
1038
  */
1259
- getTransactionOrThrow(transactionIdentifier: string): XOTemplateTransaction;
1039
+ getTransactionOrThrow(transactionIdentifier: XOTemplateTransactionIdentifier): XOTemplateTransaction;
1260
1040
  /**
1261
1041
  * Retrieves the transaction for a given action.
1262
- * @param actionIdentifier - The identifier of the action.
1042
+ * @param {XOTemplateActionIdentifier} actionIdentifier - The identifier of the action.
1043
+ * @returns {XOTemplateTransaction} The transaction definition associated with the specified action.
1263
1044
  * @throws {TemplateActionNotFoundError} If the action is not found.
1264
1045
  * @throws {TemplateTransactionNotFoundError} If the action has no transaction defined or the transaction is not found.
1265
1046
  */
1266
- getTransactionForActionOrThrow(actionIdentifier: string): XOTemplateTransaction;
1047
+ getTransactionForActionOrThrow(actionIdentifier: XOTemplateActionIdentifier): XOTemplateTransaction;
1267
1048
  }
1268
1049
  //#endregion
1269
- //#region source/utils/cashassembly.d.ts
1270
- /**
1271
- * Supported decode modes for compiled CashAssembly evaluation bytes.
1272
- */
1273
- type CompiledCashAssemblyDecodeMode = 'utf8' | 'hex' | 'boolean' | 'bigint' | 'uint8array';
1274
- /**
1275
- * Parameters for compiling CashAssembly string.
1276
- */
1277
- type CompileCashAssemblyStringParameters = {
1278
- cashAssemblyText: string;
1279
- variables: Record<string, XOInvitationVariableValue | Uint8Array>;
1280
- evaluationDecodeMode?: CompiledCashAssemblyDecodeMode;
1281
- };
1282
- /**
1283
- * Checks if the expression is a CashAssembly expression.
1284
- *
1285
- * @param expression - The expression to check.
1286
- * @returns True if the expression is a CashAssembly expression, false otherwise.
1287
- */
1288
- declare const isCashAssemblyExpression: (expression: unknown) => boolean;
1289
- /**
1290
- * Extracts all CashAssembly evaluations (i.e., substrings like $(...)) from the input text.
1291
- *
1292
- * @param text - The input string to scan for CashAssembly evaluations.
1293
- * @returns An array of evaluation strings found in the input.
1294
- *
1295
- * @example
1296
- * extractCashAssemblyEvaluations("OP_DUP <$(<foo>)> OP_HASH160 $(<bar>)");
1297
- * // returns ['$(<foo>)', '$(<bar>)']
1298
- */
1299
- declare const extractCashAssemblyEvaluations: (text: string) => string[];
1300
- /**
1301
- * Extracts unique variable identifiers enclosed in angle brackets from each evaluation string.
1302
- *
1303
- * CashAssembly literal tokens such as hex bytes, numbers, and quoted strings are excluded.
1304
- * For example, `<0x02>` and `<"minting">` are not returned.
1305
- *
1306
- * @param evaluations - An array of evaluation strings from which to extract variable names.
1307
- * @returns An array of variable names
1308
- */
1309
- declare const extractVariablesFromEvaluations: (evaluations: string[]) => string[];
1310
- /**
1311
- * Decodes compiled CashAssembly evaluation bytes into a string representation.
1312
- *
1313
- * 'evaluationDecodeMode' determines how the evaluation bytes are interpreted and presented.
1314
- * Choose based on what the evaluation is expected to produce:
1315
- * `bigint` for numeric values like satoshis, `utf8` for text labels, `hex` for binary data such
1316
- * as hashes, and `boolean` to represent boolean values.
1317
- *
1318
- * @param compiledResult - The compiled evaluation bytecode.
1319
- * @param evaluationDecodeMode - The decode mode used to convert bytes to text.
1320
- * @returns The decoded value as a string suitable for inline replacement.
1321
- */
1322
- declare const decodeCompiledCashAssemblyEvaluation: (compiledResult: Uint8Array, evaluationDecodeMode?: CompiledCashAssemblyDecodeMode) => string;
1323
- /**
1324
- * Compiles all CashAssembly evaluations in a text string and replaces each evaluation
1325
- * with a decoded string representation.
1326
- *
1327
- * @param cashAssemblyText - The string with CashAssembly evaluations.
1328
- * @param variables - Object mapping variable names to values for compilation.
1329
- * @param evaluationDecodeMode - The decode mode used after each evaluation is compiled.
1330
- * @returns Compiled text with all evaluations replaced by decoded string values.
1331
- * @throws VariableValidationFailedError when a required variable is not present in the variables map.
1332
- */
1333
- declare const compileCashAssemblyString: (parameters: CompileCashAssemblyStringParameters) => string;
1334
- //#endregion
1335
1050
  //#region source/utils/libauth-utils.d.ts
1336
- /**
1337
- * Generates bytecode for a specific CashAssembly evaluation using given variable values and a prepared compiler.
1338
- * Returns libauth result or error string.
1339
- *
1340
- * @param compiler - The libauth compiler.
1341
- * @param evaluation - The specific evaluation string to compile.
1342
- * @param variables - A record mapping variable names to their values.
1343
- * @returns Bytecode result object on success, otherwise an error string.
1344
- */
1345
- declare const generateCashAssemblyBytecode: (compiler: CompilerBch, evaluation: string, variables: Record<string, unknown>) => Uint8Array;
1346
- /**
1347
- * Prepares a compiler for the provided CashAssembly evaluations, setting required variables as 'WalletData'.
1348
- *
1349
- * @param evaluations - Array of evaluation strings (e.g., ['$(<var1>)', '$(<var2> <var3>)'])
1350
- * @returns A Libauth compiler instance for use with these evaluations.
1351
- */
1352
- declare const compileCashAssemblyEvaluations: (evaluations: string[]) => CompilerBch;
1353
1051
  /**
1354
1052
  * Creates a map of variable identifiers to role identifiers for the libauth compiler configuration.
1355
1053
  *
1356
- * @param template - The template used to gather the variable identifiers.
1357
- * @param role - The role identifier to assign to the variables.
1054
+ * @param {XOTemplate} template - The template used to gather the variable identifiers.
1055
+ * @param {XOTemplateRoleIdentifier} role - The role identifier to assign to the variables.
1358
1056
  * @returns {Record<string, string>} A map of variable identifiers to role identifiers.
1359
1057
  */
1360
- declare const entityOwnershipForLibauthCompiler: (template: XOTemplate, role: string) => Record<string, string>;
1058
+ declare const entityOwnershipForLibauthCompiler: (template: XOTemplate, role: XOTemplateRoleIdentifier) => Record<string, string>;
1361
1059
  /**
1362
1060
  * Creates a map of script identifiers to script definitions for the libauth compiler configuration.
1363
1061
  *
1364
- * @param template - The template used to gather the scripts.
1062
+ * @param {XOTemplate} template - The template used to gather the scripts.
1365
1063
  * @returns {CompilerConfiguration['scripts']} A map of script identifiers to script definitions.
1366
1064
  */
1367
1065
  declare const scriptsForLibauthCompiler: (template: XOTemplate) => CompilerConfiguration["scripts"];
1368
1066
  /**
1369
1067
  * Converts template variables into libauth variables with types.
1370
1068
  *
1371
- * @param template - The template to assign types to the variables.
1372
- * @returns CompilerConfiguration['variables']
1069
+ * @param {XOTemplate} template - The template to assign types to the variables.
1070
+ * @returns {CompilerConfiguration['variables']} Variables mapped for the libauth compiler.
1373
1071
  */
1374
1072
  declare const assignTypeToVariablesForLibauthCompiler: (template: XOTemplate) => CompilerConfiguration["variables"];
1375
1073
  /**
1376
1074
  * Converts an XO template locking type to the corresponding libauth compiler locking script type.
1377
1075
  *
1378
- * @param lockingType - The XO template locking type to convert.
1379
- * @returns The corresponding libauth compiler locking script type string.
1076
+ * @param {XOTemplateLockingType} lockingType - The XO template locking type to convert.
1077
+ * @returns {NonNullable<CompilerConfiguration['lockingScriptTypes']>[string]} The corresponding libauth compiler locking script type.
1380
1078
  */
1381
1079
  declare const convertXOLockingTypeToLibauth: (lockingType: XOTemplateLockingType) => "p2sh20" | "p2sh32" | "standard";
1382
1080
  /**
1383
1081
  * Creates the libauth compatible compiler data for a unspent output.
1384
1082
  *
1385
- * @param template - The template used to generate the compiler data for.
1386
- * @param unspentOutput - The unspent output to create the compiler data for.
1387
- * @returns The compiler data for the unspent output.
1388
- * @returns {Promise<{
1389
- * compiler: CompilerBch;
1390
- * script: string;
1391
- * valueSatoshis: bigint;
1392
- * }>} The compiler data for the unspent output.
1393
- */
1394
- declare const createLibauthCompilerDataFromUnspentOutput: (template: Template, unspentOutput: UnspentOutputData) => Promise<{
1083
+ * @param {Template} template - The template used to generate the compiler data for.
1084
+ * @param {UnspentOutputData} unspentOutput - The unspent output to create the compiler data for.
1085
+ * @param {XOTemplateOutputIdentifier} outputIdentifier - The template output identifier for the unspent output.
1086
+ * @returns {Promise<{ compiler: CompilerBch; script: string; valueSatoshis: bigint; }>} The compiler data for the unspent output.
1087
+ */
1088
+ declare const createLibauthCompilerDataFromUnspentOutput: (template: Template, unspentOutput: UnspentOutputData, outputIdentifier: XOTemplateOutputIdentifier) => Promise<{
1395
1089
  compiler: CompilerBch;
1396
1090
  script: string;
1397
1091
  valueSatoshis: bigint;
@@ -1408,12 +1102,13 @@ declare const createLibauthCompilerDataFromUnspentOutput: (template: Template, u
1408
1102
  * 4. Adds any new unspent outputs found on the blockchain but missing from the state to the state.
1409
1103
  * 5. Removes any unspent outputs present in the state but no longer in the blockchain.
1410
1104
  *
1411
- * @param state - The State instance to use for data operations.
1412
- * @param scriptHash - The script hash for which to update the stored unspent outputs.
1413
- * @param fetchUnspentOutputsCallback - Callback function to fetch unspent outputs from the blockchain.
1414
- * @throws If the script hash is not found in the state.
1105
+ * @param {State} state - The State instance to use for data operations.
1106
+ * @param {string} scriptHash - The script hash for which to update the stored unspent outputs.
1107
+ * @param {(scriptHash: string) => Promise<ScriptHashListUnspentResponse>} fetchUnspentOutputsCallback
1108
+ * Callback to fetch unspent outputs from the blockchain.
1109
+ * @throws {ScriptHashDataNotFoundError} If the script hash is not found in the state.
1415
1110
  */
1416
1111
  declare const updateUnspentOutputsForScriptHashInStore: (state: State, scriptHash: string, fetchUnspentOutputsCallback: (scriptHash: string) => Promise<ScriptHashListUnspentResponse>) => Promise<void>;
1417
1112
  //#endregion
1418
- export { AcceptInvitationParameters, AppendInvitationParameters, BlockchainMonitor, CashAssemblyCompilationFailedError, CashAssemblyVariableNotIntegerError, CircularMergeReferenceError, CommitEntityIdentifierNotFoundError, CommitNotFoundInInvitationError, CommitNotSignedError, CompileCashAssemblyStringParameters, CompiledCashAssemblyDecodeMode, CreatedByIdentifierAlreadySetError, CreatedByIdentifierSignatureAlreadySetError, DataNotFoundError, DuplicateTransactionIndexError, DuplicateTransactionLocktimeError, DuplicateTransactionVersionError, ElectrumClientNotFoundError, Engine, ExecuteActionParameters, GetSpendableResourcesParameters, InvalidActionError, InvalidCommitSignaturesError, InvalidDataTypeError, InvalidDerivativeIndexTypeError, InvalidEntityIdentifierError, InvalidInputError, InvalidInvitationError, InvalidLockingScriptTypeError, InvalidLockingTypeError, InvalidRequirementsError, InvalidRoleError, InvalidTemplateOutputSatoshisTypeError, InvalidVariableDefinitionError, InvalidVariableTypeError, InvitationAlreadyAcceptedError, InvitationBuilder, InvitationCreatedInFutureError, InvitationCreationParameters, InvitationExpiredError, InvitationNotAcceptedError, InvitationNotFoundInStoreError, InvitationTemplateMismatchError, ItemNotFoundInCommitError, LockingBytecodeGenerationFailedError, LockingBytecodeNotFoundForOutputError, LockingDataNotFoundError, MergedCommitNotFoundError, MergedInvitation, MergesWithCommitNotFoundError, MissingRequiredDataError, MissingRequiredFieldError, MissingRequiredRoleForEntityError, MissingRequiredSignatureByEntityError, MissingRequiredVariableError, MultipleRolesForStartingActionError, NoRoleSpecifiedAndMultipleRolesAvailableToBeAcceptedError, ParentCommitNotFoundError, ReserveResourcesFailedError, RoleAlreadyAcceptedByAnotherEntityError, RoleCannotStartActionError, RoleNotAvailableToBeAcceptedError, RoleNotDefinedForActionError, RootCommitNotFoundError, ScriptHashDataNotFoundError, ScriptNotFoundError, SignatureVerificationFailedError, StartingActionNotFoundError, Template, TemplateActionNotFoundError, TemplateLockingScriptInOutputNotFoundError, TemplateLockingScriptNotFoundError, TemplateLockingScriptRoleNotFoundError, TemplateLockingScriptTypeNotFoundError, TemplateNotFoundError, TemplateOutputNotFoundError, TemplateTransactionNotFoundError, TransactionGenerationFailedError, UnknownVariableError, UnlockingScriptNotFoundError, UnspentOutputNotFoundError, VariableRequiredError, VariableValidationFailedError, XOEngineOptions, assignTypeToVariablesForLibauthCompiler, compileCashAssemblyEvaluations, compileCashAssemblyString, convertCommitVariablesIntoObject, convertXOLockingTypeToLibauth, createLibauthCompilerDataFromUnspentOutput, decodeCompiledCashAssemblyEvaluation, entityOwnershipForLibauthCompiler, extractCashAssemblyEvaluations, extractVariablesFromEvaluations, findRootCommitIdentifierInInvitation, generateCashAssemblyBytecode, generateCommitIdentifier, generateTemplateIdentifier, hasInvitationExpired, isCashAssemblyExpression, listAvailableRolesForInvitation, listMissingRequirements, listPopulatedRequirementsInInvitation, listRequirementsFromTemplate, mergeInvitationCommits, parseTemplate, scriptsForLibauthCompiler, updateUnspentOutputsForScriptHashInStore, validateInvitationCommits, validateInvitationEntities, validateRoleRequirements };
1113
+ export { AcceptInvitationParameters, AppendInvitationParameters, BlockchainMonitor, CircularMergeReferenceError, CommitEntityIdentifierNotFoundError, CommitNotFoundInInvitationError, CommitNotSignedError, DuplicateTransactionIndexError, DuplicateTransactionLocktimeError, DuplicateTransactionVersionError, ElectrumClientNotFoundError, Engine, EntityIdentifierNotFoundInInvitationError, ExecuteActionParameters, FallbackLockingParameters, FallbackLockingParametersMissingError, GetSpendableResourcesParameters, InvalidCommitSignaturesError, InvalidEntityIdentifierError, InvalidInputError, InvalidLockingScriptTypeError, InvalidLockingTypeError, InvalidRequirementsError, InvalidVariableDefinitionError, InvitationBuilder, InvitationCreationParameters, InvitationExpiredError, InvitationRequirementIdentifierLists, InvitationRoleRequirementIdentifierLists, InvitationTemplateMismatchError, ItemNotFoundInCommitError, LockingBytecodeGenerationFailedError, LockingBytecodeNotFoundForOutputError, LockingDataNotFoundError, MergedCommitNotFoundError, MergedInvitation, MergesWithCommitNotFoundError, P2PKHDerivativeIndexMissingError, ParentCommitNotFoundInInvitationError, RootCommitNotFoundInInvitationError, ScriptHashDataNotFoundError, Template, TemplateActionNotFoundError, TemplateLockingScriptInOutputNotFoundError, TemplateLockingScriptNotFoundError, TemplateLockingScriptRoleNotFoundError, TemplateLockingScriptTypeNotFoundError, TemplateOutputNotFoundError, TemplateTransactionNotFoundError, TransactionGenerationFailedError, UnlockingScriptNotFoundError, XOEngineOptions, assignTypeToVariablesForLibauthCompiler, convertCommitVariablesIntoObject, convertXOLockingTypeToLibauth, createLibauthCompilerDataFromUnspentOutput, entityOwnershipForLibauthCompiler, findRootCommitIdentifierInInvitation, generateCommitIdentifier, generateTemplateIdentifier, hasInvitationExpired, listAvailableRolesForInvitation, listMissingRequirements, listPopulatedRequirementsInInvitation, listRequirementsFromTemplate, mergeInvitationCommits, parseTemplate, scriptsForLibauthCompiler, updateUnspentOutputsForScriptHashInStore, validateInvitationCommits, validateInvitationEntities, validateRoleRequirements };
1419
1114
  //# sourceMappingURL=index.d.mts.map