//#region node_modules/@xo-cash/types/dist/index.d.mts //#region source/utilities.d.ts /** * Union of all property values in an object type. * * Use this to derive a string literal union from a runtime const object declared * with `as const`. * * @example * export const XOTemplateLockingTypes = { * P2S: 'p2s', * P2PKH: 'p2pkh', * P2SH: 'p2sh', * } as const; * * export type XOTemplateLockingType = ValueOf; * // 'p2s' | 'p2pkh' | 'p2sh' */ type ValueOf = T[keyof T]; //#endregion //#region source/template.d.ts /** * Type for satoshis. */ type Satoshis = bigint; /** * A fungible token amount. */ type FungibleTokenAmount = bigint; /** * Values for BCH VM versions that an XO template can declare support for. */ declare const BchVmVersions: { readonly BCH_2020_05: "BCH_2020_05"; readonly BCH_2021_05: "BCH_2021_05"; readonly BCH_2022_05: "BCH_2022_05"; readonly BCH_2023_05: "BCH_2023_05"; readonly BCH_2024_05: "BCH_2024_05"; readonly BCH_2025_05: "BCH_2025_05"; readonly BCH_2026_05: "BCH_2026_05"; }; /** * The set of BCH VM versions that an XO template can declare support for. */ type BchVmVersion = ValueOf; /** * Values for NFT capability on template token fields. */ declare const XOTemplateNftCapabilities: { readonly NONE: "none"; readonly MUTABLE: "mutable"; readonly MINTING: "minting"; }; /** * The capability of a non-fungible token. * `minting` can create new NFTs of the same category. * `mutable` can update its own commitment data. * `none` means the commitment is immutable. */ type XOTemplateNftCapability = ValueOf; /** * Values for XO template locking script types. */ declare const XOTemplateLockingTypes: { readonly P2S: "p2s"; readonly P2PKH: "p2pkh"; readonly P2SH: "p2sh"; }; /** * The standard locking script types supported by XO. * */ type XOTemplateLockingType = ValueOf; /** * Values for primitive types declared in an XO template. * Used by constants, variables, and data fields. */ declare const XOTemplatePrimitiveTypes: { readonly BOOLEAN: "boolean"; readonly BYTES: "bytes"; readonly INTEGER: "integer"; readonly BIGINT: "bigint"; readonly STRING: "string"; readonly PRIVATE_KEY: "private_key"; readonly PUBLIC_KEY: "public_key"; readonly EXTENDED_PUBLIC_KEY: "extended_public_key"; readonly SATOSHIS: "satoshis"; readonly FUNGIBLE_TOKEN_AMOUNT: "token_amount"; readonly NON_FUNGIBLE_TOKEN_CAPABILITY: "token_capability"; readonly NON_FUNGIBLE_TOKEN_COMMITMENT: "token_commitment"; readonly TIMESTAMP: "timestamp"; readonly TOKEN_CATEGORY: "token_category"; readonly NFT_COMMITMENT: "nft_commitment"; readonly LOCKING_SCRIPT: "locking_script"; readonly TRANSACTION_HASH: "transaction_hash"; readonly TEMPLATE_IDENTIFIER: "template_identifier"; readonly SCHNORR_SIGNATURE: "signature"; }; /** * The primitive types that can be declared in an XO template. * Used by constants, variables, and data fields. */ type XOTemplatePrimitiveType = ValueOf; /** Identifies a role defined in the template's roles. */ type XOTemplateRoleIdentifier = string; /** Identifies an action defined in the template's actions. */ type XOTemplateActionIdentifier = string; /** Identifies an input defined in the template's inputs. */ type XOTemplateInputIdentifier = string; /** Identifies an output defined in the template's outputs. */ type XOTemplateOutputIdentifier = string; /** Identifies a locking script defined in the template's lockingScripts. */ type XOTemplateLockingScriptIdentifier = string; /** Identifies a script defined in the template's scripts. */ type XOTemplateScriptIdentifier = string; /** Identifies a transaction defined in the template's transactions. */ type XOTemplateTransactionIdentifier = string; /** Identifies a variable defined in the template's variables. */ type XOTemplateVariableIdentifier = string; /** Identifies a constant defined in the template's constants. */ type XOTemplateConstantIdentifier = string; /** Identifies a data field defined in the template's data. */ type XOTemplateDataIdentifier = string; /** Identifies a secret defined in a role or action's secrets list. */ type XOTemplateSecretIdentifier = string; /** Identifier for an XO template. */ type XOTemplateIdentifier = string; /** * Human-readable display properties shared by most template elements. */ type XOTemplateViewProperties = { /** * A short human-readable label for this element. */ name: string; /** * A human-readable explanation of what this element does and when it is relevant. */ description: string; /** * An optional icon identifier. */ icon?: string; }; /** * The base intent structure. Describes the common data parameters shared by all intent types * regardless of what they target. An optional templateIdentifier allows the intent to reference * a target defined in a different template. */ type XOTemplateIntent = { /** * Optional identifier for the template used in this intent. If not provided, uses the current template. */ templateIdentifier?: XOTemplateIdentifier; /** * Identifiers for items to generate when this intent is resolved (e.g. keys or secrets). */ generate?: Array; /** * Variable values to apply when this intent is resolved. */ variables?: Array>; /** * Constant values to apply when this intent is resolved. */ constants?: Array>; /** * Secret values to apply when this intent is resolved. */ secrets?: Array>; /** * Optional identifier for the role used in this intent. */ role?: XOTemplateRoleIdentifier; }; /** * An intent that targets a specific action. */ type XOTemplateActionIntent = XOTemplateIntent & { /** * The identifier for the intended action. */ action: XOTemplateActionIdentifier; }; /** * An intent that targets a specific output. */ type XOTemplateOutputIntent = XOTemplateIntent & { /** * The identifier for the intended output. */ output: XOTemplateOutputIdentifier; }; /** * An intent that targets a specific locking script. */ type XOTemplateLockingScriptIntent = XOTemplateIntent & { /** * The identifier for the intended locking script. */ lockingScript: XOTemplateLockingScriptIdentifier; }; /** * Requirements for a specific role within an action. Describes what data or secrets * the role must provide when participating. */ type XOTemplateActionRoleRequirements = { /** * List of variable identifiers required for this role. */ variables?: Array; /** * List of secret identifiers required for this role. */ secrets?: Array; }; /** * A role specific definition within an action. */ type XOTemplateActionRole = Partial & { /** * Identifiers for data items that should be generated for this role * when participating in the action. */ generate?: Array; /** * The requirements for this role within this action. */ requirements?: XOTemplateActionRoleRequirements; }; /** * Slot configuration for a role. Declares how many participants of a given * role are needed to satisfy the action's requirements. */ type XOTemplateRoleSlotsRequirements = { /** * Minimum number of participants required for this role. */ min: number; /** * Maximum number of participants allowed for this role. Undefined means unlimited. */ max?: number; }; /** * A role entry in an action's requirements block. * Declares which role must participate and how many slots are needed. */ type XOTemplateRoleSlot = { /** * The role identifier that this requirement applies to. */ role: XOTemplateRoleIdentifier; /** * Slot configuration specifying how many participants of this role are required. */ slots: XOTemplateRoleSlotsRequirements; }; /** * Requirements for an action. Declares which roles must participate and what secrets must be available. */ type XOTemplateActionRequirements = { /** * List of variable identifiers required for this action. */ variables?: Array; /** * The participants required for this action. */ participants?: Array; /** * The secrets required for this action. */ secrets?: Array; }; /** * An action within a template. */ type XOTemplateAction = XOTemplateViewProperties & { /** * Specific context for each role participating in this action. */ roles?: Record; /** * The requirements for this action. */ requirements?: XOTemplateActionRequirements; /** * Conditions that must be met for this action to be available. * * @todo More work needs to be done on this field. */ conditions?: Array; /** * The identifier of the transaction this action produces, referencing an entry * in the template's transactions. */ transaction?: XOTemplateTransactionIdentifier; /** * The identifier of the data field this action produces, referencing an entry * in the template's data. * * @todo More work needs to be done on this field. */ data?: XOTemplateDataIdentifier; }; /** * Non-fungible token configuration within a token field. */ type XOTemplateNonFungibleTokenDetails = { /** * The capability of the NFT. May be a known capability value or a CashASM expression resolving to a capability. */ capability?: XOTemplateNftCapability | string; /** * The commitment data for the NFT, as a string or CashASM expression resolving to a commitment. */ commitment?: string; }; /** * Token configuration for outputs and inputs. */ type XOTemplateToken = { /** * The category of the token, as a string or CashASM expression resolving to a category. */ category?: string; /** * The amount of fungible tokens as a bigint, a CashASM expression resolving to a bigint, or null indicating no FT is present. */ amount?: bigint | string | null; /** * Non-fungible token configuration. Null indicates no NFT is present. */ nft?: XOTemplateNonFungibleTokenDetails | null; }; /** * Asset amounts configuration. Used for balance tracking on locking scripts and their roles, and for omitting change amounts. * All fields are optional. Values may be literal amounts or CashASM expressions resolving to amounts. */ type XOTemplateAssetAmounts = { /** * The satoshi amount. * - `Satoshis`: A specific bigint amount. * - `string`: A CashASM expression that resolves to the amount. * - `true`: all, i.e. the entire amount */ satoshis?: Satoshis | string | true; /** * The fungible token amount. * - `FungibleTokenAmount`: A specific bigint amount. * - `string`: A CashASM expression that resolves to the amount. * - `true`: all, i.e. the entire amount */ fungibleTokens?: FungibleTokenAmount | string | true; /** * Whether a non-fungible token is present (0 for absent, 1 for present), * or a CashASM expression that evaluates to 0 or 1. * - `true`: resolves to 1 if an NFT is present, or 0 if none is present. Use this when * the NFT is optional, to express that the NFT is estimated to be part of the balance * if present, or absent from it if not. * - `0`: None, i.e. nothing is expected to be included * - `1`: present and complete, as value > 1 does not make sense for non-fungible tokens * - `string`: A CashASM expression that evaluates to 0 or 1. */ nonfungibleTokens?: true | 0 | 1 | string; }; /** * State configuration shared by a locking script and its individual roles. * Declares which variables and secrets are tracked in the on-chain state for that participant. */ type XOTemplateState = { /** * List of variable identifiers to track in state. */ variables?: Array; /** * List of secret identifiers to track in state. */ secrets?: Array; }; /** * A role definition within a locking script. */ type XOTemplateLockingScriptRole = Partial & { /** * List of items to track as state for this role. */ state?: XOTemplateState; /** * List of action references available to this role. */ actions?: Array; /** * Estimated ownership in the optional set of asset amounts specified. */ balance?: Partial; /** * Whether outputs locked to this script should be available for coin selection. */ selectable?: boolean; /** * Whether this output or locking script should be tracked by the engine. * When omitted, the engine treats this field as true. * - `true`: Include it. * - `false`: Exclude it. * - `string`: A CashASM expression that evaluates to a boolean relevance value. */ relevant?: boolean | string; /** * Privacy level for outputs locked to this script. * - `number`: A numeric privacy level. * - `string`: A CashASM expression that evaluates to a privacy level. */ privacy?: number | string; }; /** * A locking script definition in the template. */ type XOTemplateLockingScript = XOTemplateViewProperties & { /** * The type of locking mechanism. Defaults to 'p2s' if not specified. */ lockingType?: XOTemplateLockingType; /** * The locking script bytecode. */ lockingBytecode: string; /** * Optional default unlocking bytecode when used in automatic coin selection. */ unlockingBytecode?: string; /** * The actions available for this locking script. */ actions?: Array; /** * List of items to track as state for all participants. */ state?: XOTemplateState; /** * Estimated ownership in the optional set of asset amounts specified. */ balance?: Partial; /** * Whether outputs locked to this script should be available for coin selection. */ selectable?: boolean; /** * Privacy level for outputs locked to this script. * - `number`: A numeric privacy level. * - `string`: A CashASM expression that evaluates to a privacy level. */ privacy?: number | string; /** * Specific context for each role participating in this locking script. */ roles?: Record; }; /** * An input definition in the template. */ type XOTemplateInput = XOTemplateViewProperties & { /** * The amount of satoshis for this input. * - `Satoshis`: A specific amount of satoshis. * - `string`: A CashASM expression that resolves to the satoshi amount. */ valueSatoshis?: Satoshis | string; /** * Token configuration for this input. */ token?: XOTemplateToken | null; /** * The sequence number of this input. * - `number`: A specific sequence number. * - `string`: A CashASM expression that resolves to the sequence number. */ sequenceNumber?: number | string; /** * Identifier of the unlocking script to use for the UTXO provided for this input. */ unlockingScript?: string; /** * Amount of change that should be omitted from the automatic change handling. WARNING: Setting this can result in loss of funds! */ omitChangeAmounts?: XOTemplateAssetAmounts; }; /** * An output definition in the template. Inherits all fields from `XOTemplateLockingScript` * except `lockingType`, `lockingBytecode` and `unlockingBytecode`: outputs reference a locking script by identifier * rather than defining one inline, so repeating any of these fields here would create an ambiguity * about which declaration takes precedence. */ type XOTemplateOutput = Omit & { /** * Identifier of the locking script to use for this output. */ lockingScript: XOTemplateLockingScriptIdentifier; /** * The amount of satoshis for this output. * - `Satoshis`: A specific amount of satoshis. * - `string`: A CashASM expression that resolves to the satoshi amount. */ valueSatoshis?: Satoshis | string; /** * Token configuration for this output. */ token?: XOTemplateToken | null; }; /** * Reference to an input in a transaction definition in the template. */ type XOTemplateTransactionInput = { /** * The input definition identifier. */ input: XOTemplateInputIdentifier; /** * Optional index of this input in the transaction. */ inputIndex?: number; }; /** * Reference to an output in a transaction definition in the template. */ type XOTemplateTransactionOutput = { /** * The output definition identifier. */ output: XOTemplateOutputIdentifier; /** * Optional index of this output in the transaction. */ outputIndex?: number; }; /** * Role-specific data for a transaction within a template. */ type XOTemplateTransactionRoleData = Partial & { /** * The inputs required for this role. */ inputs?: Array; /** * The outputs required for this role. */ outputs?: Array; }; /** * A transaction template definition. */ type XOTemplateTransaction = XOTemplateViewProperties & { /** * The version of the transaction. */ version?: number; /** * The locktime for this transaction. * - `number`: A specific locktime value. * - `string`: A CashASM expression that resolves to the locktime. */ locktime?: number | string; /** * The inputs for this transaction. */ inputs: Array; /** * The outputs for this transaction. */ outputs: Array; /** * Specific context for each role participating in this transaction. */ roles?: Record; /** * Whether this transaction can be composed with other transactions. */ composable?: boolean; }; /** * A constant value definition in the template. */ type XOTemplateConstant = XOTemplateViewProperties & { /** * The data type of this constant. */ type: XOTemplatePrimitiveType; /** * The value of this constant. */ value: unknown; /** * An optional hint to help apps and users understand what this constant represents. */ hint?: unknown; }; /** * An import default value intent. Extends the base intent with optional view * properties that the engine evaluates at runtime to produce human-readable output. * The engine overrides whatever values are set here when resolving the target for a participant. */ type XOTemplateImportDefaultValue = XOTemplateIntent & Partial; /** * A variable definition in the template. */ type XOTemplateVariable = XOTemplateViewProperties & { /** * The data type of this variable. */ type?: XOTemplatePrimitiveType; /** * A hint to help users understand what value to provide. */ hint?: unknown; /** * A neutral intent that the engine uses to populate the default value for this variable. * View properties (name, description, icon) may contain CashASM expressions that the * engine evaluates at runtime to produce human-readable output. */ importDefaultValue?: XOTemplateImportDefaultValue; }; /** * A data field definition in the template. * * @todo More work needs to be done on this type. */ type XOTemplateData = { /** * The data type of this data field. */ type: XOTemplatePrimitiveType; /** * The value for this data field. */ value: unknown; /** * An optional hint to help apps and users understand this data field. */ hint?: unknown; }; /** * An icon reference in the template. */ type XOTemplateIcon = { /** * A name for this icon. */ name: string; /** * The identifier of the icon. */ hash: string; }; /** * A resource reference attached to a template. Extends view properties with a URL * pointing to external documentation or tooling. */ type XOTemplateResource = XOTemplateViewProperties & { /** * The URL for this resource. */ url: string; }; /** * Default settings applied across the template when no explicit per-action overrides are given. */ type XOTemplateDefaults = { /** * Instructions for how to construct automated change output. */ change?: XOTemplateOutputIntent; /** * Configure the default intent structure for creating receiving addresses / locking scripts. */ address?: XOTemplateLockingScriptIntent; /** * Configure the default intent structure for creating receive outputs. */ receive?: XOTemplateOutputIntent; }; /** * The XO Template. */ type XOTemplate = XOTemplateViewProperties & { /** * The URI that identifies the JSON Schema used by this template. * This enables documentation, autocompletion, and validation in JSON documents. */ $schema: string; /** * A string identifying the version of this template. */ version?: string; /** * The BCH VM versions that this template supports. At least one version is required. */ supported: Array; /** * Optional default settings used in this template. */ defaults?: XOTemplateDefaults; /** * The roles defined in this template. */ roles: Record; /** * A list of entry points defining which actions are available at the start. */ start: Array; /** * The actions defined in this template. */ actions: Record; /** * The data fields defined in this template. */ data?: Record; /** * The transaction templates defined in this template. */ transactions?: Record; /** * The inputs defined in this template. */ inputs: Record; /** * The outputs defined in this template. */ outputs: Record; /** * The locking script templates defined in this template. */ lockingScripts: Record; /** * The scripts used in this template, The keys are identifiers of the scripts and * the values are the bytecode or cashASM expressions. */ scripts: Record; /** * The constants defined in this template. */ constants?: Record; /** * The variables that must be provided for use in the template's scripts. */ variables?: Record; /** * Resource references providing external documentation or tooling links. */ resources?: Array; /** * The icons available for use throughout the template. */ icons?: Array; /** * The scenarios defined in this template. */ scenarios?: unknown; }; //#endregion //#region source/experimental/multisig.d.ts /** * A 2 of 3 vault. Each signer generates its own key and provides its public key as a variable, and the vault locking * script is built from the three public keys. Receive pays that script. Any two signers can spend it. * * The redeem script is wrapped as pay to script hash 32 by the locking type. Each spend path * pushes a Schnorr bit field and a Schnorr signature from each of the two signer keys, in key order. */ declare const multisigTemplate: XOTemplate; //#endregion //#region source/faucet_cash.d.ts declare const faucetCashTemplate: XOTemplate; //#endregion //#region source/p2pkh.d.ts declare const p2pkhTemplate: XOTemplate; //#endregion //#region source/wrapped_cash.d.ts /** * Encodes the user parts of the https://wrapped.cash/ use case as an XO template. * * The bootstrap ceremony is not encoded in this template, but the final categoryId * is properly encoded here and ensure we are operating with the correct token. */ declare const wrapBCHTemplate: XOTemplate; //#endregion //#region source/wrapped_cash_chipnet.d.ts /** * Encodes the user parts of the https://wrapped.cash/ use case as an XO template. * * The bootstrap ceremony is not encoded in this template, but the final categoryId * is properly encoded here and ensure we are operating with the correct token. */ declare const wrapBCHChipnetTemplate: XOTemplate; //#endregion export { faucetCashTemplate, multisigTemplate, p2pkhTemplate, wrapBCHChipnetTemplate, wrapBCHTemplate }; //# sourceMappingURL=index.d.mts.map