@xo-cash/types 0.0.1-development.14519184304 → 0.0.2-development.14628272866
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 +617 -183
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +46 -1
- package/dist/index.mjs.map +1 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,213 +1,95 @@
|
|
|
1
1
|
import { Input, Output } from "@bitauth/libauth";
|
|
2
2
|
|
|
3
|
-
//#region source/
|
|
3
|
+
//#region source/utilities.d.ts
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Union of all property values in an object type.
|
|
6
|
+
*
|
|
7
|
+
* Use this to derive a string literal union from a runtime const object declared
|
|
8
|
+
* with `as const`.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* export const XOTemplateLockingTypes = {
|
|
12
|
+
* P2S: 'p2s',
|
|
13
|
+
* P2PKH: 'p2pkh',
|
|
14
|
+
* P2SH: 'p2sh',
|
|
15
|
+
* } as const;
|
|
16
|
+
*
|
|
17
|
+
* export type XOTemplateLockingType = ValueOf<typeof XOTemplateLockingTypes>;
|
|
18
|
+
* // 'p2s' | 'p2pkh' | 'p2sh'
|
|
6
19
|
*/
|
|
7
|
-
type
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
outputs?: string[];
|
|
11
|
-
};
|
|
20
|
+
type ValueOf<T> = T[keyof T];
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region source/template.d.ts
|
|
12
23
|
/**
|
|
13
|
-
*
|
|
24
|
+
* Type for satoshis.
|
|
14
25
|
*/
|
|
15
|
-
type
|
|
16
|
-
roles?: Record<string, XOInvitationRoleRequirement>;
|
|
17
|
-
};
|
|
26
|
+
type Satoshis = bigint;
|
|
18
27
|
/**
|
|
19
|
-
*
|
|
28
|
+
* A fungible token amount.
|
|
20
29
|
*/
|
|
21
|
-
type
|
|
30
|
+
type FungibleTokenAmount = bigint;
|
|
22
31
|
/**
|
|
23
|
-
*
|
|
32
|
+
* Values for BCH VM versions that an XO template can declare support for.
|
|
24
33
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
value: XOInvitationVariableValue;
|
|
34
|
-
/**
|
|
35
|
-
* The role identifier this variable belongs to.
|
|
36
|
-
*/
|
|
37
|
-
roleIdentifier?: string;
|
|
34
|
+
declare const BchVmVersions: {
|
|
35
|
+
readonly BCH_2020_05: "BCH_2020_05";
|
|
36
|
+
readonly BCH_2021_05: "BCH_2021_05";
|
|
37
|
+
readonly BCH_2022_05: "BCH_2022_05";
|
|
38
|
+
readonly BCH_2023_05: "BCH_2023_05";
|
|
39
|
+
readonly BCH_2024_05: "BCH_2024_05";
|
|
40
|
+
readonly BCH_2025_05: "BCH_2025_05";
|
|
41
|
+
readonly BCH_2026_05: "BCH_2026_05";
|
|
38
42
|
};
|
|
39
43
|
/**
|
|
40
|
-
*
|
|
44
|
+
* The set of BCH VM versions that an XO template can declare support for.
|
|
41
45
|
*/
|
|
42
|
-
type
|
|
43
|
-
/**
|
|
44
|
-
* The input identifier for this input.
|
|
45
|
-
*/
|
|
46
|
-
inputIdentifier?: string;
|
|
47
|
-
/**
|
|
48
|
-
* The position/index this input should occupy in the final transaction.
|
|
49
|
-
*/
|
|
50
|
-
transactionIndex?: number;
|
|
51
|
-
/**
|
|
52
|
-
* The role identifier this input belongs to.
|
|
53
|
-
* If undefined, this is generic data applicable to the whole invitation.
|
|
54
|
-
*/
|
|
55
|
-
roleIdentifier?: string;
|
|
56
|
-
/**
|
|
57
|
-
* The parent commit's item that this item extends.
|
|
58
|
-
*/
|
|
59
|
-
mergesWith?: {
|
|
60
|
-
/**
|
|
61
|
-
* The commit identifier of the parent commit.
|
|
62
|
-
*/
|
|
63
|
-
commitIdentifier: string;
|
|
64
|
-
/**
|
|
65
|
-
* The array index of the item in the parent commit's data array.
|
|
66
|
-
* 0-based index (0 = first item, 1 = second item, etc.)
|
|
67
|
-
*/
|
|
68
|
-
index: number;
|
|
69
|
-
};
|
|
70
|
-
};
|
|
46
|
+
type BchVmVersion = ValueOf<typeof BchVmVersions>;
|
|
71
47
|
/**
|
|
72
|
-
*
|
|
48
|
+
* Values for NFT capability on template token fields.
|
|
73
49
|
*/
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
outputIdentifier?: string;
|
|
79
|
-
/**
|
|
80
|
-
* The position/index this output should occupy in the final transaction.
|
|
81
|
-
*/
|
|
82
|
-
transactionIndex?: number;
|
|
83
|
-
/**
|
|
84
|
-
* The secret identifier for this output.
|
|
85
|
-
*/
|
|
86
|
-
secretIdentifier?: string;
|
|
87
|
-
/**
|
|
88
|
-
* The role identifier this output belongs to.
|
|
89
|
-
*/
|
|
90
|
-
roleIdentifier?: string;
|
|
91
|
-
/**
|
|
92
|
-
* The parent commit's item that this item extends.
|
|
93
|
-
*/
|
|
94
|
-
mergesWith?: {
|
|
95
|
-
/**
|
|
96
|
-
* The commit identifier of the parent commit.
|
|
97
|
-
*/
|
|
98
|
-
commitIdentifier: string;
|
|
99
|
-
/**
|
|
100
|
-
* The array index of the item in the parent commit's data array.
|
|
101
|
-
* 0-based index (0 = first item, 1 = second item, etc.)
|
|
102
|
-
*/
|
|
103
|
-
index: number;
|
|
104
|
-
};
|
|
50
|
+
declare const XOTemplateNftCapabilities: {
|
|
51
|
+
readonly NONE: "none";
|
|
52
|
+
readonly MUTABLE: "mutable";
|
|
53
|
+
readonly MINTING: "minting";
|
|
105
54
|
};
|
|
106
55
|
/**
|
|
107
|
-
*
|
|
56
|
+
* The capability of a non-fungible token.
|
|
57
|
+
* `minting` can create new NFTs of the same category.
|
|
58
|
+
* `mutable` can update its own commitment data.
|
|
59
|
+
* `none` means the commitment is immutable.
|
|
108
60
|
*/
|
|
109
|
-
type
|
|
110
|
-
/**
|
|
111
|
-
* The commit identifier for this commit.
|
|
112
|
-
*/
|
|
113
|
-
commitIdentifier: string;
|
|
114
|
-
/**
|
|
115
|
-
* The identifier of the previous commit.
|
|
116
|
-
*/
|
|
117
|
-
previousCommitIdentifier: string | undefined;
|
|
118
|
-
/**
|
|
119
|
-
* The entity identifier that made this commit.
|
|
120
|
-
*/
|
|
121
|
-
entityIdentifier: string;
|
|
122
|
-
/**
|
|
123
|
-
* The data contributed by this commit.
|
|
124
|
-
*/
|
|
125
|
-
data: {
|
|
126
|
-
/**
|
|
127
|
-
* The version of the transaction.
|
|
128
|
-
*/
|
|
129
|
-
transactionVersion?: number;
|
|
130
|
-
/**
|
|
131
|
-
* The locktime for the transaction.
|
|
132
|
-
*/
|
|
133
|
-
transactionLocktime?: number;
|
|
134
|
-
/**
|
|
135
|
-
* Variables provided in this commit.
|
|
136
|
-
*/
|
|
137
|
-
variables?: XOInvitationVariable[];
|
|
138
|
-
/**
|
|
139
|
-
* Transaction inputs provided in this commit.
|
|
140
|
-
*/
|
|
141
|
-
inputs?: XOInvitationInput[];
|
|
142
|
-
/**
|
|
143
|
-
* Transaction outputs provided in this commit.
|
|
144
|
-
*/
|
|
145
|
-
outputs?: XOInvitationOutput[];
|
|
146
|
-
};
|
|
147
|
-
/**
|
|
148
|
-
* Signature of the entity committing this data.
|
|
149
|
-
*/
|
|
150
|
-
signature: string;
|
|
151
|
-
/**
|
|
152
|
-
* Expiration timestamp for this specific commit.
|
|
153
|
-
*/
|
|
154
|
-
expiresAtTimestamp: number;
|
|
155
|
-
};
|
|
61
|
+
type XOTemplateNftCapability = ValueOf<typeof XOTemplateNftCapabilities>;
|
|
156
62
|
/**
|
|
157
|
-
*
|
|
63
|
+
* Values for XO template locking script types.
|
|
158
64
|
*/
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
invitationIdentifier: string;
|
|
164
|
-
/**
|
|
165
|
-
* The timestamp when the invitation was created.
|
|
166
|
-
*/
|
|
167
|
-
createdAtTimestamp: number;
|
|
168
|
-
/**
|
|
169
|
-
* The template identifier.
|
|
170
|
-
*/
|
|
171
|
-
templateIdentifier: string;
|
|
172
|
-
/**
|
|
173
|
-
* The action identifier.
|
|
174
|
-
*/
|
|
175
|
-
actionIdentifier: string;
|
|
176
|
-
/**
|
|
177
|
-
* The commits in the invitation.
|
|
178
|
-
*/
|
|
179
|
-
commits: XOInvitationCommit[];
|
|
65
|
+
declare const XOTemplateLockingTypes: {
|
|
66
|
+
readonly P2S: "p2s";
|
|
67
|
+
readonly P2PKH: "p2pkh";
|
|
68
|
+
readonly P2SH: "p2sh";
|
|
180
69
|
};
|
|
181
|
-
//#endregion
|
|
182
|
-
//#region source/template.d.ts
|
|
183
70
|
/**
|
|
184
|
-
*
|
|
185
|
-
|
|
186
|
-
type Satoshis = bigint;
|
|
187
|
-
/**
|
|
188
|
-
* A fungible token amount.
|
|
189
|
-
*/
|
|
190
|
-
type FungibleTokenAmount = bigint;
|
|
191
|
-
/**
|
|
192
|
-
* The set of BCH VM versions that an XO template can declare support for.
|
|
193
|
-
*/
|
|
194
|
-
type BchVmVersion = 'BCH_2020_05' | 'BCH_2021_05' | 'BCH_2022_05' | 'BCH_2023_05' | 'BCH_2024_05' | 'BCH_2025_05' | 'BCH_2026_05';
|
|
195
|
-
/**
|
|
196
|
-
* The capability of a non-fungible token.
|
|
197
|
-
* - `minting` — can create new NFTs of the same category.
|
|
198
|
-
* - `mutable` — can update its own commitment data.
|
|
199
|
-
* - `none` — commitment is immutable.
|
|
71
|
+
* The standard locking script types supported by XO.
|
|
72
|
+
*
|
|
200
73
|
*/
|
|
201
|
-
type
|
|
74
|
+
type XOTemplateLockingType = ValueOf<typeof XOTemplateLockingTypes>;
|
|
202
75
|
/**
|
|
203
|
-
*
|
|
76
|
+
* Values for primitive types declared in an XO template.
|
|
77
|
+
* Used by constants, variables, and data fields.
|
|
204
78
|
*/
|
|
205
|
-
|
|
79
|
+
declare const XOTemplatePrimitiveTypes: {
|
|
80
|
+
readonly BOOLEAN: "boolean";
|
|
81
|
+
readonly BYTES: "bytes";
|
|
82
|
+
readonly INTEGER: "integer";
|
|
83
|
+
readonly BIGINT: "bigint";
|
|
84
|
+
readonly STRING: "string";
|
|
85
|
+
readonly PRIVATE_KEY: "private_key";
|
|
86
|
+
readonly PUBLIC_KEY: "public_key";
|
|
87
|
+
};
|
|
206
88
|
/**
|
|
207
89
|
* The primitive types that can be declared in an XO template.
|
|
208
90
|
* Used by constants, variables, and data fields.
|
|
209
91
|
*/
|
|
210
|
-
type XOTemplatePrimitiveType =
|
|
92
|
+
type XOTemplatePrimitiveType = ValueOf<typeof XOTemplatePrimitiveTypes>;
|
|
211
93
|
/** Identifies a role defined in the template's roles. */
|
|
212
94
|
type XOTemplateRoleIdentifier = string;
|
|
213
95
|
/** Identifies an action defined in the template's actions. */
|
|
@@ -230,6 +112,8 @@ type XOTemplateConstantIdentifier = string;
|
|
|
230
112
|
type XOTemplateDataIdentifier = string;
|
|
231
113
|
/** Identifies a secret defined in a role or action's secrets list. */
|
|
232
114
|
type XOTemplateSecretIdentifier = string;
|
|
115
|
+
/** Identifier for an XO template. */
|
|
116
|
+
type XOTemplateIdentifier = string;
|
|
233
117
|
/**
|
|
234
118
|
* Human-readable display properties shared by most template elements.
|
|
235
119
|
*/
|
|
@@ -256,7 +140,7 @@ type XOTemplateIntent = {
|
|
|
256
140
|
/**
|
|
257
141
|
* Optional identifier for the template used in this intent. If not provided, uses the current template.
|
|
258
142
|
*/
|
|
259
|
-
templateIdentifier?:
|
|
143
|
+
templateIdentifier?: XOTemplateIdentifier;
|
|
260
144
|
/**
|
|
261
145
|
* Identifiers for items to generate when this intent is resolved (e.g. keys or secrets).
|
|
262
146
|
*/
|
|
@@ -848,5 +732,555 @@ type XOTemplate = XOTemplateViewProperties & {
|
|
|
848
732
|
scenarios?: unknown;
|
|
849
733
|
};
|
|
850
734
|
//#endregion
|
|
851
|
-
|
|
735
|
+
//#region source/invitation.d.ts
|
|
736
|
+
/**
|
|
737
|
+
* Identifier for an XO invitation.
|
|
738
|
+
*/
|
|
739
|
+
type XOInvitationIdentifier = string;
|
|
740
|
+
/**
|
|
741
|
+
* Commit Identifier within an invitation.
|
|
742
|
+
*/
|
|
743
|
+
type XOInvitationCommitIdentifier = string;
|
|
744
|
+
/**
|
|
745
|
+
* Entity Identifier identifying an entity that signed an invitation commit.
|
|
746
|
+
*/
|
|
747
|
+
type XOInvitationEntityIdentifier = string;
|
|
748
|
+
/**
|
|
749
|
+
* The position/index that the input should occupy in the final transaction structure produced by the invitation.
|
|
750
|
+
*/
|
|
751
|
+
type XOInvitationTransactionInputIndex = number;
|
|
752
|
+
/**
|
|
753
|
+
* The position/index that the output should occupy in the final transaction structure produced by the invitation.
|
|
754
|
+
*/
|
|
755
|
+
type XOInvitationTransactionOutputIndex = number;
|
|
756
|
+
/**
|
|
757
|
+
* Index of an item within a commit data array. Used in `mergesWith.itemIndex` to locate the referenced item.
|
|
758
|
+
*/
|
|
759
|
+
type XOInvitationCommitDataItemIndex = number;
|
|
760
|
+
/**
|
|
761
|
+
* Signature of the entity producing a commit or result.
|
|
762
|
+
* - commit.signature: Signature of the entity that made the commit, including `data`, `createdAtTimestamp`, and optional `memo`.
|
|
763
|
+
* - result.createdBySignature: Signature of the entity that created the transaction before broadcasting or produced data.
|
|
764
|
+
* - result.broadcastedBySignature: Signature of the entity that broadcasted the transaction.
|
|
765
|
+
*/
|
|
766
|
+
type XOInvitationSignature = string;
|
|
767
|
+
/**
|
|
768
|
+
* Timestamps in an invitation e.g.
|
|
769
|
+
* - createdAtTimestamp: When the invitation, commit, or result was created.
|
|
770
|
+
* - expiresAtTimestamp: When the commit expires.
|
|
771
|
+
* - broadcastedAtTimestamp: When the transaction was broadcasted.
|
|
772
|
+
*/
|
|
773
|
+
type XOInvitationTimestamp = number;
|
|
774
|
+
/**
|
|
775
|
+
* The Hash of a Transaction.
|
|
776
|
+
*/
|
|
777
|
+
type XOInvitationTransactionHash = string;
|
|
778
|
+
/**
|
|
779
|
+
* The transaction version in the final transaction structure produced by the invitation.
|
|
780
|
+
*/
|
|
781
|
+
type XOInvitationTransactionVersion = number;
|
|
782
|
+
/**
|
|
783
|
+
* The transaction locktime in the final transaction structure produced by the invitation.
|
|
784
|
+
*/
|
|
785
|
+
type XOInvitationTransactionLocktime = number;
|
|
786
|
+
/**
|
|
787
|
+
* Pair of template and action identifiers used to resolve a template action for an invitation commit.
|
|
788
|
+
*
|
|
789
|
+
* ```
|
|
790
|
+
* {
|
|
791
|
+
* "invitationIdentifier": "...",
|
|
792
|
+
* ...
|
|
793
|
+
* "commits": [
|
|
794
|
+
* {
|
|
795
|
+
* "commitIdentifier": "...",
|
|
796
|
+
* "actionReference": {
|
|
797
|
+
* "templateIdentifier": "...",
|
|
798
|
+
* "actionIdentifier": "..."
|
|
799
|
+
* } ← this type
|
|
800
|
+
* ...
|
|
801
|
+
* }
|
|
802
|
+
* ...
|
|
803
|
+
* ]
|
|
804
|
+
* }
|
|
805
|
+
* ```
|
|
806
|
+
*/
|
|
807
|
+
type XOInvitationActionReference = {
|
|
808
|
+
/**
|
|
809
|
+
* The template that defines the action.
|
|
810
|
+
*/
|
|
811
|
+
templateIdentifier: XOTemplateIdentifier;
|
|
812
|
+
/**
|
|
813
|
+
* The action within that template.
|
|
814
|
+
*/
|
|
815
|
+
actionIdentifier: XOTemplateActionIdentifier;
|
|
816
|
+
};
|
|
817
|
+
/**
|
|
818
|
+
* Reference to an item in an earlier commit that a variable, input, or output extends.
|
|
819
|
+
*
|
|
820
|
+
* ```
|
|
821
|
+
* {
|
|
822
|
+
* "invitationIdentifier": "...",
|
|
823
|
+
* ...
|
|
824
|
+
* "commits": [
|
|
825
|
+
* {
|
|
826
|
+
* "commitIdentifier": "...",
|
|
827
|
+
* "data": {
|
|
828
|
+
* "variables|inputs|outputs": [
|
|
829
|
+
* {
|
|
830
|
+
* "mergesWith": {
|
|
831
|
+
* "commitIdentifier": "...",
|
|
832
|
+
* "itemIndex": 0
|
|
833
|
+
* } ← this type
|
|
834
|
+
* }
|
|
835
|
+
* ]
|
|
836
|
+
* }
|
|
837
|
+
* ...
|
|
838
|
+
* }
|
|
839
|
+
* ...
|
|
840
|
+
* ]
|
|
841
|
+
* }
|
|
842
|
+
* ```
|
|
843
|
+
*/
|
|
844
|
+
type XOInvitationMergesWithReference = {
|
|
845
|
+
/**
|
|
846
|
+
* Identifier of the earlier commit that contains the item being extended.
|
|
847
|
+
*/
|
|
848
|
+
commitIdentifier: XOInvitationCommitIdentifier;
|
|
849
|
+
/**
|
|
850
|
+
* Together with `commitIdentifier`, this identifies the exact item to extend when a later
|
|
851
|
+
* commit supplies information that was not added earlier. For example, when an input was
|
|
852
|
+
* already provided without `unlockingBytecode`, a follow up commit can add a new input
|
|
853
|
+
* entry with `mergesWith`, `itemIndex` and `unlockingBytecode`. The merger then uses this index to
|
|
854
|
+
* locate that earlier input and populate the missing field without replacing the commit.
|
|
855
|
+
*
|
|
856
|
+
* This variable is named 'item' because it's used with variables, inputs and outputs.
|
|
857
|
+
*
|
|
858
|
+
* Note: The index starts at 0 for the first item in the commit data array.
|
|
859
|
+
*/
|
|
860
|
+
itemIndex: XOInvitationCommitDataItemIndex;
|
|
861
|
+
};
|
|
862
|
+
/**
|
|
863
|
+
* The requirements for an invitation.
|
|
864
|
+
*/
|
|
865
|
+
type XOInvitationRoleRequirement = {
|
|
866
|
+
variables?: XOInvitationVariable[];
|
|
867
|
+
inputs?: XOInvitationInput[];
|
|
868
|
+
outputs?: XOInvitationOutput[];
|
|
869
|
+
};
|
|
870
|
+
/**
|
|
871
|
+
* The requirements for an invitation with a role.
|
|
872
|
+
*/
|
|
873
|
+
type XOInvitationRequirements = XOInvitationRoleRequirement & {
|
|
874
|
+
roles?: Record<XOTemplateRoleIdentifier, XOInvitationRoleRequirement>;
|
|
875
|
+
};
|
|
876
|
+
/**
|
|
877
|
+
* The value of a variable in an invitation.
|
|
878
|
+
*/
|
|
879
|
+
type XOInvitationVariableValue = bigint | boolean | number | string;
|
|
880
|
+
/**
|
|
881
|
+
* A variable provided in a commit.
|
|
882
|
+
*
|
|
883
|
+
* ```
|
|
884
|
+
* {
|
|
885
|
+
* "invitationIdentifier": "...",
|
|
886
|
+
* ...
|
|
887
|
+
* "commits": [
|
|
888
|
+
* {
|
|
889
|
+
* "commitIdentifier": "...",
|
|
890
|
+
* "data": {
|
|
891
|
+
* "variables": [
|
|
892
|
+
* {
|
|
893
|
+
* "variableIdentifier": "...",
|
|
894
|
+
* "value": "..."
|
|
895
|
+
* } ← this type
|
|
896
|
+
* ]
|
|
897
|
+
* }
|
|
898
|
+
* ...
|
|
899
|
+
* }
|
|
900
|
+
* ...
|
|
901
|
+
* ]
|
|
902
|
+
* }
|
|
903
|
+
* ```
|
|
904
|
+
*/
|
|
905
|
+
type XOInvitationVariable = {
|
|
906
|
+
/**
|
|
907
|
+
* The identifier of this variable.
|
|
908
|
+
*/
|
|
909
|
+
variableIdentifier: XOTemplateVariableIdentifier;
|
|
910
|
+
/**
|
|
911
|
+
* The value of this variable.
|
|
912
|
+
*/
|
|
913
|
+
value: XOInvitationVariableValue;
|
|
914
|
+
/**
|
|
915
|
+
* The role identifier this variable belongs to.
|
|
916
|
+
*/
|
|
917
|
+
roleIdentifier?: XOTemplateRoleIdentifier;
|
|
918
|
+
/**
|
|
919
|
+
* Reference to a variable in an earlier commit that this variable extends.
|
|
920
|
+
*/
|
|
921
|
+
mergesWith?: XOInvitationMergesWithReference;
|
|
922
|
+
};
|
|
923
|
+
/**
|
|
924
|
+
* A transaction input provided in a commit.
|
|
925
|
+
*
|
|
926
|
+
* ```
|
|
927
|
+
* {
|
|
928
|
+
* "invitationIdentifier": "...",
|
|
929
|
+
* ...
|
|
930
|
+
* "commits": [
|
|
931
|
+
* {
|
|
932
|
+
* "commitIdentifier": "...",
|
|
933
|
+
* "data": {
|
|
934
|
+
* "inputs": [
|
|
935
|
+
* {
|
|
936
|
+
* "inputIdentifier": "...",
|
|
937
|
+
* "transactionIndex": 0
|
|
938
|
+
* } ← this type
|
|
939
|
+
* ]
|
|
940
|
+
* }
|
|
941
|
+
* ...
|
|
942
|
+
* }
|
|
943
|
+
* ...
|
|
944
|
+
* ]
|
|
945
|
+
* }
|
|
946
|
+
* ```
|
|
947
|
+
*/
|
|
948
|
+
type XOInvitationInput = Partial<Input> & {
|
|
949
|
+
/**
|
|
950
|
+
* The identifier of this input.
|
|
951
|
+
*/
|
|
952
|
+
inputIdentifier?: XOTemplateInputIdentifier;
|
|
953
|
+
/**
|
|
954
|
+
* The position/index this input should occupy in the final transaction.
|
|
955
|
+
*/
|
|
956
|
+
transactionIndex?: XOInvitationTransactionInputIndex;
|
|
957
|
+
/**
|
|
958
|
+
* The role identifier this input belongs to.
|
|
959
|
+
* If undefined, this is generic data applicable to the whole invitation.
|
|
960
|
+
*/
|
|
961
|
+
roleIdentifier?: XOTemplateRoleIdentifier;
|
|
962
|
+
/**
|
|
963
|
+
* Reference to an input in an earlier commit that this input extends.
|
|
964
|
+
*/
|
|
965
|
+
mergesWith?: XOInvitationMergesWithReference;
|
|
966
|
+
};
|
|
967
|
+
/**
|
|
968
|
+
* A transaction output provided in a commit.
|
|
969
|
+
*
|
|
970
|
+
* ```
|
|
971
|
+
* {
|
|
972
|
+
* "invitationIdentifier": "...",
|
|
973
|
+
* ...
|
|
974
|
+
* "commits": [
|
|
975
|
+
* {
|
|
976
|
+
* "commitIdentifier": "...",
|
|
977
|
+
* "data": {
|
|
978
|
+
* "outputs": [
|
|
979
|
+
* {
|
|
980
|
+
* "outputIdentifier": "...",
|
|
981
|
+
* "transactionIndex": 0
|
|
982
|
+
* } ← this type
|
|
983
|
+
* ]
|
|
984
|
+
* }
|
|
985
|
+
* ...
|
|
986
|
+
* }
|
|
987
|
+
* ...
|
|
988
|
+
* ]
|
|
989
|
+
* }
|
|
990
|
+
* ```
|
|
991
|
+
*/
|
|
992
|
+
type XOInvitationOutput = Partial<Output> & {
|
|
993
|
+
/**
|
|
994
|
+
* The identifier of this output.
|
|
995
|
+
*/
|
|
996
|
+
outputIdentifier?: XOTemplateOutputIdentifier;
|
|
997
|
+
/**
|
|
998
|
+
* The position/index this output should occupy in the final transaction.
|
|
999
|
+
*/
|
|
1000
|
+
transactionIndex?: XOInvitationTransactionOutputIndex;
|
|
1001
|
+
/**
|
|
1002
|
+
* The secret identifier of this output.
|
|
1003
|
+
*/
|
|
1004
|
+
secretIdentifier?: XOTemplateSecretIdentifier;
|
|
1005
|
+
/**
|
|
1006
|
+
* The role identifier this output belongs to.
|
|
1007
|
+
*/
|
|
1008
|
+
roleIdentifier?: XOTemplateRoleIdentifier;
|
|
1009
|
+
/**
|
|
1010
|
+
* Reference to an output in an earlier commit that this output extends.
|
|
1011
|
+
*/
|
|
1012
|
+
mergesWith?: XOInvitationMergesWithReference;
|
|
1013
|
+
};
|
|
1014
|
+
/**
|
|
1015
|
+
* Payload provided by a single invitation commit.
|
|
1016
|
+
*
|
|
1017
|
+
* ```
|
|
1018
|
+
* {
|
|
1019
|
+
* "invitationIdentifier": "...",
|
|
1020
|
+
* ...
|
|
1021
|
+
* "commits": [
|
|
1022
|
+
* {
|
|
1023
|
+
* "commitIdentifier": "...",
|
|
1024
|
+
* "data": { } ← this type
|
|
1025
|
+
* ...
|
|
1026
|
+
* }
|
|
1027
|
+
* ...
|
|
1028
|
+
* ]
|
|
1029
|
+
* }
|
|
1030
|
+
* ```
|
|
1031
|
+
*/
|
|
1032
|
+
type XOInvitationCommitData = {
|
|
1033
|
+
/**
|
|
1034
|
+
* The version of the transaction.
|
|
1035
|
+
*/
|
|
1036
|
+
transactionVersion?: XOInvitationTransactionVersion;
|
|
1037
|
+
/**
|
|
1038
|
+
* The locktime for the transaction.
|
|
1039
|
+
*/
|
|
1040
|
+
transactionLocktime?: XOInvitationTransactionLocktime;
|
|
1041
|
+
/**
|
|
1042
|
+
* Variables provided in this commit.
|
|
1043
|
+
*/
|
|
1044
|
+
variables?: XOInvitationVariable[];
|
|
1045
|
+
/**
|
|
1046
|
+
* Transaction inputs provided in this commit.
|
|
1047
|
+
*/
|
|
1048
|
+
inputs?: XOInvitationInput[];
|
|
1049
|
+
/**
|
|
1050
|
+
* Transaction outputs provided in this commit.
|
|
1051
|
+
*/
|
|
1052
|
+
outputs?: XOInvitationOutput[];
|
|
1053
|
+
};
|
|
1054
|
+
/**
|
|
1055
|
+
* Human readable note attached to a commit so participants can coordinate better or just general notes.
|
|
1056
|
+
*
|
|
1057
|
+
* Note: When present, the engine includes the memo in the commit signing payload so peers can trust the text.
|
|
1058
|
+
*/
|
|
1059
|
+
type XOInvitationMemo = string;
|
|
1060
|
+
/**
|
|
1061
|
+
* A signed commit in an invitation history chain.
|
|
1062
|
+
*
|
|
1063
|
+
* ```
|
|
1064
|
+
* {
|
|
1065
|
+
* "invitationIdentifier": "...",
|
|
1066
|
+
* ...
|
|
1067
|
+
* "commits": [
|
|
1068
|
+
* {
|
|
1069
|
+
* "commitIdentifier": "...",
|
|
1070
|
+
* "createdAtTimestamp": 1717000000000,
|
|
1071
|
+
* "memo": "Invoice 1042",
|
|
1072
|
+
* ...
|
|
1073
|
+
* } ← this type
|
|
1074
|
+
* ...
|
|
1075
|
+
* ]
|
|
1076
|
+
* }
|
|
1077
|
+
* ```
|
|
1078
|
+
*/
|
|
1079
|
+
type XOInvitationCommit = {
|
|
1080
|
+
/**
|
|
1081
|
+
* The commit identifier for this commit.
|
|
1082
|
+
*/
|
|
1083
|
+
commitIdentifier: XOInvitationCommitIdentifier;
|
|
1084
|
+
/**
|
|
1085
|
+
* The identifier of the previous commit.
|
|
1086
|
+
*/
|
|
1087
|
+
previousCommitIdentifier: XOInvitationCommitIdentifier | undefined;
|
|
1088
|
+
/**
|
|
1089
|
+
* The entity identifier that made this commit.
|
|
1090
|
+
*/
|
|
1091
|
+
entityIdentifier: XOInvitationEntityIdentifier;
|
|
1092
|
+
/**
|
|
1093
|
+
* When this commit was created.
|
|
1094
|
+
*/
|
|
1095
|
+
createdAtTimestamp: XOInvitationTimestamp;
|
|
1096
|
+
/**
|
|
1097
|
+
* When set, the engine resolves the template action from these identifiers for this commit.
|
|
1098
|
+
* When omitted, it uses the invitation root `templateIdentifier` and `actionIdentifier`.
|
|
1099
|
+
*/
|
|
1100
|
+
actionReference?: XOInvitationActionReference;
|
|
1101
|
+
/**
|
|
1102
|
+
* The data provided by this commit.
|
|
1103
|
+
*/
|
|
1104
|
+
data: XOInvitationCommitData;
|
|
1105
|
+
/**
|
|
1106
|
+
* Signature of the entity committing this data.
|
|
1107
|
+
*/
|
|
1108
|
+
signature: XOInvitationSignature;
|
|
1109
|
+
/**
|
|
1110
|
+
* Expiration timestamp for this specific commit.
|
|
1111
|
+
*/
|
|
1112
|
+
expiresAtTimestamp: XOInvitationTimestamp;
|
|
1113
|
+
/**
|
|
1114
|
+
* Optional note from the entity.
|
|
1115
|
+
*/
|
|
1116
|
+
memo?: XOInvitationMemo;
|
|
1117
|
+
};
|
|
1118
|
+
/**
|
|
1119
|
+
* Result for a completed invitation process that resulted in a transaction.
|
|
1120
|
+
*
|
|
1121
|
+
* ```
|
|
1122
|
+
* {
|
|
1123
|
+
* "transactions": {
|
|
1124
|
+
* "requestSatoshisTransaction": {
|
|
1125
|
+
* "transactionHash": "..."
|
|
1126
|
+
* } ← this type
|
|
1127
|
+
* }
|
|
1128
|
+
* }
|
|
1129
|
+
* ```
|
|
1130
|
+
*/
|
|
1131
|
+
type XOInvitationTransactionResult = {
|
|
1132
|
+
/**
|
|
1133
|
+
* Transaction hash of the resulting transaction.
|
|
1134
|
+
*/
|
|
1135
|
+
transactionHash: XOInvitationTransactionHash;
|
|
1136
|
+
/**
|
|
1137
|
+
* Timestamp when the transaction was created i.e. before broadcasting.
|
|
1138
|
+
*/
|
|
1139
|
+
createdAtTimestamp: XOInvitationTimestamp;
|
|
1140
|
+
/**
|
|
1141
|
+
* The entity identifier that created the transaction i.e. before broadcasting.
|
|
1142
|
+
*/
|
|
1143
|
+
createdByEntityIdentifier: XOInvitationEntityIdentifier;
|
|
1144
|
+
/**
|
|
1145
|
+
* Signature of the entity that created the transaction i.e. before broadcasting.
|
|
1146
|
+
*
|
|
1147
|
+
* Note: The signature should cover the transaction data, entity details and the timestamp.
|
|
1148
|
+
*/
|
|
1149
|
+
createdBySignature: XOInvitationSignature;
|
|
1150
|
+
/**
|
|
1151
|
+
* Timestamp when the transaction was broadcasted.
|
|
1152
|
+
*/
|
|
1153
|
+
broadcastedAtTimestamp: XOInvitationTimestamp;
|
|
1154
|
+
/**
|
|
1155
|
+
* The entity identifier that broadcasted the transaction.
|
|
1156
|
+
*/
|
|
1157
|
+
broadcastedByEntityIdentifier: XOInvitationEntityIdentifier;
|
|
1158
|
+
/**
|
|
1159
|
+
* Signature of the entity that broadcasted the transaction.
|
|
1160
|
+
*
|
|
1161
|
+
* Note: The signature should cover the transaction data, the timestamp, entity details that created the transaction
|
|
1162
|
+
* and the entity details that broadcasts the transaction.
|
|
1163
|
+
*/
|
|
1164
|
+
broadcastedBySignature: XOInvitationSignature;
|
|
1165
|
+
};
|
|
1166
|
+
/**
|
|
1167
|
+
* Result for a completed invitation process that resulted in a data field.
|
|
1168
|
+
*
|
|
1169
|
+
* ```
|
|
1170
|
+
* {
|
|
1171
|
+
* "data": {
|
|
1172
|
+
* "messageSignature": {
|
|
1173
|
+
* "value": "..."
|
|
1174
|
+
* } ← this type
|
|
1175
|
+
* }
|
|
1176
|
+
* }
|
|
1177
|
+
* ```
|
|
1178
|
+
*/
|
|
1179
|
+
type XOInvitationDataResult = {
|
|
1180
|
+
/**
|
|
1181
|
+
* Resolved value for the data.
|
|
1182
|
+
*/
|
|
1183
|
+
value: XOInvitationVariableValue;
|
|
1184
|
+
/**
|
|
1185
|
+
* Timestamp when the data was created.
|
|
1186
|
+
*/
|
|
1187
|
+
createdAtTimestamp: XOInvitationTimestamp;
|
|
1188
|
+
/**
|
|
1189
|
+
* The entity identifier that created this data.
|
|
1190
|
+
*/
|
|
1191
|
+
createdByEntityIdentifier: XOInvitationEntityIdentifier;
|
|
1192
|
+
/**
|
|
1193
|
+
* Signature of the entity that created this data.
|
|
1194
|
+
*/
|
|
1195
|
+
createdBySignature: XOInvitationSignature;
|
|
1196
|
+
};
|
|
1197
|
+
/**
|
|
1198
|
+
* Result of a completed invitation. An invitation may produce one or more transactions or data fields.
|
|
1199
|
+
*
|
|
1200
|
+
* ```
|
|
1201
|
+
* {
|
|
1202
|
+
* "invitationIdentifier": "...",
|
|
1203
|
+
* ...
|
|
1204
|
+
* "result": {
|
|
1205
|
+
* "transactions": {
|
|
1206
|
+
* "requestSatoshisTransaction": {
|
|
1207
|
+
* "transactionHash": "...",
|
|
1208
|
+
* "transactionHex": "..."
|
|
1209
|
+
* },
|
|
1210
|
+
* },
|
|
1211
|
+
* "data": {
|
|
1212
|
+
* "messageSignature": {
|
|
1213
|
+
* "value": "..."
|
|
1214
|
+
* }
|
|
1215
|
+
* }
|
|
1216
|
+
* } ← this type
|
|
1217
|
+
* }
|
|
1218
|
+
* ```
|
|
1219
|
+
*/
|
|
1220
|
+
type XOInvitationResult = {
|
|
1221
|
+
/**
|
|
1222
|
+
* Transactions resulting from the invitation process.
|
|
1223
|
+
*
|
|
1224
|
+
* Note: The existing workflow does not support multiple transactions, but this structure already supports it.
|
|
1225
|
+
*/
|
|
1226
|
+
transactions?: Record<XOTemplateTransactionIdentifier, XOInvitationTransactionResult>;
|
|
1227
|
+
/**
|
|
1228
|
+
* Data resulting from the invitation process.
|
|
1229
|
+
*/
|
|
1230
|
+
data?: Record<XOTemplateDataIdentifier, XOInvitationDataResult>;
|
|
1231
|
+
};
|
|
1232
|
+
/**
|
|
1233
|
+
* An invitation shared among participants in the XO stack.
|
|
1234
|
+
*
|
|
1235
|
+
* ```
|
|
1236
|
+
* {
|
|
1237
|
+
* "invitationIdentifier": "...",
|
|
1238
|
+
* "templateIdentifier": "...",
|
|
1239
|
+
* "actionIdentifier": "...",
|
|
1240
|
+
* ...
|
|
1241
|
+
* "commits": [
|
|
1242
|
+
* {
|
|
1243
|
+
* "commitIdentifier": "...",
|
|
1244
|
+
* ...
|
|
1245
|
+
* },
|
|
1246
|
+
* {
|
|
1247
|
+
* "commitIdentifier": "...",
|
|
1248
|
+
* ...
|
|
1249
|
+
* }
|
|
1250
|
+
* ],
|
|
1251
|
+
* "result": {
|
|
1252
|
+
* "transactions": { },
|
|
1253
|
+
* "data": { }
|
|
1254
|
+
* }
|
|
1255
|
+
* } ← this type
|
|
1256
|
+
* ```
|
|
1257
|
+
*/
|
|
1258
|
+
type XOInvitation = {
|
|
1259
|
+
/**
|
|
1260
|
+
* The invitation identifier for the invitation.
|
|
1261
|
+
*/
|
|
1262
|
+
invitationIdentifier: XOInvitationIdentifier;
|
|
1263
|
+
/**
|
|
1264
|
+
* The timestamp when the invitation was created.
|
|
1265
|
+
*/
|
|
1266
|
+
createdAtTimestamp: XOInvitationTimestamp;
|
|
1267
|
+
/**
|
|
1268
|
+
* The template identifier.
|
|
1269
|
+
*/
|
|
1270
|
+
templateIdentifier: XOTemplateIdentifier;
|
|
1271
|
+
/**
|
|
1272
|
+
* The action identifier.
|
|
1273
|
+
*/
|
|
1274
|
+
actionIdentifier: XOTemplateActionIdentifier;
|
|
1275
|
+
/**
|
|
1276
|
+
* The commits in the invitation.
|
|
1277
|
+
*/
|
|
1278
|
+
commits: XOInvitationCommit[];
|
|
1279
|
+
/**
|
|
1280
|
+
* Result of the invitation process
|
|
1281
|
+
*/
|
|
1282
|
+
result?: XOInvitationResult;
|
|
1283
|
+
};
|
|
1284
|
+
//#endregion
|
|
1285
|
+
export { BchVmVersion, BchVmVersions, FungibleTokenAmount, Satoshis, ValueOf, XOInvitation, XOInvitationActionReference, XOInvitationCommit, XOInvitationCommitData, XOInvitationCommitDataItemIndex, XOInvitationCommitIdentifier, XOInvitationDataResult, XOInvitationEntityIdentifier, XOInvitationIdentifier, XOInvitationInput, XOInvitationMemo, XOInvitationMergesWithReference, XOInvitationOutput, XOInvitationRequirements, XOInvitationResult, XOInvitationRoleRequirement, XOInvitationSignature, XOInvitationTimestamp, 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 };
|
|
852
1286
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../source/
|
|
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,QA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3EA,oBAAA,EAAsB,sBAAA;EDgFb;;;EC3ET,kBAAA,EAAoB,qBAAA;EDgFL;;;EC3Ef,kBAAA,EAAoB,oBAAA;EDgFV;AAUd;;ECrFI,gBAAA,EAAkB,0BAAA;ED0FW;;;ECrF7B,OAAA,EAAS,kBAAA;ED0FT;;;ECrFA,MAAA,GAAS,kBAAA;AAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
//#region source/template.ts
|
|
2
|
+
/**
|
|
3
|
+
* Values for BCH VM versions that an XO template can declare support for.
|
|
4
|
+
*/
|
|
5
|
+
const BchVmVersions = {
|
|
6
|
+
BCH_2020_05: "BCH_2020_05",
|
|
7
|
+
BCH_2021_05: "BCH_2021_05",
|
|
8
|
+
BCH_2022_05: "BCH_2022_05",
|
|
9
|
+
BCH_2023_05: "BCH_2023_05",
|
|
10
|
+
BCH_2024_05: "BCH_2024_05",
|
|
11
|
+
BCH_2025_05: "BCH_2025_05",
|
|
12
|
+
BCH_2026_05: "BCH_2026_05"
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Values for NFT capability on template token fields.
|
|
16
|
+
*/
|
|
17
|
+
const XOTemplateNftCapabilities = {
|
|
18
|
+
NONE: "none",
|
|
19
|
+
MUTABLE: "mutable",
|
|
20
|
+
MINTING: "minting"
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Values for XO template locking script types.
|
|
24
|
+
*/
|
|
25
|
+
const XOTemplateLockingTypes = {
|
|
26
|
+
P2S: "p2s",
|
|
27
|
+
P2PKH: "p2pkh",
|
|
28
|
+
P2SH: "p2sh"
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Values for primitive types declared in an XO template.
|
|
32
|
+
* Used by constants, variables, and data fields.
|
|
33
|
+
*/
|
|
34
|
+
const XOTemplatePrimitiveTypes = {
|
|
35
|
+
BOOLEAN: "boolean",
|
|
36
|
+
BYTES: "bytes",
|
|
37
|
+
INTEGER: "integer",
|
|
38
|
+
BIGINT: "bigint",
|
|
39
|
+
STRING: "string",
|
|
40
|
+
PRIVATE_KEY: "private_key",
|
|
41
|
+
PUBLIC_KEY: "public_key"
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { BchVmVersions, XOTemplateLockingTypes, XOTemplateNftCapabilities, XOTemplatePrimitiveTypes };
|
|
46
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +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} 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;CACf"}
|