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