@xo-cash/types 0.0.3-development.15519436471 → 0.0.3-development.15521406792
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +24 -11
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +14 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -73,26 +73,39 @@ declare const XOTemplateLockingTypes: {
|
|
|
73
73
|
*/
|
|
74
74
|
type XOTemplateLockingType = ValueOf<typeof XOTemplateLockingTypes>;
|
|
75
75
|
/**
|
|
76
|
-
* Values for
|
|
76
|
+
* Values for base types declared in an XO template.
|
|
77
77
|
* Used by constants, variables, and data fields.
|
|
78
78
|
*/
|
|
79
|
-
declare const
|
|
79
|
+
declare const XOTemplateBaseTypes: {
|
|
80
80
|
readonly BOOLEAN: "boolean";
|
|
81
81
|
readonly BYTES: "bytes";
|
|
82
82
|
readonly INTEGER: "integer";
|
|
83
83
|
readonly BIGINT: "bigint";
|
|
84
84
|
readonly STRING: "string";
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* The base types that can be declared in an XO template.
|
|
88
|
+
* Used by constants, variables, and data fields.
|
|
89
|
+
*/
|
|
90
|
+
type XOTemplateBaseType = ValueOf<typeof XOTemplateBaseTypes>;
|
|
91
|
+
/**
|
|
92
|
+
* Values for primitive types declared in an XO template.
|
|
93
|
+
* Used by constants, variables, and data fields.
|
|
94
|
+
*/
|
|
95
|
+
declare const XOTemplatePrimitiveTypes: {
|
|
85
96
|
readonly PRIVATE_KEY: "private_key";
|
|
86
97
|
readonly PUBLIC_KEY: "public_key";
|
|
87
98
|
readonly EXTENDED_PUBLIC_KEY: "extended_public_key";
|
|
88
99
|
readonly SATOSHIS: "satoshis";
|
|
89
|
-
readonly FUNGIBLE_TOKEN_AMOUNT: "
|
|
100
|
+
readonly FUNGIBLE_TOKEN_AMOUNT: "token_amount";
|
|
101
|
+
readonly NON_FUNGIBLE_TOKEN_CAPABILITY: "token_capability";
|
|
102
|
+
readonly NON_FUNGIBLE_TOKEN_COMMITMENT: "token_commitment";
|
|
90
103
|
readonly TIMESTAMP: "timestamp";
|
|
91
104
|
readonly TOKEN_CATEGORY: "token_category";
|
|
92
105
|
readonly NFT_COMMITMENT: "nft_commitment";
|
|
93
106
|
readonly TRANSACTION_HASH: "transaction_hash";
|
|
94
107
|
readonly TEMPLATE_IDENTIFIER: "template_identifier";
|
|
95
|
-
readonly SCHNORR_SIGNATURE: "
|
|
108
|
+
readonly SCHNORR_SIGNATURE: "signature";
|
|
96
109
|
};
|
|
97
110
|
/**
|
|
98
111
|
* The primitive types that can be declared in an XO template.
|
|
@@ -575,7 +588,7 @@ type XOTemplateConstant = XOTemplateViewProperties & {
|
|
|
575
588
|
/**
|
|
576
589
|
* The data type of this constant.
|
|
577
590
|
*/
|
|
578
|
-
type:
|
|
591
|
+
type: XOTemplateBaseType;
|
|
579
592
|
/**
|
|
580
593
|
* The value of this constant.
|
|
581
594
|
*/
|
|
@@ -583,7 +596,7 @@ type XOTemplateConstant = XOTemplateViewProperties & {
|
|
|
583
596
|
/**
|
|
584
597
|
* An optional hint to help apps and users understand what this constant represents.
|
|
585
598
|
*/
|
|
586
|
-
hint?:
|
|
599
|
+
hint?: XOTemplatePrimitiveType;
|
|
587
600
|
};
|
|
588
601
|
/**
|
|
589
602
|
* An import default value intent. Extends the base intent with optional view
|
|
@@ -598,11 +611,11 @@ type XOTemplateVariable = XOTemplateViewProperties & {
|
|
|
598
611
|
/**
|
|
599
612
|
* The data type of this variable.
|
|
600
613
|
*/
|
|
601
|
-
type?:
|
|
614
|
+
type?: XOTemplateBaseType;
|
|
602
615
|
/**
|
|
603
616
|
* A hint to help users understand what value to provide.
|
|
604
617
|
*/
|
|
605
|
-
hint?:
|
|
618
|
+
hint?: XOTemplatePrimitiveType;
|
|
606
619
|
/**
|
|
607
620
|
* A neutral intent that the engine uses to populate the default value for this variable.
|
|
608
621
|
* View properties (name, description, icon) may contain CashASM expressions that the
|
|
@@ -619,7 +632,7 @@ type XOTemplateData = {
|
|
|
619
632
|
/**
|
|
620
633
|
* The data type of this data field.
|
|
621
634
|
*/
|
|
622
|
-
type:
|
|
635
|
+
type: XOTemplateBaseType;
|
|
623
636
|
/**
|
|
624
637
|
* The value for this data field.
|
|
625
638
|
*/
|
|
@@ -627,7 +640,7 @@ type XOTemplateData = {
|
|
|
627
640
|
/**
|
|
628
641
|
* An optional hint to help apps and users understand this data field.
|
|
629
642
|
*/
|
|
630
|
-
hint?:
|
|
643
|
+
hint?: XOTemplatePrimitiveType;
|
|
631
644
|
};
|
|
632
645
|
/**
|
|
633
646
|
* An icon reference in the template.
|
|
@@ -1302,5 +1315,5 @@ type XOInvitation = {
|
|
|
1302
1315
|
result?: XOInvitationResult;
|
|
1303
1316
|
};
|
|
1304
1317
|
//#endregion
|
|
1305
|
-
export { BchVmVersion, BchVmVersions, FungibleTokenAmount, Satoshis, ValueOf, XOInvitation, XOInvitationActionReference, XOInvitationCommit, XOInvitationCommitData, XOInvitationCommitDataItemIndex, XOInvitationCommitIdentifier, XOInvitationDataResult, XOInvitationEntityIdentifier, XOInvitationIdentifier, XOInvitationInput, XOInvitationMemo, XOInvitationMergesWithReference, XOInvitationOutput, XOInvitationRequirements, XOInvitationResult, XOInvitationRoleRequirement, XOInvitationSignature, XOInvitationTimestamp, XOInvitationTransactionBroadcastDetails, XOInvitationTransactionHash, XOInvitationTransactionInputIndex, XOInvitationTransactionLocktime, XOInvitationTransactionOutputIndex, XOInvitationTransactionResult, XOInvitationTransactionVersion, XOInvitationVariable, XOInvitationVariableValue, XOTemplate, XOTemplateAction, XOTemplateActionIdentifier, XOTemplateActionIntent, XOTemplateActionRequirements, XOTemplateActionRole, XOTemplateActionRoleRequirements, XOTemplateAssetAmounts, XOTemplateConstant, XOTemplateConstantIdentifier, XOTemplateData, XOTemplateDataIdentifier, XOTemplateDefaults, XOTemplateIcon, XOTemplateIdentifier, XOTemplateImportDefaultValue, XOTemplateInput, XOTemplateInputIdentifier, XOTemplateIntent, XOTemplateLockingScript, XOTemplateLockingScriptIdentifier, XOTemplateLockingScriptIntent, XOTemplateLockingScriptRole, XOTemplateLockingType, XOTemplateLockingTypes, XOTemplateNftCapabilities, XOTemplateNftCapability, XOTemplateNonFungibleTokenDetails, XOTemplateOutput, XOTemplateOutputIdentifier, XOTemplateOutputIntent, XOTemplatePrimitiveType, XOTemplatePrimitiveTypes, XOTemplateResource, XOTemplateRoleIdentifier, XOTemplateRoleSlot, XOTemplateRoleSlotsRequirements, XOTemplateScriptIdentifier, XOTemplateSecretIdentifier, XOTemplateState, XOTemplateToken, XOTemplateTransaction, XOTemplateTransactionIdentifier, XOTemplateTransactionInput, XOTemplateTransactionOutput, XOTemplateTransactionRoleData, XOTemplateVariable, XOTemplateVariableIdentifier, XOTemplateViewProperties };
|
|
1318
|
+
export { BchVmVersion, BchVmVersions, FungibleTokenAmount, Satoshis, ValueOf, XOInvitation, XOInvitationActionReference, XOInvitationCommit, XOInvitationCommitData, XOInvitationCommitDataItemIndex, XOInvitationCommitIdentifier, XOInvitationDataResult, XOInvitationEntityIdentifier, XOInvitationIdentifier, XOInvitationInput, XOInvitationMemo, XOInvitationMergesWithReference, XOInvitationOutput, XOInvitationRequirements, XOInvitationResult, XOInvitationRoleRequirement, XOInvitationSignature, XOInvitationTimestamp, XOInvitationTransactionBroadcastDetails, XOInvitationTransactionHash, XOInvitationTransactionInputIndex, XOInvitationTransactionLocktime, XOInvitationTransactionOutputIndex, XOInvitationTransactionResult, XOInvitationTransactionVersion, XOInvitationVariable, XOInvitationVariableValue, XOTemplate, XOTemplateAction, XOTemplateActionIdentifier, XOTemplateActionIntent, XOTemplateActionRequirements, XOTemplateActionRole, XOTemplateActionRoleRequirements, XOTemplateAssetAmounts, XOTemplateBaseType, XOTemplateBaseTypes, XOTemplateConstant, XOTemplateConstantIdentifier, XOTemplateData, XOTemplateDataIdentifier, XOTemplateDefaults, XOTemplateIcon, XOTemplateIdentifier, XOTemplateImportDefaultValue, XOTemplateInput, XOTemplateInputIdentifier, XOTemplateIntent, XOTemplateLockingScript, XOTemplateLockingScriptIdentifier, XOTemplateLockingScriptIntent, XOTemplateLockingScriptRole, XOTemplateLockingType, XOTemplateLockingTypes, XOTemplateNftCapabilities, XOTemplateNftCapability, XOTemplateNonFungibleTokenDetails, XOTemplateOutput, XOTemplateOutputIdentifier, XOTemplateOutputIntent, XOTemplatePrimitiveType, XOTemplatePrimitiveTypes, XOTemplateResource, XOTemplateRoleIdentifier, XOTemplateRoleSlot, XOTemplateRoleSlotsRequirements, XOTemplateScriptIdentifier, XOTemplateSecretIdentifier, XOTemplateState, XOTemplateToken, XOTemplateTransaction, XOTemplateTransactionIdentifier, XOTemplateTransactionInput, XOTemplateTransactionOutput, XOTemplateTransactionRoleData, XOTemplateVariable, XOTemplateVariableIdentifier, XOTemplateViewProperties };
|
|
1306
1319
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../source/utilities.ts","../source/template.ts","../source/invitation.ts"],"mappings":";;;;;;AAgBA;;;;;;;;;;;;ACPA;KDOY,OAAA,MAAa,CAAA,OAAQ,CAAA;;;;;AAAjC;KCPY,QAAA;;;;KAKA,mBAAA;;;;cAKC,aAAA;EAAA;;;;;;;;;;;KAaD,YAAA,GAAe,OAAA,QAAe,aAAA;AAb1C;;;AAAA,cAkBa,yBAAA;EAAA;;;;;;;;;AALb;KAiBY,uBAAA,GAA0B,OAAA,QAAe,yBAAA;;;;cAKxC,sBAAA;EAAA;;;;;;;;KAUD,qBAAA,GAAwB,OAAA,QAAe,sBAAA;;;;;cAMtC,wBAAA;EAAA
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../source/utilities.ts","../source/template.ts","../source/invitation.ts"],"mappings":";;;;;;AAgBA;;;;;;;;;;;;ACPA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KCjEY,kBAAA;ED2ER;;;AAMJ;;EC1EI,YAAA,GAAe,MAAA,CAAO,+BAAA,EAAiC,6BAAA;ED+ErB;;;EC1ElC,IAAA,GAAO,MAAA,CAAO,wBAAA,EAA0B,sBAAA;AAAA;;ADqF5C;;;;;;;;;;;;;;;;;;;;;AAgBA;;;;KCxEY,YAAA;EDyFA;;;ECpFR,oBAAA,EAAsB,sBAAA;ED8FmB;;;ECzFzC,kBAAA,EAAoB,qBAAA;ED8DY;;;ECzDhC,kBAAA,EAAoB,oBAAA;ED0EZ;;;ECrER,gBAAA,EAAkB,0BAAA;ED0EH;;;ECrEf,OAAA,EAAS,kBAAA;ED0EgC;;;ECrEzC,MAAA,GAAS,kBAAA;AAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -28,28 +28,36 @@ const XOTemplateLockingTypes = {
|
|
|
28
28
|
P2SH: "p2sh"
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
|
-
* Values for
|
|
31
|
+
* Values for base types declared in an XO template.
|
|
32
32
|
* Used by constants, variables, and data fields.
|
|
33
33
|
*/
|
|
34
|
-
const
|
|
34
|
+
const XOTemplateBaseTypes = {
|
|
35
35
|
BOOLEAN: "boolean",
|
|
36
36
|
BYTES: "bytes",
|
|
37
37
|
INTEGER: "integer",
|
|
38
38
|
BIGINT: "bigint",
|
|
39
|
-
STRING: "string"
|
|
39
|
+
STRING: "string"
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Values for primitive types declared in an XO template.
|
|
43
|
+
* Used by constants, variables, and data fields.
|
|
44
|
+
*/
|
|
45
|
+
const XOTemplatePrimitiveTypes = {
|
|
40
46
|
PRIVATE_KEY: "private_key",
|
|
41
47
|
PUBLIC_KEY: "public_key",
|
|
42
48
|
EXTENDED_PUBLIC_KEY: "extended_public_key",
|
|
43
49
|
SATOSHIS: "satoshis",
|
|
44
|
-
FUNGIBLE_TOKEN_AMOUNT: "
|
|
50
|
+
FUNGIBLE_TOKEN_AMOUNT: "token_amount",
|
|
51
|
+
NON_FUNGIBLE_TOKEN_CAPABILITY: "token_capability",
|
|
52
|
+
NON_FUNGIBLE_TOKEN_COMMITMENT: "token_commitment",
|
|
45
53
|
TIMESTAMP: "timestamp",
|
|
46
54
|
TOKEN_CATEGORY: "token_category",
|
|
47
55
|
NFT_COMMITMENT: "nft_commitment",
|
|
48
56
|
TRANSACTION_HASH: "transaction_hash",
|
|
49
57
|
TEMPLATE_IDENTIFIER: "template_identifier",
|
|
50
|
-
SCHNORR_SIGNATURE: "
|
|
58
|
+
SCHNORR_SIGNATURE: "signature"
|
|
51
59
|
};
|
|
52
60
|
|
|
53
61
|
//#endregion
|
|
54
|
-
export { BchVmVersions, XOTemplateLockingTypes, XOTemplateNftCapabilities, XOTemplatePrimitiveTypes };
|
|
62
|
+
export { BchVmVersions, XOTemplateBaseTypes, XOTemplateLockingTypes, XOTemplateNftCapabilities, XOTemplatePrimitiveTypes };
|
|
55
63
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../source/template.ts"],"sourcesContent":["import type { ValueOf } from './utilities.ts';\n\n// ============================================================\n// Base types\n// ============================================================\n\n/**\n * Type for satoshis.\n */\nexport type Satoshis = bigint;\n\n/**\n * A fungible token amount.\n */\nexport type FungibleTokenAmount = bigint;\n\n/**\n * Values for BCH VM versions that an XO template can declare support for.\n */\nexport const BchVmVersions = {\n BCH_2020_05: 'BCH_2020_05',\n BCH_2021_05: 'BCH_2021_05',\n BCH_2022_05: 'BCH_2022_05',\n BCH_2023_05: 'BCH_2023_05',\n BCH_2024_05: 'BCH_2024_05',\n BCH_2025_05: 'BCH_2025_05',\n BCH_2026_05: 'BCH_2026_05',\n} as const;\n\n/**\n * The set of BCH VM versions that an XO template can declare support for.\n */\nexport type BchVmVersion = ValueOf<typeof BchVmVersions>;\n\n/**\n * Values for NFT capability on template token fields.\n */\nexport const XOTemplateNftCapabilities = {\n NONE: 'none',\n MUTABLE: 'mutable',\n MINTING: 'minting',\n} as const;\n\n/**\n * The capability of a non-fungible token.\n * `minting` can create new NFTs of the same category.\n * `mutable` can update its own commitment data.\n * `none` means the commitment is immutable.\n */\nexport type XOTemplateNftCapability = ValueOf<typeof XOTemplateNftCapabilities>;\n\n/**\n * Values for XO template locking script types.\n */\nexport const XOTemplateLockingTypes = {\n P2S: 'p2s',\n P2PKH: 'p2pkh',\n P2SH: 'p2sh',\n} as const;\n\n/**\n * The standard locking script types supported by XO.\n *\n */\nexport type XOTemplateLockingType = ValueOf<typeof XOTemplateLockingTypes>;\n\n/**\n * Values for primitive types declared in an XO template.\n * Used by constants, variables, and data fields.\n */\nexport const XOTemplatePrimitiveTypes = {\n BOOLEAN: 'boolean',\n BYTES: 'bytes',\n INTEGER: 'integer',\n BIGINT: 'bigint',\n STRING: 'string',\n PRIVATE_KEY: 'private_key',\n PUBLIC_KEY: 'public_key',\n EXTENDED_PUBLIC_KEY: 'extended_public_key',\n SATOSHIS: 'satoshis',\n FUNGIBLE_TOKEN_AMOUNT: 'fungible_token_amount',\n TIMESTAMP: 'timestamp',\n TOKEN_CATEGORY: 'token_category',\n NFT_COMMITMENT: 'nft_commitment',\n TRANSACTION_HASH: 'transaction_hash',\n TEMPLATE_IDENTIFIER: 'template_identifier',\n SCHNORR_SIGNATURE: 'schnorr_signature',\n} as const;\n\n/**\n * The primitive types that can be declared in an XO template.\n * Used by constants, variables, and data fields.\n */\nexport type XOTemplatePrimitiveType = ValueOf<typeof XOTemplatePrimitiveTypes>;\n\n// ============================================================\n// Identifier Types\n// ============================================================\n\n/** Identifies a role defined in the template's roles. */\nexport type XOTemplateRoleIdentifier = string;\n\n/** Identifies an action defined in the template's actions. */\nexport type XOTemplateActionIdentifier = string;\n\n/** Identifies an input defined in the template's inputs. */\nexport type XOTemplateInputIdentifier = string;\n\n/** Identifies an output defined in the template's outputs. */\nexport type XOTemplateOutputIdentifier = string;\n\n/** Identifies a locking script defined in the template's lockingScripts. */\nexport type XOTemplateLockingScriptIdentifier = string;\n\n/** Identifies a script defined in the template's scripts. */\nexport type XOTemplateScriptIdentifier = string;\n\n/** Identifies a transaction defined in the template's transactions. */\nexport type XOTemplateTransactionIdentifier = string;\n\n/** Identifies a variable defined in the template's variables. */\nexport type XOTemplateVariableIdentifier = string;\n\n/** Identifies a constant defined in the template's constants. */\nexport type XOTemplateConstantIdentifier = string;\n\n/** Identifies a data field defined in the template's data. */\nexport type XOTemplateDataIdentifier = string;\n\n/** Identifies a secret defined in a role or action's secrets list. */\nexport type XOTemplateSecretIdentifier = string;\n\n/** Identifier for an XO template. */\nexport type XOTemplateIdentifier = string;\n\n// ============================================================\n// View Properties\n// ============================================================\n\n/**\n * Human-readable display properties shared by most template elements.\n */\nexport type XOTemplateViewProperties = {\n\n /**\n * A short human-readable label for this element.\n */\n name: string;\n\n /**\n * A human-readable explanation of what this element does and when it is relevant.\n */\n description: string;\n\n /**\n * An optional icon identifier.\n */\n icon?: string;\n};\n\n// ============================================================\n// Intents\n// ============================================================\n\n/**\n * The base intent structure. Describes the common data parameters shared by all intent types\n * regardless of what they target. An optional templateIdentifier allows the intent to reference\n * a target defined in a different template.\n */\nexport type XOTemplateIntent = {\n\n /**\n * Optional identifier for the template used in this intent. If not provided, uses the current template.\n */\n templateIdentifier?: XOTemplateIdentifier;\n\n /**\n * Identifiers for items to generate when this intent is resolved (e.g. keys or secrets).\n */\n generate?: Array<string>;\n\n /**\n * Variable values to apply when this intent is resolved.\n */\n variables?: Array<Record<XOTemplateVariableIdentifier, unknown>>;\n\n /**\n * Constant values to apply when this intent is resolved.\n */\n constants?: Array<Record<XOTemplateConstantIdentifier, unknown>>;\n\n /**\n * Secret values to apply when this intent is resolved.\n */\n secrets?: Array<Record<XOTemplateSecretIdentifier, unknown>>;\n\n /**\n * Optional identifier for the role used in this intent.\n */\n role?: XOTemplateRoleIdentifier;\n};\n\n/**\n * An intent that targets a specific action.\n */\nexport type XOTemplateActionIntent = XOTemplateIntent & {\n\n /**\n * The identifier for the intended action.\n */\n action: XOTemplateActionIdentifier;\n};\n\n/**\n * An intent that targets a specific output.\n */\nexport type XOTemplateOutputIntent = XOTemplateIntent & {\n\n /**\n * The identifier for the intended output.\n */\n output: XOTemplateOutputIdentifier;\n};\n\n/**\n * An intent that targets a specific locking script.\n */\nexport type XOTemplateLockingScriptIntent = XOTemplateIntent & {\n\n /**\n * The identifier for the intended locking script.\n */\n lockingScript: XOTemplateLockingScriptIdentifier;\n};\n\n// ============================================================\n// Actions\n// ============================================================\n\n/**\n * Requirements for a specific role within an action. Describes what data or secrets\n * the role must provide when participating.\n */\nexport type XOTemplateActionRoleRequirements = {\n\n /**\n * List of variable identifiers required for this role.\n */\n variables?: Array<XOTemplateVariableIdentifier>;\n\n /**\n * List of secret identifiers required for this role.\n */\n secrets?: Array<XOTemplateSecretIdentifier>;\n};\n\n/**\n * A role specific definition within an action.\n */\nexport type XOTemplateActionRole = Partial<XOTemplateViewProperties> & {\n\n /**\n * Identifiers for data items that should be generated for this role\n * when participating in the action.\n */\n generate?: Array<string>;\n\n /**\n * The requirements for this role within this action.\n */\n requirements?: XOTemplateActionRoleRequirements;\n};\n\n/**\n * Slot configuration for a role. Declares how many participants of a given\n * role are needed to satisfy the action's requirements.\n */\nexport type XOTemplateRoleSlotsRequirements = {\n\n /**\n * Minimum number of participants required for this role.\n */\n min: number;\n\n /**\n * Maximum number of participants allowed for this role. Undefined means unlimited.\n */\n max?: number;\n};\n\n/**\n * A role entry in an action's requirements block.\n * Declares which role must participate and how many slots are needed.\n */\nexport type XOTemplateRoleSlot = {\n\n /**\n * The role identifier that this requirement applies to.\n */\n role: XOTemplateRoleIdentifier;\n\n /**\n * Slot configuration specifying how many participants of this role are required.\n */\n slots: XOTemplateRoleSlotsRequirements;\n};\n\n/**\n * Requirements for an action. Declares which roles must participate and what secrets must be available.\n */\nexport type XOTemplateActionRequirements = {\n\n /**\n * List of variable identifiers required for this action.\n */\n variables?: Array<XOTemplateVariableIdentifier>;\n\n /**\n * The participants required for this action.\n */\n participants?: Array<XOTemplateRoleSlot>;\n\n /**\n * The secrets required for this action.\n */\n secrets?: Array<XOTemplateSecretIdentifier>;\n};\n\n/**\n * An action within a template.\n */\nexport type XOTemplateAction = XOTemplateViewProperties & {\n\n /**\n * Specific context for each role participating in this action.\n */\n roles?: Record<XOTemplateRoleIdentifier, XOTemplateActionRole>;\n\n /**\n * The requirements for this action.\n */\n requirements?: XOTemplateActionRequirements;\n\n /**\n * Conditions that must be met for this action to be available.\n *\n * @todo More work needs to be done on this field.\n */\n conditions?: Array<string>;\n\n /**\n * The identifier of the transaction this action produces, referencing an entry\n * in the template's transactions.\n */\n transaction?: XOTemplateTransactionIdentifier;\n\n /**\n * The identifier of the data field this action produces, referencing an entry\n * in the template's data.\n *\n * @todo More work needs to be done on this field.\n */\n data?: XOTemplateDataIdentifier;\n};\n\n// ============================================================\n// Tokens & Amounts\n// ============================================================\n\n/**\n * Non-fungible token configuration within a token field.\n */\nexport type XOTemplateNonFungibleTokenDetails = {\n\n /**\n * The capability of the NFT. May be a known capability value or a CashASM expression resolving to a capability.\n */\n capability?: XOTemplateNftCapability | string;\n\n /**\n * The commitment data for the NFT, as a string or CashASM expression resolving to a commitment.\n */\n commitment?: string;\n};\n\n/**\n * Token configuration for outputs and inputs.\n */\nexport type XOTemplateToken = {\n\n /**\n * The category of the token, as a string or CashASM expression resolving to a category.\n */\n category?: string;\n\n /**\n * The amount of fungible tokens as a bigint, a CashASM expression resolving to a bigint, or null indicating no FT is present.\n */\n amount?: bigint | string | null;\n\n /**\n * Non-fungible token configuration. Null indicates no NFT is present.\n */\n nft?: XOTemplateNonFungibleTokenDetails | null;\n};\n\n/**\n * Asset amounts configuration. Used for balance tracking on locking scripts and their roles, and for omitting change amounts.\n * All fields are optional. Values may be literal amounts or CashASM expressions resolving to amounts.\n */\nexport type XOTemplateAssetAmounts = {\n\n /**\n * The satoshi amount.\n * - `Satoshis`: A specific bigint amount.\n * - `string`: A CashASM expression that resolves to the amount.\n * - `true`: all, i.e. the entire amount\n */\n satoshis?: Satoshis | string | true;\n\n /**\n * The fungible token amount.\n * - `FungibleTokenAmount`: A specific bigint amount.\n * - `string`: A CashASM expression that resolves to the amount.\n * - `true`: all, i.e. the entire amount\n */\n fungibleTokens?: FungibleTokenAmount | string | true;\n\n /**\n * Whether a non-fungible token is present (0 for absent, 1 for present),\n * or a CashASM expression that evaluates to 0 or 1.\n * - `true`: resolves to 1 if an NFT is present, or 0 if none is present. Use this when\n * the NFT is optional, to express that the NFT is estimated to be part of the balance\n * if present, or absent from it if not.\n * - `0`: None, i.e. nothing is expected to be included\n * - `1`: present and complete, as value > 1 does not make sense for non-fungible tokens\n * - `string`: A CashASM expression that evaluates to 0 or 1.\n */\n nonfungibleTokens?: true | 0 | 1 | string;\n};\n\n// ============================================================\n// Shared State\n// ============================================================\n\n/**\n * State configuration shared by a locking script and its individual roles.\n * Declares which variables and secrets are tracked in the on-chain state for that participant.\n */\nexport type XOTemplateState = {\n\n /**\n * List of variable identifiers to track in state.\n */\n variables?: Array<XOTemplateVariableIdentifier>;\n\n /**\n * List of secret identifiers to track in state.\n */\n secrets?: Array<XOTemplateSecretIdentifier>;\n};\n\n// ============================================================\n// Locking Scripts\n// ============================================================\n\n/**\n * A role definition within a locking script.\n */\nexport type XOTemplateLockingScriptRole = Partial<XOTemplateViewProperties> & {\n\n /**\n * List of items to track as state for this role.\n */\n state?: XOTemplateState;\n\n /**\n * List of action references available to this role.\n */\n actions?: Array<XOTemplateActionIntent>;\n\n /**\n * Estimated ownership in the optional set of asset amounts specified.\n */\n balance?: Partial<XOTemplateAssetAmounts>;\n\n /**\n * Whether outputs locked to this script should be available for coin selection.\n */\n selectable?: boolean;\n\n /**\n * Privacy level for outputs locked to this script.\n * - `number`: A numeric privacy level.\n * - `string`: A CashASM expression that evaluates to a privacy level.\n */\n privacy?: number | string;\n};\n\n/**\n * A locking script definition in the template.\n */\nexport type XOTemplateLockingScript = XOTemplateViewProperties & {\n\n /**\n * The type of locking mechanism. Defaults to 'p2s' if not specified.\n */\n lockingType?: XOTemplateLockingType;\n\n /**\n * The locking script bytecode.\n */\n lockingBytecode: string;\n\n /**\n * Optional default unlocking bytecode when used in automatic coin selection.\n */\n unlockingBytecode?: string;\n\n /**\n * The actions available for this locking script.\n */\n actions?: Array<XOTemplateActionIntent>;\n\n /**\n * List of items to track as state for all participants.\n */\n state?: XOTemplateState;\n\n /**\n * Estimated ownership in the optional set of asset amounts specified.\n */\n balance?: Partial<XOTemplateAssetAmounts>;\n\n /**\n * Whether outputs locked to this script should be available for coin selection.\n */\n selectable?: boolean;\n\n /**\n * Privacy level for outputs locked to this script.\n * - `number`: A numeric privacy level.\n * - `string`: A CashASM expression that evaluates to a privacy level.\n */\n privacy?: number | string;\n\n /**\n * Specific context for each role participating in this locking script.\n */\n roles?: Record<XOTemplateRoleIdentifier, XOTemplateLockingScriptRole>;\n};\n\n// ============================================================\n// Inputs\n// ============================================================\n\n/**\n * An input definition in the template.\n */\nexport type XOTemplateInput = XOTemplateViewProperties & {\n\n /**\n * The amount of satoshis for this input.\n * - `Satoshis`: A specific amount of satoshis.\n * - `string`: A CashASM expression that resolves to the satoshi amount.\n */\n valueSatoshis?: Satoshis | string;\n\n /**\n * Token configuration for this input.\n */\n token?: XOTemplateToken | null;\n\n /**\n * The sequence number of this input.\n * - `number`: A specific sequence number.\n * - `string`: A CashASM expression that resolves to the sequence number.\n */\n sequenceNumber?: number | string;\n\n /**\n * Identifier of the unlocking script to use for the UTXO provided for this input.\n */\n unlockingScript?: string;\n\n /**\n * Amount of change that should be omitted from the automatic change handling. WARNING: Setting this can result in loss of funds!\n */\n omitChangeAmounts?: XOTemplateAssetAmounts;\n};\n\n// ============================================================\n// Outputs\n// ============================================================\n\n/**\n * An output definition in the template. Inherits all fields from `XOTemplateLockingScript`\n * except `lockingType`, `lockingBytecode` and `unlockingBytecode`: outputs reference a locking script by identifier\n * rather than defining one inline, so repeating any of these fields here would create an ambiguity\n * about which declaration takes precedence.\n */\nexport type XOTemplateOutput = Omit<XOTemplateLockingScript, 'lockingType' | 'lockingBytecode' | 'unlockingBytecode'> & {\n\n /**\n * Identifier of the locking script to use for this output.\n */\n lockingScript: XOTemplateLockingScriptIdentifier;\n\n /**\n * The amount of satoshis for this output.\n * - `Satoshis`: A specific amount of satoshis.\n * - `string`: A CashASM expression that resolves to the satoshi amount.\n */\n valueSatoshis?: Satoshis | string;\n\n /**\n * Token configuration for this output.\n */\n token?: XOTemplateToken | null;\n};\n\n// ============================================================\n// Transactions\n// ============================================================\n\n/**\n * Reference to an input in a transaction definition in the template.\n */\nexport type XOTemplateTransactionInput = {\n\n /**\n * The input definition identifier.\n */\n input: XOTemplateInputIdentifier;\n\n /**\n * Optional index of this input in the transaction.\n */\n inputIndex?: number;\n};\n\n/**\n * Reference to an output in a transaction definition in the template.\n */\nexport type XOTemplateTransactionOutput = {\n\n /**\n * The output definition identifier.\n */\n output: XOTemplateOutputIdentifier;\n\n /**\n * Optional index of this output in the transaction.\n */\n outputIndex?: number;\n};\n\n/**\n * Role-specific data for a transaction within a template.\n */\nexport type XOTemplateTransactionRoleData = Partial<XOTemplateViewProperties> & {\n\n /**\n * The inputs required for this role.\n */\n inputs?: Array<XOTemplateTransactionInput>;\n\n /**\n * The outputs required for this role.\n */\n outputs?: Array<XOTemplateTransactionOutput>;\n};\n\n/**\n * A transaction template definition.\n */\nexport type XOTemplateTransaction = XOTemplateViewProperties & {\n\n /**\n * The version of the transaction.\n */\n version?: number;\n\n /**\n * The locktime for this transaction.\n * - `number`: A specific locktime value.\n * - `string`: A CashASM expression that resolves to the locktime.\n */\n locktime?: number | string;\n\n /**\n * The inputs for this transaction.\n */\n inputs: Array<XOTemplateTransactionInput>;\n\n /**\n * The outputs for this transaction.\n */\n outputs: Array<XOTemplateTransactionOutput>;\n\n /**\n * Specific context for each role participating in this transaction.\n */\n roles?: Record<XOTemplateRoleIdentifier, XOTemplateTransactionRoleData>;\n\n /**\n * Whether this transaction can be composed with other transactions.\n */\n composable?: boolean;\n};\n\n// ============================================================\n// Template Data\n// ============================================================\n\n/**\n * A constant value definition in the template.\n */\nexport type XOTemplateConstant = XOTemplateViewProperties & {\n\n /**\n * The data type of this constant.\n */\n type: XOTemplatePrimitiveType;\n\n /**\n * The value of this constant.\n */\n value: unknown;\n\n /**\n * An optional hint to help apps and users understand what this constant represents.\n */\n hint?: string;\n};\n\n/**\n * An import default value intent. Extends the base intent with optional view\n * properties that the engine evaluates at runtime to produce human-readable output.\n * The engine overrides whatever values are set here when resolving the target for a participant.\n */\nexport type XOTemplateImportDefaultValue = XOTemplateIntent & Partial<XOTemplateViewProperties>;\n\n/**\n * A variable definition in the template.\n */\nexport type XOTemplateVariable = XOTemplateViewProperties & {\n\n /**\n * The data type of this variable.\n */\n type?: XOTemplatePrimitiveType;\n\n /**\n * A hint to help users understand what value to provide.\n */\n hint?: string;\n\n /**\n * A neutral intent that the engine uses to populate the default value for this variable.\n * View properties (name, description, icon) may contain CashASM expressions that the\n * engine evaluates at runtime to produce human-readable output.\n */\n importDefaultValue?: XOTemplateImportDefaultValue;\n};\n\n/**\n * A data field definition in the template.\n *\n * @todo More work needs to be done on this type.\n */\nexport type XOTemplateData = {\n\n /**\n * The data type of this data field.\n */\n type: XOTemplatePrimitiveType;\n\n /**\n * The value for this data field.\n */\n value: unknown;\n\n /**\n * An optional hint to help apps and users understand this data field.\n */\n hint?: string;\n};\n\n// ============================================================\n// Template Resources\n// ============================================================\n\n/**\n * An icon reference in the template.\n */\nexport type XOTemplateIcon = {\n\n /**\n * A name for this icon.\n */\n name: string;\n\n /**\n * The identifier of the icon.\n */\n hash: string;\n};\n\n/**\n * A resource reference attached to a template. Extends view properties with a URL\n * pointing to external documentation or tooling.\n */\nexport type XOTemplateResource = XOTemplateViewProperties & {\n\n /**\n * The URL for this resource.\n */\n url: string;\n};\n\n// ============================================================\n// Template\n// ============================================================\n\n/**\n * Default settings applied across the template when no explicit per-action overrides are given.\n */\nexport type XOTemplateDefaults = {\n\n /**\n * Instructions for how to construct automated change output.\n */\n change?: XOTemplateOutputIntent;\n};\n\n/**\n * The XO Template.\n */\nexport type XOTemplate = XOTemplateViewProperties & {\n\n /**\n * The URI that identifies the JSON Schema used by this template.\n * This enables documentation, autocompletion, and validation in JSON documents.\n */\n $schema: string;\n\n /**\n * A string identifying the version of this template.\n */\n version?: string;\n\n /**\n * The BCH VM versions that this template supports. At least one version is required.\n */\n supported: Array<BchVmVersion>;\n\n /**\n * Optional default settings used in this template.\n */\n defaults?: XOTemplateDefaults;\n\n /**\n * The roles defined in this template.\n */\n roles: Record<XOTemplateRoleIdentifier, XOTemplateViewProperties>;\n\n /**\n * A list of entry points defining which actions are available at the start.\n */\n start: Array<XOTemplateActionIntent>;\n\n /**\n * The actions defined in this template.\n */\n actions: Record<XOTemplateActionIdentifier, XOTemplateAction>;\n\n /**\n * The data fields defined in this template.\n */\n data?: Record<XOTemplateDataIdentifier, XOTemplateData>;\n\n /**\n * The transaction templates defined in this template.\n */\n transactions?: Record<XOTemplateTransactionIdentifier, XOTemplateTransaction>;\n\n /**\n * The inputs defined in this template.\n */\n inputs: Record<XOTemplateInputIdentifier, XOTemplateInput>;\n\n /**\n * The outputs defined in this template.\n */\n outputs: Record<XOTemplateOutputIdentifier, XOTemplateOutput>;\n\n /**\n * The locking script templates defined in this template.\n */\n lockingScripts: Record<XOTemplateLockingScriptIdentifier, XOTemplateLockingScript>;\n\n /**\n * The scripts used in this template, The keys are identifiers of the scripts and\n * the values are the bytecode or cashASM expressions.\n */\n scripts: Record<XOTemplateScriptIdentifier, string>;\n\n /**\n * The constants defined in this template.\n */\n constants?: Record<XOTemplateConstantIdentifier, XOTemplateConstant>;\n\n /**\n * The variables that must be provided for use in the template's scripts.\n */\n variables?: Record<XOTemplateVariableIdentifier, XOTemplateVariable>;\n\n /**\n * Resource references providing external documentation or tooling links.\n */\n resources?: Array<XOTemplateResource>;\n\n /**\n * The icons available for use throughout the template.\n */\n icons?: Array<XOTemplateIcon>;\n\n /**\n * The scenarios defined in this template.\n */\n scenarios?: unknown;\n};\n"],"mappings":";;;;AAmBA,MAAa,gBAAgB;CACzB,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CAChB;;;;AAUD,MAAa,4BAA4B;CACrC,MAAM;CACN,SAAS;CACT,SAAS;CACZ;;;;AAaD,MAAa,yBAAyB;CAClC,KAAK;CACL,OAAO;CACP,MAAM;CACT;;;;;AAYD,MAAa,2BAA2B;CACpC,SAAS;CACT,OAAO;CACP,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,aAAa;CACb,YAAY;CACZ,qBAAqB;CACrB,UAAU;CACV,uBAAuB;CACvB,WAAW;CACX,gBAAgB;CAChB,gBAAgB;CAChB,kBAAkB;CAClB,qBAAqB;CACrB,mBAAmB;CACtB"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../source/template.ts"],"sourcesContent":["import type { ValueOf } from './utilities.ts';\n\n// ============================================================\n// Base types\n// ============================================================\n\n/**\n * Type for satoshis.\n */\nexport type Satoshis = bigint;\n\n/**\n * A fungible token amount.\n */\nexport type FungibleTokenAmount = bigint;\n\n/**\n * Values for BCH VM versions that an XO template can declare support for.\n */\nexport const BchVmVersions = {\n BCH_2020_05: 'BCH_2020_05',\n BCH_2021_05: 'BCH_2021_05',\n BCH_2022_05: 'BCH_2022_05',\n BCH_2023_05: 'BCH_2023_05',\n BCH_2024_05: 'BCH_2024_05',\n BCH_2025_05: 'BCH_2025_05',\n BCH_2026_05: 'BCH_2026_05',\n} as const;\n\n/**\n * The set of BCH VM versions that an XO template can declare support for.\n */\nexport type BchVmVersion = ValueOf<typeof BchVmVersions>;\n\n/**\n * Values for NFT capability on template token fields.\n */\nexport const XOTemplateNftCapabilities = {\n NONE: 'none',\n MUTABLE: 'mutable',\n MINTING: 'minting',\n} as const;\n\n/**\n * The capability of a non-fungible token.\n * `minting` can create new NFTs of the same category.\n * `mutable` can update its own commitment data.\n * `none` means the commitment is immutable.\n */\nexport type XOTemplateNftCapability = ValueOf<typeof XOTemplateNftCapabilities>;\n\n/**\n * Values for XO template locking script types.\n */\nexport const XOTemplateLockingTypes = {\n P2S: 'p2s',\n P2PKH: 'p2pkh',\n P2SH: 'p2sh',\n} as const;\n\n/**\n * The standard locking script types supported by XO.\n *\n */\nexport type XOTemplateLockingType = ValueOf<typeof XOTemplateLockingTypes>;\n\n/**\n * Values for base types declared in an XO template.\n * Used by constants, variables, and data fields.\n */\nexport const XOTemplateBaseTypes = {\n BOOLEAN: 'boolean',\n BYTES: 'bytes',\n INTEGER: 'integer',\n BIGINT: 'bigint',\n STRING: 'string',\n} as const;\n\n/**\n * The base types that can be declared in an XO template.\n * Used by constants, variables, and data fields.\n */\nexport type XOTemplateBaseType = ValueOf<typeof XOTemplateBaseTypes>;\n\n/**\n * Values for primitive types declared in an XO template.\n * Used by constants, variables, and data fields.\n */\nexport const XOTemplatePrimitiveTypes = {\n PRIVATE_KEY: 'private_key',\n PUBLIC_KEY: 'public_key',\n EXTENDED_PUBLIC_KEY: 'extended_public_key',\n SATOSHIS: 'satoshis',\n FUNGIBLE_TOKEN_AMOUNT: 'token_amount',\n NON_FUNGIBLE_TOKEN_CAPABILITY: 'token_capability',\n NON_FUNGIBLE_TOKEN_COMMITMENT: 'token_commitment',\n TIMESTAMP: 'timestamp',\n TOKEN_CATEGORY: 'token_category',\n NFT_COMMITMENT: 'nft_commitment',\n TRANSACTION_HASH: 'transaction_hash',\n TEMPLATE_IDENTIFIER: 'template_identifier',\n SCHNORR_SIGNATURE: 'signature',\n} as const;\n\n/**\n * The primitive types that can be declared in an XO template.\n * Used by constants, variables, and data fields.\n */\nexport type XOTemplatePrimitiveType = ValueOf<typeof XOTemplatePrimitiveTypes>;\n\n// ============================================================\n// Identifier Types\n// ============================================================\n\n/** Identifies a role defined in the template's roles. */\nexport type XOTemplateRoleIdentifier = string;\n\n/** Identifies an action defined in the template's actions. */\nexport type XOTemplateActionIdentifier = string;\n\n/** Identifies an input defined in the template's inputs. */\nexport type XOTemplateInputIdentifier = string;\n\n/** Identifies an output defined in the template's outputs. */\nexport type XOTemplateOutputIdentifier = string;\n\n/** Identifies a locking script defined in the template's lockingScripts. */\nexport type XOTemplateLockingScriptIdentifier = string;\n\n/** Identifies a script defined in the template's scripts. */\nexport type XOTemplateScriptIdentifier = string;\n\n/** Identifies a transaction defined in the template's transactions. */\nexport type XOTemplateTransactionIdentifier = string;\n\n/** Identifies a variable defined in the template's variables. */\nexport type XOTemplateVariableIdentifier = string;\n\n/** Identifies a constant defined in the template's constants. */\nexport type XOTemplateConstantIdentifier = string;\n\n/** Identifies a data field defined in the template's data. */\nexport type XOTemplateDataIdentifier = string;\n\n/** Identifies a secret defined in a role or action's secrets list. */\nexport type XOTemplateSecretIdentifier = string;\n\n/** Identifier for an XO template. */\nexport type XOTemplateIdentifier = string;\n\n// ============================================================\n// View Properties\n// ============================================================\n\n/**\n * Human-readable display properties shared by most template elements.\n */\nexport type XOTemplateViewProperties = {\n\n /**\n * A short human-readable label for this element.\n */\n name: string;\n\n /**\n * A human-readable explanation of what this element does and when it is relevant.\n */\n description: string;\n\n /**\n * An optional icon identifier.\n */\n icon?: string;\n};\n\n// ============================================================\n// Intents\n// ============================================================\n\n/**\n * The base intent structure. Describes the common data parameters shared by all intent types\n * regardless of what they target. An optional templateIdentifier allows the intent to reference\n * a target defined in a different template.\n */\nexport type XOTemplateIntent = {\n\n /**\n * Optional identifier for the template used in this intent. If not provided, uses the current template.\n */\n templateIdentifier?: XOTemplateIdentifier;\n\n /**\n * Identifiers for items to generate when this intent is resolved (e.g. keys or secrets).\n */\n generate?: Array<string>;\n\n /**\n * Variable values to apply when this intent is resolved.\n */\n variables?: Array<Record<XOTemplateVariableIdentifier, unknown>>;\n\n /**\n * Constant values to apply when this intent is resolved.\n */\n constants?: Array<Record<XOTemplateConstantIdentifier, unknown>>;\n\n /**\n * Secret values to apply when this intent is resolved.\n */\n secrets?: Array<Record<XOTemplateSecretIdentifier, unknown>>;\n\n /**\n * Optional identifier for the role used in this intent.\n */\n role?: XOTemplateRoleIdentifier;\n};\n\n/**\n * An intent that targets a specific action.\n */\nexport type XOTemplateActionIntent = XOTemplateIntent & {\n\n /**\n * The identifier for the intended action.\n */\n action: XOTemplateActionIdentifier;\n};\n\n/**\n * An intent that targets a specific output.\n */\nexport type XOTemplateOutputIntent = XOTemplateIntent & {\n\n /**\n * The identifier for the intended output.\n */\n output: XOTemplateOutputIdentifier;\n};\n\n/**\n * An intent that targets a specific locking script.\n */\nexport type XOTemplateLockingScriptIntent = XOTemplateIntent & {\n\n /**\n * The identifier for the intended locking script.\n */\n lockingScript: XOTemplateLockingScriptIdentifier;\n};\n\n// ============================================================\n// Actions\n// ============================================================\n\n/**\n * Requirements for a specific role within an action. Describes what data or secrets\n * the role must provide when participating.\n */\nexport type XOTemplateActionRoleRequirements = {\n\n /**\n * List of variable identifiers required for this role.\n */\n variables?: Array<XOTemplateVariableIdentifier>;\n\n /**\n * List of secret identifiers required for this role.\n */\n secrets?: Array<XOTemplateSecretIdentifier>;\n};\n\n/**\n * A role specific definition within an action.\n */\nexport type XOTemplateActionRole = Partial<XOTemplateViewProperties> & {\n\n /**\n * Identifiers for data items that should be generated for this role\n * when participating in the action.\n */\n generate?: Array<string>;\n\n /**\n * The requirements for this role within this action.\n */\n requirements?: XOTemplateActionRoleRequirements;\n};\n\n/**\n * Slot configuration for a role. Declares how many participants of a given\n * role are needed to satisfy the action's requirements.\n */\nexport type XOTemplateRoleSlotsRequirements = {\n\n /**\n * Minimum number of participants required for this role.\n */\n min: number;\n\n /**\n * Maximum number of participants allowed for this role. Undefined means unlimited.\n */\n max?: number;\n};\n\n/**\n * A role entry in an action's requirements block.\n * Declares which role must participate and how many slots are needed.\n */\nexport type XOTemplateRoleSlot = {\n\n /**\n * The role identifier that this requirement applies to.\n */\n role: XOTemplateRoleIdentifier;\n\n /**\n * Slot configuration specifying how many participants of this role are required.\n */\n slots: XOTemplateRoleSlotsRequirements;\n};\n\n/**\n * Requirements for an action. Declares which roles must participate and what secrets must be available.\n */\nexport type XOTemplateActionRequirements = {\n\n /**\n * List of variable identifiers required for this action.\n */\n variables?: Array<XOTemplateVariableIdentifier>;\n\n /**\n * The participants required for this action.\n */\n participants?: Array<XOTemplateRoleSlot>;\n\n /**\n * The secrets required for this action.\n */\n secrets?: Array<XOTemplateSecretIdentifier>;\n};\n\n/**\n * An action within a template.\n */\nexport type XOTemplateAction = XOTemplateViewProperties & {\n\n /**\n * Specific context for each role participating in this action.\n */\n roles?: Record<XOTemplateRoleIdentifier, XOTemplateActionRole>;\n\n /**\n * The requirements for this action.\n */\n requirements?: XOTemplateActionRequirements;\n\n /**\n * Conditions that must be met for this action to be available.\n *\n * @todo More work needs to be done on this field.\n */\n conditions?: Array<string>;\n\n /**\n * The identifier of the transaction this action produces, referencing an entry\n * in the template's transactions.\n */\n transaction?: XOTemplateTransactionIdentifier;\n\n /**\n * The identifier of the data field this action produces, referencing an entry\n * in the template's data.\n *\n * @todo More work needs to be done on this field.\n */\n data?: XOTemplateDataIdentifier;\n};\n\n// ============================================================\n// Tokens & Amounts\n// ============================================================\n\n/**\n * Non-fungible token configuration within a token field.\n */\nexport type XOTemplateNonFungibleTokenDetails = {\n\n /**\n * The capability of the NFT. May be a known capability value or a CashASM expression resolving to a capability.\n */\n capability?: XOTemplateNftCapability | string;\n\n /**\n * The commitment data for the NFT, as a string or CashASM expression resolving to a commitment.\n */\n commitment?: string;\n};\n\n/**\n * Token configuration for outputs and inputs.\n */\nexport type XOTemplateToken = {\n\n /**\n * The category of the token, as a string or CashASM expression resolving to a category.\n */\n category?: string;\n\n /**\n * The amount of fungible tokens as a bigint, a CashASM expression resolving to a bigint, or null indicating no FT is present.\n */\n amount?: bigint | string | null;\n\n /**\n * Non-fungible token configuration. Null indicates no NFT is present.\n */\n nft?: XOTemplateNonFungibleTokenDetails | null;\n};\n\n/**\n * Asset amounts configuration. Used for balance tracking on locking scripts and their roles, and for omitting change amounts.\n * All fields are optional. Values may be literal amounts or CashASM expressions resolving to amounts.\n */\nexport type XOTemplateAssetAmounts = {\n\n /**\n * The satoshi amount.\n * - `Satoshis`: A specific bigint amount.\n * - `string`: A CashASM expression that resolves to the amount.\n * - `true`: all, i.e. the entire amount\n */\n satoshis?: Satoshis | string | true;\n\n /**\n * The fungible token amount.\n * - `FungibleTokenAmount`: A specific bigint amount.\n * - `string`: A CashASM expression that resolves to the amount.\n * - `true`: all, i.e. the entire amount\n */\n fungibleTokens?: FungibleTokenAmount | string | true;\n\n /**\n * Whether a non-fungible token is present (0 for absent, 1 for present),\n * or a CashASM expression that evaluates to 0 or 1.\n * - `true`: resolves to 1 if an NFT is present, or 0 if none is present. Use this when\n * the NFT is optional, to express that the NFT is estimated to be part of the balance\n * if present, or absent from it if not.\n * - `0`: None, i.e. nothing is expected to be included\n * - `1`: present and complete, as value > 1 does not make sense for non-fungible tokens\n * - `string`: A CashASM expression that evaluates to 0 or 1.\n */\n nonfungibleTokens?: true | 0 | 1 | string;\n};\n\n// ============================================================\n// Shared State\n// ============================================================\n\n/**\n * State configuration shared by a locking script and its individual roles.\n * Declares which variables and secrets are tracked in the on-chain state for that participant.\n */\nexport type XOTemplateState = {\n\n /**\n * List of variable identifiers to track in state.\n */\n variables?: Array<XOTemplateVariableIdentifier>;\n\n /**\n * List of secret identifiers to track in state.\n */\n secrets?: Array<XOTemplateSecretIdentifier>;\n};\n\n// ============================================================\n// Locking Scripts\n// ============================================================\n\n/**\n * A role definition within a locking script.\n */\nexport type XOTemplateLockingScriptRole = Partial<XOTemplateViewProperties> & {\n\n /**\n * List of items to track as state for this role.\n */\n state?: XOTemplateState;\n\n /**\n * List of action references available to this role.\n */\n actions?: Array<XOTemplateActionIntent>;\n\n /**\n * Estimated ownership in the optional set of asset amounts specified.\n */\n balance?: Partial<XOTemplateAssetAmounts>;\n\n /**\n * Whether outputs locked to this script should be available for coin selection.\n */\n selectable?: boolean;\n\n /**\n * Privacy level for outputs locked to this script.\n * - `number`: A numeric privacy level.\n * - `string`: A CashASM expression that evaluates to a privacy level.\n */\n privacy?: number | string;\n};\n\n/**\n * A locking script definition in the template.\n */\nexport type XOTemplateLockingScript = XOTemplateViewProperties & {\n\n /**\n * The type of locking mechanism. Defaults to 'p2s' if not specified.\n */\n lockingType?: XOTemplateLockingType;\n\n /**\n * The locking script bytecode.\n */\n lockingBytecode: string;\n\n /**\n * Optional default unlocking bytecode when used in automatic coin selection.\n */\n unlockingBytecode?: string;\n\n /**\n * The actions available for this locking script.\n */\n actions?: Array<XOTemplateActionIntent>;\n\n /**\n * List of items to track as state for all participants.\n */\n state?: XOTemplateState;\n\n /**\n * Estimated ownership in the optional set of asset amounts specified.\n */\n balance?: Partial<XOTemplateAssetAmounts>;\n\n /**\n * Whether outputs locked to this script should be available for coin selection.\n */\n selectable?: boolean;\n\n /**\n * Privacy level for outputs locked to this script.\n * - `number`: A numeric privacy level.\n * - `string`: A CashASM expression that evaluates to a privacy level.\n */\n privacy?: number | string;\n\n /**\n * Specific context for each role participating in this locking script.\n */\n roles?: Record<XOTemplateRoleIdentifier, XOTemplateLockingScriptRole>;\n};\n\n// ============================================================\n// Inputs\n// ============================================================\n\n/**\n * An input definition in the template.\n */\nexport type XOTemplateInput = XOTemplateViewProperties & {\n\n /**\n * The amount of satoshis for this input.\n * - `Satoshis`: A specific amount of satoshis.\n * - `string`: A CashASM expression that resolves to the satoshi amount.\n */\n valueSatoshis?: Satoshis | string;\n\n /**\n * Token configuration for this input.\n */\n token?: XOTemplateToken | null;\n\n /**\n * The sequence number of this input.\n * - `number`: A specific sequence number.\n * - `string`: A CashASM expression that resolves to the sequence number.\n */\n sequenceNumber?: number | string;\n\n /**\n * Identifier of the unlocking script to use for the UTXO provided for this input.\n */\n unlockingScript?: string;\n\n /**\n * Amount of change that should be omitted from the automatic change handling. WARNING: Setting this can result in loss of funds!\n */\n omitChangeAmounts?: XOTemplateAssetAmounts;\n};\n\n// ============================================================\n// Outputs\n// ============================================================\n\n/**\n * An output definition in the template. Inherits all fields from `XOTemplateLockingScript`\n * except `lockingType`, `lockingBytecode` and `unlockingBytecode`: outputs reference a locking script by identifier\n * rather than defining one inline, so repeating any of these fields here would create an ambiguity\n * about which declaration takes precedence.\n */\nexport type XOTemplateOutput = Omit<XOTemplateLockingScript, 'lockingType' | 'lockingBytecode' | 'unlockingBytecode'> & {\n\n /**\n * Identifier of the locking script to use for this output.\n */\n lockingScript: XOTemplateLockingScriptIdentifier;\n\n /**\n * The amount of satoshis for this output.\n * - `Satoshis`: A specific amount of satoshis.\n * - `string`: A CashASM expression that resolves to the satoshi amount.\n */\n valueSatoshis?: Satoshis | string;\n\n /**\n * Token configuration for this output.\n */\n token?: XOTemplateToken | null;\n};\n\n// ============================================================\n// Transactions\n// ============================================================\n\n/**\n * Reference to an input in a transaction definition in the template.\n */\nexport type XOTemplateTransactionInput = {\n\n /**\n * The input definition identifier.\n */\n input: XOTemplateInputIdentifier;\n\n /**\n * Optional index of this input in the transaction.\n */\n inputIndex?: number;\n};\n\n/**\n * Reference to an output in a transaction definition in the template.\n */\nexport type XOTemplateTransactionOutput = {\n\n /**\n * The output definition identifier.\n */\n output: XOTemplateOutputIdentifier;\n\n /**\n * Optional index of this output in the transaction.\n */\n outputIndex?: number;\n};\n\n/**\n * Role-specific data for a transaction within a template.\n */\nexport type XOTemplateTransactionRoleData = Partial<XOTemplateViewProperties> & {\n\n /**\n * The inputs required for this role.\n */\n inputs?: Array<XOTemplateTransactionInput>;\n\n /**\n * The outputs required for this role.\n */\n outputs?: Array<XOTemplateTransactionOutput>;\n};\n\n/**\n * A transaction template definition.\n */\nexport type XOTemplateTransaction = XOTemplateViewProperties & {\n\n /**\n * The version of the transaction.\n */\n version?: number;\n\n /**\n * The locktime for this transaction.\n * - `number`: A specific locktime value.\n * - `string`: A CashASM expression that resolves to the locktime.\n */\n locktime?: number | string;\n\n /**\n * The inputs for this transaction.\n */\n inputs: Array<XOTemplateTransactionInput>;\n\n /**\n * The outputs for this transaction.\n */\n outputs: Array<XOTemplateTransactionOutput>;\n\n /**\n * Specific context for each role participating in this transaction.\n */\n roles?: Record<XOTemplateRoleIdentifier, XOTemplateTransactionRoleData>;\n\n /**\n * Whether this transaction can be composed with other transactions.\n */\n composable?: boolean;\n};\n\n// ============================================================\n// Template Data\n// ============================================================\n\n/**\n * A constant value definition in the template.\n */\nexport type XOTemplateConstant = XOTemplateViewProperties & {\n\n /**\n * The data type of this constant.\n */\n type: XOTemplateBaseType;\n\n /**\n * The value of this constant.\n */\n value: unknown;\n\n /**\n * An optional hint to help apps and users understand what this constant represents.\n */\n hint?: XOTemplatePrimitiveType;\n};\n\n/**\n * An import default value intent. Extends the base intent with optional view\n * properties that the engine evaluates at runtime to produce human-readable output.\n * The engine overrides whatever values are set here when resolving the target for a participant.\n */\nexport type XOTemplateImportDefaultValue = XOTemplateIntent & Partial<XOTemplateViewProperties>;\n\n/**\n * A variable definition in the template.\n */\nexport type XOTemplateVariable = XOTemplateViewProperties & {\n\n /**\n * The data type of this variable.\n */\n type?: XOTemplateBaseType;\n\n /**\n * A hint to help users understand what value to provide.\n */\n hint?: XOTemplatePrimitiveType;\n\n /**\n * A neutral intent that the engine uses to populate the default value for this variable.\n * View properties (name, description, icon) may contain CashASM expressions that the\n * engine evaluates at runtime to produce human-readable output.\n */\n importDefaultValue?: XOTemplateImportDefaultValue;\n};\n\n/**\n * A data field definition in the template.\n *\n * @todo More work needs to be done on this type.\n */\nexport type XOTemplateData = {\n\n /**\n * The data type of this data field.\n */\n type: XOTemplateBaseType;\n\n /**\n * The value for this data field.\n */\n value: unknown;\n\n /**\n * An optional hint to help apps and users understand this data field.\n */\n hint?: XOTemplatePrimitiveType;\n};\n\n// ============================================================\n// Template Resources\n// ============================================================\n\n/**\n * An icon reference in the template.\n */\nexport type XOTemplateIcon = {\n\n /**\n * A name for this icon.\n */\n name: string;\n\n /**\n * The identifier of the icon.\n */\n hash: string;\n};\n\n/**\n * A resource reference attached to a template. Extends view properties with a URL\n * pointing to external documentation or tooling.\n */\nexport type XOTemplateResource = XOTemplateViewProperties & {\n\n /**\n * The URL for this resource.\n */\n url: string;\n};\n\n// ============================================================\n// Template\n// ============================================================\n\n/**\n * Default settings applied across the template when no explicit per-action overrides are given.\n */\nexport type XOTemplateDefaults = {\n\n /**\n * Instructions for how to construct automated change output.\n */\n change?: XOTemplateOutputIntent;\n};\n\n/**\n * The XO Template.\n */\nexport type XOTemplate = XOTemplateViewProperties & {\n\n /**\n * The URI that identifies the JSON Schema used by this template.\n * This enables documentation, autocompletion, and validation in JSON documents.\n */\n $schema: string;\n\n /**\n * A string identifying the version of this template.\n */\n version?: string;\n\n /**\n * The BCH VM versions that this template supports. At least one version is required.\n */\n supported: Array<BchVmVersion>;\n\n /**\n * Optional default settings used in this template.\n */\n defaults?: XOTemplateDefaults;\n\n /**\n * The roles defined in this template.\n */\n roles: Record<XOTemplateRoleIdentifier, XOTemplateViewProperties>;\n\n /**\n * A list of entry points defining which actions are available at the start.\n */\n start: Array<XOTemplateActionIntent>;\n\n /**\n * The actions defined in this template.\n */\n actions: Record<XOTemplateActionIdentifier, XOTemplateAction>;\n\n /**\n * The data fields defined in this template.\n */\n data?: Record<XOTemplateDataIdentifier, XOTemplateData>;\n\n /**\n * The transaction templates defined in this template.\n */\n transactions?: Record<XOTemplateTransactionIdentifier, XOTemplateTransaction>;\n\n /**\n * The inputs defined in this template.\n */\n inputs: Record<XOTemplateInputIdentifier, XOTemplateInput>;\n\n /**\n * The outputs defined in this template.\n */\n outputs: Record<XOTemplateOutputIdentifier, XOTemplateOutput>;\n\n /**\n * The locking script templates defined in this template.\n */\n lockingScripts: Record<XOTemplateLockingScriptIdentifier, XOTemplateLockingScript>;\n\n /**\n * The scripts used in this template, The keys are identifiers of the scripts and\n * the values are the bytecode or cashASM expressions.\n */\n scripts: Record<XOTemplateScriptIdentifier, string>;\n\n /**\n * The constants defined in this template.\n */\n constants?: Record<XOTemplateConstantIdentifier, XOTemplateConstant>;\n\n /**\n * The variables that must be provided for use in the template's scripts.\n */\n variables?: Record<XOTemplateVariableIdentifier, XOTemplateVariable>;\n\n /**\n * Resource references providing external documentation or tooling links.\n */\n resources?: Array<XOTemplateResource>;\n\n /**\n * The icons available for use throughout the template.\n */\n icons?: Array<XOTemplateIcon>;\n\n /**\n * The scenarios defined in this template.\n */\n scenarios?: unknown;\n};\n"],"mappings":";;;;AAmBA,MAAa,gBAAgB;CACzB,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CACb,aAAa;CAChB;;;;AAUD,MAAa,4BAA4B;CACrC,MAAM;CACN,SAAS;CACT,SAAS;CACZ;;;;AAaD,MAAa,yBAAyB;CAClC,KAAK;CACL,OAAO;CACP,MAAM;CACT;;;;;AAYD,MAAa,sBAAsB;CAC/B,SAAS;CACT,OAAO;CACP,SAAS;CACT,QAAQ;CACR,QAAQ;CACX;;;;;AAYD,MAAa,2BAA2B;CACpC,aAAa;CACb,YAAY;CACZ,qBAAqB;CACrB,UAAU;CACV,uBAAuB;CACvB,+BAA+B;CAC/B,+BAA+B;CAC/B,WAAW;CACX,gBAAgB;CAChB,gBAAgB;CAChB,kBAAkB;CAClB,qBAAqB;CACrB,mBAAmB;CACtB"}
|