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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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, 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";
8
+ import { XOInvitation, XOInvitationCommit, XOInvitationInput, XOInvitationOutput, XOInvitationRequirements, XOInvitationVariable, XOInvitationVariableValue, XOTemplate, XOTemplateAction, XOTemplateActionIntent, XOTemplateLockingScript, XOTemplateLockingScriptRole, XOTemplateLockingType, XOTemplateOutput, XOTemplateTransaction } 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: XOTemplateIdentifier;
51
+ templateIdentifier: string;
52
52
  /**
53
53
  * Identifier of the action within the template to initiate.
54
54
  */
55
- actionIdentifier: XOTemplateActionIdentifier;
55
+ actionIdentifier: string;
56
56
  }
57
57
  /**
58
58
  * Parameters for extending an invitation.
@@ -103,53 +103,42 @@ interface GetSpendableResourcesParameters {
103
103
  /**
104
104
  * Identifier of the template to use for resource selection.
105
105
  */
106
- templateIdentifier: XOTemplateIdentifier;
106
+ templateIdentifier: string;
107
107
  /**
108
108
  * Identifier of the output within the template.
109
109
  */
110
- outputIdentifier: XOTemplateOutputIdentifier;
110
+ outputIdentifier: string;
111
111
  }
112
+ //#endregion
113
+ //#region source/engine.d.ts
112
114
  /**
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.
115
+ * XO Engine class: Acts like an orchestrator for the XO system.
116
116
  */
117
- interface FallbackLockingParameters {
117
+ declare class Engine {
118
118
  /**
119
- * Identifier of the template to use as the fallback locking source.
119
+ * The crypto instance.
120
120
  */
121
- templateIdentifier: XOTemplateIdentifier;
121
+ private crypto;
122
122
  /**
123
- * Identifier of the output within the template.
123
+ * The state instance.
124
124
  */
125
- outputIdentifier: XOTemplateOutputIdentifier;
125
+ private state;
126
126
  /**
127
- * Identifier of the role to use for the fallback locking script.
127
+ * The blockchain monitor instance.
128
128
  */
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;
129
+ private blockchainMonitor;
130
+ /**
131
+ * The default template identifier.
132
+ */
133
+ private defaultTemplateIdentifier;
134
+ /**
135
+ * The default role identifier.
136
+ */
137
+ private defaultRoleIdentifier;
138
+ /**
139
+ * The default output identifier.
140
+ */
141
+ private defaultOutputIdentifier;
153
142
  /**
154
143
  * Constructs a new instance of XO Engine.
155
144
  * @private
@@ -179,19 +168,19 @@ declare class Engine {
179
168
  getChainStatus(): Promise<ChainStatus>;
180
169
  /**
181
170
  * Retrieves a template by its identifier from the state.
182
- * @param {XOTemplateIdentifier} templateIdentifier - Template identifier.
171
+ * @param {string} templateIdentifier - Template identifier.
183
172
  * @returns {Promise<XOTemplate | undefined>} The template object.
184
173
  */
185
- getTemplate(templateIdentifier: XOTemplateIdentifier): Promise<XOTemplate | undefined>;
174
+ getTemplate(templateIdentifier: string): Promise<XOTemplate | undefined>;
186
175
  /**
187
176
  * Imports a template into the Engine after sanitization and validation.
188
177
  * @param {string | XOTemplate} untrustedJsonOrObject - JSON or object containing the untrusted template to import.
189
- * @returns {Promise<{ template: XOTemplate; templateIdentifier: XOTemplateIdentifier }>} The imported template and its identifier.
178
+ * @returns {Promise<void>} Resolves when the template is imported.
190
179
  * @throws {TemplateImportFailedError} If the template is invalid.
191
180
  */
192
181
  importTemplate(untrustedJsonOrObject: string | XOTemplate): Promise<{
193
182
  template: XOTemplate;
194
- templateIdentifier: XOTemplateIdentifier;
183
+ templateIdentifier: string;
195
184
  }>;
196
185
  /**
197
186
  * Lists all the imported templates.
@@ -200,45 +189,43 @@ declare class Engine {
200
189
  listImportedTemplates(): Promise<XOTemplate[]>;
201
190
  /**
202
191
  * Lists the starting actions available in a specified template.
203
- * @param {XOTemplateIdentifier} templateIdentifier - Template identifier.
192
+ * @param {string} templateIdentifier - Template identifier.
204
193
  * @returns {Promise<Array<XOTemplateActionIntent>>} The list of starting actions.
205
194
  */
206
- listStartingActions(templateIdentifier: XOTemplateIdentifier): Promise<Array<XOTemplateActionIntent>>;
195
+ listStartingActions(templateIdentifier: string): Promise<Array<XOTemplateActionIntent>>;
207
196
  /**
208
197
  * Update the unspent outputs for all of a templates lockingBytecodes.
209
198
  *
210
199
  * TODO: Make this an private/internal method.
211
200
  *
212
- * @param {XOTemplateIdentifier} templateIdentifier - Template identifier.
201
+ * @param {string} templateIdentifier - Template identifier.
213
202
  * @returns {Promise<void>} Resolves when the unspent outputs are updated.
214
203
  */
215
- updateUnspentOutputsForTemplate(templateIdentifier: XOTemplateIdentifier): Promise<void>;
204
+ updateUnspentOutputsForTemplate(templateIdentifier: string): Promise<void>;
216
205
  /**
217
206
  * Subscribe to the script hashes for a template.
218
207
  *
219
208
  * TODO: Make this a private/internal method. We may change how/where this is defined in the future.
220
209
  * We'd like to ensure events are propagated to the sync server with an ACK and that the states match between remote and local.
221
210
  *
222
- * @param {XOTemplateIdentifier} templateIdentifier - Template identifier.
211
+ * @param {string} templateIdentifier - Template identifier.
223
212
  * @returns {Promise<void>} Resolves when the script hashes are subscribed.
224
213
  */
225
- subscribeToScriptHashForTemplate(templateIdentifier: XOTemplateIdentifier): Promise<void>;
214
+ subscribeToScriptHashForTemplate(templateIdentifier: string): Promise<void>;
226
215
  /**
227
- * Sets the fallback locking parameters used for change and locking bytecode generation.
216
+ * TENTATIVE METHOD: DEFAULT LOCKING STRATEGY UNKNOWN
228
217
  *
229
- * Resolution order is override, then template defaults, then these fallbacks.
230
- * If generation is required and no fallback exists, {@link FallbackLockingParametersMissingError} is thrown.
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.
231
221
  *
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.
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.
240
227
  */
241
- updateFallbackLockingParameters(fallbackLockingParameters: FallbackLockingParameters): Promise<void>;
228
+ setDefaultLockingParameters(templateIdentifier: string, outputIdentifier: string, roleIdentifier: string): Promise<void>;
242
229
  /**
243
230
  * TODO: Implement this.
244
231
  *
@@ -255,10 +242,10 @@ declare class Engine {
255
242
  * xo template are done using invitations.
256
243
  *
257
244
  * @param {InvitationCreationParameters} params - The parameters for invitation creation.
258
- * @param {XOTemplateIdentifier} params.templateIdentifier - Identifier for the template to use.
259
- * @param {XOTemplateActionIdentifier} params.actionIdentifier - Identifier for the action to initiate.
245
+ * @param {string} params.templateIdentifier - Identifier for the template to use.
246
+ * @param {string} params.actionIdentifier - Identifier for the action to initiate.
260
247
  * @returns {Promise<XOInvitation>} A promise that resolves to the constructed invitation.
261
- * @throws {TemplateNotFoundInStoreError} If the template is not found.
248
+ * @throws {TemplateNotFoundError} If the template is not found.
262
249
  * @throws {TemplateActionNotFoundError} If the action is not found.
263
250
  *
264
251
  * TODO: Add all the throws that happen during the execution of the method.
@@ -270,7 +257,7 @@ declare class Engine {
270
257
  * @param {XOInvitation} invitation - The invitation to be accepted.
271
258
  * @param {AcceptInvitationParameters} params - Optional parameters for accepting the invitation.
272
259
  * @returns {Promise<XOInvitation>} The updated XOInvitation instance.
273
- * @throws {TemplateNotFoundInStoreError} If the template is not found.
260
+ * @throws {TemplateNotFoundError} If the template is not found.
274
261
  * @throws {TemplateActionNotFoundError} If the action is not found.
275
262
  * @throws {InvalidEntityIdentifierError} If the entity identifiers are invalid.
276
263
  * @throws {InvalidRequirementsError} If the requirements are invalid.
@@ -280,29 +267,27 @@ declare class Engine {
280
267
  /**
281
268
  * Appends the invitation with the new information.
282
269
  *
283
- * @param {XOInvitationIdentifier} invitationIdentifier - The identifier of the invitation to append.
284
- * The invitation must already exist in the store.
270
+ * @param {string} invitationIdentifier - The identifier of the invitation to append. The invitation must already exist in the store.
285
271
  * @param {AppendInvitationParameters} params - The parameters to append the invitation with.
286
272
  * @returns {Promise<XOInvitation>} The appended invitation.
287
273
  * @throws {InvitationNotFoundInStoreError} If the invitation is not found in the store.
288
274
  */
289
- appendInvitation(invitationIdentifier: XOInvitationIdentifier, params: AppendInvitationParameters): Promise<XOInvitation>;
275
+ appendInvitation(invitationIdentifier: string, params: AppendInvitationParameters): Promise<XOInvitation>;
290
276
  /**
291
277
  * Signs the provided invitation once all the resources are reserved and the invitation is complete.
292
278
  * This method is used to sign own inputs and provide unlocking data for them, this appends the
293
279
  * invitation and adds new commit with unlocking data.
294
280
  *
295
- * @param {XOInvitationIdentifier} invitationIdentifier - The identifier of the invitation to sign.
296
- * The invitation must already exist in the store.
281
+ * @param {string} invitationIdentifier - The identifier of the invitation to sign. The invitation must already exist in the store.
297
282
  * @returns {Promise<XOInvitation>} Resolves when signing is complete.
298
283
  * @throws {InvitationNotFoundInStoreError} If the invitation is not found in the store.
299
284
  *
300
285
  * TODO: Add all the throws that happen during the execution of the method.
301
286
  */
302
- signInvitation(invitationIdentifier: XOInvitationIdentifier): Promise<XOInvitation>;
287
+ signInvitation(invitationIdentifier: string): Promise<XOInvitation>;
303
288
  /**
304
289
  * Executes an action for a given invitation.
305
- * @param {XOInvitationIdentifier} invitationIdentifier - The identifier of the invitation whose action to execute.
290
+ * @param {string} invitationIdentifier - The identifier of the invitation whose action to execute.
306
291
  * The invitation must already exist in the store.
307
292
  * @param {ExecuteActionParameters} params - Parameters for executing the action.
308
293
  * @returns {Promise<TransactionHash>} Resolves with the transaction hash when the action is executed.
@@ -310,13 +295,13 @@ declare class Engine {
310
295
  *
311
296
  * TODO: Add all the throws that happen during the execution of the method.
312
297
  */
313
- executeAction(invitationIdentifier: XOInvitationIdentifier, params: ExecuteActionParameters): Promise<TransactionHash>;
298
+ executeAction(invitationIdentifier: string, params: ExecuteActionParameters): Promise<TransactionHash>;
314
299
  /**
315
300
  * Lists available roles for the given invitation.
316
301
  *
317
302
  * @param {XOInvitation} invitation - The invitation to examine.
318
- * @returns {Promise<XOTemplateRoleIdentifier[]>} The list of roles that still require data.
319
- * @throws {TemplateNotFoundInStoreError} If the template is not found.
303
+ * @returns {Promise<string[]>} The list of roles that still require data.
304
+ * @throws {TemplateNotFoundError} If the template is not found.
320
305
  * @throws {TemplateActionNotFoundError} If the action is not found.
321
306
  */
322
307
  listAvailableRoles(invitation: XOInvitation): Promise<string[]>;
@@ -324,19 +309,18 @@ declare class Engine {
324
309
  * Lists requirements for the provided invitation.
325
310
  *
326
311
  * @param {XOInvitation} invitation - The invitation to analyze requirements for.
327
- * @returns {Promise<InvitationRequirementIdentifierLists>} The requirements information.
312
+ * @returns {Promise<XOInvitationRequirements>} The requirements information.
328
313
  *
329
314
  */
330
- listRequirements(invitation: XOInvitation): Promise<InvitationRequirementIdentifierLists>;
315
+ listRequirements(invitation: XOInvitation): Promise<XOInvitationRequirements>;
331
316
  /**
332
317
  * Lists missing requirements for the provided invitation.
333
318
  *
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.
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.
337
321
  * @throws {InvitationNotFoundInStoreError} If the invitation is not found in the store.
338
322
  */
339
- listMissingRequirements(invitationIdentifier: XOInvitationIdentifier): Promise<InvitationRequirementIdentifierLists>;
323
+ listMissingRequirements(invitationIdentifier: string): Promise<XOInvitationRequirements>;
340
324
  /**
341
325
  * Lists all the unspent outputs.
342
326
  *
@@ -352,7 +336,6 @@ declare class Engine {
352
336
  * @param {XOInvitation} invitation - The invitation to find resources for.
353
337
  * @param {GetSpendableResourcesParameters} options - Parameters for finding suitable resources.
354
338
  * @returns {Promise<{ unspentOutputs: UnspentOutputData[] }>} The list of suitable resources.
355
- * @throws {FallbackLockingParametersMissingError} If options are omitted and fallback locking parameters are unset.
356
339
  */
357
340
  getSpendableResources(invitation: XOInvitation, options?: GetSpendableResourcesParameters): Promise<{
358
341
  unspentOutputs: UnspentOutputData[];
@@ -360,10 +343,10 @@ declare class Engine {
360
343
  /**
361
344
  * Retrieves a list of script hash data stored for a given template identifier.
362
345
  *
363
- * @param {XOTemplateIdentifier} templateIdentifier - The identifier of the template.
346
+ * @param {string} templateIdentifier - The identifier of the template.
364
347
  * @returns {Promise<ScriptHashData[]>} An array of script hash data objects.
365
348
  */
366
- listScriptHashesForTemplate(templateIdentifier: XOTemplateIdentifier): Promise<ScriptHashData[]>;
349
+ listScriptHashesForTemplate(templateIdentifier: string): Promise<ScriptHashData[]>;
367
350
  /**
368
351
  * Gets all the script hashes from all the templates.
369
352
  *
@@ -398,42 +381,40 @@ declare class Engine {
398
381
  * TODO: If important to make this process faster, consider emitting an event and pushing process to the event loop.
399
382
  * TODO: Encrypt the new information, update the encrypted state servers.
400
383
  *
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).
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).
404
387
  * @returns {Promise<string>} The generated locking bytecode as a hexadecimal string.
405
388
  * @throws {Error} If any required template, output, or configuration is not found, or if compilation fails.
406
389
  */
407
- generateLockingBytecode(templateIdentifier: XOTemplateIdentifier, outputIdentifier: XOTemplateOutputIdentifier, roleIdentifier?: XOTemplateRoleIdentifier): Promise<string>;
390
+ generateLockingBytecode(templateIdentifier: string, outputIdentifier: string, roleIdentifier?: string): Promise<string>;
408
391
  /**
409
- * Generates a locking bytecode using the engine's fallback locking parameters.
392
+ * Generates a locking bytecode using the engine's default template, output, and role identifiers.
410
393
  *
411
- * @returns {Promise<string>} The generated locking bytecode as a hexadecimal string.
412
- * @throws {FallbackLockingParametersMissingError} If fallback locking parameters have not been set.
394
+ * @returns A promise that resolves to the generated locking bytecode as a string.
413
395
  */
414
- generateLockingBytecodeFromFallbackParameters(): Promise<string>;
396
+ generateLockingBytecodeForDefaultParameters(): Promise<string>;
415
397
  /**
416
398
  * Generate locking data and derivative index for P2PKH.
417
399
  */
418
- generateLockingDataForStandardP2PKH(templateIdentifier: XOTemplateIdentifier, roleIdentifier: XOTemplateRoleIdentifier, lockingScriptForOutput: XOTemplateLockingScript): Promise<{
400
+ generateLockingDataForStandardP2PKH(templateIdentifier: string, outputIdentifier: string, roleIdentifier: string, lockingScriptForOutput: XOTemplateLockingScript): Promise<{
419
401
  lockingData: PrivateKeyRecordForLibauthCompiler;
420
- derivativeIndex: number;
421
- secretIdentifiers: string[];
402
+ derivativeIndex: string;
422
403
  }>;
423
404
  /**
424
405
  * Fetches a stored invitation by identifier
425
406
  *
426
- * @param {XOInvitationIdentifier} invitationIdentifier - The identifier to look up.
407
+ * @param {string} invitationIdentifier - The identifier to look up.
427
408
  * @returns {Promise<StoredInvitation | undefined>} The stored invitation, or undefined.
428
409
  */
429
- getInvitationOrThrow(invitationIdentifier: XOInvitationIdentifier): Promise<StoredInvitation>;
410
+ getInvitationOrThrow(invitationIdentifier: string): Promise<StoredInvitation>;
430
411
  /**
431
412
  * Fetches a stored template by identifier
432
413
  *
433
- * @param {XOTemplateIdentifier} templateIdentifier - The identifier to look up.
414
+ * @param {string} templateIdentifier - The identifier to look up.
434
415
  * @returns {Promise<XOTemplate>} The stored template.
435
416
  */
436
- getTemplateOrThrow(templateIdentifier: XOTemplateIdentifier): Promise<XOTemplate>;
417
+ getTemplateOrThrow(templateIdentifier: string): Promise<XOTemplate>;
437
418
  /**
438
419
  * Synchronizes the store of unspent outputs for a given script hash with the current state of the blockchain.
439
420
  *
@@ -445,10 +426,39 @@ declare class Engine {
445
426
  * 5. Adds any new unspent outputs found on the blockchain but missing from the store to the store.
446
427
  * 6. Removes any unspent outputs present in the store but no longer in the blockchain.
447
428
  *
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.
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.
450
431
  */
451
432
  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;
452
462
  }
453
463
  //#endregion
454
464
  //#region source/errors.d.ts
@@ -456,73 +466,79 @@ declare class Engine {
456
466
  * Error thrown when an action is not found in the template.
457
467
  */
458
468
  declare class TemplateActionNotFoundError extends Error {
459
- constructor(actionIdentifier: XOTemplateActionIdentifier);
469
+ constructor(actionIdentifier: string);
460
470
  }
461
471
  /**
462
472
  * Error thrown when an output is not found in the template.
463
473
  */
464
474
  declare class TemplateOutputNotFoundError extends Error {
465
- constructor(outputIdentifier: XOTemplateOutputIdentifier);
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);
466
482
  }
467
483
  /**
468
484
  * Error thrown when a locking script is not found in the template.
469
485
  */
470
486
  declare class TemplateLockingScriptNotFoundError extends Error {
471
- constructor(lockingScriptIdentifier: XOTemplateLockingScriptIdentifier);
487
+ constructor(lockingScriptIdentifier: string);
472
488
  }
473
489
  /**
474
490
  * Error thrown when a locking script type is not found in the template.
475
491
  */
476
492
  declare class TemplateLockingScriptTypeNotFoundError extends Error {
477
- constructor(lockingScriptIdentifier: XOTemplateLockingScriptIdentifier);
493
+ constructor(lockingScriptIdentifier: string);
478
494
  }
479
495
  /**
480
496
  * Error thrown when an unlocking script is not found in the template.
481
497
  */
482
498
  declare class UnlockingScriptNotFoundError extends Error {
483
- constructor(unlockingScriptIdentifier?: XOTemplateScriptIdentifier);
499
+ constructor(unlockingScriptIdentifier?: string);
484
500
  }
485
501
  /**
486
- * Error thrown when a transaction is not found in the template.
502
+ * Error thrown when a script is not found in the template.
487
503
  */
488
- declare class TemplateTransactionNotFoundError extends Error {
489
- constructor(transactionIdentifier: XOTemplateTransactionIdentifier);
504
+ declare class ScriptNotFoundError extends Error {
505
+ constructor(scriptIdentifier?: string);
490
506
  }
491
507
  /**
492
- * Error thrown when a role is not found on a locking script.
508
+ * Error thrown when a starting action is not found in the template.
493
509
  */
494
- declare class TemplateLockingScriptRoleNotFoundError extends Error {
495
- constructor(lockingScriptIdentifier: XOTemplateLockingScriptIdentifier, roleIdentifier: XOTemplateRoleIdentifier);
510
+ declare class StartingActionNotFoundError extends Error {
511
+ constructor(templateIdentifier?: string);
496
512
  }
497
513
  /**
498
- * Error thrown when an output does not have a locking script.
514
+ * Error thrown when a transaction is not found in the template.
499
515
  */
500
- declare class TemplateLockingScriptInOutputNotFoundError extends Error {
501
- constructor(outputIdentifier: XOTemplateOutputIdentifier);
516
+ declare class TemplateTransactionNotFoundError extends Error {
517
+ constructor(transactionIdentifier: string);
502
518
  }
503
519
  /**
504
520
  * Error thrown when a commit entity identifier is not found.
505
521
  */
506
522
  declare class CommitEntityIdentifierNotFoundError extends Error {
507
- constructor(commitIdentifier?: XOInvitationCommitIdentifier);
523
+ constructor(commitIdentifier?: string);
508
524
  }
509
525
  /**
510
526
  * Error thrown when a commit is not signed.
511
527
  */
512
528
  declare class CommitNotSignedError extends Error {
513
- constructor(commitIdentifier?: XOInvitationCommitIdentifier);
529
+ constructor(commitIdentifier?: string);
514
530
  }
515
531
  /**
516
532
  * Error thrown when a commit is not found in the invitation.
517
533
  */
518
534
  declare class CommitNotFoundInInvitationError extends Error {
519
- constructor(commitIdentifier?: XOInvitationCommitIdentifier);
535
+ constructor(commitIdentifier?: string);
520
536
  }
521
537
  /**
522
538
  * Error thrown when one or more entity identifiers are invalid.
523
539
  */
524
540
  declare class InvalidEntityIdentifierError extends Error {
525
- constructor(entityIdentifiers?: XOInvitationEntityIdentifier[]);
541
+ constructor(entityIdentifiers?: string[]);
526
542
  }
527
543
  /**
528
544
  * Error thrown when one or more provided requirements were not expected by the template.
@@ -534,13 +550,43 @@ declare class InvalidRequirementsError extends Error {
534
550
  * Error thrown when one or more commit signatures are invalid.
535
551
  */
536
552
  declare class InvalidCommitSignaturesError extends Error {
537
- constructor(commitIdentifiers?: XOInvitationCommitIdentifier[]);
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);
538
572
  }
539
573
  /**
540
574
  * Error thrown when an invitation has expired.
541
575
  */
542
576
  declare class InvitationExpiredError extends Error {
543
- constructor(invitationIdentifier?: XOInvitationIdentifier);
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);
544
590
  }
545
591
  /**
546
592
  * Error thrown when a merged commit is not found.
@@ -554,23 +600,17 @@ declare class MergedCommitNotFoundError extends Error {
554
600
  declare class ScriptHashDataNotFoundError extends Error {
555
601
  constructor(scriptHash?: string);
556
602
  }
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
- }
563
603
  /**
564
604
  * Error thrown when the root commit for an entity cannot be found in the invitation.
565
605
  */
566
- declare class RootCommitNotFoundInInvitationError extends Error {
567
- constructor(invitationIdentifier?: XOInvitationIdentifier);
606
+ declare class RootCommitNotFoundError extends Error {
607
+ constructor(entityIdentifier?: string);
568
608
  }
569
609
  /**
570
610
  * Error thrown when a parent commit is not found.
571
611
  */
572
- declare class ParentCommitNotFoundInInvitationError extends Error {
573
- constructor(parentCommitIdentifier: XOInvitationCommitIdentifier, commitIdentifier: XOInvitationCommitIdentifier);
612
+ declare class ParentCommitNotFoundError extends Error {
613
+ constructor(parentCommitIdentifier: string, commitIdentifier: string);
574
614
  }
575
615
  /**
576
616
  * Error thrown when duplicate transactionIndex values are found.
@@ -582,25 +622,25 @@ declare class DuplicateTransactionIndexError extends Error {
582
622
  * Error thrown when a circular merge reference is detected.
583
623
  */
584
624
  declare class CircularMergeReferenceError extends Error {
585
- constructor(itemType: 'input' | 'output', mergeKey: string, commitIdentifier: XOInvitationCommitIdentifier);
625
+ constructor(itemType: 'input' | 'output', mergeKey: string, commitIdentifier: string);
586
626
  }
587
627
  /**
588
628
  * Error thrown when a mergesWith commit is not found.
589
629
  */
590
630
  declare class MergesWithCommitNotFoundError extends Error {
591
- constructor(mergesWithCommitIdentifier: XOInvitationCommitIdentifier, currentCommitIdentifier: XOInvitationCommitIdentifier);
631
+ constructor(mergesWithCommitIdentifier: string, currentCommitIdentifier: string);
592
632
  }
593
633
  /**
594
634
  * Error thrown when an item at a specific index is not found in a commit.
595
635
  */
596
636
  declare class ItemNotFoundInCommitError extends Error {
597
- constructor(itemType: 'input' | 'output', index: number, commitIdentifier: XOInvitationCommitIdentifier);
637
+ constructor(itemType: 'input' | 'output', index: number, commitIdentifier: string);
598
638
  }
599
639
  /**
600
640
  * Error thrown when locking bytecode is not found for an output.
601
641
  */
602
642
  declare class LockingBytecodeNotFoundForOutputError extends Error {
603
- constructor(outputIdentifier: XOTemplateOutputIdentifier, transactionIndex?: number);
643
+ constructor(outputIdentifier: string, transactionIndex?: number);
604
644
  }
605
645
  /**
606
646
  * Error thrown when transaction version is defined multiple times in commits.
@@ -618,7 +658,115 @@ declare class DuplicateTransactionLocktimeError extends Error {
618
658
  * Error thrown when the provided template's identifier does not match the invitation's template identifier.
619
659
  */
620
660
  declare class InvitationTemplateMismatchError extends Error {
621
- constructor(expectedTemplateIdentifier: XOTemplateIdentifier, receivedTemplateIdentifier: XOTemplateIdentifier);
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);
622
770
  }
623
771
  /**
624
772
  * Error thrown when locking bytecode generation fails.
@@ -638,46 +786,106 @@ declare class LockingDataNotFoundError extends Error {
638
786
  declare class TransactionGenerationFailedError extends Error {
639
787
  constructor();
640
788
  }
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
+ }
641
807
  /**
642
808
  * Error thrown when input is invalid.
643
809
  */
644
810
  declare class InvalidInputError extends Error {
645
811
  constructor();
646
812
  }
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
+ }
647
849
  /**
648
850
  * Error thrown when a variable definition is invalid.
649
851
  */
650
852
  declare class InvalidVariableDefinitionError extends Error {
651
- constructor(variableIdentifier: XOTemplateVariableIdentifier);
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);
652
860
  }
653
861
  /**
654
862
  * Error thrown when a locking script has an invalid type.
655
863
  */
656
864
  declare class InvalidLockingScriptTypeError extends Error {
657
- constructor(outputIdentifier: XOTemplateOutputIdentifier, expectedType: string, actualType: string);
865
+ constructor(outputIdentifier: string, expectedType: string, actualType: string);
658
866
  }
659
867
  /**
660
868
  * Error thrown when a locking type is invalid.
661
869
  */
662
870
  declare class InvalidLockingTypeError extends Error {
663
- constructor(outputIdentifier: XOTemplateOutputIdentifier, validTypes: string[], actualType: string | undefined);
871
+ constructor(outputIdentifier: string, validTypes: string[], actualType: string | undefined);
664
872
  }
665
873
  /**
666
- * Error thrown when an electrum client is not found.
874
+ * Error thrown when a derivative index has an invalid type.
667
875
  */
668
- declare class ElectrumClientNotFoundError extends Error {
669
- constructor();
876
+ declare class InvalidDerivativeIndexTypeError extends Error {
877
+ constructor(expectedType: string, actualType: string);
670
878
  }
671
879
  /**
672
- * Error thrown when fallback locking parameters are missing for locking bytecode generation.
880
+ * Error thrown when a template output valueSatoshis has an invalid type for CashAssembly expression.
673
881
  */
674
- declare class FallbackLockingParametersMissingError extends Error {
675
- constructor();
882
+ declare class InvalidTemplateOutputSatoshisTypeError extends Error {
883
+ constructor(actualType: string);
676
884
  }
677
885
  /**
678
- * Error thrown when a derivative index is required for a p2pkh locking type.
886
+ * Error thrown when an electrum client is not found.
679
887
  */
680
- declare class P2PKHDerivativeIndexMissingError extends Error {
888
+ declare class ElectrumClientNotFoundError extends Error {
681
889
  constructor();
682
890
  }
683
891
  //#endregion
@@ -686,7 +894,14 @@ declare class P2PKHDerivativeIndexMissingError extends Error {
686
894
  * BlockchainMonitor class that provides blockchain monitoring operations.
687
895
  */
688
896
  declare class BlockchainMonitor {
689
- #private;
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;
690
905
  /**
691
906
  * Creates a new instance of BlockchainMonitor.
692
907
  *
@@ -730,44 +945,50 @@ declare class BlockchainMonitor {
730
945
  * Builder for the XOInvitation
731
946
  */
732
947
  declare class InvitationBuilder {
733
- #private;
734
948
  /**
735
949
  * The identifier of the current invitation.
736
950
  *
737
951
  * TODO: Add validations and type checks to the identifier e.g length.
738
952
  */
739
- invitationIdentifier: XOInvitationIdentifier;
953
+ invitationIdentifier: string;
740
954
  /**
741
955
  * The identifier of the template for the invitation.
742
956
  *
743
957
  * TODO: Add validations and type checks to the identifier e.g it should be a 32 byte hex string, etc.
744
958
  */
745
- templateIdentifier: XOTemplateIdentifier;
959
+ templateIdentifier: string;
746
960
  /**
747
961
  * The identifier of the action for the invitation.
748
962
  */
749
- actionIdentifier: XOTemplateActionIdentifier;
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;
750
973
  /**
751
974
  * Create a new InvitationBuilder.
752
- * @param {InvitationCreationParameters} invitation - Context for invitation creation.
975
+ * @param invitation Context for invitation creation.
753
976
  */
754
977
  constructor(invitation: InvitationCreationParameters);
755
978
  /**
756
979
  * Create a builder from an existing invitation.
757
- * @param {XOInvitation} invitation - An existing invitation.
758
- * @returns {InvitationBuilder} A builder initialized from the invitation.
980
+ * @param invitation An existing XOInvitation.
759
981
  */
760
982
  static fromInvitation(invitation: XOInvitation): InvitationBuilder;
761
983
  /**
762
- * Build the invitation object to be shared.
763
- * @returns {XOInvitation} The built invitation.
984
+ * Build the XOInvitation object to be shared.
985
+ * @returns The built XOInvitation.
764
986
  */
765
987
  build(): XOInvitation;
766
988
  /**
767
- * Fully validates a given invitation.
989
+ * Fully validates a given XOInvitation.
768
990
  *
769
- * @param {XOTemplate} template - The template to validate against.
770
- * @returns {this} The builder instance after validation.
991
+ * @param template - The template to validate against.
771
992
  * @throws {InvitationExpiredError} If the invitation has expired.
772
993
  * @throws {InvalidEntityIdentifierError} If the entity identifiers are invalid.
773
994
  * @throws {InvalidRequirementsError} If the requirements are invalid.
@@ -776,35 +997,32 @@ declare class InvitationBuilder {
776
997
  validate(template: XOTemplate): this;
777
998
  /**
778
999
  * Add a commit to the invitation.
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.
1000
+ * @param commit The commit to add.
1001
+ * @returns The builder instance.
783
1002
  */
784
1003
  addCommit(commit: XOInvitationCommit): this;
785
1004
  /**
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.
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.
788
1007
  */
789
- getLastCommitIdentifier(): XOInvitationCommitIdentifier | undefined;
1008
+ getLastCommitIdentifier(): string | undefined;
790
1009
  /**
791
- * Returns the last commit in the invitation.
792
- * @returns {XOInvitationCommit | undefined} The last commit, or undefined if there are no commits.
1010
+ * Returns the last InvitationCommit in the invitation.
1011
+ * @returns The last InvitationCommit object, or undefined if there are no commits.
793
1012
  */
794
1013
  getLastCommit(): XOInvitationCommit | undefined;
795
1014
  /**
796
1015
  * Creates an unsigned commit without adding it to the invitation.
797
1016
  * This allows for atomic commit creation with signature.
798
1017
  *
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.
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)
808
1026
  */
809
1027
  createUnsignedCommit(params: {
810
1028
  inputs?: XOInvitationInput[];
@@ -814,24 +1032,34 @@ declare class InvitationBuilder {
814
1032
  transactionLocktime?: number;
815
1033
  expiresAtTimestamp?: number;
816
1034
  }): 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;
817
1045
  }
818
1046
  //#endregion
819
1047
  //#region source/invitation/commit.d.ts
820
1048
  /**
821
- * Generates a random commit identifier.
1049
+ * Generates a random 16-byte commit identifier.
822
1050
  *
823
- * @returns {XOInvitationCommitIdentifier} The generated commit identifier as a hex string.
1051
+ * @returns {string} The generated commit identifier as a hex string.
824
1052
  */
825
- declare const generateCommitIdentifier: () => XOInvitationCommitIdentifier;
1053
+ declare const generateCommitIdentifier: () => string;
826
1054
  /**
827
1055
  * Finds the root commit identifier for a given entity in an invitation. The root commit is
828
1056
  * the first commit the entity added to the invitation.
829
1057
  *
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.
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.
833
1061
  */
834
- declare const findRootCommitIdentifierInInvitation: (invitation: XOInvitation, entityIdentifier: XOInvitationEntityIdentifier) => XOInvitationCommitIdentifier | undefined;
1062
+ declare const findRootCommitIdentifierInInvitation: (invitation: XOInvitation, entityIdentifier: string) => string | undefined;
835
1063
  //#endregion
836
1064
  //#region source/invitation/merger.d.ts
837
1065
  /**
@@ -848,16 +1076,16 @@ type MergedInvitation = {
848
1076
  * Converts an array of XOInvitationVariable objects into an object,
849
1077
  * where each key is the variable's identifier and the value is the variable's value.
850
1078
  *
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.
1079
+ * @param variables - Array of XOInvitationVariable objects to convert.
1080
+ * @returns An object mapping each variable identifier to its corresponding value.
853
1081
  */
854
1082
  declare const convertCommitVariablesIntoObject: (variables: XOInvitationVariable[]) => Record<string, XOInvitationVariableValue>;
855
1083
  /**
856
1084
  * Merges invitation commits and transforms it into MergedInvitation structure.
857
1085
  *
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.
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.
861
1089
  * @throws {Error} If merge conflicts or missing references are detected.
862
1090
  */
863
1091
  declare const mergeInvitationCommits: (invitation: XOInvitation, template: XOTemplate) => MergedInvitation | null;
@@ -868,22 +1096,22 @@ declare const mergeInvitationCommits: (invitation: XOInvitation, template: XOTem
868
1096
  * Analyzes the template action to determine what variables, inputs, outputs, and role-specific
869
1097
  * requirements are needed to fulfill the action.
870
1098
  *
871
- * @param {XOTemplate} template - The template.
872
- * @param {XOTemplateAction} action - The action that has requirements.
873
- * @returns {InvitationRequirementIdentifierLists} An object containing all the requirements.
1099
+ * @param template - The template.
1100
+ * @param action - The action that has requirements.
1101
+ * @returns {XOInvitationRequirements} An object containing all the requirements.
874
1102
  */
875
- declare const listRequirementsFromTemplate: (template: XOTemplate, action: XOTemplateAction) => InvitationRequirementIdentifierLists;
1103
+ declare const listRequirementsFromTemplate: (template: XOTemplate, action: XOTemplateAction) => XOInvitationRequirements;
876
1104
  /**
877
1105
  * Lists all requirements that have been populated in the invitation by examining all commits.
878
1106
  * Extracts variable, input, and output identifiers from all commits in the invitation and
879
1107
  * organizes them into top-level and role-specific requirements.
880
1108
  *
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,
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,
883
1111
  * including top-level requirements and role-specific requirements. Only includes roles
884
1112
  * that have at least one requirement populated.
885
1113
  */
886
- declare const listPopulatedRequirementsInInvitation: (invitation: XOInvitation) => InvitationRequirementIdentifierLists;
1114
+ declare const listPopulatedRequirementsInInvitation: (invitation: XOInvitation) => XOInvitationRequirements;
887
1115
  /**
888
1116
  * Lists all missing requirements for the invitation that have not yet been supplied.
889
1117
  * Compares the requirements expected from the template with what has been populated in the invitation
@@ -891,56 +1119,57 @@ declare const listPopulatedRequirementsInInvitation: (invitation: XOInvitation)
891
1119
  *
892
1120
  * Logic: `missing_requirements = requirements_from_template - populated_requirements_in_invitation`
893
1121
  *
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
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
898
1126
  * and role-specific missing requirements. Only includes roles that have at least one missing requirement.
899
1127
  */
900
- declare const listMissingRequirements: (invitation: XOInvitation, template: XOTemplate, action: XOTemplateAction) => InvitationRequirementIdentifierLists;
1128
+ declare const listMissingRequirements: (invitation: XOInvitation, template: XOTemplate, action: XOTemplateAction) => XOInvitationRequirements;
901
1129
  /**
902
1130
  * Lists role identifiers for roles that still have capacity for additional participants.
903
1131
  * A role is considered available if the number of distinct entities that have filled it
904
1132
  * is less than the role's maximum slot count. If max is undefined, the role has unlimited capacity.
905
1133
  *
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.
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.
909
1138
  * Returns an empty array if no roles are defined in the action.
910
1139
  */
911
- declare const listAvailableRolesForInvitation: (invitation: XOInvitation, action: XOTemplateAction) => XOTemplateRoleIdentifier[];
1140
+ declare const listAvailableRolesForInvitation: (invitation: XOInvitation, action: XOTemplateAction) => string[];
912
1141
  //#endregion
913
1142
  //#region source/invitation/validation.d.ts
914
1143
  /**
915
1144
  * Validates that the invitation has not expired for any of the commits.
916
1145
  *
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.
1146
+ * @param invitation - The XOInvitation object containing creation and expiration timestamps.
1147
+ * @returns True if the invitation is expired, false if it is valid.
919
1148
  */
920
1149
  declare const hasInvitationExpired: (invitation: XOInvitation) => boolean;
921
1150
  /**
922
- * Validates that all entity identifiers in the invitation are valid extended public keys.
1151
+ * Validates that all entity identifiers in the invitation are valid public keys.
923
1152
  * Extracts unique entity identifiers from all commits.
924
1153
  *
925
- * @param {XOInvitation} invitation - The invitation to validate.
926
- * @returns {boolean} True if all entities are valid, false otherwise.
1154
+ * @param invitation - The invitation to validate.
1155
+ * @returns True if all entities are valid, false otherwise.
927
1156
  */
928
1157
  declare const validateInvitationEntities: (invitation: XOInvitation) => boolean;
929
1158
  /**
930
1159
  * Validates that all provided requirements in the invitation were expected by the template.
931
1160
  *
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.
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.
936
1165
  */
937
1166
  declare const validateRoleRequirements: (invitation: XOInvitation, template: XOTemplate, action: XOTemplateAction) => boolean;
938
1167
  /**
939
1168
  * Validates commit signatures.
940
1169
  * Signature signs: stringify(data) + templateIdentifier + actionIdentifier + invitationIdentifier + commitIdentifier + previousCommitIdentifier
941
1170
  *
942
- * @param {XOInvitation} invitation - The invitation containing commits to validate.
943
- * @returns {boolean} True if all commit signatures are valid, false otherwise.
1171
+ * @param invitation - The invitation containing commits to validate.
1172
+ * @returns True if all commit signatures are valid, false otherwise.
944
1173
  */
945
1174
  declare const validateInvitationCommits: (invitation: XOInvitation) => boolean;
946
1175
  //#endregion
@@ -949,7 +1178,10 @@ declare const validateInvitationCommits: (invitation: XOInvitation) => boolean;
949
1178
  * Template class for accessing template data.
950
1179
  */
951
1180
  declare class Template {
952
- #private;
1181
+ /**
1182
+ * The template object.
1183
+ */
1184
+ private readonly template;
953
1185
  /**
954
1186
  * Creates a Template class from a template object.
955
1187
  */
@@ -965,127 +1197,201 @@ declare class Template {
965
1197
  getStartingActions(): Array<XOTemplateActionIntent>;
966
1198
  /**
967
1199
  * 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.
970
1200
  * @throws {TemplateOutputNotFoundError} If the output is not found.
971
1201
  */
972
- getOutputOrThrow(outputIdentifier: XOTemplateOutputIdentifier): XOTemplateOutput;
1202
+ getOutputOrThrow(outputIdentifier: string): XOTemplateOutput;
973
1203
  /**
974
1204
  * 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.
977
1205
  * @throws {TemplateOutputNotFoundError} If the output is not found.
978
1206
  * @throws {TemplateLockingScriptInOutputNotFoundError} If the output has no locking script reference.
979
1207
  */
980
- getLockingScriptIdentifierOrThrow(outputIdentifier: XOTemplateOutputIdentifier): XOTemplateLockingScriptIdentifier;
1208
+ getLockingScriptIdentifierOrThrow(outputIdentifier: string): string;
981
1209
  /**
982
1210
  * 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.
985
1211
  * @throws {TemplateLockingScriptNotFoundError} If the locking script is not found.
986
1212
  */
987
- getLockingScriptOrThrow(lockingScriptIdentifier: XOTemplateLockingScriptIdentifier): XOTemplateLockingScript;
1213
+ getLockingScriptOrThrow(lockingScriptIdentifier: string): XOTemplateLockingScript;
988
1214
  /**
989
1215
  * 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.
992
1216
  * @throws {TemplateOutputNotFoundError} If the output is not found.
993
1217
  * @throws {TemplateLockingScriptInOutputNotFoundError} If the output has no locking script reference.
994
1218
  * @throws {TemplateLockingScriptNotFoundError} If the locking script definition is not found.
995
1219
  */
996
- getLockingScriptForOutputOrThrow(outputIdentifier: XOTemplateOutputIdentifier): XOTemplateLockingScript;
1220
+ getLockingScriptForOutputOrThrow(outputIdentifier: string): XOTemplateLockingScript;
997
1221
  /**
998
1222
  * Retrieves a role within a locking script.
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.
1223
+ * @param lockingScriptIdentifier - The locking script identifier.
1224
+ * @param roleIdentifier - The role identifier.
1002
1225
  * @throws {TemplateLockingScriptNotFoundError} If the locking script is not found.
1003
1226
  * @throws {TemplateLockingScriptRoleNotFoundError} If the role is not found.
1004
1227
  */
1005
- getRoleOrThrow(lockingScriptIdentifier: XOTemplateLockingScriptIdentifier, roleIdentifier: XOTemplateRoleIdentifier): XOTemplateLockingScriptRole;
1228
+ getRoleOrThrow(lockingScriptIdentifier: string, roleIdentifier: string): XOTemplateLockingScriptRole;
1006
1229
  /**
1007
1230
  * Retrieves the first available role in a locking script, or throws if none exist.
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.
1231
+ * @param lockingScriptIdentifier - The locking script identifier.
1232
+ * @returns A tuple of [roleIdentifier, role].
1011
1233
  * @throws {TemplateLockingScriptNotFoundError} If the locking script is not found.
1012
1234
  * @throws {TemplateLockingScriptRoleNotFoundError} If no roles exist.
1013
1235
  */
1014
- getFirstRoleOrThrow(lockingScriptIdentifier: XOTemplateLockingScriptIdentifier): [XOTemplateRoleIdentifier, XOTemplateLockingScriptRole];
1236
+ getFirstRoleOrThrow(lockingScriptIdentifier: string): [string, XOTemplateLockingScriptRole];
1015
1237
  /**
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.
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.
1022
1244
  * @throws {TemplateLockingScriptNotFoundError} If the locking script is not found.
1023
1245
  * @throws {TemplateLockingScriptRoleNotFoundError} If roleIdentifier is provided but the role is not found.
1024
1246
  */
1025
- getSecrets(lockingScriptIdentifier: XOTemplateLockingScriptIdentifier, roleIdentifier?: XOTemplateRoleIdentifier): string[];
1247
+ getSecrets(lockingScriptIdentifier: string, roleIdentifier?: string): string[];
1026
1248
  /**
1027
1249
  * Retrieves an action definition by identifier.
1028
- * @param {XOTemplateActionIdentifier} actionIdentifier - The identifier of the action.
1029
- * @returns {XOTemplateAction} The action definition associated with the specified action identifier.
1250
+ * @param actionIdentifier - The identifier of the action.
1030
1251
  * @throws {TemplateActionNotFoundError} If the action is not found.
1031
1252
  */
1032
- getActionOrThrow(actionIdentifier: XOTemplateActionIdentifier): XOTemplateAction;
1253
+ getActionOrThrow(actionIdentifier: string): XOTemplateAction;
1033
1254
  /**
1034
1255
  * Retrieves a transaction definition by identifier.
1035
- * @param {XOTemplateTransactionIdentifier} transactionIdentifier - The identifier of the transaction.
1036
- * @returns {XOTemplateTransaction} The transaction definition associated with the specified transaction identifier.
1256
+ * @param transactionIdentifier - The identifier of the transaction.
1037
1257
  * @throws {TemplateTransactionNotFoundError} If the transaction is not found.
1038
1258
  */
1039
- getTransactionOrThrow(transactionIdentifier: XOTemplateTransactionIdentifier): XOTemplateTransaction;
1259
+ getTransactionOrThrow(transactionIdentifier: string): XOTemplateTransaction;
1040
1260
  /**
1041
1261
  * Retrieves the transaction for a given action.
1042
- * @param {XOTemplateActionIdentifier} actionIdentifier - The identifier of the action.
1043
- * @returns {XOTemplateTransaction} The transaction definition associated with the specified action.
1262
+ * @param actionIdentifier - The identifier of the action.
1044
1263
  * @throws {TemplateActionNotFoundError} If the action is not found.
1045
1264
  * @throws {TemplateTransactionNotFoundError} If the action has no transaction defined or the transaction is not found.
1046
1265
  */
1047
- getTransactionForActionOrThrow(actionIdentifier: XOTemplateActionIdentifier): XOTemplateTransaction;
1266
+ getTransactionForActionOrThrow(actionIdentifier: string): XOTemplateTransaction;
1048
1267
  }
1049
1268
  //#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
1050
1335
  //#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;
1051
1353
  /**
1052
1354
  * Creates a map of variable identifiers to role identifiers for the libauth compiler configuration.
1053
1355
  *
1054
- * @param {XOTemplate} template - The template used to gather the variable identifiers.
1055
- * @param {XOTemplateRoleIdentifier} role - The role identifier to assign to the variables.
1356
+ * @param template - The template used to gather the variable identifiers.
1357
+ * @param role - The role identifier to assign to the variables.
1056
1358
  * @returns {Record<string, string>} A map of variable identifiers to role identifiers.
1057
1359
  */
1058
- declare const entityOwnershipForLibauthCompiler: (template: XOTemplate, role: XOTemplateRoleIdentifier) => Record<string, string>;
1360
+ declare const entityOwnershipForLibauthCompiler: (template: XOTemplate, role: string) => Record<string, string>;
1059
1361
  /**
1060
1362
  * Creates a map of script identifiers to script definitions for the libauth compiler configuration.
1061
1363
  *
1062
- * @param {XOTemplate} template - The template used to gather the scripts.
1364
+ * @param template - The template used to gather the scripts.
1063
1365
  * @returns {CompilerConfiguration['scripts']} A map of script identifiers to script definitions.
1064
1366
  */
1065
1367
  declare const scriptsForLibauthCompiler: (template: XOTemplate) => CompilerConfiguration["scripts"];
1066
1368
  /**
1067
1369
  * Converts template variables into libauth variables with types.
1068
1370
  *
1069
- * @param {XOTemplate} template - The template to assign types to the variables.
1070
- * @returns {CompilerConfiguration['variables']} Variables mapped for the libauth compiler.
1371
+ * @param template - The template to assign types to the variables.
1372
+ * @returns CompilerConfiguration['variables']
1071
1373
  */
1072
1374
  declare const assignTypeToVariablesForLibauthCompiler: (template: XOTemplate) => CompilerConfiguration["variables"];
1073
1375
  /**
1074
1376
  * Converts an XO template locking type to the corresponding libauth compiler locking script type.
1075
1377
  *
1076
- * @param {XOTemplateLockingType} lockingType - The XO template locking type to convert.
1077
- * @returns {NonNullable<CompilerConfiguration['lockingScriptTypes']>[string]} The corresponding libauth compiler locking script type.
1378
+ * @param lockingType - The XO template locking type to convert.
1379
+ * @returns The corresponding libauth compiler locking script type string.
1078
1380
  */
1079
1381
  declare const convertXOLockingTypeToLibauth: (lockingType: XOTemplateLockingType) => "p2sh20" | "p2sh32" | "standard";
1080
1382
  /**
1081
1383
  * Creates the libauth compatible compiler data for a unspent output.
1082
1384
  *
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
+ * @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<{
1089
1395
  compiler: CompilerBch;
1090
1396
  script: string;
1091
1397
  valueSatoshis: bigint;
@@ -1102,13 +1408,12 @@ declare const createLibauthCompilerDataFromUnspentOutput: (template: Template, u
1102
1408
  * 4. Adds any new unspent outputs found on the blockchain but missing from the state to the state.
1103
1409
  * 5. Removes any unspent outputs present in the state but no longer in the blockchain.
1104
1410
  *
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.
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.
1110
1415
  */
1111
1416
  declare const updateUnspentOutputsForScriptHashInStore: (state: State, scriptHash: string, fetchUnspentOutputsCallback: (scriptHash: string) => Promise<ScriptHashListUnspentResponse>) => Promise<void>;
1112
1417
  //#endregion
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 };
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 };
1114
1419
  //# sourceMappingURL=index.d.mts.map