Documentation / @xo-cash/engine
@xo-cash/engine
XO Engine
⚠️ This project is in early development phase. Use it only if you understand what you are doing and accept the risks. Do not use funds you are not willing to lose. Minor version bumps may introduce breaking changes
Installation
npm install @xo-cash/engineBasic Setup
import { Engine, XO_SUPPORTED_NETWORKS } from '@xo-cash/engine';
import { StorageType } from '@xo-cash/state';
import { p2pkhTemplate } from '@xo-cash/templates';
// Create the engine for one account. It connects to the Electrum servers of the network itself.
const engine = await Engine.create('your BIP39 mnemonic', {
network: XO_SUPPORTED_NETWORKS.chipnet,
storageType: StorageType.SQLITE,
databasePath: './',
databaseFilename: 'XO',
});
// Import a template. The result carries the template and its identifier.
const { templateIdentifier } = await engine.importTemplate(p2pkhTemplate);
// Read the actions the template can start with.
const startingActions = (await engine.getTemplate(templateIdentifier))?.start ?? [];
// Create an invitation for one of those actions.
const storedInvitation = await engine.createInvitation({
templateIdentifier,
actionIdentifier: 'requestSatoshis',
intent: startingActions.find((startingAction) => startingAction.action === 'requestSatoshis'),
});
// Stop the engine to close its Electrum connections and storage, and destroy its keys.
await engine.stop();See playground/examples/receive-satoshis.js for a full flow that funds, signs, and executes an invitation.
Links
License
MIT
Engine
Defined in: source/engine.ts:80
Public interface of the XO engine. It holds the state, keys, network, and blockchain monitor of one account.
Accessors
network
Get Signature
get network(): XONetwork;Defined in: source/engine.ts:127
Network this engine instance targets.
Returns
- Network this engine instance targets.
Methods
acceptInvitation()
acceptInvitation(invitation, params?): Promise<StoredInvitation>;Defined in: source/engine.ts:538
Accepts an invitation, an entity accepts an invitation and becomes part of the invitation.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | The invitation to be accepted. |
params? | InvitationAcceptanceParameters | Optional parameters for accepting the invitation, including the role or intent this account acts on. |
Returns
Promise<StoredInvitation>
- The accepted invitation as stored, including this account's entity identifier.
Throws
InvitationInvalidError - If the invitation does not match the XOInvitation type.
Throws
TemplateNotFoundInStoreError - If the template is not found.
Throws
TemplateActionNotFoundError - If the action is not found.
Throws
InvitationIntentMismatchError - If the intent names another template or another action than the invitation.
Throws
InvitationRoleDuplicatedError - If the role is given both directly and on the intent.
Throws
TemplateActionRoleNotFoundError - If the action does not define the role.
Throws
TemplateGeneratedVariableTypeUnsupportedError - If a variable to generate is not a private key.
Throws
InvitationValidationFailedError - If invitation validation fails once implemented.
Throws
InvitationItemFieldConflictError - If a received commit changes a value an earlier commit set.
Throws
RoleVariableEntityMismatchError - If a commit provides a variable of a role its entity does not hold.
Throws
EntityMultipleRolesWithFollowUpUnsupportedError - If a commit gives an entity more than one role with a follow up.
Throws
SecretDataNotFoundError - If a script hash of this account lists a secret that is not stored.
addChangeToInvitation()
addChangeToInvitation(
invitationIdentifier,
providedLockingBytecode?,
changeVariableValues?,
changeSelection?): Promise<StoredInvitation>;Defined in: source/engine.ts:937
Adds the change to the invitation.
Leftover fungible tokens return on one change output per category. The satoshis left after those outputs and the fee return on a satoshi change output, or on the first token change output when they are below the dust limit. A change selection adds only the satoshi change and the token categories it names, and keeps the satoshis the other token categories need for their change outputs out of the satoshi change.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | string | The identifier of the invitation to add the change to. |
providedLockingBytecode? | string | Locking bytecode to send the change to, as hex. |
changeVariableValues? | Record<string, XOInvitationVariableValue> | Values the change intent requires. |
changeSelection? | ChangeSelection | Satoshi change and token categories to add. Every leftover is added when omitted. |
Returns
Promise<StoredInvitation>
- The invitation as stored after the change output is appended.
Throws
InvitationNotFoundInStoreError - When the invitation is not stored.
Throws
TemplateNotFoundInStoreError - When the template is not stored.
Throws
ChangeLockingBytecodeMissingError - When no locking bytecode is provided, the template defines no change policy, and the wallet has no default change policy.
Throws
TemplateDefaultPolicyMissingError - When the template of the wallet default change policy does not define change.
Throws
TemplateOutputNotFoundError - When the change intent names an output its target template does not define.
Throws
IntentVariablesMissingError - When a variable the change intent requires has no value.
Throws
ChangeSatoshisInsufficientError - When the leftover satoshis cannot pay for the token change outputs and the fee.
Throws
ChangeSelectionEmptyError - When the selection names neither the satoshi change nor any token category.
Throws
ChangeTokenCategoriesUnavailableError - When the selection names token categories without leftover fungible tokens.
Throws
ChangeSatoshisBelowDustError - When only the satoshi change is added and it is below the dust limit.
appendInvitation()
appendInvitation(invitationIdentifier, params): Promise<StoredInvitation>;Defined in: source/engine.ts:609
Appends the invitation with the new information.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | string | The identifier of the invitation to append. The invitation must already exist in the store. |
params | InvitationParameters | The parameters to append the invitation with. |
Returns
Promise<StoredInvitation>
- The appended invitation as stored, including the local entity identifier.
Throws
InvitationNotFoundInStoreError - If the invitation is not found in the store.
Throws
AppendInvitationParametersEmptyError - When every appendable field is omitted.
Throws
UnspentOutputReservationExternalConflictError - If a local outpoint is already reserved by another invitation.
Throws
UnspentOutputReservationInternalConflictError - If this invitation already reserves or spends the outpoint.
Throws
TemplateOutputNotFoundError - If an output names a template output the template does not define.
Throws
TemplateLockingScriptRoleNotFoundError - If an output names a role its locking script does not define.
Throws
LockingBytecodeGenerationFailedError - If the locking bytecode of an output that names only a template output cannot be compiled.
Throws
LockingScriptSecretsNotFoundError - If such an output's locking script uses secrets this account has not generated for the invitation.
Throws
LockingScriptResolutionsMissingError - If such an output's locking script needs values the invitation does not hold yet. Use Engine.listOutputResolutions to see them and Engine.appendOwnOutputResolutions to add this account's part.
Throws
SecretDataNotFoundError - If a secret recorded for this invitation is not in the secret store.
appendOwnInputResolutions()
appendOwnInputResolutions(invitationIdentifier, inputIndex): Promise<StoredInvitation>;Defined in: source/engine.ts:744
Adds the key operations this account resolved for an invitation input, such as its signature, to that input, so the participant holding the remaining keys can complete the unlocking bytecode.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | string | Invitation the input belongs to. |
inputIndex | number | Index of the merged input. |
Returns
Promise<StoredInvitation>
- The invitation as stored after the commit with the values.
Throws
InputOwnResolutionsNotFoundError - If this account resolved nothing the invitation does not already hold.
Throws
InvitationNotFoundInStoreError - If the invitation is not found in the store.
Throws
MergedInputCommitNotFoundError - When the input has no merged leaf to extend.
Throws
MergedInputOutpointMissingError - When the merged input has no outpoint.
Throws
InputUnspentOutputUnavailableError - When the spent output is not tracked by this account or is reserved by another invitation.
Throws
UnlockingBytecodeGenerationFailedError - When the unlocking script fails to compile for a reason other than a missing identifier.
Throws
MergedOutputLockingBytecodeMissingError - When an output has no locking bytecode and its template output defines no locking script.
Throws
MergedOutputLockingScriptVariablesMissingError - When an output locking script reads variables that no commit provides.
appendOwnOutputResolutions()
appendOwnOutputResolutions(
invitationIdentifier,
outputIdentifier,
roleIdentifier?): Promise<StoredInvitation>;Defined in: source/engine.ts:689
Adds the key operations this account resolved for an invitation output to the invitation, so other participants can compile the same locking script.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | string | Invitation the output belongs to. |
outputIdentifier | string | Template output whose locking script the values are for. |
roleIdentifier? | string | Role on the output, when one is set. |
Returns
Promise<StoredInvitation>
- The invitation as stored after the commit with the values.
Throws
OutputOwnResolutionsNotFoundError - If this account resolved nothing the invitation does not already hold.
Throws
InvitationNotFoundInStoreError - If the invitation is not found in the store.
Throws
TemplateOutputNotFoundError - If the template does not define the output.
Throws
TemplateLockingScriptRoleNotFoundError - If the role is not defined on the output's locking script.
Throws
LockingScriptSecretsNotFoundError - If the locking script uses secrets this account has not generated for the invitation.
Throws
LockingBytecodeGenerationFailedError - If the locking script fails to compile for a reason other than a missing identifier.
Throws
SecretDataNotFoundError - If a secret recorded for this invitation is not in the secret store.
archiveInvitation()
archiveInvitation(invitationIdentifier): Promise<void>;Defined in: source/engine.ts:473
Archives one stored invitation in local storage.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | string | Identifier of the invitation to archive |
Returns
Promise<void>
- Resolves when the invitation is archived and its reservations are cleared
Throws
InvitationNotFoundInStoreError - If the invitation is not in the store
Warning
This archives local invitation history for the identifier.
archiveTemplate()
archiveTemplate(templateIdentifier): Promise<void>;Defined in: source/engine.ts:270
Archives one stored template in local storage.
Parameters
| Parameter | Type | Description |
|---|---|---|
templateIdentifier | string | Identifier of the template to archive |
Returns
Promise<void>
- Resolves when the template is archived
Throws
TemplateNotFoundInStoreError - If the template is not in the store.
buildInvitationTransactionFromMergedCommit()
buildInvitationTransactionFromMergedCommit(invitationIdentifier): Promise<BuiltInvitationTransaction>;Defined in: source/engine.ts:791
Builds the encoded transaction for an invitation without broadcasting or persisting a hash.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | string | Stored invitation to encode. |
Returns
Promise<BuiltInvitationTransaction>
- Transaction hex and size metadata.
Throws
InvitationNotFoundInStoreError - When the invitation is missing.
Throws
TemplateNotFoundInStoreError - When the template is missing.
Throws
TemplateActionTransactionNotFoundError - When the action has no transaction definition.
Throws
TransactionGenerationFailedError - When libauth cannot build the transaction.
Throws
MergedOutputLockingBytecodeMissingError - When an output has no locking bytecode and its template output defines no locking script.
Throws
MergedOutputLockingScriptVariablesMissingError - When an output locking script reads variables that no commit provides.
calculateChange()
calculateChange(invitationIdentifier): Promise<MergedInvitationChange>;Defined in: source/engine.ts:892
Calculates the change for the invitation.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | string | The identifier of the invitation to calculate the change for. |
Returns
Promise<MergedInvitationChange>
- The calculated change.
createInvitation()
createInvitation(params): Promise<StoredInvitation>;Defined in: source/engine.ts:512
Creates an invitation that can be shared with other entities, user, application, etc. Invitation is the fundamental communication unit in XO, all the interactions done using the xo template are done using invitations.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | InvitationCreationParameters | The parameters for invitation creation. |
Returns
Promise<StoredInvitation>
- The constructed invitation as stored, including this account's entity identifier.
Throws
TemplateNotFoundInStoreError - If the template is not found.
Throws
TemplateActionNotFoundError - If the action is not found.
Throws
InvitationIntentMismatchError - If the intent names another template or action.
Throws
InvitationRoleDuplicatedError - If the role is given both directly and on the intent.
Throws
TemplateActionRoleNotFoundError - If the action does not define the role.
Throws
TemplateGeneratedVariableTypeUnsupportedError - If a variable to generate is not a private key.
Throws
UnspentOutputReservationExternalConflictError - If a local outpoint is already reserved by another invitation.
Throws
UnspentOutputReservationInternalConflictError - If a local outpoint is already reserved by this invitation.
Throws
SecretDataNotFoundError - If a script hash of this account lists a secret that is not stored.
Throws
EntityMultipleRolesWithFollowUpUnsupportedError - If the first commit gives this account more than one role with a follow up.
DANGEROUS_deleteAccountDatabase()
DANGEROUS_deleteAccountDatabase(): Promise<void>;Defined in: source/engine.ts:434
Permanently deletes the full local account database for this engine instance.
Returns
Promise<void>
- Resolves when the local database is deleted.
Throws
- If shutdown or deletion fails.
Warning
This permanently deletes templates, invitations, script hashes, unspent outputs, and events. Use this only when the developer fully understands the data loss impact.
estimateTransactionFee()
estimateTransactionFee(invitationIdentifier): Promise<number>;Defined in: source/engine.ts:908
Estimates the transaction fee for the invitation.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | string | The identifier of the invitation to estimate the transaction fee for. |
Returns
Promise<number>
- The estimated transaction fee.
Throws
InvitationNotFoundInStoreError - When the invitation is not stored.
Throws
TemplateNotFoundInStoreError - When the template is not stored.
executeAction()
executeAction(invitationIdentifier, params): Promise<ExecuteActionResult>;Defined in: source/engine.ts:812
Executes an action for a given invitation.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | string | The identifier of the invitation whose action to execute. The invitation must already exist in the store. |
params | ExecuteActionParameters | Parameters for executing the action. |
Returns
Promise<ExecuteActionResult>
- Encoded transaction metadata and the persisted invitation.
Throws
InvitationNotFoundInStoreError - If the invitation is not found in the store.
Throws
TemplateNotFoundInStoreError - If the invitation's template is not found in the store.
Throws
TransactionResultAlreadyExistsError - If a different transaction was already recorded for the action.
Throws
TransactionBroadcastFailedError - If the network rejects the transaction.
Throws
TransactionResultNotFoundError - If the created result is missing when the broadcast is recorded.
Throws
MergedOutputLockingBytecodeMissingError - When an output has no locking bytecode and its template output defines no locking script.
Throws
MergedOutputLockingScriptVariablesMissingError - When an output locking script reads variables that no commit provides.
generateLockingBytecodeFromDefaultPolicy()
generateLockingBytecodeFromDefaultPolicy(
policy,
variableValues?,
invitationIdentifier?): Promise<string>;Defined in: source/engine.ts:414
Generates a locking bytecode from a wallet default policy.
The stored policy names a template, and that template's defaults intent says which output or locking script, role, and secrets to use. Every variable from Engine.listDefaultPolicyRequiredVariables must be in variableValues, otherwise nothing is generated and no derivation index is used.
Parameters
| Parameter | Type | Description |
|---|---|---|
policy | keyof WalletDefaultPolicies | Default policy to create from, one of change, receive, or address. |
variableValues? | Record<string, XOInvitationVariableValue> | Values for the variables the intent requires, empty when none are passed. |
invitationIdentifier? | string | Invitation the locking bytecode is built for. Keys this account already generated for it under the policy template are used instead of new ones. |
Returns
Promise<string>
- The generated locking bytecode as a hexadecimal string.
Throws
TemplateNotFoundInStoreError - When the policy template or the intent target template is not stored.
Throws
DefaultPolicyNotSetError - When the policy is not set.
Throws
TemplateDefaultPolicyMissingError - When its template does not define it.
Throws
IntentVariablesMissingError - When a required variable value is missing.
Throws
LockingBytecodeGenerationFailedError - When Libauth compilation fails.
Throws
InvitationNotFoundInStoreError - When an invitation is given and it is not stored.
Throws
SecretDataNotFoundError - When a secret recorded for that invitation is not in the secret store.
generateUnlockingBytecode()
generateUnlockingBytecode(invitationIdentifier, inputIndex): Promise<GeneratedInputUnlockingBytecode>;Defined in: source/engine.ts:1059
Compiles unlocking bytecode for one merged input without appending it to the invitation.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | string | Invitation that owns the input. |
inputIndex | number | Index of the merged input to unlock. |
Returns
Promise<GeneratedInputUnlockingBytecode>
- Unlocking bytecode for that input.
Throws
InvitationNotFoundInStoreError - When the invitation is absent from the store.
Throws
MergedInputOutpointMissingError - When the merged input has no outpoint.
Throws
InputUnspentOutputUnavailableError - When the spent output is not tracked by this account or is reserved by another invitation.
Throws
ScriptHashDataNotFoundError - When the reserved output has no stored script hash.
Throws
UnlockingBytecodeGenerationFailedError - When Libauth compilation fails.
Throws
TemplateNotFoundInStoreError - When the template is absent from the store.
Throws
MergedOutputLockingBytecodeMissingError - When an output has no locking bytecode and its template output defines no locking script.
Throws
MergedOutputLockingScriptVariablesMissingError - When an output locking script reads variables that no commit provides.
getChainStatus()
getChainStatus(): Promise<ChainStatus>;Defined in: source/engine.ts:145
Reads the chain status the Electrum application last reported, with the reported and verified block heights.
Returns
Promise<ChainStatus>
- Current height, verified height, and verified percent of the chain.
getDefaultPolicies()
getDefaultPolicies(): Promise<WalletDefaultPolicies>;Defined in: source/engine.ts:362
Returns the wallet default policies used for change, receive, and address generation.
Each policy is present only when it has been set with Engine.setDefaultPolicies.
Returns
Promise<WalletDefaultPolicies>
- Stored default policies, or an empty object when none are stored.
getInvitation()
getInvitation(invitationIdentifier): Promise<StoredInvitation | undefined>;Defined in: source/engine.ts:451
Retrieves an invitation by its identifier from the state.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | string | Invitation identifier. |
Returns
Promise<StoredInvitation | undefined>
- The invitation, or undefined when it is not stored.
getSecretPublicKey()
getSecretPublicKey(secretLookupKey): Promise<string | undefined>;Defined in: source/engine.ts:1021
Returns the public key of a secret whose value is entropy. If the value is not entropy or the secret doesn't exist, undefined is returned.
Parameters
| Parameter | Type | Description |
|---|---|---|
secretLookupKey | string | Lookup key the secret is stored under. |
Returns
Promise<string | undefined>
- The compressed public key as hex, or undefined when the secret holds no entropy.
getTemplate()
getTemplate(templateIdentifier): Promise<XOTemplate | undefined>;Defined in: source/engine.ts:230
Retrieves a template by its identifier from the state.
Parameters
| Parameter | Type | Description |
|---|---|---|
templateIdentifier | string | Template identifier. |
Returns
Promise<XOTemplate | undefined>
- The template object.
getWalletName()
getWalletName(): Promise<string | undefined>;Defined in: source/engine.ts:294
Returns the stored name of this wallet.
Returns
Promise<string | undefined>
- Stored wallet name, or undefined when no name has been stored.
importTemplate()
importTemplate(untrustedJsonOrObject): Promise<{
template: XOTemplate;
templateIdentifier: string;
}>;Defined in: source/engine.ts:249
Imports a template into the Engine after sanitization and validation.
Parameters
| Parameter | Type | Description |
|---|---|---|
untrustedJsonOrObject | string | XOTemplate | JSON or object containing the untrusted template to import. |
Returns
Promise<{ template: XOTemplate; templateIdentifier: string; }>
- The imported template and its identifier.
Throws
TemplateInvalidError - If the template is invalid.
Throws
DatabaseWriteOperationFailedError - If an unexpected database error occurs.
joinInvitationRole()
joinInvitationRole(invitationIdentifier, roleIdentifier): Promise<StoredInvitation>;Defined in: source/engine.ts:560
Joins an invitation this account already takes part in with another role.
The role must still have a free slot, and the keys it asks for are generated with the commit that names it.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | string | Invitation to join with the role. |
roleIdentifier | string | Role to take. |
Returns
Promise<StoredInvitation>
- The invitation as stored after the commit that names the role.
Throws
InvitationNotFoundInStoreError - If the invitation is not stored.
Throws
InvitationRoleUnavailableError - If the role has no free slot left.
Throws
TemplateActionRoleNotFoundError - If the action does not define the role.
Throws
EntityMultipleRolesWithFollowUpUnsupportedError - If the role would give this account more than one role with a follow up.
Throws
TemplateNotFoundInStoreError - If the template is not found.
Throws
TemplateActionNotFoundError - If the action is not found.
Throws
TemplateGeneratedVariableTypeUnsupportedError - If a variable to generate is not a private key.
listAvailableRoles()
listAvailableRoles(invitation): Promise<string[]>;Defined in: source/engine.ts:826
Lists available roles for the given invitation.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | The invitation to examine. |
Returns
Promise<string[]>
- The list of roles that still require data.
Throws
TemplateNotFoundInStoreError - If the template is not found.
Throws
TemplateActionNotFoundError - If the action is not found.
listDefaultPolicyRequiredVariables()
listDefaultPolicyRequiredVariables(policy): Promise<string[]>;Defined in: source/engine.ts:389
Lists the variables a caller must provide to create a locking bytecode from a wallet default policy.
These are the variables the policy template's defaults intent marks with a null value, plus any the generated locking script needs that the template constants and intent presets do not supply. Pass their values to Engine.generateLockingBytecodeFromDefaultPolicy.
Parameters
| Parameter | Type | Description |
|---|---|---|
policy | keyof WalletDefaultPolicies | Default policy to inspect, one of change, receive, or address. |
Returns
Promise<string[]>
- Required variable identifiers, empty when nothing needs to be provided.
Throws
TemplateNotFoundInStoreError - When the policy template or the intent target template is not stored.
Throws
DefaultPolicyNotSetError - When the policy is not set.
Throws
TemplateDefaultPolicyMissingError - When its template does not define it.
listElectrumConnections()
listElectrumConnections(): ElectrumConnection[];Defined in: source/engine.ts:136
Lists every Electrum server this engine connects to, with the state of each connection.
Returns
- One entry per Electrum client, empty before Electrum is initialized.
listInputResolutions()
listInputResolutions(invitationIdentifier, inputIndex): Promise<InvitationResolutionRequirements>;Defined in: source/engine.ts:720
Lists the key operations an invitation input's unlocking script needs from participants, without signing or adding anything.
Each operation is reported as provided when the invitation or the input holds it, as this account's own when only this account's keys resolve it, such as its signature, or as missing when another participant holds the key. The input can be signed with Engine.signInvitation once nothing is this account's own or missing.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | string | Invitation the input belongs to. |
inputIndex | number | Index of the merged input. |
Returns
Promise<InvitationResolutionRequirements>
- Provided identifiers, values this account can add, and identifiers others still owe.
Throws
InvitationNotFoundInStoreError - If the invitation is not found in the store.
Throws
MergedInputOutpointMissingError - When the merged input has no outpoint.
Throws
InputUnspentOutputUnavailableError - When the spent output is not tracked by this account or is reserved by another invitation.
Throws
ScriptHashDataNotFoundError - When the spent output has no stored script hash.
Throws
TemplateUnlockingScriptNotFoundError - When neither the template input nor the locking script names an unlocking script.
Throws
UnlockingBytecodeGenerationFailedError - When the unlocking script fails to compile for a reason other than a missing identifier.
Throws
MergedOutputLockingBytecodeMissingError - When an output has no locking bytecode and its template output defines no locking script.
Throws
MergedOutputLockingScriptVariablesMissingError - When an output locking script reads variables that no commit provides.
listInvitations()
listInvitations(options?): Promise<StoredInvitation[]>;Defined in: source/engine.ts:461
Lists invitations for this account.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | StorageListOptions | Optional list options such as archive filter. |
Returns
Promise<StoredInvitation[]>
- Invitations for this account.
listMissingRequirements()
listMissingRequirements(invitationIdentifier): Promise<InvitationMissingRequirements>;Defined in: source/engine.ts:853
Lists all missing requirements for the provided invitation. They fall in two categories, which are requirements expected by the template but not yet provided in any commit, and inputs already committed with a real UTXO outpoint that are still missing their unlocking bytecode.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | string | The identifier of the invitation to analyze. The invitation must exist in the store. |
Returns
Promise<InvitationMissingRequirements>
- Both the template-level gaps and the unsigned input gaps.
Throws
InvitationNotFoundInStoreError - If the invitation is not found in the store.
Throws
TemplateNotFoundInStoreError - If the template is not found in the store.
Throws
TemplateActionNotFoundError - When the action is not on the template.
listOutputResolutions()
listOutputResolutions(
invitationIdentifier,
outputIdentifier,
roleIdentifier?): Promise<InvitationResolutionRequirements>;Defined in: source/engine.ts:663
Lists the key operations an invitation output's locking script needs from participants, without adding anything.
Each operation is reported as provided when the invitation holds it, as this account's own when only this account's keys resolve it, or as missing when another participant holds the key. The output can be added once nothing is this account's own or missing.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | string | Invitation the output belongs to. |
outputIdentifier | string | Template output to check. |
roleIdentifier? | string | Role on the output, when one is set. |
Returns
Promise<InvitationResolutionRequirements>
- Provided identifiers, values this account can add, and identifiers others still owe.
Throws
InvitationNotFoundInStoreError - If the invitation is not found in the store.
Throws
TemplateOutputNotFoundError - If the template does not define the output.
Throws
TemplateLockingScriptRoleNotFoundError - If the role is not defined on the output's locking script.
Throws
LockingScriptSecretsNotFoundError - If the locking script uses secrets this account has not generated for the invitation.
Throws
LockingBytecodeGenerationFailedError - If the locking script fails to compile for a reason other than a missing identifier.
Throws
SecretDataNotFoundError - If a secret recorded for this invitation is not in the secret store.
listOwnCommits()
listOwnCommits(invitationIdentifier): Promise<XOInvitationCommit[]>;Defined in: source/engine.ts:864
Returns all commits in the invitation that were made by the current entity.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | string | The identifier of the invitation to examine. |
Returns
Promise<XOInvitationCommit[]>
- Commits belonging to this engine's entity, in order.
Throws
InvitationNotFoundInStoreError - If the invitation is not found in the store.
listOwnInputIndexes()
listOwnInputIndexes(invitationIdentifier): Promise<number[]>;Defined in: source/engine.ts:878
Finds all the inputs that are reserved by the current entity.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | string | The identifier of the invitation to find inputs for. |
Returns
Promise<number[]>
- The indexes of the inputs that are reserved by the current entity.
Throws
InvitationNotFoundInStoreError - When the invitation is not in the store.
Throws
TemplateNotFoundInStoreError - When the template is not in the store.
listRequirements()
listRequirements(invitation): Promise<InvitationRequirementIdentifierLists>;Defined in: source/engine.ts:838
Lists requirements for the provided invitation.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | The invitation to analyze requirements for. |
Returns
Promise<InvitationRequirementIdentifierLists>
- The requirements information.
Throws
TemplateNotFoundInStoreError - When the template is not in the store.
Throws
TemplateActionNotFoundError - When the action is not on the template.
listScriptHashData()
listScriptHashData(query): Promise<ScriptHashData[]>;Defined in: source/engine.ts:999
Lists script hashes via state indexed storage query.
Forwards to State.listScriptHashData. Exactly one of templateIdentifier, scriptHash, or invitationIdentifier.
Parameters
| Parameter | Type | Description |
|---|---|---|
query | ScriptHashDataQuery | Storage query accepted by the state package. |
Returns
Promise<ScriptHashData[]>
- Matching script hashes from storage.
Throws
QueryFieldsLimitExceededError - When more than one query field is set.
Throws
QueryInvalidError - When no recognized query field is set.
listScriptHashes()
listScriptHashes(options?): Promise<ScriptHashData[]>;Defined in: source/engine.ts:985
Lists the script hashes of every stored template. By default only the script hashes of un-archived templates are returned.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | StorageListOptions | Optional list options. |
Returns
Promise<ScriptHashData[]>
- The script hash data of every matching template.
Throws
ArchiveFilterInvalidError - When the archive filter is not one of the supported filters.
listSecretData()
listSecretData(): Promise<StoredSecretData[]>;Defined in: source/engine.ts:1010
Lists every secret this account has generated.
Each secret holds a derivation index, not a key.
Returns
Promise<StoredSecretData[]>
- The generated secrets, each with its lookup key, empty when none are stored.
listSecretsForScriptHash()
listSecretsForScriptHash(scriptHash): Promise<SecretData[]>;Defined in: source/engine.ts:1035
Lists the secrets stored for a script hash, in the order the script hash lists them.
Stored script hash data keeps only the lookup key of each secret, so each secret is read by its lookup key.
Parameters
| Parameter | Type | Description |
|---|---|---|
scriptHash | string | Script hash of a stored locking script. |
Returns
Promise<SecretData[]>
- The secrets for the script hash, empty when it lists none.
Throws
ScriptHashDataNotFoundError - When the script hash is not stored.
Throws
SecretDataNotFoundError - When the script hash lists a lookup key that has no stored secret.
listSpendableUnspentOutputs()
listSpendableUnspentOutputs(options?): Promise<UnspentOutputData[]>;Defined in: source/engine.ts:969
Lists the unreserved unspent outputs that are free to spend.
Outputs reserved by an invitation are excluded so the same output is never offered to two invitations. When ListSpendableUnspentOutputsParameters are passed, only outputs locked by that template output and matching every provided token field are returned.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | ListSpendableUnspentOutputsParameters | Template output and token fields that every returned output must match. |
Returns
Promise<UnspentOutputData[]>
- The unreserved unspent outputs that match the provided options.
Throws
TemplateNotFoundInStoreError - When the template in the options is not stored.
Throws
TemplateOutputNotFoundError - When the output in the options is not defined by that template.
listTemplates()
listTemplates(options?): Promise<StoredTemplate[]>;Defined in: source/engine.ts:259
Lists templates for this account.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | StorageListOptions | Optional list options such as archive filter. |
Returns
Promise<StoredTemplate[]>
- Templates for this account.
listTemplatesForDefaultPolicy()
listTemplatesForDefaultPolicy(policy): Promise<DefaultPolicyTemplate[]>;Defined in: source/engine.ts:372
Lists the stored templates that can back the given wallet default policy.
Parameters
| Parameter | Type | Description |
|---|---|---|
policy | keyof WalletDefaultPolicies | Default policy being chosen, one of change, receive, or address. |
Returns
Promise<DefaultPolicyTemplate[]>
- Matching templates with their storage identifiers.
listUnspentOutputs()
listUnspentOutputs(query?, filter?): Promise<UnspentOutputData[]>;Defined in: source/engine.ts:953
Lists the unspent outputs this account tracks, each with the confirmation status Electrum last reported.
Parameters
| Parameter | Type | Description |
|---|---|---|
query? | UnspentOutputDataQuery | Template, reservation, script hash, or status to select outputs by. |
filter? | UnspentOutputDataFilter | Reservation and token fields every returned output must match. |
Returns
Promise<UnspentOutputData[]>
- Unspent outputs matching the query and filter, or every tracked output when both are omitted.
resolveInvitationOutputLockingBytecode()
resolveInvitationOutputLockingBytecode(
invitationIdentifier,
outputIdentifier,
roleIdentifier?): Promise<string>;Defined in: source/engine.ts:635
Resolves the locking bytecode an invitation output compiles to, without generating or storing anything.
The locking script compiles with the template constants, the invitation variables, and the keys this account already generated for the invitation, which is what Engine.appendInvitation uses when the output is added. The script's secrets are existing secrets and are never generated for it, so a secret the invitation does not hold fails the resolution the same way adding the output would.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | string | Invitation the output belongs to. |
outputIdentifier | string | Template output to resolve. |
roleIdentifier? | string | Role on the output, when one is set. |
Returns
Promise<string>
- The locking bytecode as a hexadecimal string.
Throws
InvitationNotFoundInStoreError - If the invitation is not found in the store.
Throws
TemplateOutputNotFoundError - If the template does not define the output.
Throws
TemplateLockingScriptRoleNotFoundError - If the role is not defined on the output's locking script.
Throws
LockingScriptSecretsNotFoundError - If the locking script uses secrets this account has not generated for the invitation.
Throws
LockingBytecodeGenerationFailedError - If the locking bytecode cannot be compiled.
Throws
SecretDataNotFoundError - If a secret recorded for this invitation is not in the secret store.
Throws
CashAssemblyCompilationFailedError - If the output locking script is a CashAssembly expression that cannot be compiled.
Throws
LockingScriptCompilationFailedError - If the template locking script the output names cannot be compiled.
Throws
LockingScriptResolutionsMissingError - If the script uses key operations other participants have not resolved yet.
setDefaultPolicies()
setDefaultPolicies(policiesToSet): Promise<void>;Defined in: source/engine.ts:338
Sets the wallet default policies used for change, receive, and address generation.
Each policy is set independently. A policy omitted from policiesToSet keeps its stored value, so setting the change policy never clears the receive or address policy. Resolution order is override, then template defaults, then these default policies.
Parameters
| Parameter | Type | Description |
|---|---|---|
policiesToSet | WalletDefaultPolicies | Policies to set, each naming a template that defines that policy in its defaults. |
Returns
Promise<void>
- Resolves when the provided policies have been stored.
Throws
TemplateNotFoundInStoreError - When a policy names a template that is not stored.
Throws
TemplateDefaultPolicyMissingError - When a policy names a template whose defaults do not define that policy.
setWalletName()
setWalletName(walletName): Promise<void>;Defined in: source/engine.ts:314
Stores the name of this wallet.
The name is trimmed before it is stored and replaces any name stored before.
Parameters
| Parameter | Type | Description |
|---|---|---|
walletName | string | Name to store. |
Returns
Promise<void>
- Resolves when the trimmed name has been stored.
Throws
WalletNameMissingError - When the name is empty or contains only whitespace.
signInvitation()
signInvitation(invitationIdentifier, inputIndex): Promise<StoredInvitation>;Defined in: source/engine.ts:772
Signs one input of the invitation with this account's keys and appends a commit that holds its unlocking bytecode.
An unlocking script that needs values other entities hold, such as their signatures, is only signed once the invitation holds them. Use Engine.listInputResolutions to see what the input still needs, and Engine.appendOwnInputResolutions to add this account's part.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | string | The identifier of the invitation to sign. The invitation must already exist in the store. |
inputIndex | number | Index of the merged input to sign. |
Returns
Promise<StoredInvitation>
- The invitation as stored after the unlocking commit is appended.
Throws
InvitationNotFoundInStoreError - If the invitation is not found in the store.
Throws
MergedInputCommitNotFoundError - When the compiled input has no merged leaf to extend.
Throws
MergedInputOutpointMissingError - When the merged input has no outpoint.
Throws
InputUnspentOutputUnavailableError - When the spent output is not tracked by this account or is reserved by another invitation.
Throws
UnlockingScriptResolutionsMissingError - When the unlocking script needs values the invitation does not hold yet.
Throws
UnlockingCompilationContextMissingError - When the unlocking compilation carries no context to verify against.
Throws
UnlockingBytecodeVerificationFailedError - When the unlocking bytecode built with other entities' values fails.
Throws
MergedOutputLockingBytecodeMissingError - When an output has no locking bytecode and its template output defines no locking script.
Throws
MergedOutputLockingScriptVariablesMissingError - When an output locking script reads variables that no commit provides.
stop()
stop(): Promise<void>;Defined in: source/engine.ts:210
Stops the engine instance and cleans up resources.
Returns
Promise<void>
- Resolves when the engine is stopped.
unarchiveInvitation()
unarchiveInvitation(invitationIdentifier): Promise<void>;Defined in: source/engine.ts:484
Restores one archived invitation in local storage.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | string | Identifier of the invitation to restore |
Returns
Promise<void>
- Resolves when restoration completes
Throws
InvitationNotFoundInStoreError - If the invitation is not in the store
unarchiveTemplate()
unarchiveTemplate(templateIdentifier): Promise<void>;Defined in: source/engine.ts:281
Restores one archived template in local storage.
Parameters
| Parameter | Type | Description |
|---|---|---|
templateIdentifier | string | Identifier of the template to restore |
Returns
Promise<void>
- Resolves when restoration completes
Throws
TemplateNotFoundInStoreError - If the template is not in the store
unsetDefaultPolicies()
unsetDefaultPolicies(policiesToRemove): Promise<void>;Defined in: source/engine.ts:351
Removes wallet default policies so change, receive, or address generation no longer uses them.
Each policy is removed independently. A policy not listed in policiesToRemove keeps its stored value. Removing a policy that is not stored changes nothing.
Parameters
| Parameter | Type | Description |
|---|---|---|
policiesToRemove | keyof WalletDefaultPolicies[] | Policies to remove, each one of change, receive, or address. |
Returns
Promise<void>
- Resolves when the listed policies are no longer stored.
updateInvitation()
updateInvitation(updatedInvitation): Promise<StoredInvitation>;Defined in: source/engine.ts:585
Updates the stored invitation with a newer version received from an external participant or through some subscription. The updated invitation should have the shared history with the stored invitation, and the invitation must already be stored.
An output another participant added that locks to one of this account's scripts is stored and tracked like a script this account built, so its funds are seen and it can be unlocked later.
Parameters
| Parameter | Type | Description |
|---|---|---|
updatedInvitation | XOInvitation | Shared invitation to store. The local entity identifier and archive fields keep their stored values. |
Returns
Promise<StoredInvitation>
- The updated invitation as stored, including the local entity identifier when present.
Throws
InvitationInvalidError - If the updated invitation does not match the XOInvitation type.
Throws
InvitationNotFoundInStoreError - If the invitation is not already in the store.
Throws
TemplateNotFoundInStoreError - If the template is not found.
Throws
InvitationValidationFailedError - If the updated invitation fails validation.
Throws
InvitationHistoryConflictError - If a stored commit is missing, reordered, or has a different identifier or signature at its expected position in the updated invitation.
Throws
InvitationItemFieldConflictError - If a commit changes a value an earlier commit set.
Throws
RoleVariableEntityMismatchError - If a commit provides a variable of a role its entity does not hold.
Throws
EntityMultipleRolesWithFollowUpUnsupportedError - If a commit gives an entity more than one role with a follow up.
create()
static create(mnemonic, options): Promise<Engine>;Defined in: source/engine.ts:157
Initializes and creates a new XO Engine instance. Opens storage, configures Electrum, and starts the blockchain monitor.
Parameters
| Parameter | Type | Description |
|---|---|---|
mnemonic | string | BIP39 mnemonic to be used for this instance of the engine. |
options | XOEngineOptions | Storage, Electrum, network, and remote state settings for this instance. |
Returns
Promise<Engine>
- An initialized Engine instance.
InvitationBuilder
Defined in: source/invitation/participation/builder.ts:57
Builder for the XOInvitation
Constructors
Constructor
new InvitationBuilder(params, network): InvitationBuilder;Defined in: @xo-cash/engine/dist/index.d.mts:3284
Create a new InvitationBuilder.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | InvitationParameters | Context for invitation creation. |
network | XONetwork | Engine network that selects xpub or tpub for entity identifiers. |
Returns
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
actionIdentifier | string | The identifier of the action for the invitation. | source/invitation/participation/builder.ts:71 |
invitationIdentifier | string | The identifier of the current invitation. | source/invitation/participation/builder.ts:61 |
templateIdentifier | string | The identifier of the template for the invitation. | source/invitation/participation/builder.ts:66 |
Methods
addCommit()
addCommit(commit): this;Defined in: source/invitation/participation/builder.ts:329
Add a commit to the invitation.
Parameters
| Parameter | Type | Description |
|---|---|---|
commit | XOInvitationCommit | The commit to add. |
Returns
this
- The builder instance.
addTransactionBroadcastedResult()
addTransactionBroadcastedResult(transactionIdentifier, transactionResult): this;Defined in: source/invitation/participation/builder.ts:288
Records broadcast metadata on an existing invitation transaction result.
Parameters
| Parameter | Type | Description |
|---|---|---|
transactionIdentifier | string | Template transaction identifier for the action. |
transactionResult | XOInvitationTransactionBroadcastDetails | Broadcast result fields to merge into the stored transaction result. |
Returns
this
- Builder instance for chaining.
Throws
TransactionResultNotFoundError - When no created transaction result exists for this identifier.
Throws
InvitationResultSignatureInvalidError - When the broadcast result signature does not verify.
Throws
- When a present field fails Timestamp, ExtendedPublicKey, or SchnorrSignature construction.
addTransactionCreatedResult()
addTransactionCreatedResult(transactionIdentifier, transactionResult): this;Defined in: source/invitation/participation/builder.ts:239
Adds one transaction result to the invitation result.
Parameters
| Parameter | Type | Description |
|---|---|---|
transactionIdentifier | string | Template transaction identifier for the action. |
transactionResult | InvitationTransactionCreatedResultInput | Transaction result payload to store. |
Returns
this
- Builder instance for chaining.
Throws
TransactionResultAlreadyExistsError - When a result already exists for this transaction identifier.
Throws
InvitationResultSignatureInvalidError - When the created result signature does not verify.
Throws
- When a present field fails TransactionHash, Timestamp, ExtendedPublicKey, or SchnorrSignature construction.
build()
build(): XOInvitation;Defined in: source/invitation/participation/builder.ts:150
Build the invitation object to be shared.
Returns
- The built invitation.
createUnsignedCommit()
createUnsignedCommit(params): Omit<XOInvitationCommit, "signature" | "entityIdentifier">;Defined in: source/invitation/participation/builder.ts:369
Creates an unsigned commit without adding it to the invitation. This allows for atomic commit creation with signature.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | UnsignedCommitParameters | Parameters for creating the commit. |
Returns
Omit<XOInvitationCommit, "signature" | "entityIdentifier">
- The unsigned commit without signature.
getLastCommit()
getLastCommit(): XOInvitationCommit | undefined;Defined in: source/invitation/participation/builder.ts:351
Returns the last commit in the invitation.
Returns
XOInvitationCommit | undefined
- The last commit, or undefined if there are no commits.
getLastCommitIdentifier()
getLastCommitIdentifier(): string | undefined;Defined in: source/invitation/participation/builder.ts:343
Returns the commit identifier of the last commit in the invitation.
Returns
string | undefined
- The last commit identifier, or undefined if there are no commits.
getResult()
getResult(): XOInvitationResult | undefined;Defined in: source/invitation/participation/builder.ts:184
Returns the current invitation result, if any.
Returns
XOInvitationResult | undefined
- Invitation result or undefined when no result is attached.
removeTransactionResult()
removeTransactionResult(transactionIdentifier): this;Defined in: source/invitation/participation/builder.ts:194
Removes one transaction result from the invitation result.
Parameters
| Parameter | Type | Description |
|---|---|---|
transactionIdentifier | string | Template transaction identifier to remove. |
Returns
this
- Builder instance for chaining.
setResult()
setResult(result): this;Defined in: source/invitation/participation/builder.ts:173
Replaces the entire invitation result.
Parameters
| Parameter | Type | Description |
|---|---|---|
result | XOInvitationResult | Result to attach to the invitation. |
Returns
this
- Builder instance for chaining.
fromInvitation()
static fromInvitation(invitation, network): InvitationBuilder;Defined in: source/invitation/participation/builder.ts:124
Create a builder from an existing invitation.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | An existing invitation. |
network | XONetwork | Engine network that selects xpub or tpub for entity identifiers. |
Returns
- A builder initialized from the invitation.
BuiltInvitationTransaction
Defined in: source/invitation/interfaces.ts:136
Encoded transaction produced from a merged invitation, including serialized size.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
estimatedFeeSatoshis | number | Miner fee estimate in satoshis, which is feeEstimateInputCount times DEFAULT_FEE_SATOSHIS_PER_INPUT plus feeEstimateOutputCount times DEFAULT_FEE_SATOSHIS_PER_OUTPUT. Actual network fees may differ from this estimate. | source/invitation/interfaces.ts:165 |
feeEstimateInputCount | number | Input count used for the fee estimate (merged inputs at preview time). | source/invitation/interfaces.ts:153 |
feeEstimateOutputCount | number | Output count used for the fee estimate (active outputs at preview time). | source/invitation/interfaces.ts:158 |
serializedTransaction | string | Full transaction serialized as hex (two hex digits per byte). | source/invitation/interfaces.ts:139 |
serializedTransactionCharacterCount | number | Number of characters in serializedTransaction (twice the byte length for valid hex). | source/invitation/interfaces.ts:145 |
transactionByteLength | number | Length of the serialized transaction in bytes. | source/invitation/interfaces.ts:142 |
transactionHash | string | Transaction id hash from the encoded bytes. | source/invitation/interfaces.ts:148 |
ChangeAvailability
Defined in: source/invitation/interfaces.ts:332
Result of checking whether a change output can be appended to the merged invitation transaction.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
canAddBchChange | boolean | True when a BCH change output is included in the current change plan. | source/invitation/interfaces.ts:342 |
canAddChange | boolean | True when at least one BCH or fungible token change output can be appended. | source/invitation/interfaces.ts:337 |
canAddTokenChange | boolean | True when at least one fungible token change output is included in the current change plan. | source/invitation/interfaces.ts:347 |
changeAmountSatoshis | bigint | Satoshis for the BCH change output when canAddBchChange is true. Otherwise 0, except below_dust may still report a small nonzero surplus. | source/invitation/interfaces.ts:353 |
estimatedMinFeeSatoshis | bigint | Minimum fee estimate for the current input and output counts before projecting a change output. Uses DEFAULT_FEE_SATOSHIS_PER_INPUT and DEFAULT_FEE_SATOSHIS_PER_OUTPUT. | source/invitation/interfaces.ts:385 |
fungibleTokenChangeByCategory | FungibleTokenChangeSurplus[] | Fungible token categories with positive surplus that would be returned as change. | source/invitation/interfaces.ts:358 |
hasTemplateChangePolicy | boolean | True when template.defaults.change defines how the engine builds the change output. | source/invitation/interfaces.ts:369 |
inputTotalSatoshis | bigint | Sum of merged input satoshis used for the surplus check. | source/invitation/interfaces.ts:374 |
outputTotalSatoshis | bigint | Sum of merged output satoshis used for the surplus check. | source/invitation/interfaces.ts:379 |
reason? | ChangeUnavailableReason | Set when canAddChange is false. One of merged_commit_missing, insufficient_surplus, or below_dust. | source/invitation/interfaces.ts:364 |
ExecuteActionParameters
Defined in: source/invitation/interfaces.ts:125
Parameters for executing an action.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
broadcastTransaction | boolean | Whether to broadcast the transaction to the blockchain. | source/invitation/interfaces.ts:130 |
ExecuteActionResult
Defined in: source/invitation/interfaces.ts:171
Result of executing an invitation action, including the persisted invitation state.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
builtTransaction | BuiltInvitationTransaction | Encoded transaction metadata produced from the merged invitation. | source/invitation/interfaces.ts:174 |
storedInvitation | StoredInvitation | Invitation stored after transaction results are written. | source/invitation/interfaces.ts:177 |
InvitationInputMissingSignature
Defined in: source/invitation/interfaces.ts:197
An input committed to the invitation that carries a real UTXO outpoint but no unlocking bytecode yet. This means the input has been reserved but not yet signed by its committing entity.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
entityIdentifier | string | undefined | Identifier of the entity that committed this input, or undefined when the source commit has none. | source/invitation/interfaces.ts:212 |
inputIdentifier | string | undefined | The identifier assigned to this input, or undefined if no identifier was given. | source/invitation/interfaces.ts:202 |
outpointIndex | number | Output index of the reserved UTXO in its parent transaction. | source/invitation/interfaces.ts:227 |
outpointTransactionHash | string | Parent transaction hash for the reserved UTXO, as lowercase hex. | source/invitation/interfaces.ts:222 |
roleIdentifier | string | undefined | Role identifier this input belongs to, or undefined if it is not role-specific. | source/invitation/interfaces.ts:217 |
sourceCommitIdentifier | string | Identifier of the commit that originally introduced this input to the invitation. | source/invitation/interfaces.ts:207 |
InvitationMissingRequirements
Defined in: source/invitation/interfaces.ts:282
Combined result from listing missing requirements for an invitation. Covers both gaps at the template level (data not yet provided) and at the invitation level (data provided but not yet complete, such as unsigned inputs).
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
inputsMissingSignatures | InvitationInputMissingSignature[] | Inputs committed with a real UTXO outpoint that are still missing their unlocking bytecode. | source/invitation/interfaces.ts:292 |
participants | InvitationMissingParticipant[] | Roles that still need an entity to join the invitation with them. | source/invitation/interfaces.ts:297 |
templateRequirements | InvitationRequirementIdentifierLists | Requirements expected by the template that have not been provided in any commit yet. | source/invitation/interfaces.ts:287 |
InvitationParameters
Defined in: source/invitation/interfaces.ts:40
Parameters required for creating a new XO invitation.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
actionIdentifier | string | Identifier of the action within the template to initiate. | source/invitation/interfaces.ts:50 |
expiresAtTimestamp? | number | Optional expiration timestamp. | source/invitation/interfaces.ts:90 |
inputs? | XOInvitationInput[] | Optional array of inputs. | source/invitation/interfaces.ts:65 |
locktime? | number | Optional transaction locktime. | source/invitation/interfaces.ts:60 |
outputs? | XOInvitationOutput[] | Optional array of outputs. | source/invitation/interfaces.ts:70 |
resolutions? | XOInvitationResolution[] | Optional array of key operations resolved by the entity holding the key, such as a public key or a data signature. | source/invitation/interfaces.ts:80 |
roleIdentifier? | string | Optional role the committing entity takes with this commit. | source/invitation/interfaces.ts:85 |
templateIdentifier | string | Identifier of the template to use for this invitation. | source/invitation/interfaces.ts:45 |
variables? | XOInvitationVariable[] | Optional array of variables. | source/invitation/interfaces.ts:75 |
version? | number | Optional transaction version. | source/invitation/interfaces.ts:55 |
ListSpendableUnspentOutputsParameters
Defined in: source/interfaces.ts:56
Parameters for finding spendable inputs.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
lockingScriptIdentifier? | string | Identifier of the locking script within the template. | source/interfaces.ts:71 |
outputIdentifier? | string | Identifier of the output within the template. | source/interfaces.ts:66 |
templateIdentifier | string | Identifier of the template to use for resource selection. | source/interfaces.ts:61 |
tokenAmount? | string | Keep only UTXOs whose fungible token amount equals this value. | source/interfaces.ts:81 |
tokenCategory? | string | Keep only UTXOs whose CashToken category equals this value. | source/interfaces.ts:76 |
tokenNftCapability? | XOTemplateNftCapability | Keep only UTXOs whose NFT capability equals this value. | source/interfaces.ts:86 |
tokenNftCommitment? | string | Keep only UTXOs whose NFT commitment equals this value. | source/interfaces.ts:91 |
WalletDefaultPolicies
Defined in: source/interfaces.ts:99
Default policies used when generating change, address and other locking bytecodes.
Resolution order for locking bytecode generation is manual override, then template defaults, then these default policies.
XOEngineOptions
Defined in: source/interfaces.ts:15
Configuration options for the XO Engine.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
databaseFilename? | string | Filename of the database file. | source/interfaces.ts:35 |
databasePath? | string | Directory path where the database will be stored. | source/interfaces.ts:30 |
electrumApplicationIdentifier? | string | The Electrum application identifier to use. | source/interfaces.ts:45 |
electrumServers? | ElectrumServersWithBlockchain | Electrum servers to connect to, each with the blockchain checkpoint and consensus parameters of the target network. | source/interfaces.ts:40 |
network? | XONetwork | Network this engine instance targets. | source/interfaces.ts:20 |
remoteEncryptedStateServers? | string[] | Remote encrypted state servers to use. | source/interfaces.ts:50 |
storageType? | StorageType | The storage type to use. | source/interfaces.ts:25 |
AccountContext
type AccountContext = object;Defined in: source/invitation/interfaces.ts:31
Account pieces an invitation function may read. Each function requires the fields it uses.
AppendInvitationParameters
type AppendInvitationParameters = Partial<InvitationParameters>;Defined in: source/invitation/interfaces.ts:120
Parameters for appending to an existing invitation. All fields are optional.
ChangeSelection
type ChangeSelection = object;Defined in: source/invitation/interfaces.ts:308
Change outputs to add to an invitation, chosen from its leftover satoshis and fungible tokens.
Properties
includeSatoshiChange
includeSatoshiChange: boolean;Defined in: source/invitation/interfaces.ts:311
True to add a change output for the leftover satoshis.
ChangeUnavailableReason
type ChangeUnavailableReason = "merged_commit_missing" | "insufficient_surplus" | "below_dust";Defined in: source/invitation/interfaces.ts:303
Why a merged invitation transaction cannot accept a change output right now.
DefaultPolicyTemplate
type DefaultPolicyTemplate = object;Defined in: source/interfaces.ts:114
A stored template that can back a wallet default policy, with the identifier it is stored under.
Properties
template
template: XOTemplate;Defined in: source/interfaces.ts:124
Template whose defaults define the policy.
templateIdentifier
templateIdentifier: XOTemplateIdentifier;Defined in: source/interfaces.ts:119
Identifier to pass as the policy template identifier.
ElectrumConnection
type ElectrumConnection = object;Defined in: source/network/electrum.ts:47
One Electrum server the engine connects to and the state of that connection.
Properties
chainHeight?
optional chainHeight?: number;Defined in: source/network/electrum.ts:72
Chain height the server reports.
hostIdentifier
hostIdentifier: string;Defined in: source/network/electrum.ts:52
Host and port of the server, such as electrum.imaginary.cash:50004.
isEncrypted
isEncrypted: boolean;Defined in: source/network/electrum.ts:57
Whether the connection uses TLS.
software?
optional software?: string;Defined in: source/network/electrum.ts:67
Name and version of the server software.
status
status: ElectrumConnectionStatus;Defined in: source/network/electrum.ts:62
State of the connection.
ElectrumConnectionStatus
type ElectrumConnectionStatus = ValueOf<typeof ELECTRUM_CONNECTION_STATUSES>;Defined in: source/network/electrum.ts:30
State of one Electrum connection.
EntityRolesMultipleEntry
type EntityRolesMultipleEntry = object;Defined in: source/errors/invitation.ts:76
One entity that holds more than one role with a follow up in an invitation.
Properties
entityIdentifier
entityIdentifier: XOInvitationEntityIdentifier;Defined in: source/errors/invitation.ts:81
Entity that takes the roles.
roleIdentifiers
roleIdentifiers: XOTemplateRoleIdentifier[];Defined in: source/errors/invitation.ts:86
Every role with a follow up the entity holds, in the order its commits take them.
FungibleTokenChangeSurplus
type FungibleTokenChangeSurplus = object;Defined in: source/invitation/interfaces.ts:320
One fungible token category with surplus that can be returned as change.
Properties
tokenCategory
tokenCategory: string;Defined in: source/invitation/interfaces.ts:323
Normalized lowercase token category hex.
InvitationAcceptanceParameters
type InvitationAcceptanceParameters = Omit<InvitationCreationParameters, "templateIdentifier" | "actionIdentifier">;Defined in: source/invitation/interfaces.ts:115
Parameters for accepting an invitation. The template and action come from the invitation itself.
InvitationCommitHistoryComparison
type InvitationCommitHistoryComparison = object;Defined in: source/invitation/helpers/commits.ts:6
Comparison between the locally stored invitation and incoming shared invitation JSON.
InvitationCreationParameters
type InvitationCreationParameters = InvitationParameters & object;Defined in: source/invitation/interfaces.ts:96
Parameters for creating an invitation, including the role the creating entity takes in the action.
Type Declaration
| Name | Type | Description | Defined in |
|---|---|---|---|
intent? | XOTemplateActionIntent | Intent this account acted on, such as a start entry, a follow up offered by a locking script, or a default. It must name the invitation's action. Its role is the role this account takes, and the keys in its generate list are generated as well as the ones the action role lists. | source/invitation/interfaces.ts:109 |
roleIdentifier? | XOTemplateRoleIdentifier | Role this account takes in the action, when no intent names it. The keys the role lists in its generate list are generated for this account. | source/invitation/interfaces.ts:102 |
InvitationInputSpentOutputFields
type InvitationInputSpentOutputFields = object;Defined in: source/invitation/merge/types.ts:20
Spent output value and token fields that may be recorded on an invitation input at runtime.
Kept in the engine package rather than on XOInvitationInput in @xo-cash/types.
InvitationInputWithSpentOutputFields
type InvitationInputWithSpentOutputFields = XOInvitationInput & InvitationInputSpentOutputFields;Defined in: source/invitation/merge/types.ts:28
Invitation input that may also carry spent output value and token metadata.
InvitationItemFieldConflict
type InvitationItemFieldConflict = object;Defined in: source/errors/invitation.ts:19
One field that a later commit tried to set after an earlier commit already committed a value for it.
Properties
earlierCommitIdentifier
earlierCommitIdentifier: XOInvitationCommitIdentifier;Defined in: source/errors/invitation.ts:39
Commit that set the field first.
fieldName
fieldName: string;Defined in: source/errors/invitation.ts:29
Name of the conflicting field.
fundingItemKey
fundingItemKey: string;Defined in: source/errors/invitation.ts:34
Commit identifier and position of the funding item that introduced the input or output.
itemType
itemType: "input" | "output";Defined in: source/errors/invitation.ts:24
Whether the conflicting field belongs to an input or an output.
laterCommitIdentifier
laterCommitIdentifier: XOInvitationCommitIdentifier;Defined in: source/errors/invitation.ts:44
Commit that tried to set the field again.
InvitationMissingParticipant
type InvitationMissingParticipant = object;Defined in: source/invitation/interfaces.ts:254
A role of the action that fewer entities have taken than the action requires.
Properties
filledSlots
filledSlots: number;Defined in: source/invitation/interfaces.ts:264
Number of entities that have taken the role so far.
maximumSlots
maximumSlots: number | undefined;Defined in: source/invitation/interfaces.ts:274
Maximum number of entities the role takes, or undefined when it takes any number.
minimumSlots
minimumSlots: number;Defined in: source/invitation/interfaces.ts:269
Minimum number of entities the action requires for the role.
roleIdentifier
roleIdentifier: XOTemplateRoleIdentifier;Defined in: source/invitation/interfaces.ts:259
Role that is waiting for an entity to join the invitation with it.
InvitationRequirementFieldName
type InvitationRequirementFieldName = ValueOf<typeof INVITATION_REQUIREMENT_FIELD_NAMES>;Defined in: source/defaults.ts:99
Union of requirement field name strings on an invitation requirements object.
InvitationRequirementIdentifierLists
type InvitationRequirementIdentifierLists = InvitationRoleRequirementIdentifierLists & object;Defined in: source/invitation/interfaces.ts:401
Identifier lists for invitation requirements. Template and invitation listing APIs compare by identifier strings, not full commit items.
Type Declaration
| Name | Type | Defined in |
|---|---|---|
roles? | Record<XOTemplateRoleIdentifier, InvitationRoleRequirementIdentifierLists> | source/invitation/interfaces.ts:402 |
InvitationResolutionRequirements
type InvitationResolutionRequirements = object;Defined in: source/invitation/interfaces.ts:233
The key operations a script needs from participants, grouped by who still has to provide them.
Properties
missingIdentifiers
missingIdentifiers: XOInvitationResolutionIdentifier[];Defined in: source/invitation/interfaces.ts:248
Identifiers other participants have not provided yet.
ownResolutions
ownResolutions: XOInvitationResolution[];Defined in: source/invitation/interfaces.ts:243
Values resolved from this account's keys that the invitation does not hold yet.
providedIdentifiers
providedIdentifiers: XOInvitationResolutionIdentifier[];Defined in: source/invitation/interfaces.ts:238
Identifiers the invitation already holds a value for.
InvitationRoleRequirementIdentifierLists
type InvitationRoleRequirementIdentifierLists = object;Defined in: source/invitation/interfaces.ts:391
Identifier lists for a single role's invitation requirements.
InvitationTransactionBroadcastedResultInput
type InvitationTransactionBroadcastedResultInput = XOInvitationTransactionBroadcastDetails;Defined in: source/invitation/interfaces.ts:191
Fields accepted when recording that an invitation transaction was broadcast.
InvitationTransactionCreatedResultInput
type InvitationTransactionCreatedResultInput = Pick<XOInvitationTransactionResult,
| "transactionHash"
| "createdAtTimestamp"
| "createdByEntityIdentifier"
| "createdBySignature">;Defined in: source/invitation/interfaces.ts:183
Fields accepted when recording that an invitation transaction was created.
MergedInvitation
type MergedInvitation = object;Defined in: source/invitation/merge/types.ts:45
The final resultant of merging invitation commits. Each input and output carries the identifier of the commit that last wrote it.
MergedInvitationChange
type MergedInvitationChange = object;Defined in: source/invitation/change/derive.ts:26
Leftover satoshi and fungible tokens.
Properties
tokens
tokens: OutputToken[];Defined in: source/invitation/change/derive.ts:36
Leftover fungible tokens.
valueSatoshis
valueSatoshis: bigint;Defined in: source/invitation/change/derive.ts:31
Leftover satoshis. This remainder is the fee until a change output takes part of it.
MergedInvitationInput
type MergedInvitationInput = InvitationInputWithSpentOutputFields & object;Defined in: source/invitation/merge/types.ts:34
A merged input enriched with the identifier of the commit that last wrote to it. When a later commit extends an earlier one via mergesWith, the extending commit's identifier is used.
Type Declaration
| Name | Type | Defined in |
|---|---|---|
sourceCommitIdentifier | XOInvitationCommitIdentifier | source/invitation/merge/types.ts:34 |
MergedInvitationOutput
type MergedInvitationOutput = XOInvitationOutput & object;Defined in: source/invitation/merge/types.ts:39
A merged output enriched with the identifier of the commit that last wrote to it.
Type Declaration
| Name | Type | Defined in |
|---|---|---|
sourceCommitIdentifier | XOInvitationCommitIdentifier | source/invitation/merge/types.ts:39 |
RoleVariableEntityMismatch
type RoleVariableEntityMismatch = object;Defined in: source/errors/invitation.ts:50
One variable a commit provides for roles its entity does not hold.
Properties
commitIdentifier
commitIdentifier: XOInvitationCommitIdentifier;Defined in: source/errors/invitation.ts:55
Commit that provides the variable.
entityIdentifier
entityIdentifier: XOInvitationEntityIdentifier;Defined in: source/errors/invitation.ts:60
Entity that made the commit.
roleIdentifiers
roleIdentifiers: XOTemplateRoleIdentifier[];Defined in: source/errors/invitation.ts:70
Roles the variable belongs to, each taken by other entities.
variableIdentifier
variableIdentifier: XOTemplateVariableIdentifier;Defined in: source/errors/invitation.ts:65
Variable the commit provides.
XONetwork
type XONetwork = ValueOf<typeof XO_SUPPORTED_NETWORKS>;Defined in: source/defaults.ts:122
One supported network.
appendOwnOutputResolutions
const appendOwnOutputResolutions: (context, invitationIdentifier, outputIdentifier, roleIdentifier?) => Promise<StoredInvitation>;Defined in: source/invitation/generation/locking-bytecode.ts:190
Adds the key operations this account resolved for an invitation output to the invitation, so other participants can compile the same locking script.
Only values the invitation does not hold yet are added, in one commit. Use listOutputResolutions first to check that there is something to add.
Parameters
| Parameter | Type | Description |
|---|---|---|
context | Required<AccountContext> | State, signing, and network for this account. |
invitationIdentifier | XOInvitationIdentifier | Invitation the output belongs to. |
outputIdentifier | XOTemplateOutputIdentifier | Template output whose locking script the values are for. |
roleIdentifier? | XOTemplateRoleIdentifier | Role on the output, when one is set. |
Returns
Promise<StoredInvitation>
- The invitation as stored after the commit with the values.
Throws
OutputOwnResolutionsNotFoundError - If this account resolved nothing the invitation does not already hold.
Throws
InvitationNotFoundInStoreError - If the invitation is not found in the store.
Throws
TemplateOutputNotFoundError - If the template does not define the output.
Throws
TemplateLockingScriptRoleNotFoundError - If the role is not defined on the output's locking script.
Throws
LockingScriptSecretsNotFoundError - If the locking script uses secrets this account has not generated for the invitation.
Throws
LockingBytecodeGenerationFailedError - If the locking script fails to compile for a reason other than a missing identifier.
Throws
SecretDataNotFoundError - If a secret recorded for this invitation is not in the secret store.
applyInvitationTransactionResultToInvitation
const applyInvitationTransactionResultToInvitation: (invitation, transactionIdentifier, transactionResult) => XOInvitation;Defined in: source/invitation/helpers/transaction-result.ts:70
Attaches one transaction result to an invitation under result.transactions.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | Invitation to update. |
transactionIdentifier | XOTemplateTransactionIdentifier | Template transaction identifier for the action. |
transactionResult | XOInvitationTransactionResult | Transaction result to store. |
Returns
- Invitation with the transaction result merged into
result.
assertCommitsDoNotChangeCommittedFields
const assertCommitsDoNotChangeCommittedFields: (invitation) => void;Defined in: source/invitation/validation/committed-fields.ts:127
Checks that no commit changes a value an earlier commit already set on the same input or output.
The merge keeps the earliest value and ignores a changed one, so a changed value never takes effect. Rejecting it before the commit is stored surfaces the defect, and keeps an invitation free of commits whose values are ignored. A later commit may still fill an unset field or repeat a value that is already set.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | Invitation whose commits are checked in stored order, including the commit being added. |
Returns
void
Throws
CommitIdentifierDuplicatedError - When a commit identifier appears more than once.
Throws
ParentCommitNotFoundError - When a commit names a previous commit that is not in the invitation.
Throws
CommitChainOrderInvalidError - When a commit does not name the commit stored before it.
Throws
MergesWithCommitNotFoundError - When a mergesWith reference names a missing commit.
Throws
MergesWithCommitNotEarlierError - When a mergesWith reference names the same commit or a later one.
Throws
CommitItemNotFoundError - When a mergesWith reference points at an item that does not exist.
Throws
InvitationItemFieldConflictError - When any commit changes a value an earlier commit set.
assertEntityFollowUpRoles
const assertEntityFollowUpRoles: (invitation, template) => void;Defined in: source/invitation/validation/follow-up-roles.ts:21
Checks that no entity in an invitation holds more than one role with a follow up.
Any role identifier in a commit means its entity joins as that role, whether the commit names the role in its data or tags a variable, input, output, or resolution with it. An entity may hold several roles, but at most one of them may have a follow up in the outputs the action produces, so every produced output has one role that decides what happens with it next.
Allowing a single account to hold more than one role with a follow up is not supported yet.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | Invitation whose commits are checked, including the commits being added. |
template | XOTemplate | Template that defines the invitation action and the locking scripts of its outputs. |
Returns
void
Throws
TemplateActionNotFoundError - When the template does not define the invitation action.
Throws
EntityMultipleRolesWithFollowUpUnsupportedError - When an entity holds more than one role with a follow up.
assertRoleVariablesProvidedByRoleEntities
const assertRoleVariablesProvidedByRoleEntities: (invitation, template) => void;Defined in: source/invitation/validation/role-variables.ts:20
Checks that every variable of a role is provided by an entity holding that role.
A variable belongs to the role it is tagged with. An untagged variable belongs to every role whose requirements in the action list it. Roles are taken in commit order, and a role holds at most the maximum number of entities its slots allow, so an entity that tries to take a full role does not hold it. A commit may provide a variable of a role only when its entity holds one of the variable's roles. A variable that belongs to no role may be provided by anyone.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | Invitation whose commits are checked, including the commits being added. |
template | XOTemplate | Template that defines the invitation action, its roles, and their slots. |
Returns
void
Throws
TemplateActionNotFoundError - When the template does not define the invitation action.
Throws
RoleVariableEntityMismatchError - When a commit provides a variable of a role its entity does not hold.
buildAccountDatabaseName
const buildAccountDatabaseName: (mnemonic, network, databaseFilename?) => string;Defined in: source/network/helper.ts:80
Builds the database name used for one mnemonic on one network.
Parameters
| Parameter | Type | Description |
|---|---|---|
mnemonic | string | BIP39 mnemonic for the account. |
network | XONetwork | Engine network. |
databaseFilename? | string | Optional name that already replaces XO. |
Returns
string
- Full database name including account hash.
buildCompilerBytecodeDataFromCompilationVariables
const buildCompilerBytecodeDataFromCompilationVariables: (template, compilationVariables) => Record<
| XOTemplateVariableIdentifier
| XOTemplateConstantIdentifier, Uint8Array>;Defined in: source/compilation/template-locking-bytecode.ts:143
Builds the libauth data.bytecode map from invitation and template constant values.
Parameters
| Parameter | Type | Description |
|---|---|---|
template | XOTemplate | Imported template definition. |
compilationVariables | Record< | XOTemplateVariableIdentifier | XOTemplateConstantIdentifier, XOInvitationVariableValue> | Map built by mergeTemplateConstantsWithInvitationVariables. |
Returns
Record< | XOTemplateVariableIdentifier | XOTemplateConstantIdentifier, Uint8Array>
- Bytecode map keyed by template variable identifiers.
buildElectrumCacheDatabaseFilename
const buildElectrumCacheDatabaseFilename: (network, accountHash, databaseFilename?) => string;Defined in: source/network/helper.ts:97
Builds the Electrum cache database filename for one account on one network.
The name always includes Electrum, so it never matches the account database name built from the same database filename.
Parameters
| Parameter | Type | Description |
|---|---|---|
network | XONetwork | Engine network. |
accountHash | string | Account hash for this mnemonic. |
databaseFilename? | string | Optional name included before Electrum. |
Returns
string
- Cache database filename.
buildInvitationTransactionFromMergedCommit
const buildInvitationTransactionFromMergedCommit: (mergedCommit, template, actionIdentifier) => BuiltInvitationTransaction;Defined in: source/invitation/generation/transaction.ts:122
Encodes the merged invitation commit as a transaction and returns hex plus size metadata.
Parameters
| Parameter | Type | Description |
|---|---|---|
mergedCommit | MergedInvitation | Merged inputs and outputs from the invitation. |
template | XOTemplate | Template that defines the action transaction shape. |
actionIdentifier | XOTemplateActionIdentifier | Action used to validate that a transaction is defined. |
Returns
- Serialized transaction hex, byte length, and hash.
Throws
TemplateActionTransactionNotFoundError - When the action has no transaction definition.
Throws
MergedOutputLockingBytecodeMissingError - When an output has no locking bytecode and its template output defines no locking script.
Throws
MergedOutputLockingScriptVariablesMissingError - When an output locking script reads variables that no commit provides.
Throws
TransactionGenerationFailedError - When libauth cannot build the transaction.
buildNetworkDatabaseFilename
const buildNetworkDatabaseFilename: (network, databaseFilename?) => string;Defined in: source/network/helper.ts:68
Builds the database filename for a network.
Every network appends the network name to the provided database filename, or to XO when none is provided.
Parameters
| Parameter | Type | Description |
|---|---|---|
network | XONetwork | Engine network. |
databaseFilename? | string | Optional name included before the network name. |
Returns
string
- Database filename for the network.
combineResolutions
const combineResolutions: (earlierResolutions, laterResolutions) => XOInvitationResolution[];Defined in: source/resolutions/combine.ts:39
Combines two versions of one input's resolutions into one list.
Each entity extends the input with its own resolutions, so the later list adds the operations the earlier list does not resolve. An operation both lists resolve keeps the earlier value.
Parameters
| Parameter | Type | Description |
|---|---|---|
earlierResolutions | XOInvitationResolution[] | Resolutions of the earlier version. |
laterResolutions | XOInvitationResolution[] | Resolutions of the later version. |
Returns
- Every operation either list resolves, earlier resolutions first.
compareInvitationCommitHistories
const compareInvitationCommitHistories: (storedInvitation, incomingInvitation) => InvitationCommitHistoryComparison;Defined in: source/invitation/helpers/commits.ts:22
Compares stored and incoming commit chains for shared prefix history and appended commits.
Parameters
| Parameter | Type | Description |
|---|---|---|
storedInvitation | XOInvitation | Invitation currently in local storage. |
incomingInvitation | XOInvitation | Invitation from shared JSON or remote sync. |
Returns
InvitationCommitHistoryComparison
- Diff of the shared commit prefix and the commits that were appended.
compileLockingBytecodeFromTemplateLockingScriptIdentifier
const compileLockingBytecodeFromTemplateLockingScriptIdentifier: (template, lockingScriptIdentifier, compilationVariables) => Uint8Array;Defined in: source/compilation/template-locking-bytecode.ts:270
Compiles locking bytecode from a template locking script definition and invitation variable context.
Used when an output references a locking script by identifier rather than a CashAssembly expression on the output itself.
Parameters
| Parameter | Type | Description |
|---|---|---|
template | XOTemplate | Template whose locking scripts are compiled. |
lockingScriptIdentifier | XOTemplateLockingScriptIdentifier | Locking script identifier from the template output definition. |
compilationVariables | Record< | XOTemplateVariableIdentifier | XOTemplateConstantIdentifier, XOInvitationVariableValue> | Variable map including template constants and commit variables. |
Returns
Uint8Array
- Compiled locking bytecode bytes for the merged output.
Throws
LockingScriptCompilationFailedError - When Libauth compilation of the locking script fails.
completeMergedInput
const completeMergedInput: (input, template?, actionIdentifier?) => InvitationInputWithSpentOutputFields;Defined in: source/invitation/merge/complete.ts:78
Completes one merged input with the values its commits left unset.
The transaction index comes from the template when the input fills a template input. Libauth reads the sequence number and the unlocking script length of every input, so a missing sequence number becomes DEFAULT_SEQUENCE_NUMBER, meaning no relative locktime, and a missing unlocking script becomes PLACEHOLDER_UNLOCKING_BYTECODE, so the transaction can be built before that signature exists.
Parameters
| Parameter | Type | Description |
|---|---|---|
input | InvitationInputWithSpentOutputFields | Merged input. |
template? | XOTemplate | Template used to resolve the transaction index from inputIndex. |
actionIdentifier? | string | Invitation action whose transaction definition supplies inputIndex. |
Returns
InvitationInputWithSpentOutputFields
- Input with the template transaction index and the defaults applied.
completeMergedOutput
const completeMergedOutput: (output, outputIndex, variables, template, actionIdentifier) => XOInvitationOutput;Defined in: source/invitation/merge/complete.ts:158
Completes one merged output with the values its commits left unset.
Outputs without an output identifier keep the fields already on the commit, and only their token is completed. When an identifier is present, the locking bytecode, value, token, and transaction index the commits left unset are taken from the template and the merged variables. When the template locking script reads a variable that no commit provides yet, the locking bytecode stays unset.
Parameters
| Parameter | Type | Description |
|---|---|---|
output | MergedInvitationOutput | Merged output, including an output that only names a template slot. |
outputIndex | number | Position of the output in the merged output list. |
variables | XOInvitationVariable[] | Merged invitation variables used to evaluate CashAssembly. |
template | XOTemplate | Template that defines output locking scripts. |
actionIdentifier | string | Invitation action whose transaction definition supplies the output index. |
Returns
- Output with the template values and a complete token applied.
Throws
CommitTokenCategoryMissingError - When a token the commit supplies has no category.
Throws
CommitTokenNftCapabilityMissingError - When an NFT the commit supplies has no capability.
DEFAULT_ACCOUNT_DATABASE_FILENAME
const DEFAULT_ACCOUNT_DATABASE_FILENAME: "XO" = "XO";Defined in: source/defaults.ts:132
Base database name matching State when databaseFilename is omitted.
DEFAULT_COMMIT_EXPIRATION_IN_MILLISECONDS
const DEFAULT_COMMIT_EXPIRATION_IN_MILLISECONDS: number;Defined in: source/defaults.ts:12
When an entity opts to participate in an invitation, it reserves resources (e.g., UTXOs) that would otherwise be available to other invitations. To prevent resources from remaining locked indefinitely, each reservation requires an expiration time, after which the resources can be released.
By default, the expiration time is set to 5 hour.
DEFAULT_ELECTRUM_APPLICATION_IDENTIFIER
const DEFAULT_ELECTRUM_APPLICATION_IDENTIFIER: "xo" = "xo";Defined in: source/defaults.ts:54
The default electrum application identifier.
DEFAULT_ELECTRUM_CACHE_DATABASE_FILENAME
const DEFAULT_ELECTRUM_CACHE_DATABASE_FILENAME: "Electrum" = "Electrum";Defined in: source/defaults.ts:137
Name that sets the Electrum cache database apart from the account database.
DEFAULT_FEE_SATOSHIS_PER_INPUT
const DEFAULT_FEE_SATOSHIS_PER_INPUT: 160 = 160;Defined in: source/defaults.ts:69
Default value of per input fee to help in estimation of the transaction fee.
DEFAULT_FEE_SATOSHIS_PER_OUTPUT
const DEFAULT_FEE_SATOSHIS_PER_OUTPUT: 120 = 120;Defined in: source/defaults.ts:74
Default value of per output fee to help in estimation of the transaction fee.
DEFAULT_LOCKTIME
const DEFAULT_LOCKTIME: 0 = 0;Defined in: source/defaults.ts:27
The default locktime is 0, which means the transaction is valid in any block and has no absolute locktime constraint.
DEFAULT_SEQUENCE_NUMBER
const DEFAULT_SEQUENCE_NUMBER: 0 = 0;Defined in: source/defaults.ts:22
The default sequence number is 0, which disables relative locktime on the input.
DEFAULT_STORAGE_TYPE
const DEFAULT_STORAGE_TYPE: INDEXEDDB = StorageType.INDEXEDDB;Defined in: source/defaults.ts:17
The default storage backend is IndexedDB.
DEFAULT_VERSION
const DEFAULT_VERSION: 2 = 2;Defined in: source/defaults.ts:32
The default transaction version is 2.
DEFAULT_XO_NETWORK
const DEFAULT_XO_NETWORK: XONetwork;Defined in: source/defaults.ts:127
Network used when XOEngineOptions.network is omitted.
DUST_LIMIT_SATOSHIS
const DUST_LIMIT_SATOSHIS: 546 = 546;Defined in: source/defaults.ts:59
Minimum output value the engine treats as spendable change (BCH dust limit).
ELECTRUM_CONNECTION_STATUSES
const ELECTRUM_CONNECTION_STATUSES: object;Defined in: source/network/electrum.ts:18
Names of the states an Electrum connection can be in.
Type Declaration
| Name | Type | Defined in |
|---|---|---|
connected | "connected" | @xo-cash/engine/dist/index.d.mts:503 |
connecting | "connecting" | @xo-cash/engine/dist/index.d.mts:505 |
disconnected | "disconnected" | source/network/electrum.ts:18 |
disconnecting | "disconnecting" | @xo-cash/engine/dist/index.d.mts:504 |
reconnecting | "reconnecting" | @xo-cash/engine/dist/index.d.mts:506 |
unrecoverable | "unrecoverable" | @xo-cash/engine/dist/index.d.mts:507 |
EMPTY_BYTECODE
const EMPTY_BYTECODE: Uint8Array<ArrayBuffer>;Defined in: source/defaults.ts:37
Empty bytecode used when a token category, NFT commitment, unlocking placeholder, or similar byte field has no value yet.
encodeMergedInvitationTransaction
const encodeMergedInvitationTransaction: (mergedCommit, template, actionIdentifier) => Uint8Array;Defined in: source/invitation/generation/transaction.ts:39
Encodes the merged invitation as a libauth transaction for size and hash measurement.
Parameters
| Parameter | Type | Description |
|---|---|---|
mergedCommit | MergedInvitation | Merged commit whose inputs and outputs are encoded. |
template | XOTemplate | Template that defines the action. |
actionIdentifier | XOTemplateActionIdentifier | Action the transaction is built for, used to complete outputs without locking bytecode. |
Returns
Uint8Array
- Serialized transaction bytes.
Throws
TemplateActionNotFoundError - When the action is not on the template.
Throws
TemplateActionTransactionNotFoundError - When the action has no transaction definition.
Throws
MergedOutputLockingBytecodeMissingError - When an output has no locking bytecode and its template output defines no locking script.
Throws
MergedOutputLockingScriptVariablesMissingError - When an output locking script reads variables that no commit provides.
Throws
TransactionGenerationFailedError - When libauth cannot build the transaction.
executeAction
const executeAction: (context, invitationIdentifier, params) => Promise<ExecuteActionResult>;Defined in: source/invitation/participation/execute.ts:198
Executes an action for a given invitation.
Parameters
| Parameter | Type | Description |
|---|---|---|
context | Required<AccountContext> | State, signing, and network for this account. |
invitationIdentifier | XOInvitationIdentifier | The identifier of the invitation whose action to execute. |
params | ExecuteActionParameters | Parameters for executing the action. |
Returns
Promise<ExecuteActionResult>
- Encoded transaction metadata and the persisted invitation.
Throws
InvitationNotFoundInStoreError - If the invitation is not found in the store.
Throws
TemplateNotFoundInStoreError - If the invitation's template is not found in the store.
Throws
TransactionResultAlreadyExistsError - If a different transaction was already recorded for the action.
Throws
TransactionBroadcastFailedError - If the network rejects the transaction.
Throws
TransactionResultNotFoundError - If the created result is missing when the broadcast is recorded.
Throws
MergedOutputLockingBytecodeMissingError - When an output has no locking bytecode and its template output defines no locking script.
Throws
MergedOutputLockingScriptVariablesMissingError - When an output locking script reads variables that no commit provides.
fetchDecodedTransactionOutput
const fetchDecodedTransactionOutput: (transactionHash, outputIndex) => Promise<Output>;Defined in: source/network/electrum.ts:83
Decodes one output from a transaction loaded through Electrum.
Parameters
| Parameter | Type | Description |
|---|---|---|
transactionHash | TransactionHash | Parent transaction id in Electrum hex form. |
outputIndex | number | Output index in the decoded transaction. |
Returns
Promise<Output>
- Decoded libauth output.
Throws
TransactionOutputNotFoundError - When the output index is missing.
fetchScriptHashUnspentOutputs
const fetchScriptHashUnspentOutputs: (scriptHash) => Promise<ScriptHashListUnspentResponse>;Defined in: source/network/electrum.ts:158
Fetches unspent outputs for a script hash, including CashToken unspent outputs.
Parameters
| Parameter | Type | Description |
|---|---|---|
scriptHash | string | Script hash to query. |
Returns
Promise<ScriptHashListUnspentResponse>
- Unspent outputs for the script hash.
fetchUnspentOutputsForLockingBytecode
const fetchUnspentOutputsForLockingBytecode: (lockingBytecode, templateIdentifier) => Promise<UnspentOutputData[]>;Defined in: source/network/electrum.ts:175
Fetches unspent outputs for a locking bytecode from Electrum.
Results are not stored. Tracking a locking script still goes through registration with a real template output identifier.
Parameters
| Parameter | Type | Description |
|---|---|---|
lockingBytecode | string | Locking bytecode as hexadecimal. |
templateIdentifier | XOTemplateIdentifier | Template that produced the locking bytecode. |
Returns
Promise<UnspentOutputData[]>
- Unspent outputs for the locking bytecode.
findEntityLockingScriptRole
const findEntityLockingScriptRole: (invitation, template, entityIdentifier, lockingScriptIdentifier) =>
| XOTemplateRoleIdentifier
| undefined;Defined in: source/invitation/helpers/roles.ts:171
Finds the role an entity holds in an invitation that a locking script declares.
An output added without a role is built for the role its entity already holds, when the output's locking script declares exactly one of the entity's roles. That role decides the keys the script is built with and the follow up stored for it.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | Invitation whose commits give the entity its roles. |
template | XOTemplate | Template that defines the invitation action and the locking script. |
entityIdentifier | XOInvitationEntityIdentifier | Entity whose role is looked up. |
lockingScriptIdentifier | XOTemplateLockingScriptIdentifier | Locking script whose declared roles are read. |
Returns
| XOTemplateRoleIdentifier | undefined
- The one role the entity holds that the locking script declares, or undefined when there is none or more than one.
Throws
TemplateActionNotFoundError - When the template does not define the invitation action.
findRootCommitIdentifierInInvitation
const findRootCommitIdentifierInInvitation: (invitation, entityIdentifier) =>
| XOInvitationCommitIdentifier
| undefined;Defined in: source/invitation/helpers/commits.ts:68
Finds the root commit identifier for a given entity in an invitation. The root commit is the first commit the entity added to the invitation.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | The invitation whose commits are searched. |
entityIdentifier | XOInvitationEntityIdentifier | The entity identifier to search for among the invitation commits. |
Returns
| XOInvitationCommitIdentifier | undefined
- The root commit identifier if the entity has a commit in the invitation, otherwise undefined.
generateCommitIdentifier
const generateCommitIdentifier: () => XOInvitationCommitIdentifier;Defined in: source/invitation/helpers/identifiers.ts:27
Generates a random commit identifier from COMMIT_IDENTIFIER_BYTE_LENGTH random bytes.
Returns
- The generated commit identifier as a hex string.
Throws
CommitIdentifierAllZeroesError - If the random bytes are all zeroes.
Throws
CommitIdentifierMaximumError - If the random bytes are all 0xFF.
Throws
- If generateRandomBytes rejects the environment cryptographically secure pseudo-random number generator.
generateInvitationIdentifier
const generateInvitationIdentifier: () => XOInvitationIdentifier;Defined in: source/invitation/helpers/identifiers.ts:13
Generates a random invitation identifier from INVITATION_IDENTIFIER_BYTE_LENGTH random bytes.
Returns
- The generated invitation identifier as a hex string.
Throws
InvitationIdentifierAllZeroesError - If the random bytes are all zeroes.
Throws
InvitationIdentifierMaximumError - If the random bytes are all 0xFF.
Throws
- If generateRandomBytes rejects the environment cryptographically secure pseudo-random number generator.
getInvitationTransactionHash
const getInvitationTransactionHash: (invitation, transactionIdentifier) =>
| XOInvitationTransactionHash
| undefined;Defined in: source/invitation/helpers/transaction-result.ts:23
Reads the persisted transaction hash for one template transaction.
Write paths construct TransactionHash before persist, so a stored hash is already valid.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | Invitation that may store the hash under result.transactions. |
transactionIdentifier | XOTemplateTransactionIdentifier | Template transaction identifier for the action. |
Returns
| XOInvitationTransactionHash | undefined
- Transaction hash when present, otherwise undefined.
getTemplateActionOrThrow
const getTemplateActionOrThrow: (template, actionIdentifier) => XOTemplateAction;Defined in: source/template.ts:170
Returns an action definition by identifier.
Parameters
| Parameter | Type | Description |
|---|---|---|
template | XOTemplate | Template whose actions are searched. |
actionIdentifier | XOTemplateActionIdentifier | Action identifier to look up. |
Returns
- Action definition for that identifier.
Throws
TemplateActionNotFoundError - When the action is absent from the template.
getTemplateActionTransactionIdentifierOrThrow
const getTemplateActionTransactionIdentifierOrThrow: (template, actionIdentifier) => XOTemplateTransactionIdentifier;Defined in: source/template.ts:191
Returns the transaction identifier an action names.
Parameters
| Parameter | Type | Description |
|---|---|---|
template | XOTemplate | Template that defines the action. |
actionIdentifier | XOTemplateActionIdentifier | Action whose transaction is read. |
Returns
XOTemplateTransactionIdentifier
- Transaction identifier the action names.
Throws
TemplateActionNotFoundError - When the action is absent from the template.
Throws
TemplateActionTransactionNotFoundError - When the action names no transaction.
getTemplateLockingScriptIdentifierOrThrow
const getTemplateLockingScriptIdentifierOrThrow: (template, outputIdentifier) => XOTemplateLockingScriptIdentifier;Defined in: source/template.ts:58
Returns the locking script identifier declared on an output.
Parameters
| Parameter | Type | Description |
|---|---|---|
template | XOTemplate | Template whose outputs are searched. |
outputIdentifier | XOTemplateOutputIdentifier | Output whose locking script is read. |
Returns
XOTemplateLockingScriptIdentifier
- Locking script identifier on that output.
Throws
TemplateOutputNotFoundError - When the output is absent from the template.
Throws
TemplateOutputLockingScriptNotFoundError - When the output has no locking script reference.
getTemplateLockingScriptOrThrow
const getTemplateLockingScriptOrThrow: (template, lockingScriptIdentifier) => XOTemplateLockingScript;Defined in: source/template.ts:83
Returns a locking script definition by identifier.
Parameters
| Parameter | Type | Description |
|---|---|---|
template | XOTemplate | Template whose locking scripts are searched. |
lockingScriptIdentifier | XOTemplateLockingScriptIdentifier | Locking script identifier to look up. |
Returns
- Locking script definition for that identifier.
Throws
TemplateLockingScriptNotFoundError - When the locking script is absent from the template.
Throws
TemplateLockingScriptTypeNotFoundError - When the locking script omits lockingType.
getTemplateOutputOrThrow
const getTemplateOutputOrThrow: (template, outputIdentifier) => XOTemplateOutput;Defined in: source/template.ts:38
Returns an output definition by identifier.
Parameters
| Parameter | Type | Description |
|---|---|---|
template | XOTemplate | Template whose outputs are searched. |
outputIdentifier | XOTemplateOutputIdentifier | Output identifier to look up. |
Returns
- Output definition for that identifier.
Throws
TemplateOutputNotFoundError - When the output is absent from the template.
getTemplateRoleOrThrow
const getTemplateRoleOrThrow: (template, lockingScriptIdentifier, roleIdentifier) => XOTemplateLockingScriptRole;Defined in: source/template.ts:112
Returns a role definition on a locking script.
Parameters
| Parameter | Type | Description |
|---|---|---|
template | XOTemplate | Template whose locking scripts are searched. |
lockingScriptIdentifier | XOTemplateLockingScriptIdentifier | Locking script that owns the role. |
roleIdentifier | XOTemplateRoleIdentifier | Role identifier to look up. |
Returns
- Role definition on that locking script.
Throws
TemplateLockingScriptNotFoundError - When the locking script is absent from the template.
Throws
TemplateLockingScriptRoleNotFoundError - When the role is absent from the locking script.
getTemplateTransactionOrThrow
const getTemplateTransactionOrThrow: (template, transactionIdentifier) => XOTemplateTransaction;Defined in: source/template.ts:237
Returns a transaction definition by identifier.
Parameters
| Parameter | Type | Description |
|---|---|---|
template | XOTemplate | Template whose transactions are searched. |
transactionIdentifier | XOTemplateTransactionIdentifier | Transaction identifier to look up. |
Returns
- Transaction definition for that identifier.
Throws
TemplateTransactionNotFoundError - When the transaction is absent from the template.
INVITATION_REQUIREMENT_FIELD_NAME_LIST
const INVITATION_REQUIREMENT_FIELD_NAME_LIST: readonly InvitationRequirementFieldName[];Defined in: source/defaults.ts:104
Requirement field names in iteration order for template and commit requirement scans.
INVITATION_REQUIREMENT_FIELD_NAMES
const INVITATION_REQUIREMENT_FIELD_NAMES: object;Defined in: source/defaults.ts:90
Requirement field names on an invitation requirements object. Used to iterate over variables, inputs, and outputs in a consistent order.
Type Declaration
| Name | Type | Defined in |
|---|---|---|
inputs | "inputs" | @xo-cash/engine/dist/index.d.mts:84 |
outputs | "outputs" | @xo-cash/engine/dist/index.d.mts:85 |
variables | "variables" | source/defaults.ts:90 |
isInvitationTransactionCreatedResultComplete
const isInvitationTransactionCreatedResultComplete: (invitationIdentifier, transactionResult) => boolean;Defined in: source/invitation/helpers/transaction-result.ts:38
Returns true when a stored transaction created result has a verifiable Schnorr signature.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitationIdentifier | XOInvitationIdentifier | Invitation that owns the transaction result. |
transactionResult | XOInvitationTransactionResult | Transaction result to inspect. |
Returns
boolean
- Whether the created result is complete enough to treat as persisted execution output.
isInvitationTransactionHashOnlyUpdate
const isInvitationTransactionHashOnlyUpdate: (storedInvitation, incomingInvitation, template, invitationCommitHistoryComparison) => boolean;Defined in: source/invitation/helpers/transaction-result.ts:96
Returns true when an update changes only the persisted transaction hash and leaves commit history unchanged.
Parameters
| Parameter | Type | Description |
|---|---|---|
storedInvitation | XOInvitation | Invitation currently in local storage. |
incomingInvitation | XOInvitation | Invitation from shared JSON or remote sync. |
template | XOTemplate | Template that defines the action transaction key. |
invitationCommitHistoryComparison | InvitationCommitHistoryComparison | Commit history diff from compareInvitationCommitHistories. |
Returns
boolean
- Whether validation can be skipped for a hash only write.
isLibauthKeyTemplateVariable
const isLibauthKeyTemplateVariable: (variableIdentifier, templateSecretIdentifiers, variableDefinition?) => boolean;Defined in: source/compilation/libauth-utils.ts:119
Returns whether a template variable should compile as a Libauth Key.
Prefers an explicit private_key type. Also treats locking script secrets as Key so older stored templates without a type still unlock with data.keys instead of WalletData bytecode.
Parameters
| Parameter | Type | Description |
|---|---|---|
variableIdentifier | string | Variable or secret identifier. |
templateSecretIdentifiers | Set<string> | Secrets from listTemplateSecretIdentifiers. |
variableDefinition? | XOTemplateVariable | Template variable when present. |
Returns
boolean
- True when Libauth must resolve this identifier through private keys.
isUnlockingBytecodeMissingOrPlaceholder
const isUnlockingBytecodeMissingOrPlaceholder: (unlockingBytecode) => boolean;Defined in: source/invitation/merge/merge-commits.ts:120
Returns true when unlocking bytecode is absent or still the merge placeholder.
Parameters
| Parameter | Type | Description |
|---|---|---|
unlockingBytecode | MergedInvitationInput["unlockingBytecode"] | Unlocking script on a merged input. |
Returns
boolean
- True when the input is not signed yet.
isXOSupportedNetwork
const isXOSupportedNetwork: (value) => value is XONetwork;Defined in: source/network/helper.ts:17
Returns true when the value is a supported network.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | string | Network name to test. |
Returns
value is XONetwork
- Whether the value is a supported XONetwork.
listAvailableRolesForInvitation
const listAvailableRolesForInvitation: (invitation, action) => XOTemplateRoleIdentifier[];Defined in: source/invitation/requirements/roles.ts:55
Lists role identifiers for roles that still have capacity for additional participants. A role is considered available if the number of distinct entities that have filled it is less than the role's maximum slot count. If max is undefined, the role has unlimited capacity.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | The invitation object to check for available roles. |
action | XOTemplateAction | The template action being analyzed to determine which roles are expected. |
Returns
- Role identifiers for roles that can still accept participants. Returns an empty array if no roles are defined in the action.
listCommitRoleIdentifiers
const listCommitRoleIdentifiers: (commit) => Set<XOTemplateRoleIdentifier>;Defined in: source/invitation/helpers/roles.ts:23
Lists the roles a commit takes for its entity.
A commit takes a role when it names the role in its data, or when it tags a variable, input, output, or resolution with the role. This is the same rule the slot count of a role uses.
Parameters
| Parameter | Type | Description |
|---|---|---|
commit | XOInvitationCommit | Commit whose roles are read. |
Returns
- Every role the commit takes.
listCommitsForEntity
const listCommitsForEntity: (invitation, entityIdentifier) => XOInvitationCommit[];Defined in: source/invitation/helpers/commits.ts:91
Finds all commits in the invitation that were made by the specified entity. The returned array preserves the original commit order.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | The invitation to examine. |
entityIdentifier | XOInvitationEntityIdentifier | The entity whose commits should be returned. |
Returns
- Commits that belong to the entity, in the order they appear in the invitation.
listElectrumConnections
const listElectrumConnections: () => ElectrumConnection[];Defined in: source/network/electrum.ts:203
Lists every Electrum server the engine connects to, with the state of each connection.
Returns
- One entry per Electrum client, empty before Electrum is initialized.
listFollowUpRoleIdentifiers
const listFollowUpRoleIdentifiers: (template, actionIdentifier) => Set<XOTemplateRoleIdentifier>;Defined in: source/invitation/helpers/roles.ts:132
Lists the roles that have a follow up in the outputs an action produces.
A locking script names, for each role it declares, what that role does with an output locked to it, such as the state it saves, the actions it can take next, and how the output counts toward its balance. A role has a follow up when the locking script of any output in the action's transaction declares it. An output whose locking script is a CashAssembly expression declares no roles.
Parameters
| Parameter | Type | Description |
|---|---|---|
template | XOTemplate | Template that defines the action, its transaction, outputs, and locking scripts. |
actionIdentifier | XOTemplateActionIdentifier | Action whose produced outputs are read. |
Returns
- Roles declared by a locking script of the action's outputs.
Throws
TemplateActionNotFoundError - When the template does not define the action.
listInputsMissingSignatures
const listInputsMissingSignatures: (invitation, template) => InvitationInputMissingSignature[];Defined in: source/invitation/requirements/signatures.ts:18
Lists inputs that have a real UTXO outpoint committed to the invitation but no unlocking bytecode yet. These inputs have been reserved by their committing entity but have not been signed.
Detection uses the merged invitation state. An input is considered unsigned when its unlocking bytecode in the merged result is absent or is the placeholder (an empty Uint8Array). Attribution is taken directly from the sourceCommitIdentifier on each merged input.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | The invitation to examine. |
template | XOTemplate | The template for this invitation, required by the merger. |
Returns
InvitationInputMissingSignature[]
- Descriptors for each unsigned input, including which entity committed it.
listIntentRequiredVariableIdentifiers
const listIntentRequiredVariableIdentifiers: (template, intent, lockingScriptIdentifier) => XOTemplateVariableIdentifier[];Defined in: source/compilation/intent-variables.ts:144
Lists every variable a caller must provide to create a locking bytecode from an intent.
These are the variables the intent marks with a null value, plus any the target locking script needs that neither the template constants nor the intent presets supply.
Parameters
| Parameter | Type | Description |
|---|---|---|
template | XOTemplate | Template that defines the intent target. |
intent | XOTemplateIntent | Intent from the template defaults. |
lockingScriptIdentifier | XOTemplateLockingScriptIdentifier | Locking script the intent generates. |
Returns
XOTemplateVariableIdentifier[]
- Required variable identifiers, intent variables first.
Throws
TemplateLockingScriptNotFoundError - When the locking script is not defined by the template.
listInvitationContentValidationIssues
const listInvitationContentValidationIssues: (invitation, network) => Error[];Defined in: source/invitation/validation/invitation.ts:397
Runs every invitation content validation and returns all discovered errors.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | The built invitation object to validate. |
network | XONetwork | Engine network that selects xpub or tpub for entity identifiers. |
Returns
Error[]
- Every validation error found. An empty array means the invitation content is valid.
listInvitationResolutions
const listInvitationResolutions: (commits) => Record<XOInvitationResolutionIdentifier, Uint8Array>;Defined in: source/resolutions/combine.ts:12
Collects the resolutions every commit of an invitation provides in its commit data, keyed by the key operation.
These are the public keys and data signatures participants shared. When two commits resolve one operation, the earlier value is kept, the same way an earlier commit's input and output fields are kept.
Parameters
| Parameter | Type | Description |
|---|---|---|
commits | readonly XOInvitationCommit[] | Invitation commits in stored order. |
Returns
Record<XOInvitationResolutionIdentifier, Uint8Array>
- The resolved value of each key operation.
listInvitationScriptHashesToTrack
const listInvitationScriptHashesToTrack: (context, storedInvitation) => Promise<ScriptHashData[]>;Defined in: source/invitation/helpers/outputs.ts:114
Lists the outputs of an invitation that this account should start tracking.
Every participant adds outputs to an invitation in their own commits. An output another participant added can still pay to a locking script built with keys of this account. This account then has to track the script hash of that output, or it never learns about the unspent outputs the output receives and cannot spend them later. This function finds those outputs and returns their script hash data. trackInvitationScriptHashes saves and subscribes what it returns.
Every output in the data.outputs of every commit goes through the checks below, in this order. The output is returned only when it passes all of them, and the first check it fails skips it.
- The output names its template output and carries its locking bytecode. Both
outputIdentifierandlockingBytecodeare set on the commit output. Without both there is no script hash to track and no template locking script to compare with. - The output belongs to the action of the invitation. The transaction of
invitation.actionIdentifiernamesoutputIdentifier, either in its own outputs or in the outputs of one of its roles, as isActionTransactionOutput checks. An output the action does not name passes only when this account added it itself, meaningcommit.entityIdentifierequals this accountentityIdentifier. An extra output another participant appended stays with that participant. - The template output locks to a template locking script.
template.outputs[outputIdentifier].lockingScriptnames one of the locking scripts of the template. When it is a CashAssembly expression instead, such as$(<someVariable>), the output is skipped, because that script is built from variables alone and is never locked to keys of this account. - This account does not track the script hash yet. The script hash of
lockingBytecodeis not saved already, and an earlier commit output in this same call has not listed it, so each script hash is returned once. A script this account already tracks, such as one it built itself, is skipped. - The template marks the output as relevant for the role that added it. isLockingOutputRelevantForRole reads the
relevantflag for theroleIdentifierof the output, both on the template output and on the same role of the locking script. Only a booleanfalsein either place skips the output. A missing flag, or an output withoutroleIdentifier, passes. - This account rebuilds exactly the same locking bytecode. compileLockingScript compiles the template locking script with the keys this account holds for the invitation and the values other participants published as resolutions, and the result must equal
lockingBytecode. When the compile cannot finish yet, because a resolution is still missing (LockingScriptResolutionsMissingError) or the bytecode cannot be generated (LockingBytecodeGenerationFailedError), the output is skipped, and a later call checks it again. Any other compile error is thrown.
Parameters
| Parameter | Type | Description |
|---|---|---|
context | Pick<Required<AccountContext>, "state" | "crypto"> | State for the invitation and crypto that compiles a locking script. |
storedInvitation | StoredInvitation | Invitation whose outputs are checked. |
Returns
Promise<ScriptHashData[]>
- Script hash data of every output relevant to this account that is not stored yet.
Throws
TemplateNotFoundInStoreError - If the invitation template is not stored.
Throws
SecretDataNotFoundError - If a secret recorded for this invitation is not in the secret store.
Throws
InvitationResolutionIdentifierInvalidError - If a resolution is not an operation on a template key.
Throws
TemplateLockingScriptNotFoundError - If the output names a locking script that is not in the template.
Throws
TemplateLockingScriptBytecodeNotFoundError - If the locking script has no locking bytecode.
Throws
TemplateLockingScriptTypeNotFoundError - If the locking script has no locking type.
Throws
TemplateRoleRelevantCashAssemblyUnsupportedError - If relevant is a CashASM string.
Throws
TemplateActionNotFoundError - If the invitation action is not in the template.
listInvitationValidationIssues
const listInvitationValidationIssues: (invitation, template, network) => Error[];Defined in: source/invitation/validation/invitation.ts:417
Resolves the template action and collects every validation error for an invitation.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | The invitation to validate. |
template | XOTemplate | The template to validate against. |
network | XONetwork | Engine network that selects xpub or tpub for entity identifiers. |
Returns
Error[]
- Every validation error found. An empty array means the invitation content is valid.
listInvitationVariablesFromCommits
const listInvitationVariablesFromCommits: (commits, additionalVariables?) => XOInvitationVariable[];Defined in: source/compilation/template-locking-bytecode.ts:71
Collects invitation variables from stored commits and optional append parameters.
Parameters
| Parameter | Type | Description |
|---|---|---|
commits | readonly XOInvitationCommit[] | Invitation commits to read variables from. |
additionalVariables? | XOInvitationVariable[] | Extra variables mixed with variables already on commits. |
Returns
- Flat list of variables in commit order.
listMissingParticipants
const listMissingParticipants: (invitation, action) => InvitationMissingParticipant[];Defined in: source/invitation/requirements/roles.ts:85
Lists the roles of an action that fewer entities have taken than the action requires.
Each role in the action's participants needs at least its minimum number of entities before the action can complete, so a role below its minimum is waiting for someone to join the invitation with it.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | The invitation whose participants are counted. |
action | XOTemplateAction | The template action that declares the participants. |
Returns
InvitationMissingParticipant[]
- Every role below its minimum, in the order the action lists them.
listOutputResolutions
const listOutputResolutions: (context, invitationIdentifier, outputIdentifier, roleIdentifier?) => Promise<InvitationResolutionRequirements>;Defined in: source/invitation/generation/locking-bytecode.ts:149
Lists the key operations an invitation output's locking script needs from participants, without adding anything.
The output compiles with the same variables, keys, and resolutions as when it is added. Each operation is reported as provided when the invitation holds it, as this account's own when only this account's keys resolve it, or as missing when another participant holds the key. An output whose locking script is a CashAssembly expression uses no keys.
Parameters
| Parameter | Type | Description |
|---|---|---|
context | Pick<Required<AccountContext>, "state" | "crypto"> | State that stores the invitation and crypto that compiles with its keys. |
invitationIdentifier | XOInvitationIdentifier | Invitation the output belongs to. |
outputIdentifier | XOTemplateOutputIdentifier | Template output to check. |
roleIdentifier? | XOTemplateRoleIdentifier | Role on the output, when one is set. |
Returns
Promise<InvitationResolutionRequirements>
- Provided identifiers, values this account can add, and identifiers others still owe.
Throws
InvitationNotFoundInStoreError - If the invitation is not found in the store.
Throws
TemplateOutputNotFoundError - If the template does not define the output.
Throws
TemplateLockingScriptRoleNotFoundError - If the role is not defined on the output's locking script.
Throws
LockingScriptSecretsNotFoundError - If the locking script uses secrets this account has not generated for the invitation.
Throws
LockingBytecodeGenerationFailedError - If the locking script fails to compile for a reason other than a missing identifier.
Throws
SecretDataNotFoundError - If a secret recorded for this invitation is not in the secret store.
listPopulatedRequirementsInInvitation
const listPopulatedRequirementsInInvitation: (invitation) => InvitationRequirementIdentifierLists;Defined in: source/invitation/requirements/template.ts:334
Lists all requirements that have been populated in the invitation by examining all commits. Extracts variable, input, and output identifiers from all commits in the invitation and organizes them into top-level and role-specific requirements.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | The invitation object to analyze for populated requirements. |
Returns
InvitationRequirementIdentifierLists
- An object containing all populated requirements found in the invitation's commits, including top-level requirements and role-specific requirements. Only includes roles that have at least one requirement populated.
listRequirementIdentifiersAcrossRoles
const listRequirementIdentifiersAcrossRoles: (requirements, requirementFieldName) => InvitationRequirementIdentifier[];Defined in: source/invitation/requirements/template.ts:52
Unions requirement identifiers from the top level and every role for one field kind.
Template actions may list a requirement at the top level while commits store it under a role bucket. Missing requirement checks and unexpected requirement checks both need the same union so populated ids are recognized when they appear anywhere in the structure.
Parameters
| Parameter | Type | Description |
|---|---|---|
requirements | InvitationRequirementIdentifierLists | Requirement lists from the template or from populated commits. |
requirementFieldName | InvitationRequirementFieldName | Which requirement list to union (variables, inputs, or outputs). |
Returns
InvitationRequirementIdentifier[]
- De duplicated identifiers from the top level list and every role list.
listRequirementsFromTemplate
const listRequirementsFromTemplate: (template, action) => InvitationRequirementIdentifierLists;Defined in: source/invitation/requirements/template.ts:144
Extracts and lists all requirements from the template and action for an invitation. Analyzes the template action to determine what variables, inputs, outputs, and role-specific requirements are needed to fulfill the action.
Parameters
| Parameter | Type | Description |
|---|---|---|
template | XOTemplate | The template. |
action | XOTemplateAction | The action that has requirements. |
Returns
InvitationRequirementIdentifierLists
- An object containing all the requirements.
Todo
Support minimum and maximum role slots.
listRoleHolderEntities
const listRoleHolderEntities: (invitation, template) => Record<XOTemplateRoleIdentifier, XOInvitationEntityIdentifier[]>;Defined in: source/invitation/helpers/roles.ts:99
Lists the entities holding each role of an invitation's action.
Roles are taken in commit order, by naming the role in the commit data or by tagging an item with it, and a role holds at most the maximum number of entities its slots allow. This is who may provide each role's variables.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | Invitation whose commits take the roles. |
template | XOTemplate | Template that defines the invitation action and its slots. |
Returns
Record<XOTemplateRoleIdentifier, XOInvitationEntityIdentifier[]>
- Entities holding each taken role, in the order they took it.
Throws
TemplateActionNotFoundError - When the template does not define the invitation action.
listTemplateActionIntents
const listTemplateActionIntents: (template) => XOTemplateActionIntent[];Defined in: source/template.ts:215
Lists one action intent for every action the template defines.
Each intent names only its action. It carries no role, constants, variables, or generate list.
Parameters
| Parameter | Type | Description |
|---|---|---|
template | XOTemplate | Template whose actions are listed. |
Returns
- One intent per action identifier, in the order the template declares them.
listTemplateSecretIdentifiers
const listTemplateSecretIdentifiers: (template) => Set<string>;Defined in: source/compilation/libauth-utils.ts:88
Collects every secret identifier declared on locking scripts and their roles.
Template variable type is optional. Secrets listed under locking script state still identify Key material for Libauth even when private_key was never stored on the variable.
Parameters
| Parameter | Type | Description |
|---|---|---|
template | XOTemplate | Template whose locking script secrets are read. |
Returns
Set<string>
- Deduplicated secret identifiers from locking script state.
listTemplateSecrets
const listTemplateSecrets: (template, lockingScriptIdentifier, roleIdentifier?) => string[];Defined in: source/template.ts:142
Returns secret identifiers tracked for a locking script or one of its roles.
Parameters
| Parameter | Type | Description |
|---|---|---|
template | XOTemplate | Template whose locking scripts are searched. |
lockingScriptIdentifier | XOTemplateLockingScriptIdentifier | Locking script whose secrets are read. |
roleIdentifier? | XOTemplateRoleIdentifier | Role whose secrets are used when provided. |
Returns
string[]
- Secret identifiers from the role or from the locking script.
Throws
TemplateLockingScriptNotFoundError - When the locking script is absent from the template.
Throws
TemplateLockingScriptRoleNotFoundError - When a role is provided but is absent.
listUnfilledRequirements
const listUnfilledRequirements: (invitation, template, action) => InvitationRequirementIdentifierLists;Defined in: source/invitation/requirements/template.ts:397
Lists all missing requirements for the invitation that have not yet been supplied. Compares the requirements expected from the template with what has been populated in the invitation to determine what is still needed.
The missing requirements are the template requirements that the invitation has not populated.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | The invitation object to check for missing requirements. |
template | XOTemplate | The template defining what requirements are expected. |
action | XOTemplateAction | The template action being analyzed to determine required requirements. |
Returns
InvitationRequirementIdentifierLists
- An object containing all missing requirements, including top-level missing requirements and role-specific missing requirements. Only includes roles that have at least one missing requirement.
listVariableIdentifiersToGenerate
const listVariableIdentifiersToGenerate: (template, actionIdentifier, roleIdentifier?, intentGenerate?) => XOTemplateVariableIdentifier[];Defined in: source/template.ts:271
Lists the variables to generate for an entity that takes part in an action.
Combines the generate list of an intent with the generate list of the action role. A variable in both, or listed twice, is one variable. The action role's list comes from the template, so an intent can add variables but never drop one the action needs.
Every variable is checked, and all variables that are not declared as private keys are reported together as private_key type is the only supported type.
Parameters
| Parameter | Type | Description |
|---|---|---|
template | XOTemplate | Template that defines the action and declares the variables. |
actionIdentifier | XOTemplateActionIdentifier | Action the entity takes part in. |
roleIdentifier? | XOTemplateRoleIdentifier | Role the entity takes, when it takes one. |
intentGenerate? | XOTemplateVariableIdentifier[] | Generate list of an intent, when one is given. |
Returns
XOTemplateVariableIdentifier[]
- Variables to generate, each listed once, empty when nothing is asked for.
Throws
TemplateActionNotFoundError - When the template does not define the action.
Throws
TemplateActionRoleNotFoundError - When the action does not define the role.
Throws
TemplateGeneratedVariableTypeUnsupportedError - When a listed variable is not declared as a private key.
mergeInvitationCommits
const mergeInvitationCommits: (invitation, template) => MergedInvitation;Defined in: source/invitation/merge/merge-commits.ts:275
Merges invitation commits and transforms it into MergedInvitation structure.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | The invitation containing commits to merge. |
template | XOTemplate | The template used for resolving output identifiers. |
Returns
- Merged invitation structure.
Throws
CommitIdentifierDuplicatedError - When a commit identifier appears more than once.
Throws
ParentCommitNotFoundError - When a commit names a previous commit that is not in the invitation.
Throws
CommitChainOrderInvalidError - When a commit does not name the commit stored before it.
Throws
InvitationVariableIdentifierInvalidError - When any variable identifier contains a dot.
Throws
TransactionVersionDuplicatedError - When more than one commit sets the transaction version.
Throws
TransactionLocktimeDuplicatedError - When more than one commit sets the transaction locktime.
Throws
MergesWithCommitNotFoundError - When a mergesWith reference names a missing commit.
Throws
MergesWithCommitNotEarlierError - When a mergesWith reference names the same commit or a later one.
Throws
CommitItemNotFoundError - When a mergesWith reference points at an item that does not exist.
Throws
TransactionIndexDuplicatedError - When two merged inputs or two merged outputs claim the same transactionIndex.
Todo
Handle different variables with the same identifier according to the minimum and maximum the template sets.
mergeInvitationTransactionHashOnlyUpdate
const mergeInvitationTransactionHashOnlyUpdate: (storedInvitation, incomingInvitation, template) => XOInvitation;Defined in: source/invitation/helpers/transaction-result.ts:142
Merges an incoming hash only update into the stored invitation result while preserving other result metadata.
A hash is written only onto an existing created result. Incomplete entity or signature placeholders are never synthesized.
Parameters
| Parameter | Type | Description |
|---|---|---|
storedInvitation | XOInvitation | Shared invitation currently in local storage. |
incomingInvitation | XOInvitation | Shared invitation carrying the new hash. |
template | XOTemplate | Template that defines the action transaction key. |
Returns
- Shared invitation ready for persistence with the updated transaction hash.
Throws
- When the incoming hash fails TransactionHash construction.
mergeTemplateConstantsWithInvitationVariables
const mergeTemplateConstantsWithInvitationVariables: (template, invitationVariables) => Record<
| XOTemplateVariableIdentifier
| XOTemplateConstantIdentifier, XOInvitationVariableValue>;Defined in: source/compilation/template-locking-bytecode.ts:34
Builds the variable map used to evaluate template CashAssembly and compile locking bytecode.
Template constant defaults are applied first. Invitation commit variables overwrite constants when identifiers collide. A constant whose value is not a string, number, bigint, or boolean is left out of the map.
Parameters
| Parameter | Type | Description |
|---|---|---|
template | XOTemplate | Imported template definition. |
invitationVariables | XOInvitationVariable[] | Variables collected from invitation commits. |
Returns
Record< | XOTemplateVariableIdentifier | XOTemplateConstantIdentifier, XOInvitationVariableValue>
- Map from identifier to value for compilation.
PLACEHOLDER_UNLOCKING_BYTECODE
const PLACEHOLDER_UNLOCKING_BYTECODE: Uint8Array<ArrayBuffer>;Defined in: source/defaults.ts:49
An empty unlocking bytecode used as a placeholder for inputs (unlockingBytecode) within an invitation. This placeholder is used when the entities responsible for signing those inputs have not yet provided their signatures for the resulting transaction.
Using a placeholder unlocking bytecode enables the engine to construct transaction structures for the libauth compiler when working on template actions, even before all participant signatures are available. This is especially helpful when invitation commits are merged, as it allows the transaction to be built and it's parts can be validated before all unlocking scripts have been provided.
readIntentVariableRequirements
const readIntentVariableRequirements: (intent) => IntentVariableRequirements;Defined in: source/compilation/intent-variables.ts:44
Reads the variables an intent declares.
An intent lists variables as single entry objects. A null value marks a variable the caller must provide when something is created from the intent. Any other value is a preset used as is.
Parameters
| Parameter | Type | Description |
|---|---|---|
intent | XOTemplateIntent | Intent from the template defaults. |
Returns
IntentVariableRequirements
- Preset values and the identifiers the caller must provide.
resolveElectrumServersForNetwork
const resolveElectrumServersForNetwork: (network) => ElectrumServersWithBlockchain;Defined in: source/network/helper.ts:46
Resolves default Electrum hosts for a network.
Each host carries the blockchain checkpoint and consensus parameters of that network.
Parameters
| Parameter | Type | Description |
|---|---|---|
network | XONetwork | Engine network. |
Returns
ElectrumServersWithBlockchain
- Server list for that network.
resolveHdKeyNetwork
const resolveHdKeyNetwork: (network) => HdKeyNetwork;Defined in: source/network/helper.ts:29
Maps an engine network to the libauth HD key network used for the purpose path and xpub or tpub encoding.
Libauth HdKeyNetwork is only mainnet or testnet. Chipnet and testnet4 are not members of that type, so both use testnet.
Parameters
| Parameter | Type | Description |
|---|---|---|
network | XONetwork | Engine network. |
Returns
HdKeyNetwork
- Mainnet encoding, or testnet encoding for chipnet and testnet4.
resolveInvitationOutputLockingBytecode
const resolveInvitationOutputLockingBytecode: (context, invitationIdentifier, outputIdentifier, roleIdentifier?) => Promise<string>;Defined in: source/invitation/generation/locking-bytecode.ts:103
Resolves the locking bytecode an invitation output compiles to, without generating or storing anything.
The locking script compiles with the template constants, the invitation variables, and the keys this account already generated for the invitation, which is what appending the output uses. It is the keyed counterpart of resolving a template output from variables alone. The script's secrets are existing secrets and are never generated for it, so a secret the invitation does not hold fails the resolution the same way adding the output would.
Parameters
| Parameter | Type | Description |
|---|---|---|
context | Pick<Required<AccountContext>, "state" | "crypto"> | State that stores the invitation and crypto that compiles with its keys. |
invitationIdentifier | XOInvitationIdentifier | Invitation the output belongs to. |
outputIdentifier | XOTemplateOutputIdentifier | Template output to resolve. |
roleIdentifier? | XOTemplateRoleIdentifier | Role on the output, when one is set. |
Returns
Promise<string>
- The locking bytecode as a hexadecimal string.
Throws
InvitationNotFoundInStoreError - If the invitation is not found in the store.
Throws
TemplateOutputNotFoundError - If the template does not define the output.
Throws
TemplateLockingScriptRoleNotFoundError - If the role is not defined on the output's locking script.
Throws
LockingScriptSecretsNotFoundError - If the locking script uses secrets this account has not generated for the invitation.
Throws
LockingScriptResolutionsMissingError - If the script uses key operations other participants have not resolved yet.
Throws
LockingBytecodeGenerationFailedError - If the locking bytecode cannot be compiled.
Throws
SecretDataNotFoundError - If a secret recorded for this invitation is not in the secret store.
Throws
CashAssemblyCompilationFailedError - If the output locking script is a CashAssembly expression that cannot be compiled.
Throws
LockingScriptCompilationFailedError - If the template locking script the output names cannot be compiled.
resolveMergedItemMergeTarget
const resolveMergedItemMergeTarget: (invitation, mergedCommit, itemType, mergedItemIndex) =>
| XOInvitationMergesWithReference
| undefined;Defined in: source/invitation/merge/merge-targets.ts:132
Resolves the mergesWith target for one merged input or output.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | Invitation that contains source commits. |
mergedCommit | MergedInvitation | Full merged transaction. |
itemType | "input" | "output" | Whether the item is a merged input or a merged output. |
mergedItemIndex | number | Position in mergedCommit.inputs or mergedCommit.outputs. |
Returns
| XOInvitationMergesWithReference | undefined
- Merge target for the merged item, or undefined when the item cannot be matched.
resolveTemplateOutputLockingBytecode
const resolveTemplateOutputLockingBytecode: (template, outputIdentifier, invitationVariables) => Uint8Array;Defined in: source/compilation/template-locking-bytecode.ts:313
Resolves locking bytecode for a template output from invitation variables and template constants.
Parameters
| Parameter | Type | Description |
|---|---|---|
template | XOTemplate | Template for the invitation. |
outputIdentifier | XOTemplateOutputIdentifier | Template output identifier. |
invitationVariables | XOInvitationVariable[] | Variables from merged commits and the current append. |
Returns
Uint8Array
- Locking bytecode bytes for the output.
Throws
TemplateOutputNotFoundError - When the output is absent from the template.
Throws
TemplateOutputLockingScriptNotFoundError - When the template output has no locking script reference.
Throws
CashAssemblyCompilationFailedError - When a CashAssembly expression fails to compile.
Throws
LockingScriptCompilationFailedError - When the template locking script fails to compile.
Throws
TemplateLockingScriptTypeNotFoundError - When the locking script definition is incomplete.
Throws
TemplateOutputLockingScriptReferenceInvalidError - When a locking script or script the output references is not in the template.
resolveTemplateTransactionItemIndex
const resolveTemplateTransactionItemIndex: (template, actionIdentifier, itemType, itemIdentifier) => number | undefined;Defined in: source/resolutions/transaction-index.ts:52
Resolves the transaction index declared for one template input or output slot on the active action transaction.
Parameters
| Parameter | Type | Description |
|---|---|---|
template | XOTemplate | Imported template for the invitation. |
actionIdentifier | XOTemplateActionIdentifier | Action on the invitation. |
itemType | "input" | "output" | Whether the slot is an input or an output. |
itemIdentifier | | XOTemplateInputIdentifier | XOTemplateOutputIdentifier | Template input or output slot being provided. |
Returns
number | undefined
- Input or output index from the transaction definition when present.
TOKEN_BEARING_OUTPUT_MINIMUM_SATOSHIS
const TOKEN_BEARING_OUTPUT_MINIMUM_SATOSHIS: 800 = 800;Defined in: source/defaults.ts:64
Minimum satoshis on a CashToken bearing output so the token remains standard and spendable.
UNDEFINED_TRANSACTION_INDEX_SORT_VALUE
const UNDEFINED_TRANSACTION_INDEX_SORT_VALUE: number;Defined in: source/defaults.ts:84
Sort key used when a merged input or output has no transactionIndex so unordered items follow indexed items.
updateInvitation
const updateInvitation: (context, receivedInvitation) => Promise<StoredInvitation>;Defined in: source/invitation/participation/update.ts:33
Updates the stored invitation with a newer version received from an external participant or through some subscription. The updated invitation should have the shared history with the stored invitation.
An output another participant added that locks to one of this account's scripts is stored and tracked like a script this account built, so its funds are seen and it can be unlocked later.
Parameters
| Parameter | Type | Description |
|---|---|---|
context | Required<AccountContext> | State, signing, and network for this account. |
receivedInvitation | XOInvitation | Shared invitation to store. The local entity identifier and archive fields keep their stored values. |
Returns
Promise<StoredInvitation>
- The updated invitation as stored, including the local entity identifier when present.
Throws
InvitationNotFoundInStoreError - If the invitation is not already in the store.
Throws
TemplateNotFoundInStoreError - If the template is not found.
Throws
InvitationInvalidError - If the updated invitation does not match the XOInvitation type.
Throws
InvitationValidationFailedError - If the updated invitation fails validation.
Throws
InvitationHistoryConflictError - If a stored commit is missing, reordered, or differs at its expected position.
Throws
InvitationItemFieldConflictError - If a commit changes a value an earlier commit set.
Throws
RoleVariableEntityMismatchError - If a commit provides a variable of a role its entity does not hold.
Throws
EntityMultipleRolesWithFollowUpUnsupportedError - If a commit gives an entity more than one role with a follow up.
validateInvitation
const validateInvitation: (invitation, template, network) => void;Defined in: source/invitation/validation/invitation.ts:451
Validates an invitation against a template and throws when any check fails.
Parameters
| Parameter | Type | Description |
|---|---|---|
invitation | XOInvitation | The invitation to validate. |
template | XOTemplate | The template to validate against. |
network | XONetwork | Engine network that selects xpub or tpub for entity identifiers. |
Returns
void
Throws
InvitationValidationFailedError - If one or more validation checks fail.
XO_SUPPORTED_NETWORKS
const XO_SUPPORTED_NETWORKS: object;Defined in: source/defaults.ts:113
Supported networks by the engine.
Type Declaration
| Name | Type | Defined in |
|---|---|---|
chipnet | "chipnet" | @xo-cash/engine/dist/index.d.mts:100 |
mainnet | "mainnet" | source/defaults.ts:113 |
testnet4 | "testnet4" | @xo-cash/engine/dist/index.d.mts:101 |
ZERO_FUNGIBLE_TOKEN_AMOUNT
const ZERO_FUNGIBLE_TOKEN_AMOUNT: 0n = 0n;Defined in: source/defaults.ts:79
Zero fungible token amount used when a token bearing output has no amount yet.
ChainStatus
Defined in: @electrum-cash/application/dist/index.d.mts:369
Emitted when additional block headers have been verified to be a part of the current longest chain.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
currentHeight | number | number of blocks that have been reported to be part of the block chain. | source/invitation/interfaces.ts:269 |
verifiedHeight | number | number of blocks that have been verified to be part of the block chain. | @electrum-cash/application/dist/index.d.mts:373 |
verifiedPercent | string | percentage of blocks that have been verified to be included in the chain. | source/invitation/interfaces.ts:274 |
AppendInvitationParametersEmptyError
Defined in: source/errors/invitation.ts:148
Thrown when append invitation parameters omit every appendable field.
Extends
Error
Constructors
Constructor
new AppendInvitationParametersEmptyError(): AppendInvitationParametersEmptyError;Defined in: source/errors/invitation.ts:148
Returns
AppendInvitationParametersEmptyError
Overrides
Error.constructorCashAssemblyVariableNotIntegerError
Defined in: source/errors/compilation.ts:20
Thrown when a number variable value is not a valid integer for CashAssembly compilation.
Extends
Error
Constructors
Constructor
new CashAssemblyVariableNotIntegerError(variableName, value): CashAssemblyVariableNotIntegerError;Defined in: @xo-cash/engine/dist/index.d.mts:2583
Parameters
| Parameter | Type |
|---|---|
variableName | string |
value | number |
Returns
CashAssemblyVariableNotIntegerError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
value | readonly | number | Numeric value that was not an integer. | source/errors/compilation.ts:29 |
variableName | readonly | string | Variable name whose value was rejected. | source/errors/compilation.ts:24 |
ChangeLockingBytecodeMissingError
Defined in: source/errors/invitation.ts:1058
Thrown when change is added to an invitation but no locking bytecode was provided, the template defines no change policy, and the wallet has no default change policy.
Extends
Error
Constructors
Constructor
new ChangeLockingBytecodeMissingError(invitationIdentifier, templateIdentifier): ChangeLockingBytecodeMissingError;Defined in: @xo-cash/engine/dist/index.d.mts:2371
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
templateIdentifier | string |
Returns
ChangeLockingBytecodeMissingError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
invitationIdentifier | readonly | string | Invitation the change was added to. | source/errors/invitation.ts:1062 |
templateIdentifier | readonly | string | Template of the invitation, which defines no change policy. | source/errors/invitation.ts:1067 |
ChangeSatoshisBelowDustError
Defined in: source/errors/invitation.ts:1378
Thrown when the satoshi change is selected alone and the satoshis left after the fee and the token change outputs are below the dust limit, so no change output can hold them.
Extends
Error
Constructors
Constructor
new ChangeSatoshisBelowDustError(
invitationIdentifier,
satoshiChange,
dustLimitSatoshis): ChangeSatoshisBelowDustError;Defined in: @xo-cash/engine/dist/index.d.mts:2565
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
satoshiChange | bigint |
dustLimitSatoshis | bigint |
Returns
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
dustLimitSatoshis | readonly | bigint | Smallest amount an output may hold, in satoshis. | source/errors/invitation.ts:1392 |
invitationIdentifier | readonly | string | Invitation the change was added to. | source/errors/invitation.ts:1382 |
satoshiChange | readonly | bigint | Satoshis left for the satoshi change output. | source/errors/invitation.ts:1387 |
ChangeSatoshisInsufficientError
Defined in: source/errors/invitation.ts:1086
Thrown when change is added to an invitation with leftover fungible tokens, but the leftover satoshis cannot pay for the token change outputs and the estimated fee.
Extends
Error
Constructors
Constructor
new ChangeSatoshisInsufficientError(
invitationIdentifier,
requiredSatoshis,
availableSatoshis): ChangeSatoshisInsufficientError;Defined in: @xo-cash/engine/dist/index.d.mts:2392
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
requiredSatoshis | bigint |
availableSatoshis | bigint |
Returns
ChangeSatoshisInsufficientError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
availableSatoshis | readonly | bigint | Satoshis the inputs hold beyond the outputs. | source/errors/invitation.ts:1100 |
invitationIdentifier | readonly | string | Invitation the change was added to. | source/errors/invitation.ts:1090 |
requiredSatoshis | readonly | bigint | Satoshis the token change outputs and the estimated fee need. | source/errors/invitation.ts:1095 |
ChangeSelectionEmptyError
Defined in: source/errors/invitation.ts:1331
Thrown when change is added to an invitation with a selection that names neither the satoshi change nor any token category.
Extends
Error
Constructors
Constructor
new ChangeSelectionEmptyError(invitationIdentifier): ChangeSelectionEmptyError;Defined in: @xo-cash/engine/dist/index.d.mts:2528
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
Returns
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
invitationIdentifier | readonly | string | Invitation the change was added to. | source/errors/invitation.ts:1335 |
ChangeTokenCategoriesUnavailableError
Defined in: source/errors/invitation.ts:1350
Thrown when change is added to an invitation with token categories that have no leftover fungible tokens.
Extends
Error
Constructors
Constructor
new ChangeTokenCategoriesUnavailableError(invitationIdentifier, tokenCategories): ChangeTokenCategoriesUnavailableError;Defined in: @xo-cash/engine/dist/index.d.mts:2544
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
tokenCategories | string[] |
Returns
ChangeTokenCategoriesUnavailableError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
invitationIdentifier | readonly | string | Invitation the change was added to. | source/errors/invitation.ts:1354 |
tokenCategories | readonly | string[] | Selected token categories without leftover fungible tokens, as hex. | source/errors/invitation.ts:1359 |
CommitChainOrderInvalidError
Defined in: source/errors/invitation.ts:717
Thrown when a commit does not name the commit stored immediately before it as its previous commit.
Extends
Error
Constructors
Constructor
new CommitChainOrderInvalidError(
commitIdentifier,
expectedPreviousCommitIdentifier?,
receivedPreviousCommitIdentifier?): CommitChainOrderInvalidError;Defined in: @xo-cash/engine/dist/index.d.mts:2178
Parameters
| Parameter | Type |
|---|---|
commitIdentifier | string |
expectedPreviousCommitIdentifier? | string |
receivedPreviousCommitIdentifier? | string |
Returns
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
commitIdentifier | readonly | string | Commit whose previous commit identifier breaks the chain. | source/errors/invitation.ts:721 |
expectedPreviousCommitIdentifier | readonly | string | undefined | Identifier of the commit stored immediately before it, or undefined for the first commit. | source/errors/invitation.ts:726 |
receivedPreviousCommitIdentifier | readonly | string | undefined | Previous commit identifier the commit actually carries. | source/errors/invitation.ts:731 |
CommitIdentifierDuplicatedError
Defined in: source/errors/invitation.ts:698
Thrown when the same commit identifier appears more than once in an invitation.
Extends
Error
Constructors
Constructor
new CommitIdentifierDuplicatedError(commitIdentifiers): CommitIdentifierDuplicatedError;Defined in: @xo-cash/engine/dist/index.d.mts:2158
Parameters
| Parameter | Type |
|---|---|
commitIdentifiers | string[] |
Returns
CommitIdentifierDuplicatedError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
commitIdentifiers | readonly | string[] | Commit identifiers that appear more than once. | source/errors/invitation.ts:702 |
CommitItemNotFoundError
Defined in: source/errors/invitation.ts:483
Thrown when an input or output at a given index is absent from a commit.
Extends
Error
Constructors
Constructor
new CommitItemNotFoundError(
itemType,
itemIndex,
commitIdentifier): CommitItemNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:2042
Parameters
| Parameter | Type |
|---|---|
itemType | "input" | "output" |
itemIndex | number |
commitIdentifier | string |
Returns
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
commitIdentifier | readonly | string | Commit that was searched. | source/errors/invitation.ts:497 |
itemIndex | readonly | number | Index that was looked up in the commit. | source/errors/invitation.ts:492 |
itemType | readonly | "input" | "output" | Whether the missing item is an input or an output. | source/errors/invitation.ts:487 |
CommitSignatureInvalidError
Defined in: source/errors/invitation.ts:215
Collected during invitation validation when a commit signature does not verify or verification throws.
Extends
Error
Constructors
Constructor
new CommitSignatureInvalidError(commitIdentifier, cause?): CommitSignatureInvalidError;Defined in: @xo-cash/engine/dist/index.d.mts:1888
Parameters
| Parameter | Type |
|---|---|
commitIdentifier | string |
cause? | Error |
Returns
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Overrides | Defined in |
|---|---|---|---|---|---|
cause? | readonly | Error | Error thrown by signature verification, when verification threw. | Error.cause | source/errors/invitation.ts:224 |
commitIdentifier | readonly | string | Identifier of the commit whose signature failed. | - | source/errors/invitation.ts:219 |
CommitTokenCategoryMissingError
Defined in: source/errors/invitation.ts:1281
Thrown when a token a commit supplies on an output has no category.
Extends
Error
Constructors
Constructor
new CommitTokenCategoryMissingError(commitIdentifier, outputIndex): CommitTokenCategoryMissingError;Defined in: @xo-cash/engine/dist/index.d.mts:2500
Parameters
| Parameter | Type |
|---|---|
commitIdentifier | string |
outputIndex | number |
Returns
CommitTokenCategoryMissingError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
commitIdentifier | readonly | string | Commit that last wrote the output. | source/errors/invitation.ts:1285 |
outputIndex | readonly | number | Position of the output in the merged output list. | source/errors/invitation.ts:1290 |
CommitTokenNftCapabilityMissingError
Defined in: source/errors/invitation.ts:1306
Thrown when an NFT a commit supplies on an output has no capability.
Extends
Error
Constructors
Constructor
new CommitTokenNftCapabilityMissingError(commitIdentifier, outputIndex): CommitTokenNftCapabilityMissingError;Defined in: @xo-cash/engine/dist/index.d.mts:2516
Parameters
| Parameter | Type |
|---|---|
commitIdentifier | string |
outputIndex | number |
Returns
CommitTokenNftCapabilityMissingError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
commitIdentifier | readonly | string | Commit that last wrote the output. | source/errors/invitation.ts:1310 |
outputIndex | readonly | number | Position of the output in the merged output list. | source/errors/invitation.ts:1315 |
DataResultSignatureInvalidError
Defined in: source/errors/invitation.ts:321
Collected during invitation validation when a data result signature does not verify or verification throws.
Extends
Error
Constructors
Constructor
new DataResultSignatureInvalidError(dataIdentifier, cause?): DataResultSignatureInvalidError;Defined in: @xo-cash/engine/dist/index.d.mts:1948
Parameters
| Parameter | Type |
|---|---|
dataIdentifier | string |
cause? | Error |
Returns
DataResultSignatureInvalidError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Overrides | Defined in |
|---|---|---|---|---|---|
cause? | readonly | Error | Error thrown by signature verification, when verification threw. | Error.cause | source/errors/invitation.ts:330 |
dataIdentifier | readonly | string | Template data identifier of the result whose signature failed. | - | source/errors/invitation.ts:325 |
DefaultPolicyNotSetError
Defined in: source/errors/wallet.ts:10
Thrown when a wallet default policy is used before it has been set.
Extends
Error
Constructors
Constructor
new DefaultPolicyNotSetError(policy): DefaultPolicyNotSetError;Defined in: @xo-cash/engine/dist/index.d.mts:2956
Parameters
| Parameter | Type |
|---|---|
policy | keyof WalletDefaultPolicies |
Returns
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
policy | readonly | keyof WalletDefaultPolicies | Default policy that was looked up. | source/errors/wallet.ts:14 |
EntityMultipleRolesWithFollowUpUnsupportedError
Defined in: source/errors/invitation.ts:943
Thrown when an entity holds more than one role with a follow up action.
Extends
Error
Constructors
Constructor
new EntityMultipleRolesWithFollowUpUnsupportedError(entities): EntityMultipleRolesWithFollowUpUnsupportedError;Defined in: @xo-cash/engine/dist/index.d.mts:2302
Parameters
| Parameter | Type |
|---|---|
entities | EntityRolesMultipleEntry[] |
Returns
EntityMultipleRolesWithFollowUpUnsupportedError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
entities | readonly | EntityRolesMultipleEntry[] | Every entity that holds more than one role with a follow up, with those roles. | source/errors/invitation.ts:947 |
InputOwnResolutionsNotFoundError
Defined in: source/errors/compilation.ts:432
Thrown when this account is asked to add its own resolutions for an input, but it resolved none that the invitation does not already hold.
Extends
Error
Constructors
Constructor
new InputOwnResolutionsNotFoundError(invitationIdentifier, inputIndex): InputOwnResolutionsNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:2810
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
inputIndex | number |
Returns
InputOwnResolutionsNotFoundError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
inputIndex | readonly | number | Merged input the resolutions were asked for. | source/errors/compilation.ts:441 |
invitationIdentifier | readonly | string | Invitation the input belongs to. | source/errors/compilation.ts:436 |
InputUnspentOutputUnavailableError
Defined in: source/errors/invitation.ts:605
Thrown when the output a merged input spends is not tracked by this account, or is reserved by another invitation.
Extends
Error
Constructors
Constructor
new InputUnspentOutputUnavailableError(
invitationIdentifier,
inputIndex,
outpointTransactionHash,
outpointIndex,
reservedBy?): InputUnspentOutputUnavailableError;Defined in: @xo-cash/engine/dist/index.d.mts:2126
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
inputIndex | number |
outpointTransactionHash | string |
outpointIndex | number |
reservedBy? | string |
Returns
InputUnspentOutputUnavailableError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
inputIndex | readonly | number | Position of the input in the merged input list. | source/errors/invitation.ts:614 |
invitationIdentifier | readonly | string | Invitation that owns the input. | source/errors/invitation.ts:609 |
outpointIndex | readonly | number | Index of the spent output in that transaction. | source/errors/invitation.ts:624 |
outpointTransactionHash | readonly | string | Hash of the transaction that holds the spent output, as hexadecimal. | source/errors/invitation.ts:619 |
reservedBy | readonly | string | undefined | Invitation that reserves the output, undefined when this account does not track the output. | source/errors/invitation.ts:629 |
IntentVariablesMissingError
Defined in: source/errors/compilation.ts:492
Thrown when variables an intent requires are missing from the provided values.
Extends
Error
Constructors
Constructor
new IntentVariablesMissingError(
templateIdentifier,
lockingScriptIdentifier,
variableIdentifiers): IntentVariablesMissingError;Defined in: @xo-cash/engine/dist/index.d.mts:2850
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
lockingScriptIdentifier | string |
variableIdentifiers | string[] |
Returns
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
lockingScriptIdentifier | readonly | string | Locking script the intent generates. | source/errors/compilation.ts:501 |
templateIdentifier | readonly | string | Template that defines the intent. | source/errors/compilation.ts:496 |
variableIdentifiers | readonly | string[] | Variables the intent requires that have no provided value. | source/errors/compilation.ts:506 |
InvitationFieldInvalidError
Defined in: source/errors/invitation.ts:191
Collected during invitation validation when an invitation field does not construct a valid primitive.
Extends
Error
Constructors
Constructor
new InvitationFieldInvalidError(path, cause): InvitationFieldInvalidError;Defined in: @xo-cash/engine/dist/index.d.mts:1872
Parameters
| Parameter | Type |
|---|---|
path | readonly (string | number)[] |
cause | Error |
Returns
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Overrides | Defined in |
|---|---|---|---|---|---|
cause | readonly | Error | Error thrown by the primitive that rejected the field value. | Error.cause | source/errors/invitation.ts:200 |
path | readonly | readonly (string | number)[] | Location of the field inside the invitation, as object keys and array indexes. | - | source/errors/invitation.ts:195 |
InvitationHistoryConflictError
Defined in: source/errors/invitation.ts:121
Thrown when an updated invitation diverges from the commit history already stored locally.
Extends
Error
Constructors
Constructor
new InvitationHistoryConflictError(invitationIdentifier, commitIdentifier): InvitationHistoryConflictError;Defined in: @xo-cash/engine/dist/index.d.mts:1831
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
commitIdentifier | string |
Returns
InvitationHistoryConflictError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
commitIdentifier | readonly | string | Stored commit at which the histories diverged. | source/errors/invitation.ts:130 |
invitationIdentifier | readonly | string | Invitation whose stored and updated histories diverge. | source/errors/invitation.ts:125 |
InvitationIntentMismatchError
Defined in: source/errors/invitation.ts:835
Thrown when an intent passed with an invitation names a different template or action than the invitation.
Extends
Error
Constructors
Constructor
new InvitationIntentMismatchError(
field,
invitationValue,
intentValue): InvitationIntentMismatchError;Defined in: @xo-cash/engine/dist/index.d.mts:2248
Parameters
| Parameter | Type |
|---|---|
field | "templateIdentifier" | "action" |
invitationValue | string |
intentValue | string |
Returns
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
field | readonly | "templateIdentifier" | "action" | Intent field that does not match the invitation. | source/errors/invitation.ts:839 |
intentValue | readonly | string | Value the intent has for the field. | source/errors/invitation.ts:849 |
invitationValue | readonly | string | Value the invitation has for the field. | source/errors/invitation.ts:844 |
InvitationItemFieldConflictError
Defined in: source/errors/invitation.ts:810
Thrown when a later commit sets an input or output field that an earlier commit already set, even to the same value.
Extends
Error
Constructors
Constructor
new InvitationItemFieldConflictError(conflicts): InvitationItemFieldConflictError;Defined in: @xo-cash/engine/dist/index.d.mts:2228
Parameters
| Parameter | Type |
|---|---|
conflicts | InvitationItemFieldConflict[] |
Returns
InvitationItemFieldConflictError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
conflicts | readonly | InvitationItemFieldConflict[] | Every conflicting field with the commits involved. | source/errors/invitation.ts:814 |
InvitationResolutionIdentifierInvalidError
Defined in: source/errors/invitation.ts:894
Thrown when a resolution names something other than an operation on a template key, since only key operations can be resolved by the participant holding the key.
Extends
Error
Constructors
Constructor
new InvitationResolutionIdentifierInvalidError(resolutionIdentifiers): InvitationResolutionIdentifierInvalidError;Defined in: @xo-cash/engine/dist/index.d.mts:2277
Parameters
| Parameter | Type |
|---|---|
resolutionIdentifiers | string[] |
Returns
InvitationResolutionIdentifierInvalidError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
resolutionIdentifiers | readonly | string[] | Identifiers that are not operations on a template key. | source/errors/invitation.ts:898 |
InvitationResultSignatureInvalidError
Defined in: source/errors/invitation.ts:661
Thrown when an invitation result signature fails verification.
Extends
Error
Constructors
Constructor
new InvitationResultSignatureInvalidError(
invitationIdentifier,
resultKind,
resultIdentifier): InvitationResultSignatureInvalidError;Defined in: @xo-cash/engine/dist/index.d.mts:2146
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
resultKind | "data" | "transaction_created" | "transaction_broadcasted" |
resultIdentifier | string |
Returns
InvitationResultSignatureInvalidError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
invitationIdentifier | readonly | string | Invitation whose result signature failed. | source/errors/invitation.ts:665 |
resultIdentifier | readonly | string | Result identifier whose signature failed. | source/errors/invitation.ts:675 |
resultKind | readonly | "data" | "transaction_created" | "transaction_broadcasted" | Kind of invitation result that was verified. | source/errors/invitation.ts:670 |
InvitationRoleDuplicatedError
Defined in: source/errors/invitation.ts:866
Thrown when the role an entity takes is given both directly and on the intent.
Extends
Error
Constructors
Constructor
new InvitationRoleDuplicatedError(roleIdentifier, intentRoleIdentifier): InvitationRoleDuplicatedError;Defined in: @xo-cash/engine/dist/index.d.mts:2264
Parameters
| Parameter | Type |
|---|---|
roleIdentifier | string |
intentRoleIdentifier | string |
Returns
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
intentRoleIdentifier | readonly | string | Role given on the intent. | source/errors/invitation.ts:875 |
roleIdentifier | readonly | string | Role given directly. | source/errors/invitation.ts:870 |
InvitationRoleUnavailableError
Defined in: source/errors/invitation.ts:970
Thrown when an entity tries to join an invitation with a role that has no free slot left.
Extends
Error
Constructors
Constructor
new InvitationRoleUnavailableError(
invitationIdentifier,
roleIdentifier,
availableRoleIdentifiers): InvitationRoleUnavailableError;Defined in: @xo-cash/engine/dist/index.d.mts:2322
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
roleIdentifier | string |
availableRoleIdentifiers | string[] |
Returns
InvitationRoleUnavailableError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
availableRoleIdentifiers | readonly | string[] | Roles that still have a free slot. | source/errors/invitation.ts:984 |
invitationIdentifier | readonly | string | Invitation the entity tries to join. | source/errors/invitation.ts:974 |
roleIdentifier | readonly | string | Role that has no free slot. | source/errors/invitation.ts:979 |
InvitationTemplateMismatchError
Defined in: source/errors/invitation.ts:553
Thrown when a provided template identifier does not match the invitation template identifier.
Extends
Error
Constructors
Constructor
new InvitationTemplateMismatchError(expectedTemplateIdentifier, receivedTemplateIdentifier): InvitationTemplateMismatchError;Defined in: @xo-cash/engine/dist/index.d.mts:2082
Parameters
| Parameter | Type |
|---|---|
expectedTemplateIdentifier | string |
receivedTemplateIdentifier | string |
Returns
InvitationTemplateMismatchError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
expectedTemplateIdentifier | readonly | string | Template identifier stored on the invitation. | source/errors/invitation.ts:557 |
receivedTemplateIdentifier | readonly | string | Template identifier that was supplied for validation. | source/errors/invitation.ts:562 |
InvitationValidationFailedError
Defined in: source/errors/invitation.ts:163
Thrown when one or more invitation validation checks fail. Holds one error for each failed check, in the order the checks ran.
Extends
AggregateError
Constructors
Constructor
new InvitationValidationFailedError(invitationIdentifier, errors): InvitationValidationFailedError;Defined in: @xo-cash/engine/dist/index.d.mts:1856
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
errors | Error[] |
Returns
InvitationValidationFailedError
Overrides
AggregateError.constructorProperties
| Property | Modifier | Type | Description | Overrides | Defined in |
|---|---|---|---|---|---|
errors | readonly | Error[] | Validation errors collected before the throw. | AggregateError.errors | source/errors/invitation.ts:172 |
invitationIdentifier | readonly | string | Invitation that failed validation. | - | source/errors/invitation.ts:167 |
InvitationVariableIdentifierInvalidError
Defined in: source/errors/invitation.ts:785
Thrown when invitation commits carry variable identifiers that contain a dot.
The compiler reads a dotted identifier as an operation on a variable, such as someKey.public_key, and looks that identifier up in the same bytecode map as variable values. A dotted variable would replace the value that operation derives from a key.
Extends
Error
Constructors
Constructor
new InvitationVariableIdentifierInvalidError(invalidVariables): InvitationVariableIdentifierInvalidError;Defined in: @xo-cash/engine/dist/index.d.mts:2213
Parameters
| Parameter | Type |
|---|---|
invalidVariables | object[] |
Returns
InvitationVariableIdentifierInvalidError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
invalidVariables | readonly | object[] | Each invalid variable identifier with the commit that supplied it. | source/errors/invitation.ts:789 |
LockingBytecodeGenerationFailedError
Defined in: source/errors/compilation.ts:82
Thrown when a locking script stops compiling before it produces bytecode.
Extends
Error
Constructors
Constructor
new LockingBytecodeGenerationFailedError(
templateIdentifier,
lockingScriptIdentifier,
incompleteCompilation): LockingBytecodeGenerationFailedError;Defined in: @xo-cash/engine/dist/index.d.mts:2631
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
lockingScriptIdentifier | string |
incompleteCompilation | IncompleteScriptCompilation |
Returns
LockingBytecodeGenerationFailedError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
compilationErrors | readonly | ScriptCompilationErrorDetail[] | Every error the compiler reported, with its source range. | source/errors/compilation.ts:106 |
compilationStage | readonly | "parse" | "reduce" | "resolve" | Compiler stage that stopped. | source/errors/compilation.ts:101 |
lockingScriptIdentifier | readonly | string | Locking script that failed to compile. | source/errors/compilation.ts:91 |
scriptId | readonly | string | Script the compiler was compiling. | source/errors/compilation.ts:96 |
templateIdentifier | readonly | string | Template that defines the locking script. | source/errors/compilation.ts:86 |
LockingScriptCompilationFailedError
Defined in: source/errors/compilation.ts:45
Thrown when a template locking script compiled from variables alone fails to compile.
Extends
Error
Constructors
Constructor
new LockingScriptCompilationFailedError(
templateIdentifier,
lockingScriptIdentifier,
compilationErrorMessages): LockingScriptCompilationFailedError;Defined in: @xo-cash/engine/dist/index.d.mts:2603
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
lockingScriptIdentifier | string |
compilationErrorMessages | string[] |
Returns
LockingScriptCompilationFailedError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
compilationErrorMessages | readonly | string[] | Every error message the compiler reported. | source/errors/compilation.ts:59 |
lockingScriptIdentifier | readonly | string | Locking script that failed to compile. | source/errors/compilation.ts:54 |
templateIdentifier | readonly | string | Template that defines the locking script. | source/errors/compilation.ts:49 |
LockingScriptResolutionsMissingError
Defined in: source/errors/compilation.ts:247
Thrown when a locking script cannot be compiled yet because the compiler reports identifiers missing from the compilation data, such as a public key of a key another entity holds. The operations the compiler resolved from this account's keys are carried so they can be provided to the invitation.
Extends
Error
Constructors
Constructor
new LockingScriptResolutionsMissingError(
lockingScriptIdentifier,
missingIdentifiers,
resolvedKeyOperations,
compilationErrors): LockingScriptResolutionsMissingError;Defined in: @xo-cash/engine/dist/index.d.mts:2710
Parameters
| Parameter | Type |
|---|---|
lockingScriptIdentifier | string |
missingIdentifiers | string[] |
resolvedKeyOperations | Record<XOInvitationResolutionIdentifier, Uint8Array> |
compilationErrors | ScriptCompilationErrorDetail[] |
Returns
LockingScriptResolutionsMissingError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
compilationErrors | readonly | ScriptCompilationErrorDetail[] | Compiler errors with their source position, missing identifier, and owning entity. | source/errors/compilation.ts:266 |
lockingScriptIdentifier | readonly | string | Locking script that could not be compiled. | source/errors/compilation.ts:251 |
missingIdentifiers | readonly | string[] | Identifiers the compiler reports as missing. | source/errors/compilation.ts:256 |
resolvedKeyOperations | readonly | Record<XOInvitationResolutionIdentifier, Uint8Array> | Operations on this account's keys the compiler resolved, keyed by their full identifier. | source/errors/compilation.ts:261 |
LockingScriptSecretsNotFoundError
Defined in: source/errors/compilation.ts:184
Thrown when a locking script uses existing secrets that this account has not generated for the invitation it is built for. Only a generate list creates a secret, so a secret the script expects to exist is never generated in its place.
Extends
Error
Constructors
Constructor
new LockingScriptSecretsNotFoundError(
templateIdentifier,
lockingScriptIdentifier,
secretIdentifiers,
roleIdentifier?,
invitationIdentifier?): LockingScriptSecretsNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:2684
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
lockingScriptIdentifier | string |
secretIdentifiers | string[] |
roleIdentifier? | string |
invitationIdentifier? | string |
Returns
LockingScriptSecretsNotFoundError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
invitationIdentifier | readonly | string | undefined | Invitation whose secrets were searched, when it is known. | source/errors/compilation.ts:208 |
lockingScriptIdentifier | readonly | string | Locking script that uses the secrets. | source/errors/compilation.ts:193 |
roleIdentifier | readonly | string | undefined | Role the locking script was built for, when one was given. | source/errors/compilation.ts:203 |
secretIdentifiers | readonly | string[] | Secrets the locking script uses that the invitation does not hold. | source/errors/compilation.ts:198 |
templateIdentifier | readonly | string | Template that defines the locking script. | source/errors/compilation.ts:188 |
MergedInputCommitNotFoundError
Defined in: source/errors/invitation.ts:94
Thrown when no commit in the invitation introduced a merged input, so there is no commit for a new commit to extend.
Extends
Error
Constructors
Constructor
new MergedInputCommitNotFoundError(invitationIdentifier, inputIndex): MergedInputCommitNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:1815
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
inputIndex | number |
Returns
MergedInputCommitNotFoundError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
inputIndex | readonly | number | Position of the input in the merged input list. | source/errors/invitation.ts:103 |
invitationIdentifier | readonly | string | Invitation whose commits were searched. | source/errors/invitation.ts:98 |
MergedInputNotFoundError
Defined in: source/errors/invitation.ts:1032
Thrown when the merged invitation has no input at the index asked to be unlocked.
Extends
Error
Constructors
Constructor
new MergedInputNotFoundError(invitationIdentifier, inputIndex): MergedInputNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:2354
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
inputIndex | number |
Returns
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
inputIndex | readonly | number | Position in the merged input list that has no input. | source/errors/invitation.ts:1041 |
invitationIdentifier | readonly | string | Invitation whose merged inputs were searched. | source/errors/invitation.ts:1036 |
MergedInputOutpointMissingError
Defined in: source/errors/invitation.ts:578
Thrown when a merged input to unlock has no outpoint, so there is no output for it to spend.
Extends
Error
Constructors
Constructor
new MergedInputOutpointMissingError(invitationIdentifier, inputIndex): MergedInputOutpointMissingError;Defined in: @xo-cash/engine/dist/index.d.mts:2098
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
inputIndex | number |
Returns
MergedInputOutpointMissingError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
inputIndex | readonly | number | Position of the input in the merged input list. | source/errors/invitation.ts:587 |
invitationIdentifier | readonly | string | Invitation that owns the input. | source/errors/invitation.ts:582 |
MergedItemTokenIncompleteError
Defined in: source/errors/invitation.ts:1250
Thrown when the token on a merged input or output is missing its category or amount.
Extends
Error
Constructors
Constructor
new MergedItemTokenIncompleteError(
itemType,
itemIndex,
commitIdentifier): MergedItemTokenIncompleteError;Defined in: @xo-cash/engine/dist/index.d.mts:2484
Parameters
| Parameter | Type |
|---|---|
itemType | "input" | "output" |
itemIndex | number |
commitIdentifier | string |
Returns
MergedItemTokenIncompleteError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
commitIdentifier | readonly | string | Commit that last wrote the item. | source/errors/invitation.ts:1264 |
itemIndex | readonly | number | Position of the item in the merged input or output list. | source/errors/invitation.ts:1259 |
itemType | readonly | "input" | "output" | Whether the item is a merged input or a merged output. | source/errors/invitation.ts:1254 |
MergedItemValueSatoshisMissingError
Defined in: source/errors/invitation.ts:1119
Thrown when a merged input has neither valueSatoshis nor an outpoint, or a merged output has no valueSatoshis.
Extends
Error
Constructors
Constructor
new MergedItemValueSatoshisMissingError(
itemType,
itemIndex,
commitIdentifier): MergedItemValueSatoshisMissingError;Defined in: @xo-cash/engine/dist/index.d.mts:2412
Parameters
| Parameter | Type |
|---|---|
itemType | "input" | "output" |
itemIndex | number |
commitIdentifier | string |
Returns
MergedItemValueSatoshisMissingError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
commitIdentifier | readonly | string | Commit that last wrote the item. | source/errors/invitation.ts:1133 |
itemIndex | readonly | number | Position of the item in the merged input or output list. | source/errors/invitation.ts:1128 |
itemType | readonly | "input" | "output" | Whether the item is a merged input or a merged output. | source/errors/invitation.ts:1123 |
MergedOutputLockingBytecodeMissingError
Defined in: source/errors/invitation.ts:1150
Thrown when a merged output names a template output that defines no locking script and the commit that last wrote it provides no locking bytecode.
Extends
Error
Constructors
Constructor
new MergedOutputLockingBytecodeMissingError(
outputIdentifier,
outputIndex,
transactionIndex,
commitIdentifier,
templateIdentifier): MergedOutputLockingBytecodeMissingError;Defined in: @xo-cash/engine/dist/index.d.mts:2440
Parameters
| Parameter | Type |
|---|---|
outputIdentifier | string |
outputIndex | number |
transactionIndex | number | undefined |
commitIdentifier | string |
templateIdentifier | string |
Returns
MergedOutputLockingBytecodeMissingError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
commitIdentifier | readonly | string | Commit that last wrote the output. | source/errors/invitation.ts:1169 |
outputIdentifier | readonly | string | Template output the merged output names. | source/errors/invitation.ts:1154 |
outputIndex | readonly | number | Position of the output in the merged output list. | source/errors/invitation.ts:1159 |
templateIdentifier | readonly | string | Template whose output defines no locking script. | source/errors/invitation.ts:1174 |
transactionIndex | readonly | number | undefined | Position of the output in the transaction when the commit or the template action sets it. | source/errors/invitation.ts:1164 |
MergedOutputLockingScriptVariablesMissingError
Defined in: source/errors/invitation.ts:1206
Thrown when a merged output has no locking bytecode because its template locking script reads variables that no commit provides.
Extends
Error
Constructors
Constructor
new MergedOutputLockingScriptVariablesMissingError(
outputIdentifier,
outputIndex,
variableIdentifiers,
templateIdentifier): MergedOutputLockingScriptVariablesMissingError;Defined in: @xo-cash/engine/dist/index.d.mts:2464
Parameters
| Parameter | Type |
|---|---|
outputIdentifier | string |
outputIndex | number |
variableIdentifiers | string[] |
templateIdentifier | string |
Returns
MergedOutputLockingScriptVariablesMissingError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
outputIdentifier | readonly | string | Template output the merged output names. | source/errors/invitation.ts:1210 |
outputIndex | readonly | number | Position of the output in the merged output list. | source/errors/invitation.ts:1215 |
templateIdentifier | readonly | string | Template that defines the output locking script. | source/errors/invitation.ts:1225 |
variableIdentifiers | readonly | string[] | Variables the locking script reads that no commit provides. | source/errors/invitation.ts:1220 |
MergesWithCommitNotEarlierError
Defined in: source/errors/invitation.ts:754
Thrown when a mergesWith reference points at the same commit or a later commit instead of an earlier one.
Extends
Error
Constructors
Constructor
new MergesWithCommitNotEarlierError(mergesWithCommitIdentifier, currentCommitIdentifier): MergesWithCommitNotEarlierError;Defined in: @xo-cash/engine/dist/index.d.mts:2194
Parameters
| Parameter | Type |
|---|---|
mergesWithCommitIdentifier | string |
currentCommitIdentifier | string |
Returns
MergesWithCommitNotEarlierError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
currentCommitIdentifier | readonly | string | Commit that contains the mergesWith reference. | source/errors/invitation.ts:763 |
mergesWithCommitIdentifier | readonly | string | Commit identifier that mergesWith pointed at. | source/errors/invitation.ts:758 |
MergesWithCommitNotFoundError
Defined in: source/errors/invitation.ts:443
Thrown when a mergesWith commit identifier is absent from the invitation.
Extends
Error
Constructors
Constructor
new MergesWithCommitNotFoundError(
invitationIdentifier,
mergesWithCommitIdentifier,
currentCommitIdentifier?): MergesWithCommitNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:2022
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
mergesWithCommitIdentifier | string |
currentCommitIdentifier? | string |
Returns
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
currentCommitIdentifier | readonly | string | undefined | Commit that referenced the missing mergesWith commit, undefined when that commit is still being built. | source/errors/invitation.ts:457 |
invitationIdentifier | readonly | string | Invitation whose commits were searched. | source/errors/invitation.ts:447 |
mergesWithCommitIdentifier | readonly | string | Commit identifier that mergesWith pointed at. | source/errors/invitation.ts:452 |
OutputLockingBytecodeNotProvidedError
Defined in: source/errors/invitation.ts:1005
Thrown when an output appended to an invitation names a template output but carries no locking bytecode.
Extends
Error
Constructors
Constructor
new OutputLockingBytecodeNotProvidedError(invitationIdentifier, outputIdentifier): OutputLockingBytecodeNotProvidedError;Defined in: @xo-cash/engine/dist/index.d.mts:2338
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
outputIdentifier | string |
Returns
OutputLockingBytecodeNotProvidedError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
invitationIdentifier | readonly | string | Invitation the output is appended to. | source/errors/invitation.ts:1009 |
outputIdentifier | readonly | string | Template output that has no locking bytecode. | source/errors/invitation.ts:1014 |
OutputOwnResolutionsNotFoundError
Defined in: source/errors/compilation.ts:404
Thrown when this account is asked to add its own resolutions for an output, but it resolved none that the invitation does not already hold.
Extends
Error
Constructors
Constructor
new OutputOwnResolutionsNotFoundError(invitationIdentifier, outputIdentifier): OutputOwnResolutionsNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:2793
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
outputIdentifier | string |
Returns
OutputOwnResolutionsNotFoundError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
invitationIdentifier | readonly | string | Invitation the output belongs to. | source/errors/compilation.ts:408 |
outputIdentifier | readonly | string | Template output the resolutions were asked for. | source/errors/compilation.ts:413 |
ParentCommitNotFoundError
Defined in: source/errors/invitation.ts:377
Thrown when a parent commit identifier is absent from the invitation.
Extends
Error
Constructors
Constructor
new ParentCommitNotFoundError(parentCommitIdentifier, commitIdentifier): ParentCommitNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:1980
Parameters
| Parameter | Type |
|---|---|
parentCommitIdentifier | string |
commitIdentifier | string |
Returns
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
commitIdentifier | readonly | string | Commit that referenced the missing parent. | source/errors/invitation.ts:386 |
parentCommitIdentifier | readonly | string | Parent commit identifier that was looked up. | source/errors/invitation.ts:381 |
RoleVariableEntityMismatchError
Defined in: source/errors/invitation.ts:916
Thrown when a commit provides a variable that belongs to a role its entity does not hold, since only an entity holding the role may provide its variables.
Extends
Error
Constructors
Constructor
new RoleVariableEntityMismatchError(mismatches): RoleVariableEntityMismatchError;Defined in: @xo-cash/engine/dist/index.d.mts:2290
Parameters
| Parameter | Type |
|---|---|
mismatches | RoleVariableEntityMismatch[] |
Returns
RoleVariableEntityMismatchError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
mismatches | readonly | RoleVariableEntityMismatch[] | Every variable provided by an entity that does not hold its role. | source/errors/invitation.ts:920 |
RootCommitNotFoundError
Defined in: source/errors/invitation.ts:350
Thrown when the root commit for an entity cannot be found in the invitation.
Extends
Error
Constructors
Constructor
new RootCommitNotFoundError(invitationIdentifier, entityIdentifier): RootCommitNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:1964
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
entityIdentifier | string |
Returns
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
entityIdentifier | readonly | string | Entity whose root commit was searched. | source/errors/invitation.ts:359 |
invitationIdentifier | readonly | string | Invitation identifier that was searched. | source/errors/invitation.ts:354 |
SecretIdentifierTypeInvalidError
Defined in: source/errors/compilation.ts:459
Thrown when a secret used to derive a key is declared in the template with a type other than private_key.
Extends
Error
Constructors
Constructor
new SecretIdentifierTypeInvalidError(
templateIdentifier,
secretIdentifier,
declaredType?): SecretIdentifierTypeInvalidError;Defined in: @xo-cash/engine/dist/index.d.mts:2830
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
secretIdentifier | string |
declaredType? | string |
Returns
SecretIdentifierTypeInvalidError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
declaredType | readonly | string | undefined | Type the template declares for the secret, undefined when the template does not declare it. | source/errors/compilation.ts:473 |
secretIdentifier | readonly | string | Secret identifier whose template variable is not a private key. | source/errors/compilation.ts:468 |
templateIdentifier | readonly | string | Template that declares the secret. | source/errors/compilation.ts:463 |
TemplateActionNotFoundError
Defined in: source/errors/template.ts:19
Thrown when an action identifier is absent from the template.
Extends
Error
Constructors
Constructor
new TemplateActionNotFoundError(templateIdentifier, actionIdentifier): TemplateActionNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:1388
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
actionIdentifier | string |
Returns
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
actionIdentifier | readonly | string | Action identifier that is missing. | source/errors/template.ts:28 |
templateIdentifier | readonly | string | Template whose action is missing. | source/errors/template.ts:23 |
TemplateActionRoleNotFoundError
Defined in: source/errors/template.ts:425
Thrown when a role is not defined on the template action an entity tries to take.
Extends
Error
Constructors
Constructor
new TemplateActionRoleNotFoundError(
templateIdentifier,
actionIdentifier,
roleIdentifier): TemplateActionRoleNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:1642
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
actionIdentifier | string |
roleIdentifier | string |
Returns
TemplateActionRoleNotFoundError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
actionIdentifier | readonly | string | Action whose role is missing. | source/errors/template.ts:434 |
roleIdentifier | readonly | string | Role that is missing. | source/errors/template.ts:439 |
templateIdentifier | readonly | string | Template that defines the action. | source/errors/template.ts:429 |
TemplateActionTransactionNotFoundError
Defined in: source/errors/template.ts:144
Thrown when a template action names no transaction.
Extends
Error
Constructors
Constructor
new TemplateActionTransactionNotFoundError(templateIdentifier, actionIdentifier): TemplateActionTransactionNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:1468
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
actionIdentifier | string |
Returns
TemplateActionTransactionNotFoundError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
actionIdentifier | readonly | string | Action identifier whose transaction is missing. | source/errors/template.ts:153 |
templateIdentifier | readonly | string | Template that defines the action. | source/errors/template.ts:148 |
TemplateDefaultPolicyMissingError
Defined in: source/errors/template.ts:509
Thrown when a wallet default policy names a template whose defaults do not define that policy.
Extends
Error
Constructors
Constructor
new TemplateDefaultPolicyMissingError(templateIdentifier, policy): TemplateDefaultPolicyMissingError;Defined in: @xo-cash/engine/dist/index.d.mts:1686
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
policy | keyof WalletDefaultPolicies |
Returns
TemplateDefaultPolicyMissingError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
policy | readonly | keyof WalletDefaultPolicies | Default policy that is missing. | source/errors/template.ts:518 |
templateIdentifier | readonly | string | Template whose default policy is missing. | source/errors/template.ts:513 |
TemplateGeneratedVariableTypeUnsupportedError
Defined in: source/errors/template.ts:456
Thrown when a template action role asks the engine to generate variables that are not private keys.
Extends
Error
Constructors
Constructor
new TemplateGeneratedVariableTypeUnsupportedError(
templateIdentifier,
actionIdentifier,
variableIdentifiers,
variableTypes,
roleIdentifier?): TemplateGeneratedVariableTypeUnsupportedError;Defined in: @xo-cash/engine/dist/index.d.mts:1670
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
actionIdentifier | string |
variableIdentifiers | string[] |
variableTypes | (string | undefined)[] |
roleIdentifier? | string |
Returns
TemplateGeneratedVariableTypeUnsupportedError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
actionIdentifier | readonly | string | Action the variables are generated for. | source/errors/template.ts:465 |
roleIdentifier | readonly | string | undefined | Role the entity takes in the action, when it takes one. | source/errors/template.ts:470 |
templateIdentifier | readonly | string | Template that defines the variables. | source/errors/template.ts:460 |
variableIdentifiers | readonly | string[] | Generated variables that are not defined as private keys. | source/errors/template.ts:475 |
variableTypes | readonly | (string | undefined)[] | Defined type of each of those variables, undefined when the template does not define the variable. | source/errors/template.ts:480 |
TemplateLockingScriptBytecodeNotFoundError
Defined in: source/errors/template.ts:559
Thrown when a template locking script omits its locking bytecode.
Extends
Error
Constructors
Constructor
new TemplateLockingScriptBytecodeNotFoundError(templateIdentifier, lockingScriptIdentifier): TemplateLockingScriptBytecodeNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:1718
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
lockingScriptIdentifier | string |
Returns
TemplateLockingScriptBytecodeNotFoundError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
lockingScriptIdentifier | readonly | string | Locking script that has no locking bytecode. | source/errors/template.ts:568 |
templateIdentifier | readonly | string | Template that defines the locking script. | source/errors/template.ts:563 |
TemplateLockingScriptNotFoundError
Defined in: source/errors/template.ts:69
Thrown when a locking script identifier is absent from the template.
Extends
Error
Constructors
Constructor
new TemplateLockingScriptNotFoundError(templateIdentifier, lockingScriptIdentifier): TemplateLockingScriptNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:1420
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
lockingScriptIdentifier | string |
Returns
TemplateLockingScriptNotFoundError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
lockingScriptIdentifier | readonly | string | Locking script identifier that is missing. | source/errors/template.ts:78 |
templateIdentifier | readonly | string | Template whose locking script is missing. | source/errors/template.ts:73 |
TemplateLockingScriptRoleNotFoundError
Defined in: source/errors/template.ts:194
Thrown when a locking script role identifier is absent from the template.
Extends
Error
Constructors
Constructor
new TemplateLockingScriptRoleNotFoundError(
templateIdentifier,
lockingScriptIdentifier,
roleIdentifier): TemplateLockingScriptRoleNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:1504
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
lockingScriptIdentifier | string |
roleIdentifier | string |
Returns
TemplateLockingScriptRoleNotFoundError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
lockingScriptIdentifier | readonly | string | Locking script identifier that was searched. | source/errors/template.ts:203 |
roleIdentifier | readonly | string | Role identifier that is missing. | source/errors/template.ts:208 |
templateIdentifier | readonly | string | Template that defines the locking script. | source/errors/template.ts:198 |
TemplateLockingScriptTypeNotFoundError
Defined in: source/errors/template.ts:534
Thrown when a template locking script omits its locking type.
Extends
Error
Constructors
Constructor
new TemplateLockingScriptTypeNotFoundError(templateIdentifier, lockingScriptIdentifier): TemplateLockingScriptTypeNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:1702
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
lockingScriptIdentifier | string |
Returns
TemplateLockingScriptTypeNotFoundError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
lockingScriptIdentifier | readonly | string | Locking script that has no locking type. | source/errors/template.ts:543 |
templateIdentifier | readonly | string | Template that defines the locking script. | source/errors/template.ts:538 |
TemplateOutputLockingScriptNotFoundError
Defined in: source/errors/template.ts:169
Thrown when a template output has no locking script.
Extends
Error
Constructors
Constructor
new TemplateOutputLockingScriptNotFoundError(templateIdentifier, outputIdentifier): TemplateOutputLockingScriptNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:1484
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
outputIdentifier | string |
Returns
TemplateOutputLockingScriptNotFoundError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
outputIdentifier | readonly | string | Output identifier whose locking script is missing. | source/errors/template.ts:178 |
templateIdentifier | readonly | string | Template that defines the output. | source/errors/template.ts:173 |
TemplateOutputLockingScriptReferenceInvalidError
Defined in: source/errors/template.ts:584
Thrown when a template output names a locking script, or a locking script names a script, that the template does not define.
Extends
Error
Constructors
Constructor
new TemplateOutputLockingScriptReferenceInvalidError(
templateIdentifier,
outputIdentifier,
lockingScriptReference): TemplateOutputLockingScriptReferenceInvalidError;Defined in: @xo-cash/engine/dist/index.d.mts:1738
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
outputIdentifier | string |
lockingScriptReference | string |
Returns
TemplateOutputLockingScriptReferenceInvalidError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
lockingScriptReference | readonly | string | Locking script or script identifier the template does not define. | source/errors/template.ts:598 |
outputIdentifier | readonly | string | Template output whose locking script definition holds the reference. | source/errors/template.ts:593 |
templateIdentifier | readonly | string | Template that defines the output. | source/errors/template.ts:588 |
TemplateOutputNotFoundError
Defined in: source/errors/template.ts:44
Thrown when an output identifier is absent from the template.
Extends
Error
Constructors
Constructor
new TemplateOutputNotFoundError(templateIdentifier, outputIdentifier): TemplateOutputNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:1404
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
outputIdentifier | string |
Returns
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
outputIdentifier | readonly | string | Output identifier that is missing. | source/errors/template.ts:53 |
templateIdentifier | readonly | string | Template whose output is missing. | source/errors/template.ts:48 |
TemplateRoleRelevantCashAssemblyUnsupportedError
Defined in: source/errors/template.ts:229
Thrown when a role sets relevant to CashAssembly that the engine cannot evaluate yet.
Extends
Error
Constructors
Constructor
new TemplateRoleRelevantCashAssemblyUnsupportedError(
templateIdentifier,
outputIdentifier,
roleIdentifier,
relevantExpression): TemplateRoleRelevantCashAssemblyUnsupportedError;Defined in: @xo-cash/engine/dist/index.d.mts:1528
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
outputIdentifier | string |
roleIdentifier | string |
relevantExpression | string |
Returns
TemplateRoleRelevantCashAssemblyUnsupportedError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
outputIdentifier | readonly | string | Output whose role declared the unsupported expression. | source/errors/template.ts:238 |
relevantExpression | readonly | string | CashAssembly expression from the role relevant field. | source/errors/template.ts:248 |
roleIdentifier | readonly | string | Role whose relevant field is a CashAssembly string. | source/errors/template.ts:243 |
templateIdentifier | readonly | string | Template that defines the role. | source/errors/template.ts:233 |
TemplateTokenAmountInvalidError
Defined in: source/errors/template.ts:392
Thrown when a template output token amount does not resolve to a valid fungible token amount.
Extends
Error
Constructors
Constructor
new TemplateTokenAmountInvalidError(
templateIdentifier,
outputIdentifier,
tokenAmount): TemplateTokenAmountInvalidError;Defined in: @xo-cash/engine/dist/index.d.mts:1622
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
outputIdentifier | string |
tokenAmount | string |
Returns
TemplateTokenAmountInvalidError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
outputIdentifier | readonly | string | Output identifier whose token amount could not be resolved. | source/errors/template.ts:401 |
templateIdentifier | readonly | string | Template that defines the output. | source/errors/template.ts:396 |
tokenAmount | readonly | string | Template amount, or the value its CashAssembly expression evaluated to. | source/errors/template.ts:406 |
TemplateTokenCategoryMissingError
Defined in: source/errors/template.ts:273
Thrown when a template output token omits a category.
Extends
Error
Constructors
Constructor
new TemplateTokenCategoryMissingError(templateIdentifier, outputIdentifier): TemplateTokenCategoryMissingError;Defined in: @xo-cash/engine/dist/index.d.mts:1544
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
outputIdentifier | string |
Returns
TemplateTokenCategoryMissingError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
outputIdentifier | readonly | string | Output whose token omits the category. | source/errors/template.ts:282 |
templateIdentifier | readonly | string | Template that defines the output. | source/errors/template.ts:277 |
TemplateTokenNftCapabilityInvalidError
Defined in: source/errors/template.ts:323
Thrown when a template output NFT capability is not recognized.
Extends
Error
Constructors
Constructor
new TemplateTokenNftCapabilityInvalidError(
templateIdentifier,
outputIdentifier,
capabilityValue): TemplateTokenNftCapabilityInvalidError;Defined in: @xo-cash/engine/dist/index.d.mts:1580
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
outputIdentifier | string |
capabilityValue | string |
Returns
TemplateTokenNftCapabilityInvalidError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
capabilityValue | readonly | string | Capability value that was rejected. | source/errors/template.ts:337 |
outputIdentifier | readonly | string | Output whose NFT capability was rejected. | source/errors/template.ts:332 |
templateIdentifier | readonly | string | Template that defines the output. | source/errors/template.ts:327 |
TemplateTokenNftCapabilityMissingError
Defined in: source/errors/template.ts:298
Thrown when a template output NFT omits capability.
Extends
Error
Constructors
Constructor
new TemplateTokenNftCapabilityMissingError(templateIdentifier, outputIdentifier): TemplateTokenNftCapabilityMissingError;Defined in: @xo-cash/engine/dist/index.d.mts:1560
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
outputIdentifier | string |
Returns
TemplateTokenNftCapabilityMissingError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
outputIdentifier | readonly | string | Output whose NFT omits the capability. | source/errors/template.ts:307 |
templateIdentifier | readonly | string | Template that defines the output. | source/errors/template.ts:302 |
TemplateTransactionNotFoundError
Defined in: source/errors/template.ts:119
Thrown when a transaction identifier is absent from the template.
Extends
Error
Constructors
Constructor
new TemplateTransactionNotFoundError(templateIdentifier, transactionIdentifier): TemplateTransactionNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:1452
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
transactionIdentifier | string |
Returns
TemplateTransactionNotFoundError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
templateIdentifier | readonly | string | Template whose transaction is missing. | source/errors/template.ts:123 |
transactionIdentifier | readonly | string | Transaction identifier that is missing. | source/errors/template.ts:128 |
TemplateUnlockingScriptNotFoundError
Defined in: source/errors/template.ts:94
Thrown when the template defines no unlocking script for a locking script.
Extends
Error
Constructors
Constructor
new TemplateUnlockingScriptNotFoundError(templateIdentifier, lockingScriptIdentifier): TemplateUnlockingScriptNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:1436
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
lockingScriptIdentifier | string |
Returns
TemplateUnlockingScriptNotFoundError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
lockingScriptIdentifier | readonly | string | Locking script that has no unlocking script. | source/errors/template.ts:103 |
templateIdentifier | readonly | string | Template whose unlocking script is missing. | source/errors/template.ts:98 |
TemplateValueSatoshisInvalidError
Defined in: source/errors/template.ts:356
Thrown when a template output valueSatoshis string is neither CashAssembly nor a decimal integer.
Extends
Error
Constructors
Constructor
new TemplateValueSatoshisInvalidError(
templateIdentifier,
outputIdentifier,
templateValueSatoshis,
options?): TemplateValueSatoshisInvalidError;Defined in: @xo-cash/engine/dist/index.d.mts:1600
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
outputIdentifier | string |
templateValueSatoshis | string |
options? | { cause?: unknown; } |
options.cause? | unknown |
Returns
TemplateValueSatoshisInvalidError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
outputIdentifier | readonly | string | Output identifier whose valueSatoshis could not be resolved. | source/errors/template.ts:365 |
templateIdentifier | readonly | string | Template that defines the output. | source/errors/template.ts:360 |
templateValueSatoshis | readonly | string | Passed valueSatoshis string. | source/errors/template.ts:370 |
TransactionBroadcastFailedError
Defined in: source/errors/transaction.ts:116
Thrown when a built invitation transaction cannot be broadcast to the network.
Extends
Error
Constructors
Constructor
new TransactionBroadcastFailedError(
invitationIdentifier,
transactionHash,
reason,
options?): TransactionBroadcastFailedError;Defined in: @xo-cash/engine/dist/index.d.mts:2940
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
transactionHash | string |
reason | string |
options? | { cause?: unknown; } |
options.cause? | unknown |
Returns
TransactionBroadcastFailedError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
invitationIdentifier | readonly | string | Invitation the transaction was built from. | source/errors/transaction.ts:120 |
reason | readonly | string | Reason the Electrum servers reported for rejecting the transaction. | source/errors/transaction.ts:130 |
transactionHash | readonly | string | Hash of the transaction that was broadcast. | source/errors/transaction.ts:125 |
TransactionBroadcastMetadataIncompleteError
Defined in: source/errors/invitation.ts:302
Collected during invitation validation when a transaction result has some but not all broadcast fields.
Extends
Error
Constructors
Constructor
new TransactionBroadcastMetadataIncompleteError(transactionIdentifier): TransactionBroadcastMetadataIncompleteError;Defined in: @xo-cash/engine/dist/index.d.mts:1932
Parameters
| Parameter | Type |
|---|---|
transactionIdentifier | string |
Returns
TransactionBroadcastMetadataIncompleteError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
transactionIdentifier | readonly | string | Template transaction identifier of the result with incomplete broadcast fields. | source/errors/invitation.ts:306 |
TransactionBroadcastSignatureInvalidError
Defined in: source/errors/invitation.ts:273
Collected during invitation validation when a transaction result broadcast signature does not verify or verification throws.
Extends
Error
Constructors
Constructor
new TransactionBroadcastSignatureInvalidError(transactionIdentifier, cause?): TransactionBroadcastSignatureInvalidError;Defined in: @xo-cash/engine/dist/index.d.mts:1920
Parameters
| Parameter | Type |
|---|---|
transactionIdentifier | string |
cause? | Error |
Returns
TransactionBroadcastSignatureInvalidError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Overrides | Defined in |
|---|---|---|---|---|---|
cause? | readonly | Error | Error thrown by signature verification, when verification threw. | Error.cause | source/errors/invitation.ts:282 |
transactionIdentifier | readonly | string | Template transaction identifier of the result whose signature failed. | - | source/errors/invitation.ts:277 |
TransactionCreatedSignatureInvalidError
Defined in: source/errors/invitation.ts:244
Collected during invitation validation when a transaction result created signature does not verify or verification throws.
Extends
Error
Constructors
Constructor
new TransactionCreatedSignatureInvalidError(transactionIdentifier, cause?): TransactionCreatedSignatureInvalidError;Defined in: @xo-cash/engine/dist/index.d.mts:1904
Parameters
| Parameter | Type |
|---|---|
transactionIdentifier | string |
cause? | Error |
Returns
TransactionCreatedSignatureInvalidError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Overrides | Defined in |
|---|---|---|---|---|---|
cause? | readonly | Error | Error thrown by signature verification, when verification threw. | Error.cause | source/errors/invitation.ts:253 |
transactionIdentifier | readonly | string | Template transaction identifier of the result whose signature failed. | - | source/errors/invitation.ts:248 |
TransactionGenerationFailedError
Defined in: source/errors/transaction.ts:35
Thrown when transaction generation fails.
Extends
Error
Constructors
Constructor
new TransactionGenerationFailedError(
templateIdentifier,
actionIdentifier,
reason): TransactionGenerationFailedError;Defined in: @xo-cash/engine/dist/index.d.mts:2888
Parameters
| Parameter | Type |
|---|---|
templateIdentifier | string |
actionIdentifier | string |
reason | string |
Returns
TransactionGenerationFailedError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
actionIdentifier | readonly | string | Action whose transaction failed to generate. | source/errors/transaction.ts:44 |
reason | readonly | string | Generation failure reported by Libauth. | source/errors/transaction.ts:49 |
templateIdentifier | readonly | string | Template that defines the action. | source/errors/transaction.ts:39 |
TransactionIndexDuplicatedError
Defined in: source/errors/invitation.ts:402
Thrown when two or more merged inputs or outputs share the same transactionIndex.
Extends
Error
Constructors
Constructor
new TransactionIndexDuplicatedError(itemType, duplicateGroups): TransactionIndexDuplicatedError;Defined in: @xo-cash/engine/dist/index.d.mts:1999
Parameters
| Parameter | Type |
|---|---|
itemType | "input" | "output" |
duplicateGroups | object[] |
Returns
TransactionIndexDuplicatedError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
duplicateGroups | readonly | object[] | Groups of merged array positions that share one transactionIndex. | source/errors/invitation.ts:411 |
itemType | readonly | "input" | "output" | Whether the conflict is among inputs or outputs. | source/errors/invitation.ts:406 |
TransactionLocktimeDuplicatedError
Defined in: source/errors/invitation.ts:534
Thrown when transaction locktime is defined in more than one commit.
Extends
Error
Constructors
Constructor
new TransactionLocktimeDuplicatedError(commitIdentifiers): TransactionLocktimeDuplicatedError;Defined in: @xo-cash/engine/dist/index.d.mts:2066
Parameters
| Parameter | Type |
|---|---|
commitIdentifiers | string[] |
Returns
TransactionLocktimeDuplicatedError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
commitIdentifiers | readonly | string[] | Commit identifiers that each defined transaction locktime. | source/errors/invitation.ts:538 |
TransactionOutputNotFoundError
Defined in: source/errors/transaction.ts:10
Thrown when a parent transaction has no output at the requested index.
Extends
Error
Constructors
Constructor
new TransactionOutputNotFoundError(transactionHash, outputIndex): TransactionOutputNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:2868
Parameters
| Parameter | Type |
|---|---|
transactionHash | string |
outputIndex | number |
Returns
TransactionOutputNotFoundError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
outputIndex | readonly | number | Output index that was looked up. | source/errors/transaction.ts:19 |
transactionHash | readonly | string | Parent transaction hash that was searched. | source/errors/transaction.ts:14 |
TransactionResultAlreadyExistsError
Defined in: source/errors/transaction.ts:66
Thrown when a transaction result already exists for the given template transaction identifier.
Extends
Error
Constructors
Constructor
new TransactionResultAlreadyExistsError(invitationIdentifier, transactionIdentifier): TransactionResultAlreadyExistsError;Defined in: @xo-cash/engine/dist/index.d.mts:2904
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
transactionIdentifier | string |
Returns
TransactionResultAlreadyExistsError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
invitationIdentifier | readonly | string | Invitation that already has the result. | source/errors/transaction.ts:70 |
transactionIdentifier | readonly | string | Template transaction identifier that already has a result. | source/errors/transaction.ts:75 |
TransactionResultNotFoundError
Defined in: source/errors/transaction.ts:91
Thrown when a transaction result is absent for the given template transaction identifier.
Extends
Error
Constructors
Constructor
new TransactionResultNotFoundError(invitationIdentifier, transactionIdentifier): TransactionResultNotFoundError;Defined in: @xo-cash/engine/dist/index.d.mts:2920
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
transactionIdentifier | string |
Returns
TransactionResultNotFoundError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
invitationIdentifier | readonly | string | Invitation that was searched. | source/errors/transaction.ts:95 |
transactionIdentifier | readonly | string | Template transaction identifier whose result was missing. | source/errors/transaction.ts:100 |
TransactionVersionDuplicatedError
Defined in: source/errors/invitation.ts:515
Thrown when transaction version is defined in more than one commit.
Extends
Error
Constructors
Constructor
new TransactionVersionDuplicatedError(commitIdentifiers): TransactionVersionDuplicatedError;Defined in: @xo-cash/engine/dist/index.d.mts:2054
Parameters
| Parameter | Type |
|---|---|
commitIdentifiers | string[] |
Returns
TransactionVersionDuplicatedError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
commitIdentifiers | readonly | string[] | Commit identifiers that each defined transaction version. | source/errors/invitation.ts:519 |
UnlockingBytecodeGenerationFailedError
Defined in: source/errors/compilation.ts:138
Thrown when an unlocking script stops compiling before it produces bytecode.
Extends
Error
Constructors
Constructor
new UnlockingBytecodeGenerationFailedError(inputIndex, incompleteCompilation): UnlockingBytecodeGenerationFailedError;Defined in: @xo-cash/engine/dist/index.d.mts:2655
Parameters
| Parameter | Type |
|---|---|
inputIndex | number |
incompleteCompilation | IncompleteScriptCompilation |
Returns
UnlockingBytecodeGenerationFailedError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
compilationErrors | readonly | ScriptCompilationErrorDetail[] | Every error the compiler reported, with its source range. | source/errors/compilation.ts:157 |
compilationStage | readonly | "parse" | "reduce" | "resolve" | Compiler stage that stopped. | source/errors/compilation.ts:152 |
inputIndex | readonly | number | Merged input whose unlocking script failed to compile. | source/errors/compilation.ts:142 |
scriptId | readonly | string | Script the compiler was compiling. | source/errors/compilation.ts:147 |
UnlockingBytecodeVerificationFailedError
Defined in: source/errors/compilation.ts:337
Thrown when an unlocking bytecode built with values other participants provided does not unlock the output it spends.
Extends
Error
Constructors
Constructor
new UnlockingBytecodeVerificationFailedError(
inputIndex,
outpointTransactionHash,
outpointIndex,
reason): UnlockingBytecodeVerificationFailedError;Defined in: @xo-cash/engine/dist/index.d.mts:2760
Parameters
| Parameter | Type |
|---|---|
inputIndex | number |
outpointTransactionHash | string |
outpointIndex | number |
reason | string |
Returns
UnlockingBytecodeVerificationFailedError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
inputIndex | readonly | number | Merged input whose unlocking bytecode failed. | source/errors/compilation.ts:341 |
outpointIndex | readonly | number | Index of the spent output in that transaction. | source/errors/compilation.ts:351 |
outpointTransactionHash | readonly | string | Hash of the transaction that holds the spent output, as hexadecimal. | source/errors/compilation.ts:346 |
reason | readonly | string | Failure reported by the virtual machine. | source/errors/compilation.ts:356 |
UnlockingCompilationContextMissingError
Defined in: source/errors/compilation.ts:376
Thrown when the unlocking compilation of a merged input carries no compilation context to verify the unlocking bytecode against.
Extends
Error
Constructors
Constructor
new UnlockingCompilationContextMissingError(invitationIdentifier, inputIndex): UnlockingCompilationContextMissingError;Defined in: @xo-cash/engine/dist/index.d.mts:2776
Parameters
| Parameter | Type |
|---|---|
invitationIdentifier | string |
inputIndex | number |
Returns
UnlockingCompilationContextMissingError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
inputIndex | readonly | number | Merged input whose compilation has no context. | source/errors/compilation.ts:385 |
invitationIdentifier | readonly | string | Invitation that owns the input. | source/errors/compilation.ts:380 |
UnlockingScriptResolutionsMissingError
Defined in: source/errors/compilation.ts:293
Thrown when an input's unlocking script cannot be compiled yet because the compiler reports identifiers missing from the compilation data, such as a signature of a key another entity holds. The operations the compiler resolved from this account's keys are carried so they can be provided to the invitation.
Extends
Error
Constructors
Constructor
new UnlockingScriptResolutionsMissingError(
inputIndex,
missingIdentifiers,
resolvedKeyOperations,
compilationErrors): UnlockingScriptResolutionsMissingError;Defined in: @xo-cash/engine/dist/index.d.mts:2736
Parameters
| Parameter | Type |
|---|---|
inputIndex | number |
missingIdentifiers | string[] |
resolvedKeyOperations | Record<XOInvitationResolutionIdentifier, Uint8Array> |
compilationErrors | ScriptCompilationErrorDetail[] |
Returns
UnlockingScriptResolutionsMissingError
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
compilationErrors | readonly | ScriptCompilationErrorDetail[] | Compiler errors with their source position, missing identifier, and owning entity. | source/errors/compilation.ts:312 |
inputIndex | readonly | number | Merged input whose unlocking script could not be compiled. | source/errors/compilation.ts:297 |
missingIdentifiers | readonly | string[] | Identifiers the compiler reports as missing. | source/errors/compilation.ts:302 |
resolvedKeyOperations | readonly | Record<XOInvitationResolutionIdentifier, Uint8Array> | Operations on this account's keys the compiler resolved, keyed by their full identifier. | source/errors/compilation.ts:307 |
WalletNameMissingError
Defined in: source/errors/wallet.ts:29
Thrown when a wallet name is empty or contains only whitespace.
Extends
Error
Constructors
Constructor
new WalletNameMissingError(): WalletNameMissingError;Defined in: source/errors/wallet.ts:29
Returns
Overrides
Error.constructor