@xo-cash/engine 0.0.1 → 0.1.0-next.17298219321
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/README.md +21 -18
- package/dist/index.d.mts +3310 -938
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +7838 -2157
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -22
package/dist/index.d.mts
CHANGED
|
@@ -1,71 +1,209 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { ScriptHashData, ScriptHashDataQuery, SecretData, State, StorageListOptions, StorageType, StoredInvitation, StoredSecretData, StoredTemplate, UnspentOutputData, UnspentOutputDataFilter, UnspentOutputDataQuery } from "@xo-cash/state";
|
|
2
|
+
import { ElectrumServersWithBlockchain } from "@electrum-cash/servers";
|
|
3
|
+
import { Crypto, IncompleteScriptCompilation, ScriptCompilationErrorDetail } from "@xo-cash/crypto";
|
|
4
|
+
import { ChainStatus, ChainStatus as ChainStatus$1 } from "@electrum-cash/application";
|
|
5
|
+
import { HdKeyNetwork, Output } from "@bitauth/libauth";
|
|
6
|
+
import { OutputToken, ValueOf, XOInvitation, XOInvitationCommit, XOInvitationCommitIdentifier, XOInvitationEntityIdentifier, XOInvitationIdentifier, XOInvitationInput, XOInvitationMergesWithReference, XOInvitationOutput, XOInvitationResolution, XOInvitationResolutionIdentifier, XOInvitationResult, XOInvitationTimestamp, XOInvitationTransactionBroadcastDetails, XOInvitationTransactionHash, XOInvitationTransactionLocktime, XOInvitationTransactionResult, XOInvitationTransactionVersion, XOInvitationVariable, XOInvitationVariableValue, XOTemplate, XOTemplateAction, XOTemplateActionIdentifier, XOTemplateActionIntent, XOTemplateConstantIdentifier, XOTemplateDataIdentifier, XOTemplateIdentifier, XOTemplateInputIdentifier, XOTemplateIntent, XOTemplateLockingScript, XOTemplateLockingScriptIdentifier, XOTemplateLockingScriptRole, XOTemplateNftCapability, XOTemplateOutput, XOTemplateOutputIdentifier, XOTemplateRoleIdentifier, XOTemplateSecretIdentifier, XOTemplateTransaction, XOTemplateTransactionIdentifier, XOTemplateVariable, XOTemplateVariableIdentifier } from "@xo-cash/types";
|
|
6
7
|
import { ScriptHashListUnspentResponse, TransactionHash } from "@electrum-cash/protocol";
|
|
7
|
-
import { ElectrumServers } from "@electrum-cash/servers";
|
|
8
|
-
import { XOInvitation, XOInvitationCommit, XOInvitationInput, XOInvitationOutput, XOInvitationRequirements, XOInvitationVariable, XOInvitationVariableValue, XOTemplate, XOTemplateAction, XOTemplateActionIntent, XOTemplateLockingScript, XOTemplateLockingScriptRole, XOTemplateLockingType, XOTemplateOutput, XOTemplateTransaction } from "@xo-cash/types";
|
|
9
8
|
|
|
10
|
-
//#region source/
|
|
9
|
+
//#region source/defaults.d.ts
|
|
11
10
|
/**
|
|
12
|
-
*
|
|
11
|
+
* When an entity opts to participate in an invitation, it reserves resources (e.g., UTXOs)
|
|
12
|
+
* that would otherwise be available to other invitations. To prevent resources from remaining
|
|
13
|
+
* locked indefinitely, each reservation requires an expiration time, after which the resources
|
|
14
|
+
* can be released.
|
|
15
|
+
*
|
|
16
|
+
* By default, the expiration time is set to 5 hour.
|
|
13
17
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
18
|
+
declare const DEFAULT_COMMIT_EXPIRATION_IN_MILLISECONDS: number;
|
|
19
|
+
/**
|
|
20
|
+
* The default storage backend is IndexedDB.
|
|
21
|
+
*/
|
|
22
|
+
declare const DEFAULT_STORAGE_TYPE = StorageType.INDEXEDDB;
|
|
23
|
+
/**
|
|
24
|
+
* The default sequence number is 0, which disables relative locktime on the input.
|
|
25
|
+
*/
|
|
26
|
+
declare const DEFAULT_SEQUENCE_NUMBER = 0;
|
|
27
|
+
/**
|
|
28
|
+
* The default locktime is 0, which means the transaction is valid in any block and has no absolute locktime constraint.
|
|
29
|
+
*/
|
|
30
|
+
declare const DEFAULT_LOCKTIME = 0;
|
|
31
|
+
/**
|
|
32
|
+
* The default transaction version is 2.
|
|
33
|
+
*/
|
|
34
|
+
declare const DEFAULT_VERSION = 2;
|
|
35
|
+
/**
|
|
36
|
+
* Empty bytecode used when a token category, NFT commitment, unlocking placeholder, or similar byte field has no value yet.
|
|
37
|
+
*/
|
|
38
|
+
declare const EMPTY_BYTECODE: Uint8Array<ArrayBuffer>;
|
|
39
|
+
/**
|
|
40
|
+
* An empty unlocking bytecode used as a placeholder for inputs (unlockingBytecode) within an invitation.
|
|
41
|
+
* This placeholder is used when the entities responsible for signing those inputs
|
|
42
|
+
* have not yet provided their signatures for the resulting transaction.
|
|
43
|
+
*
|
|
44
|
+
* Using a placeholder unlocking bytecode enables the engine to construct transaction structures for the
|
|
45
|
+
* libauth compiler when working on template actions, even before all participant signatures are available.
|
|
46
|
+
* This is especially helpful when invitation commits are merged, as it allows the transaction to be built and it's
|
|
47
|
+
* parts can be validated before all unlocking scripts have been provided.
|
|
48
|
+
*/
|
|
49
|
+
declare const PLACEHOLDER_UNLOCKING_BYTECODE: Uint8Array<ArrayBuffer>;
|
|
50
|
+
/**
|
|
51
|
+
* The default electrum application identifier.
|
|
52
|
+
*/
|
|
53
|
+
declare const DEFAULT_ELECTRUM_APPLICATION_IDENTIFIER = "xo";
|
|
54
|
+
/**
|
|
55
|
+
* Minimum output value the engine treats as spendable change (BCH dust limit).
|
|
56
|
+
*/
|
|
57
|
+
declare const DUST_LIMIT_SATOSHIS = 546;
|
|
58
|
+
/**
|
|
59
|
+
* Minimum satoshis on a CashToken bearing output so the token remains standard and spendable.
|
|
60
|
+
*/
|
|
61
|
+
declare const TOKEN_BEARING_OUTPUT_MINIMUM_SATOSHIS = 800;
|
|
62
|
+
/**
|
|
63
|
+
* Default value of per input fee to help in estimation of the transaction fee.
|
|
64
|
+
*/
|
|
65
|
+
declare const DEFAULT_FEE_SATOSHIS_PER_INPUT = 160;
|
|
66
|
+
/**
|
|
67
|
+
* Default value of per output fee to help in estimation of the transaction fee.
|
|
68
|
+
*/
|
|
69
|
+
declare const DEFAULT_FEE_SATOSHIS_PER_OUTPUT = 120;
|
|
70
|
+
/**
|
|
71
|
+
* Zero fungible token amount used when a token bearing output has no amount yet.
|
|
72
|
+
*/
|
|
73
|
+
declare const ZERO_FUNGIBLE_TOKEN_AMOUNT = 0n;
|
|
74
|
+
/**
|
|
75
|
+
* Sort key used when a merged input or output has no transactionIndex so unordered items follow indexed items.
|
|
76
|
+
*/
|
|
77
|
+
declare const UNDEFINED_TRANSACTION_INDEX_SORT_VALUE: number;
|
|
78
|
+
/**
|
|
79
|
+
* Requirement field names on an invitation requirements object.
|
|
80
|
+
* Used to iterate over variables, inputs, and outputs in a consistent order.
|
|
81
|
+
*/
|
|
82
|
+
declare const INVITATION_REQUIREMENT_FIELD_NAMES: {
|
|
83
|
+
readonly variables: "variables";
|
|
84
|
+
readonly inputs: "inputs";
|
|
85
|
+
readonly outputs: "outputs";
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Union of requirement field name strings on an invitation requirements object.
|
|
89
|
+
*/
|
|
90
|
+
type InvitationRequirementFieldName = ValueOf<typeof INVITATION_REQUIREMENT_FIELD_NAMES>;
|
|
91
|
+
/**
|
|
92
|
+
* Requirement field names in iteration order for template and commit requirement scans.
|
|
93
|
+
*/
|
|
94
|
+
declare const INVITATION_REQUIREMENT_FIELD_NAME_LIST: readonly InvitationRequirementFieldName[];
|
|
95
|
+
/**
|
|
96
|
+
* Supported networks by the engine.
|
|
97
|
+
*/
|
|
98
|
+
declare const XO_SUPPORTED_NETWORKS: {
|
|
99
|
+
readonly mainnet: "mainnet";
|
|
100
|
+
readonly chipnet: "chipnet";
|
|
101
|
+
readonly testnet4: "testnet4";
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* One supported network.
|
|
105
|
+
*/
|
|
106
|
+
type XONetwork = ValueOf<typeof XO_SUPPORTED_NETWORKS>;
|
|
107
|
+
/**
|
|
108
|
+
* Network used when {@link XOEngineOptions.network} is omitted.
|
|
109
|
+
*/
|
|
110
|
+
declare const DEFAULT_XO_NETWORK: XONetwork;
|
|
111
|
+
/**
|
|
112
|
+
* Base database name matching {@link State} when databaseFilename is omitted.
|
|
113
|
+
*/
|
|
114
|
+
declare const DEFAULT_ACCOUNT_DATABASE_FILENAME = "XO";
|
|
115
|
+
/**
|
|
116
|
+
* Name that sets the Electrum cache database apart from the account database.
|
|
117
|
+
*/
|
|
118
|
+
declare const DEFAULT_ELECTRUM_CACHE_DATABASE_FILENAME = "Electrum";
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region source/network/helper.d.ts
|
|
121
|
+
/**
|
|
122
|
+
* Returns true when the value is a supported network.
|
|
123
|
+
*
|
|
124
|
+
* @param {string} value - Network name to test.
|
|
125
|
+
* @returns {boolean} - Whether the value is a supported {@link XONetwork}.
|
|
126
|
+
*/
|
|
127
|
+
declare const isXOSupportedNetwork: (value: string) => value is XONetwork;
|
|
128
|
+
/**
|
|
129
|
+
* Maps an engine network to the libauth HD key network used for the purpose path and xpub or tpub encoding.
|
|
130
|
+
*
|
|
131
|
+
* Libauth {@link HdKeyNetwork} is only `mainnet` or `testnet`. Chipnet and testnet4 are not members of that type, so both use `testnet`.
|
|
132
|
+
*
|
|
133
|
+
* @param {XONetwork} network - Engine network.
|
|
134
|
+
* @returns {HdKeyNetwork} - Mainnet encoding, or testnet encoding for chipnet and testnet4.
|
|
135
|
+
*/
|
|
136
|
+
declare const resolveHdKeyNetwork: (network: XONetwork) => HdKeyNetwork;
|
|
137
|
+
/**
|
|
138
|
+
* Resolves default Electrum hosts for a network.
|
|
139
|
+
*
|
|
140
|
+
* Each host carries the blockchain checkpoint and consensus parameters of that network.
|
|
141
|
+
*
|
|
142
|
+
* @param {XONetwork} network - Engine network.
|
|
143
|
+
* @returns {ElectrumServersWithBlockchain} - Server list for that network.
|
|
144
|
+
*/
|
|
145
|
+
declare const resolveElectrumServersForNetwork: (network: XONetwork) => ElectrumServersWithBlockchain;
|
|
146
|
+
/**
|
|
147
|
+
* Builds the database filename for a network.
|
|
148
|
+
*
|
|
149
|
+
* Every network appends the network name to the provided database filename, or to `XO` when none is provided.
|
|
150
|
+
*
|
|
151
|
+
* @param {XONetwork} network - Engine network.
|
|
152
|
+
* @param {string} [databaseFilename] - Optional name included before the network name.
|
|
153
|
+
* @returns {string} - Database filename for the network.
|
|
154
|
+
*/
|
|
155
|
+
declare const buildNetworkDatabaseFilename: (network: XONetwork, databaseFilename?: string) => string;
|
|
156
|
+
/**
|
|
157
|
+
* Builds the database name used for one mnemonic on one network.
|
|
158
|
+
*
|
|
159
|
+
* @param {string} mnemonic - BIP39 mnemonic for the account.
|
|
160
|
+
* @param {XONetwork} network - Engine network.
|
|
161
|
+
* @param {string} [databaseFilename] - Optional name that already replaces `XO`.
|
|
162
|
+
* @returns {string} - Full database name including account hash.
|
|
163
|
+
*/
|
|
164
|
+
declare const buildAccountDatabaseName: (mnemonic: string, network: XONetwork, databaseFilename?: string) => string;
|
|
165
|
+
/**
|
|
166
|
+
* Builds the Electrum cache database filename for one account on one network.
|
|
167
|
+
*
|
|
168
|
+
* The name always includes `Electrum`, so it never matches the account database name built from the same database filename.
|
|
169
|
+
*
|
|
170
|
+
* @param {XONetwork} network - Engine network.
|
|
171
|
+
* @param {string} accountHash - Account hash for this mnemonic.
|
|
172
|
+
* @param {string} [databaseFilename] - Optional name included before `Electrum`.
|
|
173
|
+
* @returns {string} - Cache database filename.
|
|
174
|
+
*/
|
|
175
|
+
declare const buildElectrumCacheDatabaseFilename: (network: XONetwork, accountHash: string, databaseFilename?: string) => string;
|
|
176
|
+
//#endregion
|
|
177
|
+
//#region source/invitation/interfaces.d.ts
|
|
178
|
+
/**
|
|
179
|
+
* Account pieces an invitation function may read.
|
|
180
|
+
* Each function requires the fields it uses.
|
|
181
|
+
*/
|
|
182
|
+
type AccountContext = {
|
|
183
|
+
state?: State;
|
|
184
|
+
crypto?: Crypto;
|
|
185
|
+
network?: XONetwork;
|
|
186
|
+
};
|
|
44
187
|
/**
|
|
45
188
|
* Parameters required for creating a new XO invitation.
|
|
46
189
|
*/
|
|
47
|
-
interface
|
|
190
|
+
interface InvitationParameters {
|
|
48
191
|
/**
|
|
49
192
|
* Identifier of the template to use for this invitation.
|
|
50
193
|
*/
|
|
51
|
-
templateIdentifier:
|
|
194
|
+
templateIdentifier: XOTemplateIdentifier;
|
|
52
195
|
/**
|
|
53
196
|
* Identifier of the action within the template to initiate.
|
|
54
197
|
*/
|
|
55
|
-
actionIdentifier:
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Parameters for extending an invitation.
|
|
59
|
-
*/
|
|
60
|
-
interface AppendInvitationParameters {
|
|
198
|
+
actionIdentifier: XOTemplateActionIdentifier;
|
|
61
199
|
/**
|
|
62
200
|
* Optional transaction version.
|
|
63
201
|
*/
|
|
64
|
-
version?:
|
|
202
|
+
version?: XOInvitationTransactionVersion;
|
|
65
203
|
/**
|
|
66
204
|
* Optional transaction locktime.
|
|
67
205
|
*/
|
|
68
|
-
locktime?:
|
|
206
|
+
locktime?: XOInvitationTransactionLocktime;
|
|
69
207
|
/**
|
|
70
208
|
* Optional array of inputs.
|
|
71
209
|
*/
|
|
@@ -78,15 +216,43 @@ interface AppendInvitationParameters {
|
|
|
78
216
|
* Optional array of variables.
|
|
79
217
|
*/
|
|
80
218
|
variables?: XOInvitationVariable[];
|
|
219
|
+
/**
|
|
220
|
+
* Optional array of key operations resolved by the entity holding the key, such as a public key or a data signature.
|
|
221
|
+
*/
|
|
222
|
+
resolutions?: XOInvitationResolution[];
|
|
223
|
+
/**
|
|
224
|
+
* Optional role the committing entity takes with this commit.
|
|
225
|
+
*/
|
|
226
|
+
roleIdentifier?: XOTemplateRoleIdentifier;
|
|
81
227
|
/**
|
|
82
228
|
* Optional expiration timestamp.
|
|
83
229
|
*/
|
|
84
|
-
expiresAtTimestamp?:
|
|
230
|
+
expiresAtTimestamp?: XOInvitationTimestamp;
|
|
85
231
|
}
|
|
86
232
|
/**
|
|
87
|
-
* Parameters for
|
|
233
|
+
* Parameters for creating an invitation, including the role the creating entity takes in the action.
|
|
234
|
+
*/
|
|
235
|
+
type InvitationCreationParameters = InvitationParameters & {
|
|
236
|
+
/**
|
|
237
|
+
* Role this account takes in the action, when no intent names it. The keys the role lists in its generate list are
|
|
238
|
+
* generated for this account.
|
|
239
|
+
*/
|
|
240
|
+
roleIdentifier?: XOTemplateRoleIdentifier;
|
|
241
|
+
/**
|
|
242
|
+
* Intent this account acted on, such as a start entry, a follow up offered by a locking script, or a default. It must
|
|
243
|
+
* name the invitation's action. Its role is the role this account takes, and the keys in its generate list are
|
|
244
|
+
* generated as well as the ones the action role lists.
|
|
245
|
+
*/
|
|
246
|
+
intent?: XOTemplateActionIntent;
|
|
247
|
+
};
|
|
248
|
+
/**
|
|
249
|
+
* Parameters for accepting an invitation. The template and action come from the invitation itself.
|
|
250
|
+
*/
|
|
251
|
+
type InvitationAcceptanceParameters = Omit<InvitationCreationParameters, 'templateIdentifier' | 'actionIdentifier'>;
|
|
252
|
+
/**
|
|
253
|
+
* Parameters for appending to an existing invitation. All fields are optional.
|
|
88
254
|
*/
|
|
89
|
-
type
|
|
255
|
+
type AppendInvitationParameters = Partial<InvitationParameters>;
|
|
90
256
|
/**
|
|
91
257
|
* Parameters for executing an action.
|
|
92
258
|
*/
|
|
@@ -97,1323 +263,3529 @@ interface ExecuteActionParameters {
|
|
|
97
263
|
broadcastTransaction: boolean;
|
|
98
264
|
}
|
|
99
265
|
/**
|
|
100
|
-
*
|
|
266
|
+
* Encoded transaction produced from a merged invitation, including serialized size.
|
|
101
267
|
*/
|
|
102
|
-
interface
|
|
268
|
+
interface BuiltInvitationTransaction {
|
|
269
|
+
/** Full transaction serialized as hex (two hex digits per byte). */
|
|
270
|
+
serializedTransaction: string;
|
|
271
|
+
/** Length of the serialized transaction in bytes. */
|
|
272
|
+
transactionByteLength: number;
|
|
273
|
+
/** Number of characters in serializedTransaction (twice the byte length for valid hex). */
|
|
274
|
+
serializedTransactionCharacterCount: number;
|
|
275
|
+
/** Transaction id hash from the encoded bytes. */
|
|
276
|
+
transactionHash: XOInvitationTransactionHash;
|
|
103
277
|
/**
|
|
104
|
-
*
|
|
278
|
+
* Input count used for the fee estimate (merged inputs at preview time).
|
|
105
279
|
*/
|
|
106
|
-
|
|
280
|
+
feeEstimateInputCount: number;
|
|
107
281
|
/**
|
|
108
|
-
*
|
|
282
|
+
* Output count used for the fee estimate (active outputs at preview time).
|
|
283
|
+
*/
|
|
284
|
+
feeEstimateOutputCount: number;
|
|
285
|
+
/**
|
|
286
|
+
* Miner fee estimate in satoshis, which is feeEstimateInputCount times {@link DEFAULT_FEE_SATOSHIS_PER_INPUT} plus
|
|
287
|
+
* feeEstimateOutputCount times {@link DEFAULT_FEE_SATOSHIS_PER_OUTPUT}.
|
|
288
|
+
* Actual network fees may differ from this estimate.
|
|
109
289
|
*/
|
|
110
|
-
|
|
290
|
+
estimatedFeeSatoshis: number;
|
|
111
291
|
}
|
|
112
|
-
//#endregion
|
|
113
|
-
//#region source/engine.d.ts
|
|
114
292
|
/**
|
|
115
|
-
*
|
|
293
|
+
* Result of executing an invitation action, including the persisted invitation state.
|
|
116
294
|
*/
|
|
117
|
-
|
|
295
|
+
interface ExecuteActionResult {
|
|
296
|
+
/** Encoded transaction metadata produced from the merged invitation. */
|
|
297
|
+
builtTransaction: BuiltInvitationTransaction;
|
|
298
|
+
/** Invitation stored after transaction results are written. */
|
|
299
|
+
storedInvitation: StoredInvitation;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Fields accepted when recording that an invitation transaction was created.
|
|
303
|
+
*/
|
|
304
|
+
type InvitationTransactionCreatedResultInput = Pick<XOInvitationTransactionResult, 'transactionHash' | 'createdAtTimestamp' | 'createdByEntityIdentifier' | 'createdBySignature'>;
|
|
305
|
+
/**
|
|
306
|
+
* Fields accepted when recording that an invitation transaction was broadcast.
|
|
307
|
+
*/
|
|
308
|
+
type InvitationTransactionBroadcastedResultInput = XOInvitationTransactionBroadcastDetails;
|
|
309
|
+
/**
|
|
310
|
+
* An input committed to the invitation that carries a real UTXO outpoint but no unlocking bytecode yet.
|
|
311
|
+
* This means the input has been reserved but not yet signed by its committing entity.
|
|
312
|
+
*/
|
|
313
|
+
interface InvitationInputMissingSignature {
|
|
118
314
|
/**
|
|
119
|
-
* The
|
|
315
|
+
* The identifier assigned to this input, or undefined if no identifier was given.
|
|
120
316
|
*/
|
|
121
|
-
|
|
317
|
+
inputIdentifier: XOTemplateInputIdentifier | undefined;
|
|
122
318
|
/**
|
|
123
|
-
*
|
|
319
|
+
* Identifier of the commit that originally introduced this input to the invitation.
|
|
124
320
|
*/
|
|
125
|
-
|
|
321
|
+
sourceCommitIdentifier: XOInvitationCommitIdentifier;
|
|
126
322
|
/**
|
|
127
|
-
*
|
|
323
|
+
* Identifier of the entity that committed this input, or undefined when the source commit has none.
|
|
128
324
|
*/
|
|
129
|
-
|
|
325
|
+
entityIdentifier: XOInvitationEntityIdentifier | undefined;
|
|
130
326
|
/**
|
|
131
|
-
*
|
|
327
|
+
* Role identifier this input belongs to, or undefined if it is not role-specific.
|
|
132
328
|
*/
|
|
133
|
-
|
|
329
|
+
roleIdentifier: XOTemplateRoleIdentifier | undefined;
|
|
134
330
|
/**
|
|
135
|
-
*
|
|
331
|
+
* Parent transaction hash for the reserved UTXO, as lowercase hex.
|
|
136
332
|
*/
|
|
137
|
-
|
|
333
|
+
outpointTransactionHash: string;
|
|
138
334
|
/**
|
|
139
|
-
*
|
|
335
|
+
* Output index of the reserved UTXO in its parent transaction.
|
|
140
336
|
*/
|
|
141
|
-
|
|
337
|
+
outpointIndex: number;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* The key operations a script needs from participants, grouped by who still has to provide them.
|
|
341
|
+
*/
|
|
342
|
+
type InvitationResolutionRequirements = {
|
|
142
343
|
/**
|
|
143
|
-
*
|
|
144
|
-
* @private
|
|
145
|
-
* @param {string} mnemonic - The BIP39 mnemonic to be used for this instance of the engine.
|
|
146
|
-
* @param {State} state - State instance.
|
|
147
|
-
* @param {BlockchainMonitor} blockchainMonitor - Blockchain monitor instance.
|
|
344
|
+
* Identifiers the invitation already holds a value for.
|
|
148
345
|
*/
|
|
149
|
-
|
|
346
|
+
providedIdentifiers: XOInvitationResolutionIdentifier[];
|
|
150
347
|
/**
|
|
151
|
-
*
|
|
152
|
-
* Configures the state, initializes the sync server and monitor for app and blockchain events
|
|
153
|
-
*
|
|
154
|
-
* @param {string} mnemonic - BIP39 mnemonic to be used for this instance of the engine.
|
|
155
|
-
* @param {XOEngineOptions} options - Database configuration options.
|
|
156
|
-
* @returns {Promise<Engine>} An initialized Engine instance.
|
|
348
|
+
* Values resolved from this account's keys that the invitation does not hold yet.
|
|
157
349
|
*/
|
|
158
|
-
|
|
350
|
+
ownResolutions: XOInvitationResolution[];
|
|
159
351
|
/**
|
|
160
|
-
*
|
|
161
|
-
* @returns {Promise<void>} Resolves when the engine is stopped.
|
|
352
|
+
* Identifiers other participants have not provided yet.
|
|
162
353
|
*/
|
|
163
|
-
|
|
354
|
+
missingIdentifiers: XOInvitationResolutionIdentifier[];
|
|
355
|
+
};
|
|
356
|
+
/**
|
|
357
|
+
* A role of the action that fewer entities have taken than the action requires.
|
|
358
|
+
*/
|
|
359
|
+
type InvitationMissingParticipant = {
|
|
164
360
|
/**
|
|
165
|
-
*
|
|
166
|
-
* @returns {Promise<ChainStatus>} The current chain status.
|
|
361
|
+
* Role that is waiting for an entity to join the invitation with it.
|
|
167
362
|
*/
|
|
168
|
-
|
|
363
|
+
roleIdentifier: XOTemplateRoleIdentifier;
|
|
169
364
|
/**
|
|
170
|
-
*
|
|
171
|
-
* @param {string} templateIdentifier - Template identifier.
|
|
172
|
-
* @returns {Promise<XOTemplate | undefined>} The template object.
|
|
365
|
+
* Number of entities that have taken the role so far.
|
|
173
366
|
*/
|
|
174
|
-
|
|
367
|
+
filledSlots: number;
|
|
175
368
|
/**
|
|
176
|
-
*
|
|
177
|
-
* @param {string | XOTemplate} untrustedJsonOrObject - JSON or object containing the untrusted template to import.
|
|
178
|
-
* @returns {Promise<void>} Resolves when the template is imported.
|
|
179
|
-
* @throws {TemplateImportFailedError} If the template is invalid.
|
|
369
|
+
* Minimum number of entities the action requires for the role.
|
|
180
370
|
*/
|
|
181
|
-
|
|
182
|
-
template: XOTemplate;
|
|
183
|
-
templateIdentifier: string;
|
|
184
|
-
}>;
|
|
371
|
+
minimumSlots: number;
|
|
185
372
|
/**
|
|
186
|
-
*
|
|
187
|
-
* @returns {Promise<XOTemplate[]>} The list of imported templates.
|
|
373
|
+
* Maximum number of entities the role takes, or undefined when it takes any number.
|
|
188
374
|
*/
|
|
189
|
-
|
|
375
|
+
maximumSlots: number | undefined;
|
|
376
|
+
};
|
|
377
|
+
/**
|
|
378
|
+
* Combined result from listing missing requirements for an invitation.
|
|
379
|
+
* Covers both gaps at the template level (data not yet provided) and at the invitation level
|
|
380
|
+
* (data provided but not yet complete, such as unsigned inputs).
|
|
381
|
+
*/
|
|
382
|
+
interface InvitationMissingRequirements {
|
|
190
383
|
/**
|
|
191
|
-
*
|
|
192
|
-
* @param {string} templateIdentifier - Template identifier.
|
|
193
|
-
* @returns {Promise<Array<XOTemplateActionIntent>>} The list of starting actions.
|
|
384
|
+
* Requirements expected by the template that have not been provided in any commit yet.
|
|
194
385
|
*/
|
|
195
|
-
|
|
386
|
+
templateRequirements: InvitationRequirementIdentifierLists;
|
|
196
387
|
/**
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
* TODO: Make this an private/internal method.
|
|
200
|
-
*
|
|
201
|
-
* @param {string} templateIdentifier - Template identifier.
|
|
202
|
-
* @returns {Promise<void>} Resolves when the unspent outputs are updated.
|
|
388
|
+
* Inputs committed with a real UTXO outpoint that are still missing their unlocking bytecode.
|
|
203
389
|
*/
|
|
204
|
-
|
|
390
|
+
inputsMissingSignatures: InvitationInputMissingSignature[];
|
|
205
391
|
/**
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* TODO: Make this a private/internal method. We may change how/where this is defined in the future.
|
|
209
|
-
* We'd like to ensure events are propagated to the sync server with an ACK and that the states match between remote and local.
|
|
210
|
-
*
|
|
211
|
-
* @param {string} templateIdentifier - Template identifier.
|
|
212
|
-
* @returns {Promise<void>} Resolves when the script hashes are subscribed.
|
|
392
|
+
* Roles that still need an entity to join the invitation with them.
|
|
213
393
|
*/
|
|
214
|
-
|
|
394
|
+
participants: InvitationMissingParticipant[];
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Why a merged invitation transaction cannot accept a change output right now.
|
|
398
|
+
*/
|
|
399
|
+
type ChangeUnavailableReason = 'merged_commit_missing' | 'insufficient_surplus' | 'below_dust';
|
|
400
|
+
/**
|
|
401
|
+
* One fungible token category with surplus that can be returned as change.
|
|
402
|
+
*/
|
|
403
|
+
type FungibleTokenChangeSurplus = {
|
|
404
|
+
/** Normalized lowercase token category hex. */tokenCategory: string; /** Fungible amount returning to the wallet as change. */
|
|
405
|
+
surplusAmount: bigint;
|
|
406
|
+
};
|
|
407
|
+
/**
|
|
408
|
+
* Result of checking whether a change output can be appended to the merged invitation transaction.
|
|
409
|
+
*/
|
|
410
|
+
interface ChangeAvailability {
|
|
215
411
|
/**
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
* Sets the default locking parameters (template, output, and role identifiers) for the engine.
|
|
219
|
-
* TODO: The default identifiers exist as the strategy on how to create the change and default
|
|
220
|
-
* unlocking conditions are unclear. This is likely to change in the future.
|
|
221
|
-
*
|
|
222
|
-
* @param {string} templateIdentifier - The identifier of the template to use as default.
|
|
223
|
-
* @param {string} outputIdentifier - The identifier of the output within the specified template.
|
|
224
|
-
* @param {string} roleIdentifier - The identifier of the role to use as default for this output.
|
|
225
|
-
* @returns {Promise<void>} Resolves when the default parameters have been successfully set.
|
|
226
|
-
* @throws {Error} If the template or output cannot be found.
|
|
412
|
+
* True when at least one BCH or fungible token change output can be appended.
|
|
227
413
|
*/
|
|
228
|
-
|
|
414
|
+
canAddChange: boolean;
|
|
229
415
|
/**
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
* State sync should always be working, any hiccups in the sync process should be resolved
|
|
233
|
-
* Unable to do so should halt all operations unless no remote servers are provided.
|
|
234
|
-
*
|
|
235
|
-
* Initializes the state sync process.
|
|
236
|
-
* @returns {Promise<void>} Resolves when the state sync is initialized.
|
|
416
|
+
* True when a BCH change output is included in the current change plan.
|
|
237
417
|
*/
|
|
238
|
-
|
|
418
|
+
canAddBchChange: boolean;
|
|
239
419
|
/**
|
|
240
|
-
*
|
|
241
|
-
* Invitation is the fundamental communication unit in XO, all the interactions done using the
|
|
242
|
-
* xo template are done using invitations.
|
|
243
|
-
*
|
|
244
|
-
* @param {InvitationCreationParameters} params - The parameters for invitation creation.
|
|
245
|
-
* @param {string} params.templateIdentifier - Identifier for the template to use.
|
|
246
|
-
* @param {string} params.actionIdentifier - Identifier for the action to initiate.
|
|
247
|
-
* @returns {Promise<XOInvitation>} A promise that resolves to the constructed invitation.
|
|
248
|
-
* @throws {TemplateNotFoundError} If the template is not found.
|
|
249
|
-
* @throws {TemplateActionNotFoundError} If the action is not found.
|
|
250
|
-
*
|
|
251
|
-
* TODO: Add all the throws that happen during the execution of the method.
|
|
420
|
+
* True when at least one fungible token change output is included in the current change plan.
|
|
252
421
|
*/
|
|
253
|
-
|
|
422
|
+
canAddTokenChange: boolean;
|
|
254
423
|
/**
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
* @param {XOInvitation} invitation - The invitation to be accepted.
|
|
258
|
-
* @param {AcceptInvitationParameters} params - Optional parameters for accepting the invitation.
|
|
259
|
-
* @returns {Promise<XOInvitation>} The updated XOInvitation instance.
|
|
260
|
-
* @throws {TemplateNotFoundError} If the template is not found.
|
|
261
|
-
* @throws {TemplateActionNotFoundError} If the action is not found.
|
|
262
|
-
* @throws {InvalidEntityIdentifierError} If the entity identifiers are invalid.
|
|
263
|
-
* @throws {InvalidRequirementsError} If the requirements are invalid.
|
|
264
|
-
* @throws {InvalidCommitSignaturesError} If the commit signatures are invalid.
|
|
424
|
+
* Satoshis for the BCH change output when canAddBchChange is true.
|
|
425
|
+
* Otherwise 0, except below_dust may still report a small nonzero surplus.
|
|
265
426
|
*/
|
|
266
|
-
|
|
427
|
+
changeAmountSatoshis: bigint;
|
|
267
428
|
/**
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
* @param {string} invitationIdentifier - The identifier of the invitation to append. The invitation must already exist in the store.
|
|
271
|
-
* @param {AppendInvitationParameters} params - The parameters to append the invitation with.
|
|
272
|
-
* @returns {Promise<XOInvitation>} The appended invitation.
|
|
273
|
-
* @throws {InvitationNotFoundInStoreError} If the invitation is not found in the store.
|
|
429
|
+
* Fungible token categories with positive surplus that would be returned as change.
|
|
274
430
|
*/
|
|
275
|
-
|
|
431
|
+
fungibleTokenChangeByCategory: FungibleTokenChangeSurplus[];
|
|
276
432
|
/**
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
* invitation and adds new commit with unlocking data.
|
|
280
|
-
*
|
|
281
|
-
* @param {string} invitationIdentifier - The identifier of the invitation to sign. The invitation must already exist in the store.
|
|
282
|
-
* @returns {Promise<XOInvitation>} Resolves when signing is complete.
|
|
283
|
-
* @throws {InvitationNotFoundInStoreError} If the invitation is not found in the store.
|
|
284
|
-
*
|
|
285
|
-
* TODO: Add all the throws that happen during the execution of the method.
|
|
433
|
+
* Set when canAddChange is false.
|
|
434
|
+
* One of merged_commit_missing, insufficient_surplus, or below_dust.
|
|
286
435
|
*/
|
|
287
|
-
|
|
436
|
+
reason?: ChangeUnavailableReason;
|
|
288
437
|
/**
|
|
289
|
-
*
|
|
290
|
-
* @param {string} invitationIdentifier - The identifier of the invitation whose action to execute.
|
|
291
|
-
* The invitation must already exist in the store.
|
|
292
|
-
* @param {ExecuteActionParameters} params - Parameters for executing the action.
|
|
293
|
-
* @returns {Promise<TransactionHash>} Resolves with the transaction hash when the action is executed.
|
|
294
|
-
* @throws {InvitationNotFoundInStoreError} If the invitation is not found in the store.
|
|
295
|
-
*
|
|
296
|
-
* TODO: Add all the throws that happen during the execution of the method.
|
|
438
|
+
* True when template.defaults.change defines how the engine builds the change output.
|
|
297
439
|
*/
|
|
298
|
-
|
|
440
|
+
hasTemplateChangePolicy: boolean;
|
|
299
441
|
/**
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
* @param {XOInvitation} invitation - The invitation to examine.
|
|
303
|
-
* @returns {Promise<string[]>} The list of roles that still require data.
|
|
304
|
-
* @throws {TemplateNotFoundError} If the template is not found.
|
|
305
|
-
* @throws {TemplateActionNotFoundError} If the action is not found.
|
|
442
|
+
* Sum of merged input satoshis used for the surplus check.
|
|
306
443
|
*/
|
|
307
|
-
|
|
444
|
+
inputTotalSatoshis: bigint;
|
|
308
445
|
/**
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
* @param {XOInvitation} invitation - The invitation to analyze requirements for.
|
|
312
|
-
* @returns {Promise<XOInvitationRequirements>} The requirements information.
|
|
313
|
-
*
|
|
446
|
+
* Sum of merged output satoshis used for the surplus check.
|
|
314
447
|
*/
|
|
315
|
-
|
|
448
|
+
outputTotalSatoshis: bigint;
|
|
316
449
|
/**
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
* @param {string} invitationIdentifier - The identifier of the invitation to analyze. The invitation must already exist in the store.
|
|
320
|
-
* @returns {Promise<XOInvitationRequirements>} The missing requirements.
|
|
321
|
-
* @throws {InvitationNotFoundInStoreError} If the invitation is not found in the store.
|
|
450
|
+
* Minimum fee estimate for the current input and output counts before projecting a change output.
|
|
451
|
+
* Uses {@link DEFAULT_FEE_SATOSHIS_PER_INPUT} and {@link DEFAULT_FEE_SATOSHIS_PER_OUTPUT}.
|
|
322
452
|
*/
|
|
323
|
-
|
|
453
|
+
estimatedMinFeeSatoshis: bigint;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Identifier lists for a single role's invitation requirements.
|
|
457
|
+
*/
|
|
458
|
+
type InvitationRoleRequirementIdentifierLists = {
|
|
459
|
+
variables?: XOTemplateVariableIdentifier[];
|
|
460
|
+
inputs?: XOTemplateInputIdentifier[];
|
|
461
|
+
outputs?: XOTemplateOutputIdentifier[];
|
|
462
|
+
};
|
|
463
|
+
/**
|
|
464
|
+
* Identifier lists for invitation requirements.
|
|
465
|
+
* Template and invitation listing APIs compare by identifier strings, not full commit items.
|
|
466
|
+
*/
|
|
467
|
+
type InvitationRequirementIdentifierLists = InvitationRoleRequirementIdentifierLists & {
|
|
468
|
+
roles?: Record<XOTemplateRoleIdentifier, InvitationRoleRequirementIdentifierLists>;
|
|
469
|
+
};
|
|
470
|
+
//#endregion
|
|
471
|
+
//#region source/compilation/generate-unlocking-bytecode.d.ts
|
|
472
|
+
/**
|
|
473
|
+
* Unlocking bytecode compiled for one reserved invitation input.
|
|
474
|
+
*/
|
|
475
|
+
type GeneratedInputUnlockingBytecode = {
|
|
324
476
|
/**
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
* @returns {Promise<UnspentOutputData[]>} The list of unspent outputs.
|
|
477
|
+
* Parent transaction hash of the spent outpoint, lowercase hex.
|
|
328
478
|
*/
|
|
329
|
-
|
|
479
|
+
outpointTransactionHash: string;
|
|
330
480
|
/**
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
* TODO: May become private. This may change in the future and become a more advanced coin selection method used directly by the engine.
|
|
334
|
-
* The current behavior is that it finds "spendable" outputs, but we may adjust this to actually find "suitable" outputs.
|
|
335
|
-
*
|
|
336
|
-
* @param {XOInvitation} invitation - The invitation to find resources for.
|
|
337
|
-
* @param {GetSpendableResourcesParameters} options - Parameters for finding suitable resources.
|
|
338
|
-
* @returns {Promise<{ unspentOutputs: UnspentOutputData[] }>} The list of suitable resources.
|
|
481
|
+
* Output index of the spent outpoint.
|
|
339
482
|
*/
|
|
340
|
-
|
|
341
|
-
unspentOutputs: UnspentOutputData[];
|
|
342
|
-
}>;
|
|
483
|
+
outpointIndex: number;
|
|
343
484
|
/**
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
* @param {string} templateIdentifier - The identifier of the template.
|
|
347
|
-
* @returns {Promise<ScriptHashData[]>} An array of script hash data objects.
|
|
485
|
+
* Compiled unlocking bytecode for this input.
|
|
348
486
|
*/
|
|
349
|
-
|
|
487
|
+
unlockingBytecode: Uint8Array;
|
|
488
|
+
};
|
|
489
|
+
//#endregion
|
|
490
|
+
//#region source/network/electrum.d.ts
|
|
491
|
+
/**
|
|
492
|
+
* Names of the states an Electrum connection can be in.
|
|
493
|
+
*/
|
|
494
|
+
declare const ELECTRUM_CONNECTION_STATUSES: {
|
|
495
|
+
readonly disconnected: "disconnected";
|
|
496
|
+
readonly connected: "connected";
|
|
497
|
+
readonly disconnecting: "disconnecting";
|
|
498
|
+
readonly connecting: "connecting";
|
|
499
|
+
readonly reconnecting: "reconnecting";
|
|
500
|
+
readonly unrecoverable: "unrecoverable";
|
|
501
|
+
};
|
|
502
|
+
/**
|
|
503
|
+
* State of one Electrum connection.
|
|
504
|
+
*/
|
|
505
|
+
type ElectrumConnectionStatus = ValueOf<typeof ELECTRUM_CONNECTION_STATUSES>;
|
|
506
|
+
/**
|
|
507
|
+
* One Electrum server the engine connects to and the state of that connection.
|
|
508
|
+
*/
|
|
509
|
+
type ElectrumConnection = {
|
|
350
510
|
/**
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
* @returns {Promise<ScriptHashData[]>} An array of script hash data objects.
|
|
511
|
+
* Host and port of the server, such as `electrum.imaginary.cash:50004`.
|
|
354
512
|
*/
|
|
355
|
-
|
|
513
|
+
hostIdentifier: string;
|
|
356
514
|
/**
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
* Role is important because in the template definition it can direct to a different secret or a locking script
|
|
360
|
-
* for that to be discovered and used, it must know what role is provided. Also, it's important for libauth compiler
|
|
361
|
-
* to know what role is being used to generate the locking bytecode.
|
|
362
|
-
*
|
|
363
|
-
* Currently, only "standard" type (e.g. P2PKH) locking scripts are supported.
|
|
364
|
-
* In the future, this method will be extended to support more output script types based on template definitions.
|
|
365
|
-
*
|
|
366
|
-
* Future definition of primitives is going to define how other non-p2pkh locking scripts are validated,
|
|
367
|
-
* for example, p2pkh is possible because the engine know what a private key and public key is more such primitives
|
|
368
|
-
* will be defined and they will be helpful in generating and validating locking scripts of different types.
|
|
369
|
-
*
|
|
370
|
-
* Process overview:
|
|
371
|
-
* - Fetch the template and output definition by their identifiers.
|
|
372
|
-
* - Find the relevant locking script and roles.
|
|
373
|
-
* - Select the specified role or fallback to the first available role.
|
|
374
|
-
* - Build the entity ownership mapping, scripts, and variable definitions for Libauth.
|
|
375
|
-
* - Set up unlocking scripts and locking script type for the compiler configuration.
|
|
376
|
-
* - For "standard" lock scripts, generate entropy if required. (TODO: Improve entropy generation.)
|
|
377
|
-
* - Compile the locking bytecode with the Libauth compiler.
|
|
378
|
-
* - Subscribe to blockchain updates for the script hash and store the resulting bytecode.
|
|
379
|
-
*
|
|
380
|
-
* TODO: Support additional types of outputs/scripts tied to template specification.
|
|
381
|
-
* TODO: If important to make this process faster, consider emitting an event and pushing process to the event loop.
|
|
382
|
-
* TODO: Encrypt the new information, update the encrypted state servers.
|
|
383
|
-
*
|
|
384
|
-
* @param {string} templateIdentifier - Identifier of the template.
|
|
385
|
-
* @param {string} outputIdentifier - Identifier of the output (from the template).
|
|
386
|
-
* @param {string} roleIdentifier - Role identifier (corresponding to a role in the output's script).
|
|
387
|
-
* @returns {Promise<string>} The generated locking bytecode as a hexadecimal string.
|
|
388
|
-
* @throws {Error} If any required template, output, or configuration is not found, or if compilation fails.
|
|
515
|
+
* Whether the connection uses TLS.
|
|
389
516
|
*/
|
|
390
|
-
|
|
517
|
+
isEncrypted: boolean;
|
|
391
518
|
/**
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
* @returns A promise that resolves to the generated locking bytecode as a string.
|
|
519
|
+
* State of the connection.
|
|
395
520
|
*/
|
|
396
|
-
|
|
521
|
+
status: ElectrumConnectionStatus;
|
|
397
522
|
/**
|
|
398
|
-
*
|
|
523
|
+
* Name and version of the server software.
|
|
399
524
|
*/
|
|
400
|
-
|
|
401
|
-
lockingData: PrivateKeyRecordForLibauthCompiler;
|
|
402
|
-
derivativeIndex: string;
|
|
403
|
-
}>;
|
|
525
|
+
software?: string;
|
|
404
526
|
/**
|
|
405
|
-
*
|
|
406
|
-
*
|
|
407
|
-
* @param {string} invitationIdentifier - The identifier to look up.
|
|
408
|
-
* @returns {Promise<StoredInvitation | undefined>} The stored invitation, or undefined.
|
|
527
|
+
* Chain height the server reports.
|
|
409
528
|
*/
|
|
410
|
-
|
|
529
|
+
chainHeight?: number;
|
|
530
|
+
};
|
|
531
|
+
/**
|
|
532
|
+
* Decodes one output from a transaction loaded through Electrum.
|
|
533
|
+
*
|
|
534
|
+
* @param {TransactionHash} transactionHash - Parent transaction id in Electrum hex form.
|
|
535
|
+
* @param {number} outputIndex - Output index in the decoded transaction.
|
|
536
|
+
* @returns {Promise<Output>} - Decoded libauth output.
|
|
537
|
+
* @throws {@link TransactionOutputNotFoundError} - When the output index is missing.
|
|
538
|
+
*/
|
|
539
|
+
declare const fetchDecodedTransactionOutput: (transactionHash: TransactionHash, outputIndex: number) => Promise<Output>;
|
|
540
|
+
/**
|
|
541
|
+
* Fetches unspent outputs for a script hash, including CashToken unspent outputs.
|
|
542
|
+
*
|
|
543
|
+
* @param {string} scriptHash - Script hash to query.
|
|
544
|
+
* @returns {Promise<ScriptHashListUnspentResponse>} - Unspent outputs for the script hash.
|
|
545
|
+
*/
|
|
546
|
+
declare const fetchScriptHashUnspentOutputs: (scriptHash: string) => Promise<ScriptHashListUnspentResponse>;
|
|
547
|
+
/**
|
|
548
|
+
* Fetches unspent outputs for a locking bytecode from Electrum.
|
|
549
|
+
*
|
|
550
|
+
* Results are not stored. Tracking a locking script still goes through registration with a real template output identifier.
|
|
551
|
+
*
|
|
552
|
+
* @param {string} lockingBytecode - Locking bytecode as hexadecimal.
|
|
553
|
+
* @param {XOTemplateIdentifier} templateIdentifier - Template that produced the locking bytecode.
|
|
554
|
+
* @returns {Promise<UnspentOutputData[]>} - Unspent outputs for the locking bytecode.
|
|
555
|
+
*/
|
|
556
|
+
declare const fetchUnspentOutputsForLockingBytecode: (lockingBytecode: string, templateIdentifier: XOTemplateIdentifier) => Promise<UnspentOutputData[]>;
|
|
557
|
+
/**
|
|
558
|
+
* Lists every Electrum server the engine connects to, with the state of each connection.
|
|
559
|
+
*
|
|
560
|
+
* @returns {ElectrumConnection[]} - One entry per Electrum client, empty before Electrum is initialized.
|
|
561
|
+
*/
|
|
562
|
+
declare const listElectrumConnections: () => ElectrumConnection[];
|
|
563
|
+
//#endregion
|
|
564
|
+
//#region source/interfaces.d.ts
|
|
565
|
+
/**
|
|
566
|
+
* Configuration options for the XO Engine.
|
|
567
|
+
*/
|
|
568
|
+
interface XOEngineOptions {
|
|
411
569
|
/**
|
|
412
|
-
*
|
|
413
|
-
*
|
|
414
|
-
* @param {string} templateIdentifier - The identifier to look up.
|
|
415
|
-
* @returns {Promise<XOTemplate>} The stored template.
|
|
570
|
+
* Network this engine instance targets.
|
|
416
571
|
*/
|
|
417
|
-
|
|
572
|
+
network?: XONetwork;
|
|
418
573
|
/**
|
|
419
|
-
*
|
|
574
|
+
* The storage type to use.
|
|
575
|
+
*/
|
|
576
|
+
storageType?: StorageType;
|
|
577
|
+
/**
|
|
578
|
+
* Directory path where the database will be stored.
|
|
579
|
+
*/
|
|
580
|
+
databasePath?: string;
|
|
581
|
+
/**
|
|
582
|
+
* Filename of the database file.
|
|
583
|
+
*/
|
|
584
|
+
databaseFilename?: string;
|
|
585
|
+
/**
|
|
586
|
+
* Electrum servers to connect to, each with the blockchain checkpoint and consensus parameters of the target network.
|
|
587
|
+
*/
|
|
588
|
+
electrumServers?: ElectrumServersWithBlockchain;
|
|
589
|
+
/**
|
|
590
|
+
* The Electrum application identifier to use.
|
|
591
|
+
*/
|
|
592
|
+
electrumApplicationIdentifier?: string;
|
|
593
|
+
/**
|
|
594
|
+
* Remote encrypted state servers to use.
|
|
595
|
+
*/
|
|
596
|
+
remoteEncryptedStateServers?: string[];
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Parameters for finding spendable inputs.
|
|
600
|
+
*/
|
|
601
|
+
interface ListSpendableUnspentOutputsParameters {
|
|
602
|
+
/**
|
|
603
|
+
* Identifier of the template to use for resource selection.
|
|
604
|
+
*/
|
|
605
|
+
templateIdentifier: XOTemplateIdentifier;
|
|
606
|
+
/**
|
|
607
|
+
* Identifier of the output within the template.
|
|
608
|
+
*/
|
|
609
|
+
outputIdentifier?: XOTemplateOutputIdentifier;
|
|
610
|
+
/**
|
|
611
|
+
* Identifier of the locking script within the template.
|
|
612
|
+
*/
|
|
613
|
+
lockingScriptIdentifier?: XOTemplateLockingScriptIdentifier;
|
|
614
|
+
/**
|
|
615
|
+
* Keep only UTXOs whose CashToken category equals this value.
|
|
616
|
+
*/
|
|
617
|
+
tokenCategory?: string;
|
|
618
|
+
/**
|
|
619
|
+
* Keep only UTXOs whose fungible token amount equals this value.
|
|
620
|
+
*/
|
|
621
|
+
tokenAmount?: string;
|
|
622
|
+
/**
|
|
623
|
+
* Keep only UTXOs whose NFT capability equals this value.
|
|
624
|
+
*/
|
|
625
|
+
tokenNftCapability?: XOTemplateNftCapability;
|
|
626
|
+
/**
|
|
627
|
+
* Keep only UTXOs whose NFT commitment equals this value.
|
|
628
|
+
*/
|
|
629
|
+
tokenNftCommitment?: string;
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Default policies used when generating change, address and other locking bytecodes.
|
|
633
|
+
*
|
|
634
|
+
* Resolution order for locking bytecode generation is manual override, then template defaults, then these default policies.
|
|
635
|
+
*/
|
|
636
|
+
interface WalletDefaultPolicies {
|
|
637
|
+
change?: {
|
|
638
|
+
templateIdentifier: XOTemplateIdentifier;
|
|
639
|
+
};
|
|
640
|
+
receive?: {
|
|
641
|
+
templateIdentifier: XOTemplateIdentifier;
|
|
642
|
+
};
|
|
643
|
+
address?: {
|
|
644
|
+
templateIdentifier: XOTemplateIdentifier;
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* A stored template that can back a wallet default policy, with the identifier it is stored under.
|
|
649
|
+
*/
|
|
650
|
+
type DefaultPolicyTemplate = {
|
|
651
|
+
/**
|
|
652
|
+
* Identifier to pass as the policy template identifier.
|
|
653
|
+
*/
|
|
654
|
+
templateIdentifier: XOTemplateIdentifier;
|
|
655
|
+
/**
|
|
656
|
+
* Template whose defaults define the policy.
|
|
657
|
+
*/
|
|
658
|
+
template: XOTemplate;
|
|
659
|
+
};
|
|
660
|
+
//#endregion
|
|
661
|
+
//#region source/invitation/merge/types.d.ts
|
|
662
|
+
/**
|
|
663
|
+
* Spent output value and token fields that may be recorded on an invitation input at runtime.
|
|
664
|
+
*
|
|
665
|
+
* Kept in the engine package rather than on {@link XOInvitationInput} in `@xo-cash/types`.
|
|
666
|
+
*/
|
|
667
|
+
type InvitationInputSpentOutputFields = {
|
|
668
|
+
valueSatoshis?: Output['valueSatoshis'];
|
|
669
|
+
token?: OutputToken;
|
|
670
|
+
};
|
|
671
|
+
/**
|
|
672
|
+
* Invitation input that may also carry spent output value and token metadata.
|
|
673
|
+
*/
|
|
674
|
+
type InvitationInputWithSpentOutputFields = XOInvitationInput & InvitationInputSpentOutputFields;
|
|
675
|
+
/**
|
|
676
|
+
* A merged input enriched with the identifier of the commit that last wrote to it.
|
|
677
|
+
* When a later commit extends an earlier one via mergesWith, the extending commit's identifier is used.
|
|
678
|
+
*/
|
|
679
|
+
type MergedInvitationInput = InvitationInputWithSpentOutputFields & {
|
|
680
|
+
sourceCommitIdentifier: XOInvitationCommitIdentifier;
|
|
681
|
+
};
|
|
682
|
+
/**
|
|
683
|
+
* A merged output enriched with the identifier of the commit that last wrote to it.
|
|
684
|
+
*/
|
|
685
|
+
type MergedInvitationOutput = XOInvitationOutput & {
|
|
686
|
+
sourceCommitIdentifier: XOInvitationCommitIdentifier;
|
|
687
|
+
};
|
|
688
|
+
/**
|
|
689
|
+
* The final resultant of merging invitation commits.
|
|
690
|
+
* Each input and output carries the identifier of the commit that last wrote it.
|
|
691
|
+
*/
|
|
692
|
+
type MergedInvitation = {
|
|
693
|
+
inputs: MergedInvitationInput[];
|
|
694
|
+
outputs: MergedInvitationOutput[];
|
|
695
|
+
variables: XOInvitationVariable[];
|
|
696
|
+
transactionVersion: XOInvitationTransactionVersion;
|
|
697
|
+
transactionLocktime: XOInvitationTransactionLocktime;
|
|
698
|
+
};
|
|
699
|
+
//#endregion
|
|
700
|
+
//#region source/invitation/change/derive.d.ts
|
|
701
|
+
/**
|
|
702
|
+
* Leftover satoshi and fungible tokens.
|
|
703
|
+
*/
|
|
704
|
+
type MergedInvitationChange = {
|
|
705
|
+
/**
|
|
706
|
+
* Leftover satoshis. This remainder is the fee until a change output takes part of it.
|
|
707
|
+
*/
|
|
708
|
+
valueSatoshis: bigint;
|
|
709
|
+
/**
|
|
710
|
+
* Leftover fungible tokens.
|
|
711
|
+
*/
|
|
712
|
+
tokens: OutputToken[];
|
|
713
|
+
};
|
|
714
|
+
//#endregion
|
|
715
|
+
//#region source/engine.d.ts
|
|
716
|
+
/**
|
|
717
|
+
* Public interface of the XO engine. It holds the state, keys, network, and blockchain monitor of one account.
|
|
718
|
+
*/
|
|
719
|
+
declare class Engine {
|
|
720
|
+
#private;
|
|
721
|
+
/**
|
|
722
|
+
* Constructs a new instance of XO Engine.
|
|
723
|
+
* @private
|
|
724
|
+
* @param {string} mnemonic - The BIP39 mnemonic to be used for this instance of the engine.
|
|
725
|
+
* @param {State} state - State instance.
|
|
726
|
+
* @param {BlockchainMonitor} blockchainMonitor - Blockchain monitor instance.
|
|
727
|
+
* @param {XONetwork} network - Network this instance derives keys and isolates storage for.
|
|
728
|
+
*/
|
|
729
|
+
private constructor();
|
|
730
|
+
/**
|
|
731
|
+
* Network this engine instance targets.
|
|
732
|
+
*
|
|
733
|
+
* @returns {XONetwork} - Network this engine instance targets.
|
|
734
|
+
*/
|
|
735
|
+
get network(): XONetwork;
|
|
736
|
+
/**
|
|
737
|
+
* Lists every Electrum server this engine connects to, with the state of each connection.
|
|
420
738
|
*
|
|
421
|
-
*
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
*
|
|
739
|
+
* @returns {ElectrumConnection[]} - One entry per Electrum client, empty before Electrum is initialized.
|
|
740
|
+
*/
|
|
741
|
+
listElectrumConnections(): ElectrumConnection[];
|
|
742
|
+
/**
|
|
743
|
+
* Reads the chain status the Electrum application last reported, with the reported and verified block heights.
|
|
744
|
+
*
|
|
745
|
+
* @returns {Promise<ChainStatus>} - Current height, verified height, and verified percent of the chain.
|
|
746
|
+
*/
|
|
747
|
+
getChainStatus(): Promise<ChainStatus$1>;
|
|
748
|
+
/**
|
|
749
|
+
* Initializes and creates a new XO Engine instance.
|
|
750
|
+
* Opens storage, configures Electrum, and starts the blockchain monitor.
|
|
751
|
+
*
|
|
752
|
+
* @param {string} mnemonic - BIP39 mnemonic to be used for this instance of the engine.
|
|
753
|
+
* @param {XOEngineOptions} options - Storage, Electrum, network, and remote state settings for this instance.
|
|
754
|
+
* @returns {Promise<Engine>} - An initialized Engine instance.
|
|
755
|
+
*/
|
|
756
|
+
static create(mnemonic: string, options: XOEngineOptions): Promise<Engine>;
|
|
757
|
+
/**
|
|
758
|
+
* Stops the engine instance and cleans up resources.
|
|
759
|
+
* @returns {Promise<void>} - Resolves when the engine is stopped.
|
|
760
|
+
*/
|
|
761
|
+
stop(): Promise<void>;
|
|
762
|
+
/**
|
|
763
|
+
* Retrieves a template by its identifier from the state.
|
|
764
|
+
* @param {XOTemplateIdentifier} templateIdentifier - Template identifier.
|
|
765
|
+
* @returns {Promise<XOTemplate | undefined>} - The template object.
|
|
766
|
+
*/
|
|
767
|
+
getTemplate(templateIdentifier: XOTemplateIdentifier): Promise<XOTemplate | undefined>;
|
|
768
|
+
/**
|
|
769
|
+
* Imports a template into the Engine after sanitization and validation.
|
|
770
|
+
*
|
|
771
|
+
* @param {string | XOTemplate} untrustedJsonOrObject - JSON or object containing the untrusted template to import.
|
|
772
|
+
* @returns {Promise<{ template: XOTemplate; templateIdentifier: XOTemplateIdentifier }>} - The imported template and its identifier.
|
|
773
|
+
* @throws {@link TemplateInvalidError} - If the template is invalid.
|
|
774
|
+
* @throws {@link DatabaseWriteOperationFailedError} - If an unexpected database error occurs.
|
|
775
|
+
*/
|
|
776
|
+
importTemplate(untrustedJsonOrObject: string | XOTemplate): Promise<{
|
|
777
|
+
template: XOTemplate;
|
|
778
|
+
templateIdentifier: XOTemplateIdentifier;
|
|
779
|
+
}>;
|
|
780
|
+
/**
|
|
781
|
+
* Lists templates for this account.
|
|
782
|
+
*
|
|
783
|
+
* @param {StorageListOptions} [options] - Optional list options such as archive filter.
|
|
784
|
+
* @returns {Promise<StoredTemplate[]>} - Templates for this account.
|
|
785
|
+
*/
|
|
786
|
+
listTemplates(options?: StorageListOptions): Promise<StoredTemplate[]>;
|
|
787
|
+
/**
|
|
788
|
+
* Archives one stored template in local storage.
|
|
789
|
+
*
|
|
790
|
+
* @param {XOTemplateIdentifier} templateIdentifier - Identifier of the template to archive
|
|
791
|
+
* @returns {Promise<void>} - Resolves when the template is archived
|
|
792
|
+
* @throws {@link TemplateNotFoundInStoreError} - If the template is not in the store.
|
|
793
|
+
*/
|
|
794
|
+
archiveTemplate(templateIdentifier: XOTemplateIdentifier): Promise<void>;
|
|
795
|
+
/**
|
|
796
|
+
* Restores one archived template in local storage.
|
|
428
797
|
*
|
|
429
|
-
* @param
|
|
430
|
-
* @
|
|
798
|
+
* @param {XOTemplateIdentifier} templateIdentifier - Identifier of the template to restore
|
|
799
|
+
* @returns {Promise<void>} - Resolves when restoration completes
|
|
800
|
+
* @throws {@link TemplateNotFoundInStoreError} - If the template is not in the store
|
|
801
|
+
*/
|
|
802
|
+
unarchiveTemplate(templateIdentifier: XOTemplateIdentifier): Promise<void>;
|
|
803
|
+
/**
|
|
804
|
+
* Returns the stored name of this wallet.
|
|
805
|
+
*
|
|
806
|
+
* @returns {Promise<string | undefined>} - Stored wallet name, or undefined when no name has been stored.
|
|
807
|
+
*/
|
|
808
|
+
getWalletName(): Promise<string | undefined>;
|
|
809
|
+
/**
|
|
810
|
+
* Stores the name of this wallet.
|
|
811
|
+
*
|
|
812
|
+
* The name is trimmed before it is stored and replaces any name stored before.
|
|
813
|
+
*
|
|
814
|
+
* @param {string} walletName - Name to store.
|
|
815
|
+
* @returns {Promise<void>} - Resolves when the trimmed name has been stored.
|
|
816
|
+
* @throws {@link WalletNameMissingError} - When the name is empty or contains only whitespace.
|
|
817
|
+
*/
|
|
818
|
+
setWalletName(walletName: string): Promise<void>;
|
|
819
|
+
/**
|
|
820
|
+
* Sets the wallet default policies used for change, receive, and address generation.
|
|
821
|
+
*
|
|
822
|
+
* Each policy is set independently. A policy omitted from `policiesToSet` keeps its stored value,
|
|
823
|
+
* so setting the change policy never clears the receive or address policy.
|
|
824
|
+
* Resolution order is override, then template defaults, then these default policies.
|
|
825
|
+
*
|
|
826
|
+
* @param {WalletDefaultPolicies} policiesToSet - Policies to set, each naming a template that defines that policy in its defaults.
|
|
827
|
+
* @returns {Promise<void>} - Resolves when the provided policies have been stored.
|
|
828
|
+
* @throws {@link TemplateNotFoundInStoreError} - When a policy names a template that is not stored.
|
|
829
|
+
* @throws {@link TemplateDefaultPolicyMissingError} - When a policy names a template whose defaults do not define that policy.
|
|
830
|
+
*/
|
|
831
|
+
setDefaultPolicies(policiesToSet: WalletDefaultPolicies): Promise<void>;
|
|
832
|
+
/**
|
|
833
|
+
* Removes wallet default policies so change, receive, or address generation no longer uses them.
|
|
834
|
+
*
|
|
835
|
+
* Each policy is removed independently. A policy not listed in `policiesToRemove` keeps its stored value.
|
|
836
|
+
* Removing a policy that is not stored changes nothing.
|
|
837
|
+
*
|
|
838
|
+
* @param {Array<keyof WalletDefaultPolicies>} policiesToRemove - Policies to remove, each one of change, receive, or address.
|
|
839
|
+
* @returns {Promise<void>} - Resolves when the listed policies are no longer stored.
|
|
840
|
+
*/
|
|
841
|
+
unsetDefaultPolicies(policiesToRemove: Array<keyof WalletDefaultPolicies>): Promise<void>;
|
|
842
|
+
/**
|
|
843
|
+
* Returns the wallet default policies used for change, receive, and address generation.
|
|
844
|
+
*
|
|
845
|
+
* Each policy is present only when it has been set with {@link Engine.setDefaultPolicies}.
|
|
846
|
+
*
|
|
847
|
+
* @returns {Promise<WalletDefaultPolicies>} - Stored default policies, or an empty object when none are stored.
|
|
848
|
+
*/
|
|
849
|
+
getDefaultPolicies(): Promise<WalletDefaultPolicies>;
|
|
850
|
+
/**
|
|
851
|
+
* Lists the stored templates that can back the given wallet default policy.
|
|
852
|
+
*
|
|
853
|
+
* @param {keyof WalletDefaultPolicies} policy - Default policy being chosen, one of change, receive, or address.
|
|
854
|
+
* @returns {Promise<DefaultPolicyTemplate[]>} - Matching templates with their storage identifiers.
|
|
855
|
+
*/
|
|
856
|
+
listTemplatesForDefaultPolicy(policy: keyof WalletDefaultPolicies): Promise<DefaultPolicyTemplate[]>;
|
|
857
|
+
/**
|
|
858
|
+
* Lists the variables a caller must provide to create a locking bytecode from a wallet default policy.
|
|
859
|
+
*
|
|
860
|
+
* These are the variables the policy template's defaults intent marks with a null value, plus any the generated
|
|
861
|
+
* locking script needs that the template constants and intent presets do not supply.
|
|
862
|
+
* Pass their values to {@link Engine.generateLockingBytecodeFromDefaultPolicy}.
|
|
863
|
+
*
|
|
864
|
+
* @param {keyof WalletDefaultPolicies} policy - Default policy to inspect, one of change, receive, or address.
|
|
865
|
+
* @returns {Promise<XOTemplateVariableIdentifier[]>} - Required variable identifiers, empty when nothing needs to be provided.
|
|
866
|
+
* @throws {@link TemplateNotFoundInStoreError} - When the policy template or the intent target template is not stored.
|
|
867
|
+
* @throws {@link DefaultPolicyNotSetError} - When the policy is not set.
|
|
868
|
+
* @throws {@link TemplateDefaultPolicyMissingError} - When its template does not define it.
|
|
869
|
+
*/
|
|
870
|
+
listDefaultPolicyRequiredVariables(policy: keyof WalletDefaultPolicies): Promise<XOTemplateVariableIdentifier[]>;
|
|
871
|
+
/**
|
|
872
|
+
* Generates a locking bytecode from a wallet default policy.
|
|
873
|
+
*
|
|
874
|
+
* The stored policy names a template, and that template's defaults intent says which output or locking script,
|
|
875
|
+
* role, and secrets to use. Every variable from {@link Engine.listDefaultPolicyRequiredVariables} must be in
|
|
876
|
+
* `variableValues`, otherwise nothing is generated and no derivation index is used.
|
|
877
|
+
*
|
|
878
|
+
* @param {keyof WalletDefaultPolicies} policy - Default policy to create from, one of change, receive, or address.
|
|
879
|
+
* @param {Record<XOTemplateVariableIdentifier, XOInvitationVariableValue>} [variableValues] - Values for the variables the intent requires,
|
|
880
|
+
* empty when none are passed.
|
|
881
|
+
* @param {XOInvitationIdentifier} [invitationIdentifier] - Invitation the locking bytecode is built for. Keys this account already
|
|
882
|
+
* generated for it under the policy template are used instead of new ones.
|
|
883
|
+
* @returns {Promise<string>} - The generated locking bytecode as a hexadecimal string.
|
|
884
|
+
* @throws {@link TemplateNotFoundInStoreError} - When the policy template or the intent target template is not stored.
|
|
885
|
+
* @throws {@link DefaultPolicyNotSetError} - When the policy is not set.
|
|
886
|
+
* @throws {@link TemplateDefaultPolicyMissingError} - When its template does not define it.
|
|
887
|
+
* @throws {@link IntentVariablesMissingError} - When a required variable value is missing.
|
|
888
|
+
* @throws {@link LockingBytecodeGenerationFailedError} - When Libauth compilation fails.
|
|
889
|
+
* @throws {@link InvitationNotFoundInStoreError} - When an invitation is given and it is not stored.
|
|
890
|
+
* @throws {@link SecretDataNotFoundError} - When a secret recorded for that invitation is not in the secret store.
|
|
891
|
+
*/
|
|
892
|
+
generateLockingBytecodeFromDefaultPolicy(policy: keyof WalletDefaultPolicies, variableValues?: Record<XOTemplateVariableIdentifier, XOInvitationVariableValue>, invitationIdentifier?: XOInvitationIdentifier): Promise<string>;
|
|
893
|
+
/**
|
|
894
|
+
* Permanently deletes the full local account database for this engine instance.
|
|
895
|
+
*
|
|
896
|
+
* @returns {Promise<void>} - Resolves when the local database is deleted.
|
|
897
|
+
* @throws {Error} - If shutdown or deletion fails.
|
|
898
|
+
* @warning This permanently deletes templates, invitations, script hashes, unspent outputs, and events.
|
|
899
|
+
* Use this only when the developer fully understands the data loss impact.
|
|
900
|
+
*/
|
|
901
|
+
DANGEROUS_deleteAccountDatabase(): Promise<void>;
|
|
902
|
+
/**
|
|
903
|
+
* Retrieves an invitation by its identifier from the state.
|
|
904
|
+
*
|
|
905
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - Invitation identifier.
|
|
906
|
+
* @returns {Promise<StoredInvitation | undefined>} - The invitation, or undefined when it is not stored.
|
|
907
|
+
*/
|
|
908
|
+
getInvitation(invitationIdentifier: XOInvitationIdentifier): Promise<StoredInvitation | undefined>;
|
|
909
|
+
/**
|
|
910
|
+
* Lists invitations for this account.
|
|
911
|
+
*
|
|
912
|
+
* @param {StorageListOptions} [options] - Optional list options such as archive filter.
|
|
913
|
+
* @returns {Promise<StoredInvitation[]>} - Invitations for this account.
|
|
914
|
+
*/
|
|
915
|
+
listInvitations(options?: StorageListOptions): Promise<StoredInvitation[]>;
|
|
916
|
+
/**
|
|
917
|
+
* Archives one stored invitation in local storage.
|
|
918
|
+
*
|
|
919
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - Identifier of the invitation to archive
|
|
920
|
+
* @returns {Promise<void>} - Resolves when the invitation is archived and its reservations are cleared
|
|
921
|
+
* @throws {@link InvitationNotFoundInStoreError} - If the invitation is not in the store
|
|
922
|
+
* @warning This archives local invitation history for the identifier.
|
|
923
|
+
*/
|
|
924
|
+
archiveInvitation(invitationIdentifier: XOInvitationIdentifier): Promise<void>;
|
|
925
|
+
/**
|
|
926
|
+
* Restores one archived invitation in local storage.
|
|
927
|
+
*
|
|
928
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - Identifier of the invitation to restore
|
|
929
|
+
* @returns {Promise<void>} - Resolves when restoration completes
|
|
930
|
+
* @throws {@link InvitationNotFoundInStoreError} - If the invitation is not in the store
|
|
931
|
+
*/
|
|
932
|
+
unarchiveInvitation(invitationIdentifier: XOInvitationIdentifier): Promise<void>;
|
|
933
|
+
/**
|
|
934
|
+
* Creates an invitation that can be shared with other entities, user, application, etc.
|
|
935
|
+
* Invitation is the fundamental communication unit in XO, all the interactions done using the
|
|
936
|
+
* xo template are done using invitations.
|
|
937
|
+
*
|
|
938
|
+
* @param {InvitationCreationParameters} params - The parameters for invitation creation.
|
|
939
|
+
* @param {XOTemplateIdentifier} params.templateIdentifier - Identifier for the template to use.
|
|
940
|
+
* @param {XOTemplateActionIdentifier} params.actionIdentifier - Identifier for the action to initiate.
|
|
941
|
+
* @param {XOTemplateRoleIdentifier} [params.roleIdentifier] - Role this account takes in the action, when no intent names it.
|
|
942
|
+
* @param {XOTemplateActionIntent} [params.intent] - Intent this account acted on. Its role is the role taken, and its generate list
|
|
943
|
+
* is generated together with the action role's, one key per variable.
|
|
944
|
+
* @returns {Promise<StoredInvitation>} - The constructed invitation as stored, including this account's entity identifier.
|
|
945
|
+
* @throws {@link TemplateNotFoundInStoreError} - If the template is not found.
|
|
946
|
+
* @throws {@link TemplateActionNotFoundError} - If the action is not found.
|
|
947
|
+
* @throws {@link InvitationIntentMismatchError} - If the intent names another template or action.
|
|
948
|
+
* @throws {@link InvitationRoleDuplicatedError} - If the role is given both directly and on the intent.
|
|
949
|
+
* @throws {@link TemplateActionRoleNotFoundError} - If the action does not define the role.
|
|
950
|
+
* @throws {@link TemplateGeneratedVariableTypeUnsupportedError} - If a variable to generate is not a private key.
|
|
951
|
+
* @throws {@link UnspentOutputReservationExternalConflictError} - If a local outpoint is already reserved by another invitation.
|
|
952
|
+
* @throws {@link UnspentOutputReservationInternalConflictError} - If a local outpoint is already reserved by this invitation.
|
|
953
|
+
*
|
|
954
|
+
* @throws {@link SecretDataNotFoundError} - If a script hash of this account lists a secret that is not stored.
|
|
955
|
+
* @throws {@link EntityMultipleRolesWithFollowUpUnsupportedError} - If the first commit gives this account more than one role with a follow up.
|
|
956
|
+
*/
|
|
957
|
+
createInvitation(params: InvitationCreationParameters): Promise<StoredInvitation>;
|
|
958
|
+
/**
|
|
959
|
+
* Accepts an invitation, an entity accepts an invitation and becomes part of the invitation.
|
|
960
|
+
*
|
|
961
|
+
* @param {XOInvitation} invitation - The invitation to be accepted.
|
|
962
|
+
* @param {InvitationAcceptanceParameters} params - Optional parameters for accepting the invitation, including the role or intent
|
|
963
|
+
* this account acts on.
|
|
964
|
+
* @returns {Promise<StoredInvitation>} - The accepted invitation as stored, including this account's entity identifier.
|
|
965
|
+
* @throws {@link InvitationInvalidError} - If the invitation does not match the XOInvitation type.
|
|
966
|
+
* @throws {@link TemplateNotFoundInStoreError} - If the template is not found.
|
|
967
|
+
* @throws {@link TemplateActionNotFoundError} - If the action is not found.
|
|
968
|
+
* @throws {@link InvitationIntentMismatchError} - If the intent names another template or another action than the invitation.
|
|
969
|
+
* @throws {@link InvitationRoleDuplicatedError} - If the role is given both directly and on the intent.
|
|
970
|
+
* @throws {@link TemplateActionRoleNotFoundError} - If the action does not define the role.
|
|
971
|
+
* @throws {@link TemplateGeneratedVariableTypeUnsupportedError} - If a variable to generate is not a private key.
|
|
972
|
+
* @throws {@link InvitationValidationFailedError} - If invitation validation fails once implemented.
|
|
973
|
+
* @throws {@link InvitationItemFieldConflictError} - If a received commit changes a value an earlier commit set.
|
|
974
|
+
* @throws {@link RoleVariableEntityMismatchError} - If a commit provides a variable of a role its entity does not hold.
|
|
975
|
+
* @throws {@link EntityMultipleRolesWithFollowUpUnsupportedError} - If a commit gives an entity more than one role with a follow up.
|
|
976
|
+
* @throws {@link SecretDataNotFoundError} - If a script hash of this account lists a secret that is not stored.
|
|
977
|
+
*/
|
|
978
|
+
acceptInvitation(invitation: XOInvitation, params?: InvitationAcceptanceParameters): Promise<StoredInvitation>;
|
|
979
|
+
/**
|
|
980
|
+
* Joins an invitation this account already takes part in with another role.
|
|
981
|
+
*
|
|
982
|
+
* The role must still have a free slot, and the keys it asks for are generated with the commit that names it.
|
|
983
|
+
*
|
|
984
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - Invitation to join with the role.
|
|
985
|
+
* @param {XOTemplateRoleIdentifier} roleIdentifier - Role to take.
|
|
986
|
+
* @returns {Promise<StoredInvitation>} - The invitation as stored after the commit that names the role.
|
|
987
|
+
* @throws {@link InvitationNotFoundInStoreError} - If the invitation is not stored.
|
|
988
|
+
* @throws {@link InvitationRoleUnavailableError} - If the role has no free slot left.
|
|
989
|
+
* @throws {@link TemplateActionRoleNotFoundError} - If the action does not define the role.
|
|
990
|
+
* @throws {@link EntityMultipleRolesWithFollowUpUnsupportedError} - If the role would give this account more than one role with a follow up.
|
|
991
|
+
* @throws {@link TemplateNotFoundInStoreError} - If the template is not found.
|
|
992
|
+
* @throws {@link TemplateActionNotFoundError} - If the action is not found.
|
|
993
|
+
* @throws {@link TemplateGeneratedVariableTypeUnsupportedError} - If a variable to generate is not a private key.
|
|
994
|
+
*/
|
|
995
|
+
joinInvitationRole(invitationIdentifier: XOInvitationIdentifier, roleIdentifier: XOTemplateRoleIdentifier): Promise<StoredInvitation>;
|
|
996
|
+
/**
|
|
997
|
+
* Updates the stored invitation with a newer version received from an external participant or through some subscription.
|
|
998
|
+
* The updated invitation should have the shared history with the stored invitation, and the invitation must already be stored.
|
|
999
|
+
*
|
|
1000
|
+
* An output another participant added that locks to one of this account's scripts is stored and tracked like a script
|
|
1001
|
+
* this account built, so its funds are seen and it can be unlocked later.
|
|
1002
|
+
*
|
|
1003
|
+
* @param {XOInvitation} updatedInvitation - Shared invitation to store. The local entity identifier and archive fields keep their stored values.
|
|
1004
|
+
* @returns {Promise<StoredInvitation>} - The updated invitation as stored, including the local entity identifier when present.
|
|
1005
|
+
* @throws {@link InvitationInvalidError} - If the updated invitation does not match the XOInvitation type.
|
|
1006
|
+
* @throws {@link InvitationNotFoundInStoreError} - If the invitation is not already in the store.
|
|
1007
|
+
* @throws {@link TemplateNotFoundInStoreError} - If the template is not found.
|
|
1008
|
+
* @throws {@link InvitationValidationFailedError} - If the updated invitation fails validation.
|
|
1009
|
+
* @throws {@link InvitationHistoryConflictError} - If a stored commit is missing, reordered, or has a
|
|
1010
|
+
* different identifier or signature at its expected position in the updated invitation.
|
|
1011
|
+
* @throws {@link InvitationItemFieldConflictError} - If a commit changes a value an earlier commit set.
|
|
1012
|
+
* @throws {@link RoleVariableEntityMismatchError} - If a commit provides a variable of a role its entity does not hold.
|
|
1013
|
+
* @throws {@link EntityMultipleRolesWithFollowUpUnsupportedError} - If a commit gives an entity more than one role with a follow up.
|
|
1014
|
+
*/
|
|
1015
|
+
updateInvitation(updatedInvitation: XOInvitation): Promise<StoredInvitation>;
|
|
1016
|
+
/**
|
|
1017
|
+
* Appends the invitation with the new information.
|
|
1018
|
+
*
|
|
1019
|
+
* @param {string} invitationIdentifier - The identifier of the invitation to append. The invitation must already exist in the store.
|
|
1020
|
+
* @param {InvitationParameters} params - The parameters to append the invitation with.
|
|
1021
|
+
* @returns {Promise<StoredInvitation>} - The appended invitation as stored, including the local entity identifier.
|
|
1022
|
+
* @throws {@link InvitationNotFoundInStoreError} - If the invitation is not found in the store.
|
|
1023
|
+
* @throws {@link AppendInvitationParametersEmptyError} - When every appendable field is omitted.
|
|
1024
|
+
* @throws {@link UnspentOutputReservationExternalConflictError} - If a local outpoint is already reserved by another invitation.
|
|
1025
|
+
* @throws {@link UnspentOutputReservationInternalConflictError} - If this invitation already reserves or spends the outpoint.
|
|
1026
|
+
* @throws {@link TemplateOutputNotFoundError} - If an output names a template output the template does not define.
|
|
1027
|
+
* @throws {@link TemplateLockingScriptRoleNotFoundError} - If an output names a role its locking script does not define.
|
|
1028
|
+
* @throws {@link LockingBytecodeGenerationFailedError} - If the locking bytecode of an output that names only a template output cannot be
|
|
1029
|
+
* compiled.
|
|
1030
|
+
* @throws {@link LockingScriptSecretsNotFoundError} - If such an output's locking script uses secrets this account has not generated for the
|
|
1031
|
+
* invitation.
|
|
1032
|
+
* @throws {@link LockingScriptResolutionsMissingError} - If such an output's locking script needs values the invitation does not hold yet.
|
|
1033
|
+
* Use {@link Engine.listOutputResolutions} to see them and {@link Engine.appendOwnOutputResolutions} to add this account's part.
|
|
1034
|
+
* @throws {@link SecretDataNotFoundError} - If a secret recorded for this invitation is not in the secret store.
|
|
1035
|
+
*/
|
|
1036
|
+
appendInvitation(invitationIdentifier: XOInvitationIdentifier, params: InvitationParameters): Promise<StoredInvitation>;
|
|
1037
|
+
/**
|
|
1038
|
+
* Resolves the locking bytecode an invitation output compiles to, without generating or storing anything.
|
|
1039
|
+
*
|
|
1040
|
+
* The locking script compiles with the template constants, the invitation variables, and the keys this account already
|
|
1041
|
+
* generated for the invitation, which is what {@link Engine.appendInvitation} uses when the output is added. The script's
|
|
1042
|
+
* secrets are existing secrets and are never generated for it, so a secret the invitation does not hold fails the
|
|
1043
|
+
* resolution the same way adding the output would.
|
|
1044
|
+
*
|
|
1045
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - Invitation the output belongs to.
|
|
1046
|
+
* @param {XOTemplateOutputIdentifier} outputIdentifier - Template output to resolve.
|
|
1047
|
+
* @param {XOTemplateRoleIdentifier} [roleIdentifier] - Role on the output, when one is set.
|
|
1048
|
+
* @returns {Promise<string>} - The locking bytecode as a hexadecimal string.
|
|
1049
|
+
* @throws {@link InvitationNotFoundInStoreError} - If the invitation is not found in the store.
|
|
1050
|
+
* @throws {@link TemplateOutputNotFoundError} - If the template does not define the output.
|
|
1051
|
+
* @throws {@link TemplateLockingScriptRoleNotFoundError} - If the role is not defined on the output's locking script.
|
|
1052
|
+
* @throws {@link LockingScriptSecretsNotFoundError} - If the locking script uses secrets this account has not generated for the invitation.
|
|
1053
|
+
* @throws {@link LockingBytecodeGenerationFailedError} - If the locking bytecode cannot be compiled.
|
|
1054
|
+
* @throws {@link SecretDataNotFoundError} - If a secret recorded for this invitation is not in the secret store.
|
|
1055
|
+
* @throws {@link CashAssemblyCompilationFailedError} - If the output locking script is a CashAssembly expression that cannot be compiled.
|
|
1056
|
+
* @throws {@link LockingScriptCompilationFailedError} - If the template locking script the output names cannot be compiled.
|
|
1057
|
+
* @throws {@link LockingScriptResolutionsMissingError} - If the script uses key operations other participants have not resolved yet.
|
|
1058
|
+
*/
|
|
1059
|
+
resolveInvitationOutputLockingBytecode(invitationIdentifier: XOInvitationIdentifier, outputIdentifier: XOTemplateOutputIdentifier, roleIdentifier?: XOTemplateRoleIdentifier): Promise<string>;
|
|
1060
|
+
/**
|
|
1061
|
+
* Lists the key operations an invitation output's locking script needs from participants, without adding anything.
|
|
1062
|
+
*
|
|
1063
|
+
* Each operation is reported as provided when the invitation holds it, as this account's own when only this account's
|
|
1064
|
+
* keys resolve it, or as missing when another participant holds the key. The output can be added once nothing is
|
|
1065
|
+
* this account's own or missing.
|
|
1066
|
+
*
|
|
1067
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - Invitation the output belongs to.
|
|
1068
|
+
* @param {XOTemplateOutputIdentifier} outputIdentifier - Template output to check.
|
|
1069
|
+
* @param {XOTemplateRoleIdentifier} [roleIdentifier] - Role on the output, when one is set.
|
|
1070
|
+
* @returns {Promise<InvitationResolutionRequirements>} - Provided identifiers, values this account can add, and identifiers others still owe.
|
|
1071
|
+
* @throws {@link InvitationNotFoundInStoreError} - If the invitation is not found in the store.
|
|
1072
|
+
* @throws {@link TemplateOutputNotFoundError} - If the template does not define the output.
|
|
1073
|
+
* @throws {@link TemplateLockingScriptRoleNotFoundError} - If the role is not defined on the output's locking script.
|
|
1074
|
+
* @throws {@link LockingScriptSecretsNotFoundError} - If the locking script uses secrets this account has not generated for the invitation.
|
|
1075
|
+
* @throws {@link LockingBytecodeGenerationFailedError} - If the locking script fails to compile for a reason other than a missing identifier.
|
|
1076
|
+
* @throws {@link SecretDataNotFoundError} - If a secret recorded for this invitation is not in the secret store.
|
|
1077
|
+
*/
|
|
1078
|
+
listOutputResolutions(invitationIdentifier: XOInvitationIdentifier, outputIdentifier: XOTemplateOutputIdentifier, roleIdentifier?: XOTemplateRoleIdentifier): Promise<InvitationResolutionRequirements>;
|
|
1079
|
+
/**
|
|
1080
|
+
* Adds the key operations this account resolved for an invitation output to the invitation, so other participants can
|
|
1081
|
+
* compile the same locking script.
|
|
1082
|
+
*
|
|
1083
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - Invitation the output belongs to.
|
|
1084
|
+
* @param {XOTemplateOutputIdentifier} outputIdentifier - Template output whose locking script the values are for.
|
|
1085
|
+
* @param {XOTemplateRoleIdentifier} [roleIdentifier] - Role on the output, when one is set.
|
|
1086
|
+
* @returns {Promise<StoredInvitation>} - The invitation as stored after the commit with the values.
|
|
1087
|
+
* @throws {@link OutputOwnResolutionsNotFoundError} - If this account resolved nothing the invitation does not already hold.
|
|
1088
|
+
* @throws {@link InvitationNotFoundInStoreError} - If the invitation is not found in the store.
|
|
1089
|
+
* @throws {@link TemplateOutputNotFoundError} - If the template does not define the output.
|
|
1090
|
+
* @throws {@link TemplateLockingScriptRoleNotFoundError} - If the role is not defined on the output's locking script.
|
|
1091
|
+
* @throws {@link LockingScriptSecretsNotFoundError} - If the locking script uses secrets this account has not generated for the invitation.
|
|
1092
|
+
* @throws {@link LockingBytecodeGenerationFailedError} - If the locking script fails to compile for a reason other than a missing identifier.
|
|
1093
|
+
* @throws {@link SecretDataNotFoundError} - If a secret recorded for this invitation is not in the secret store.
|
|
1094
|
+
*/
|
|
1095
|
+
appendOwnOutputResolutions(invitationIdentifier: XOInvitationIdentifier, outputIdentifier: XOTemplateOutputIdentifier, roleIdentifier?: XOTemplateRoleIdentifier): Promise<StoredInvitation>;
|
|
1096
|
+
/**
|
|
1097
|
+
* Lists the key operations an invitation input's unlocking script needs from participants, without signing or adding anything.
|
|
1098
|
+
*
|
|
1099
|
+
* Each operation is reported as provided when the invitation or the input holds it, as this account's own when only
|
|
1100
|
+
* this account's keys resolve it, such as its signature, or as missing when another participant holds the key. The
|
|
1101
|
+
* input can be signed with {@link Engine.signInvitation} once nothing is this account's own or missing.
|
|
1102
|
+
*
|
|
1103
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - Invitation the input belongs to.
|
|
1104
|
+
* @param {number} inputIndex - Index of the merged input.
|
|
1105
|
+
* @returns {Promise<InvitationResolutionRequirements>} - Provided identifiers, values this account can add, and identifiers others still owe.
|
|
1106
|
+
* @throws {@link InvitationNotFoundInStoreError} - If the invitation is not found in the store.
|
|
1107
|
+
* @throws {@link MergedInputOutpointMissingError} - When the merged input has no outpoint.
|
|
1108
|
+
* @throws {@link InputUnspentOutputUnavailableError} - When the spent output is not tracked by this account or is reserved by another invitation.
|
|
1109
|
+
* @throws {@link ScriptHashDataNotFoundError} - When the spent output has no stored script hash.
|
|
1110
|
+
* @throws {@link TemplateUnlockingScriptNotFoundError} - When neither the template input nor the locking script names an unlocking script.
|
|
1111
|
+
* @throws {@link UnlockingBytecodeGenerationFailedError} - When the unlocking script fails to compile for a reason other than a missing
|
|
1112
|
+
* identifier.
|
|
1113
|
+
*/
|
|
1114
|
+
listInputResolutions(invitationIdentifier: XOInvitationIdentifier, inputIndex: number): Promise<InvitationResolutionRequirements>;
|
|
1115
|
+
/**
|
|
1116
|
+
* Adds the key operations this account resolved for an invitation input, such as its signature, to that input, so the
|
|
1117
|
+
* participant holding the remaining keys can complete the unlocking bytecode.
|
|
1118
|
+
*
|
|
1119
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - Invitation the input belongs to.
|
|
1120
|
+
* @param {number} inputIndex - Index of the merged input.
|
|
1121
|
+
* @returns {Promise<StoredInvitation>} - The invitation as stored after the commit with the values.
|
|
1122
|
+
* @throws {@link InputOwnResolutionsNotFoundError} - If this account resolved nothing the invitation does not already hold.
|
|
1123
|
+
* @throws {@link InvitationNotFoundInStoreError} - If the invitation is not found in the store.
|
|
1124
|
+
* @throws {@link MergedInputCommitNotFoundError} - When the input has no merged leaf to extend.
|
|
1125
|
+
* @throws {@link MergedInputOutpointMissingError} - When the merged input has no outpoint.
|
|
1126
|
+
* @throws {@link InputUnspentOutputUnavailableError} - When the spent output is not tracked by this account or is reserved by another invitation.
|
|
1127
|
+
* @throws {@link UnlockingBytecodeGenerationFailedError} - When the unlocking script fails to compile for a reason other than a missing
|
|
1128
|
+
* identifier.
|
|
1129
|
+
*/
|
|
1130
|
+
appendOwnInputResolutions(invitationIdentifier: XOInvitationIdentifier, inputIndex: number): Promise<StoredInvitation>;
|
|
1131
|
+
/**
|
|
1132
|
+
* Signs one input of the invitation with this account's keys and appends a commit that holds its unlocking bytecode.
|
|
1133
|
+
*
|
|
1134
|
+
* An unlocking script that needs values other entities hold, such as their signatures, is only signed once the invitation
|
|
1135
|
+
* holds them. Use {@link Engine.listInputResolutions} to see what the input still needs, and
|
|
1136
|
+
* {@link Engine.appendOwnInputResolutions} to add this account's part.
|
|
1137
|
+
*
|
|
1138
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - The identifier of the invitation to sign.
|
|
1139
|
+
* The invitation must already exist in the store.
|
|
1140
|
+
* @param {number} inputIndex - Index of the merged input to sign.
|
|
1141
|
+
* @returns {Promise<StoredInvitation>} - The invitation as stored after the unlocking commit is appended.
|
|
1142
|
+
* @throws {@link InvitationNotFoundInStoreError} - If the invitation is not found in the store.
|
|
1143
|
+
* @throws {@link MergedInputCommitNotFoundError} - When the compiled input has no merged leaf to extend.
|
|
1144
|
+
* @throws {@link MergedInputOutpointMissingError} - When the merged input has no outpoint.
|
|
1145
|
+
* @throws {@link InputUnspentOutputUnavailableError} - When the spent output is not tracked by this account or is reserved by another invitation.
|
|
1146
|
+
* @throws {@link UnlockingScriptResolutionsMissingError} - When the unlocking script needs values the invitation does not hold yet.
|
|
1147
|
+
* @throws {@link UnlockingCompilationContextMissingError} - When the unlocking compilation carries no context to verify against.
|
|
1148
|
+
* @throws {@link UnlockingBytecodeVerificationFailedError} - When the unlocking bytecode built with other entities' values fails.
|
|
1149
|
+
*/
|
|
1150
|
+
signInvitation(invitationIdentifier: XOInvitationIdentifier, inputIndex: number): Promise<StoredInvitation>;
|
|
1151
|
+
/**
|
|
1152
|
+
* Builds the encoded transaction for an invitation without broadcasting or persisting a hash.
|
|
1153
|
+
*
|
|
1154
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - Stored invitation to encode.
|
|
1155
|
+
* @returns {Promise<BuiltInvitationTransaction>} - Transaction hex and size metadata.
|
|
1156
|
+
* @throws {@link InvitationNotFoundInStoreError} - When the invitation is missing.
|
|
1157
|
+
* @throws {@link TemplateNotFoundInStoreError} - When the template is missing.
|
|
1158
|
+
* @throws {@link TemplateActionTransactionNotFoundError} - When the action has no transaction definition.
|
|
1159
|
+
* @throws {@link TransactionGenerationFailedError} - When libauth cannot build the transaction.
|
|
1160
|
+
*/
|
|
1161
|
+
buildInvitationTransactionFromMergedCommit(invitationIdentifier: XOInvitationIdentifier): Promise<BuiltInvitationTransaction>;
|
|
1162
|
+
/**
|
|
1163
|
+
* Executes an action for a given invitation.
|
|
1164
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - The identifier of the invitation whose action to execute.
|
|
1165
|
+
* The invitation must already exist in the store.
|
|
1166
|
+
* @param {ExecuteActionParameters} params - Parameters for executing the action.
|
|
1167
|
+
* @returns {Promise<ExecuteActionResult>} - Encoded transaction metadata and the persisted invitation.
|
|
1168
|
+
* @throws {@link InvitationNotFoundInStoreError} - If the invitation is not found in the store.
|
|
1169
|
+
* @throws {@link TemplateNotFoundInStoreError} - If the invitation's template is not found in the store.
|
|
1170
|
+
* @throws {@link TransactionResultAlreadyExistsError} - If a different transaction was already recorded for the action.
|
|
1171
|
+
* @throws {@link TransactionBroadcastFailedError} - If the network rejects the transaction.
|
|
1172
|
+
* @throws {@link TransactionResultNotFoundError} - If the created result is missing when the broadcast is recorded.
|
|
1173
|
+
*/
|
|
1174
|
+
executeAction(invitationIdentifier: XOInvitationIdentifier, params: ExecuteActionParameters): Promise<ExecuteActionResult>;
|
|
1175
|
+
/**
|
|
1176
|
+
* Lists available roles for the given invitation.
|
|
1177
|
+
*
|
|
1178
|
+
* @param {XOInvitation} invitation - The invitation to examine.
|
|
1179
|
+
* @returns {Promise<XOTemplateRoleIdentifier[]>} - The list of roles that still require data.
|
|
1180
|
+
* @throws {@link TemplateNotFoundInStoreError} - If the template is not found.
|
|
1181
|
+
* @throws {@link TemplateActionNotFoundError} - If the action is not found.
|
|
1182
|
+
*/
|
|
1183
|
+
listAvailableRoles(invitation: XOInvitation): Promise<string[]>;
|
|
1184
|
+
/**
|
|
1185
|
+
* Lists requirements for the provided invitation.
|
|
1186
|
+
*
|
|
1187
|
+
* @param {XOInvitation} invitation - The invitation to analyze requirements for.
|
|
1188
|
+
* @throws {@link TemplateNotFoundInStoreError} - When the template is not in the store.
|
|
1189
|
+
* @throws {@link TemplateActionNotFoundError} - When the action is not on the template.
|
|
1190
|
+
* @returns {Promise<InvitationRequirementIdentifierLists>} - The requirements information.
|
|
1191
|
+
*/
|
|
1192
|
+
listRequirements(invitation: XOInvitation): Promise<InvitationRequirementIdentifierLists>;
|
|
1193
|
+
/**
|
|
1194
|
+
* Lists all missing requirements for the provided invitation. They fall in two categories, which are
|
|
1195
|
+
* requirements expected by the template but not yet provided in any commit, and inputs
|
|
1196
|
+
* already committed with a real UTXO outpoint that are still missing their unlocking bytecode.
|
|
1197
|
+
*
|
|
1198
|
+
* @param {string} invitationIdentifier - The identifier of the invitation to analyze. The invitation must exist in the store.
|
|
1199
|
+
* @returns {Promise<InvitationMissingRequirements>} - Both the template-level gaps and the unsigned input gaps.
|
|
1200
|
+
* @throws {@link InvitationNotFoundInStoreError} - If the invitation is not found in the store.
|
|
1201
|
+
* @throws {@link TemplateNotFoundInStoreError} - If the template is not found in the store.
|
|
1202
|
+
* @throws {@link TemplateActionNotFoundError} - When the action is not on the template.
|
|
1203
|
+
*/
|
|
1204
|
+
listMissingRequirements(invitationIdentifier: XOInvitationIdentifier): Promise<InvitationMissingRequirements>;
|
|
1205
|
+
/**
|
|
1206
|
+
* Returns all commits in the invitation that were made by the current entity.
|
|
1207
|
+
*
|
|
1208
|
+
* @param {string} invitationIdentifier - The identifier of the invitation to examine.
|
|
1209
|
+
* @returns {Promise<XOInvitationCommit[]>} - Commits belonging to this engine's entity, in order.
|
|
1210
|
+
* @throws {@link InvitationNotFoundInStoreError} - If the invitation is not found in the store.
|
|
1211
|
+
*/
|
|
1212
|
+
listOwnCommits(invitationIdentifier: XOInvitationIdentifier): Promise<XOInvitationCommit[]>;
|
|
1213
|
+
/**
|
|
1214
|
+
* Finds all the inputs that are reserved by the current entity.
|
|
1215
|
+
*
|
|
1216
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - The identifier of the invitation to find inputs for.
|
|
1217
|
+
* @throws {@link InvitationNotFoundInStoreError} - When the invitation is not in the store.
|
|
1218
|
+
* @throws {@link TemplateNotFoundInStoreError} - When the template is not in the store.
|
|
1219
|
+
* @returns {Promise<number[]>} - The indexes of the inputs that are reserved by the current entity.
|
|
1220
|
+
*/
|
|
1221
|
+
listOwnInputIndexes(invitationIdentifier: XOInvitationIdentifier): Promise<number[]>;
|
|
1222
|
+
/**
|
|
1223
|
+
* Calculates the change for the invitation.
|
|
1224
|
+
*
|
|
1225
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - The identifier of the invitation to calculate the change for.
|
|
1226
|
+
* @returns {Promise<MergedInvitationChange>} - The calculated change.
|
|
1227
|
+
*/
|
|
1228
|
+
calculateChange(invitationIdentifier: XOInvitationIdentifier): Promise<MergedInvitationChange>;
|
|
1229
|
+
/**
|
|
1230
|
+
* Estimates the transaction fee for the invitation.
|
|
1231
|
+
*
|
|
1232
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - The identifier of the invitation to estimate the transaction fee for.
|
|
1233
|
+
* @throws {@link InvitationNotFoundInStoreError} - When the invitation is not stored.
|
|
1234
|
+
* @throws {@link TemplateNotFoundInStoreError} - When the template is not stored.
|
|
1235
|
+
* @returns {Promise<number>} - The estimated transaction fee.
|
|
1236
|
+
*/
|
|
1237
|
+
estimateTransactionFee(invitationIdentifier: XOInvitationIdentifier): Promise<number>;
|
|
1238
|
+
/**
|
|
1239
|
+
* Adds the change to the invitation.
|
|
1240
|
+
*
|
|
1241
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - The identifier of the invitation to add the change to.
|
|
1242
|
+
* @param {string} [providedLockingBytecode] - Locking bytecode to send the change to, as hex.
|
|
1243
|
+
* @param {Record<XOTemplateVariableIdentifier, XOInvitationVariableValue>} [changeVariableValues] - Values the change intent requires.
|
|
1244
|
+
* @throws {@link InvitationNotFoundInStoreError} - When the invitation is not stored.
|
|
1245
|
+
* @throws {@link TemplateNotFoundInStoreError} - When the template is not stored.
|
|
1246
|
+
* @throws {@link ChangeLockingBytecodeMissingError} - When no locking bytecode is provided, the template defines no change policy, and the
|
|
1247
|
+
* wallet has no default change policy.
|
|
1248
|
+
* @throws {@link TemplateDefaultPolicyMissingError} - When the template of the wallet default change policy does not define change.
|
|
1249
|
+
* @throws {@link TemplateOutputNotFoundError} - When the change intent names an output its target template does not define.
|
|
1250
|
+
* @throws {@link IntentVariablesMissingError} - When a variable the change intent requires has no value.
|
|
1251
|
+
* @returns {Promise<StoredInvitation>} - The invitation as stored after the change output is appended.
|
|
1252
|
+
*/
|
|
1253
|
+
addChangeToInvitation(invitationIdentifier: XOInvitationIdentifier, providedLockingBytecode?: string, changeVariableValues?: Record<XOTemplateVariableIdentifier, XOInvitationVariableValue>): Promise<StoredInvitation>;
|
|
1254
|
+
/**
|
|
1255
|
+
* Lists the unspent outputs this account tracks, each with the confirmation status Electrum last reported.
|
|
1256
|
+
*
|
|
1257
|
+
* @param {UnspentOutputDataQuery} [query] - Template, reservation, script hash, or status to select outputs by.
|
|
1258
|
+
* @param {UnspentOutputDataFilter} [filter] - Reservation and token fields every returned output must match.
|
|
1259
|
+
* @returns {Promise<UnspentOutputData[]>} - Unspent outputs matching the query and filter, or every tracked output when both are omitted.
|
|
1260
|
+
*/
|
|
1261
|
+
listUnspentOutputs(query?: UnspentOutputDataQuery, filter?: UnspentOutputDataFilter): Promise<UnspentOutputData[]>;
|
|
1262
|
+
/**
|
|
1263
|
+
* Lists the unreserved unspent outputs that are free to spend.
|
|
1264
|
+
*
|
|
1265
|
+
* Outputs reserved by an invitation are excluded so the same output is never offered to two invitations.
|
|
1266
|
+
* When {@link ListSpendableUnspentOutputsParameters} are passed, only outputs locked by that template output
|
|
1267
|
+
* and matching every provided token field are returned.
|
|
1268
|
+
*
|
|
1269
|
+
* @param {ListSpendableUnspentOutputsParameters} [options] - Template output and token fields that every returned output must match.
|
|
1270
|
+
* @returns {Promise<UnspentOutputData[]>} - The unreserved unspent outputs that match the provided options.
|
|
1271
|
+
* @throws {@link TemplateNotFoundInStoreError} - When the template in the options is not stored.
|
|
1272
|
+
* @throws {@link TemplateOutputNotFoundError} - When the output in the options is not defined by that template.
|
|
1273
|
+
*/
|
|
1274
|
+
listSpendableUnspentOutputs(options?: ListSpendableUnspentOutputsParameters): Promise<UnspentOutputData[]>;
|
|
1275
|
+
/**
|
|
1276
|
+
* Lists the script hashes of every stored template. By default only the script hashes of un-archived templates are returned.
|
|
1277
|
+
*
|
|
1278
|
+
* @param {StorageListOptions} [options] - Optional list options.
|
|
1279
|
+
* @param {ArchiveFilter} [options.archived] - Filter applied to the templates based on archive state.
|
|
1280
|
+
* @returns {Promise<ScriptHashData[]>} - The script hash data of every matching template.
|
|
1281
|
+
* @throws {@link ArchiveFilterInvalidError} - When the archive filter is not one of the supported filters.
|
|
1282
|
+
*/
|
|
1283
|
+
listScriptHashes(options?: StorageListOptions): Promise<ScriptHashData[]>;
|
|
1284
|
+
/**
|
|
1285
|
+
* Lists script hashes via state indexed storage query.
|
|
1286
|
+
*
|
|
1287
|
+
* Forwards to {@link State.listScriptHashData}. Exactly one of templateIdentifier, scriptHash, or invitationIdentifier.
|
|
1288
|
+
*
|
|
1289
|
+
* @param {ScriptHashDataQuery} query - Storage query accepted by the state package.
|
|
1290
|
+
* @returns {Promise<ScriptHashData[]>} - Matching script hashes from storage.
|
|
1291
|
+
* @throws {@link QueryFieldsLimitExceededError} - When more than one query field is set.
|
|
1292
|
+
* @throws {@link QueryInvalidError} - When no recognized query field is set.
|
|
1293
|
+
*/
|
|
1294
|
+
listScriptHashData(query: ScriptHashDataQuery): Promise<ScriptHashData[]>;
|
|
1295
|
+
/**
|
|
1296
|
+
* Lists every secret this account has generated.
|
|
1297
|
+
*
|
|
1298
|
+
* Each secret holds a derivation index, not a key.
|
|
1299
|
+
*
|
|
1300
|
+
* @returns {Promise<StoredSecretData[]>} - The generated secrets, each with its lookup key, empty when none are stored.
|
|
1301
|
+
*/
|
|
1302
|
+
listSecretData(): Promise<StoredSecretData[]>;
|
|
1303
|
+
/**
|
|
1304
|
+
* Returns the public key of a secret whose value is entropy. If the value is not entropy or the secret
|
|
1305
|
+
* doesn't exist, undefined is returned.
|
|
1306
|
+
*
|
|
1307
|
+
* @param {string} secretLookupKey - Lookup key the secret is stored under.
|
|
1308
|
+
* @returns {Promise<string | undefined>} - The compressed public key as hex, or undefined when the secret holds no entropy.
|
|
1309
|
+
*/
|
|
1310
|
+
getSecretPublicKey(secretLookupKey: string): Promise<string | undefined>;
|
|
1311
|
+
/**
|
|
1312
|
+
* Lists the secrets stored for a script hash, in the order the script hash lists them.
|
|
1313
|
+
*
|
|
1314
|
+
* Stored script hash data keeps only the lookup key of each secret, so each secret is read by its lookup key.
|
|
1315
|
+
*
|
|
1316
|
+
* @param {string} scriptHash - Script hash of a stored locking script.
|
|
1317
|
+
* @returns {Promise<SecretData[]>} - The secrets for the script hash, empty when it lists none.
|
|
1318
|
+
* @throws {@link ScriptHashDataNotFoundError} - When the script hash is not stored.
|
|
1319
|
+
* @throws {@link SecretDataNotFoundError} - When the script hash lists a lookup key that has no stored secret.
|
|
1320
|
+
*/
|
|
1321
|
+
listSecretsForScriptHash(scriptHash: string): Promise<SecretData[]>;
|
|
1322
|
+
/**
|
|
1323
|
+
* Compiles unlocking bytecode for one merged input without appending it to the invitation.
|
|
1324
|
+
*
|
|
1325
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - Invitation that owns the input.
|
|
1326
|
+
* @param {number} inputIndex - Index of the merged input to unlock.
|
|
1327
|
+
* @returns {Promise<GeneratedInputUnlockingBytecode>} - Unlocking bytecode for that input.
|
|
1328
|
+
* @throws {@link InvitationNotFoundInStoreError} - When the invitation is absent from the store.
|
|
1329
|
+
* @throws {@link MergedInputOutpointMissingError} - When the merged input has no outpoint.
|
|
1330
|
+
* @throws {@link InputUnspentOutputUnavailableError} - When the spent output is not tracked by this account or is reserved by another invitation.
|
|
1331
|
+
* @throws {@link ScriptHashDataNotFoundError} - When the reserved output has no stored script hash.
|
|
1332
|
+
* @throws {@link UnlockingBytecodeGenerationFailedError} - When Libauth compilation fails.
|
|
1333
|
+
* @throws {@link TemplateNotFoundInStoreError} - When the template is absent from the store.
|
|
1334
|
+
*/
|
|
1335
|
+
generateUnlockingBytecode(invitationIdentifier: XOInvitationIdentifier, inputIndex: number): Promise<GeneratedInputUnlockingBytecode>;
|
|
1336
|
+
}
|
|
1337
|
+
//#endregion
|
|
1338
|
+
//#region source/errors/template.d.ts
|
|
1339
|
+
/**
|
|
1340
|
+
* Thrown when an action identifier is absent from the template.
|
|
1341
|
+
*
|
|
1342
|
+
* @group Errors
|
|
1343
|
+
*/
|
|
1344
|
+
declare class TemplateActionNotFoundError extends Error {
|
|
1345
|
+
/**
|
|
1346
|
+
* Template whose action is missing.
|
|
1347
|
+
*/
|
|
1348
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
1349
|
+
/**
|
|
1350
|
+
* Action identifier that is missing.
|
|
1351
|
+
*/
|
|
1352
|
+
readonly actionIdentifier: XOTemplateActionIdentifier;
|
|
1353
|
+
constructor(templateIdentifier: XOTemplateIdentifier, actionIdentifier: XOTemplateActionIdentifier);
|
|
1354
|
+
}
|
|
1355
|
+
/**
|
|
1356
|
+
* Thrown when an output identifier is absent from the template.
|
|
1357
|
+
*
|
|
1358
|
+
* @group Errors
|
|
1359
|
+
*/
|
|
1360
|
+
declare class TemplateOutputNotFoundError extends Error {
|
|
1361
|
+
/**
|
|
1362
|
+
* Template whose output is missing.
|
|
1363
|
+
*/
|
|
1364
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
1365
|
+
/**
|
|
1366
|
+
* Output identifier that is missing.
|
|
1367
|
+
*/
|
|
1368
|
+
readonly outputIdentifier: XOTemplateOutputIdentifier;
|
|
1369
|
+
constructor(templateIdentifier: XOTemplateIdentifier, outputIdentifier: XOTemplateOutputIdentifier);
|
|
1370
|
+
}
|
|
1371
|
+
/**
|
|
1372
|
+
* Thrown when a locking script identifier is absent from the template.
|
|
1373
|
+
*
|
|
1374
|
+
* @group Errors
|
|
1375
|
+
*/
|
|
1376
|
+
declare class TemplateLockingScriptNotFoundError extends Error {
|
|
1377
|
+
/**
|
|
1378
|
+
* Template whose locking script is missing.
|
|
1379
|
+
*/
|
|
1380
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
1381
|
+
/**
|
|
1382
|
+
* Locking script identifier that is missing.
|
|
1383
|
+
*/
|
|
1384
|
+
readonly lockingScriptIdentifier: XOTemplateLockingScriptIdentifier;
|
|
1385
|
+
constructor(templateIdentifier: XOTemplateIdentifier, lockingScriptIdentifier: XOTemplateLockingScriptIdentifier);
|
|
1386
|
+
}
|
|
1387
|
+
/**
|
|
1388
|
+
* Thrown when the template defines no unlocking script for a locking script.
|
|
1389
|
+
*
|
|
1390
|
+
* @group Errors
|
|
1391
|
+
*/
|
|
1392
|
+
declare class TemplateUnlockingScriptNotFoundError extends Error {
|
|
1393
|
+
/**
|
|
1394
|
+
* Template whose unlocking script is missing.
|
|
1395
|
+
*/
|
|
1396
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
1397
|
+
/**
|
|
1398
|
+
* Locking script that has no unlocking script.
|
|
1399
|
+
*/
|
|
1400
|
+
readonly lockingScriptIdentifier: XOTemplateLockingScriptIdentifier;
|
|
1401
|
+
constructor(templateIdentifier: XOTemplateIdentifier, lockingScriptIdentifier: XOTemplateLockingScriptIdentifier);
|
|
1402
|
+
}
|
|
1403
|
+
/**
|
|
1404
|
+
* Thrown when a transaction identifier is absent from the template.
|
|
1405
|
+
*
|
|
1406
|
+
* @group Errors
|
|
1407
|
+
*/
|
|
1408
|
+
declare class TemplateTransactionNotFoundError extends Error {
|
|
1409
|
+
/**
|
|
1410
|
+
* Template whose transaction is missing.
|
|
1411
|
+
*/
|
|
1412
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
1413
|
+
/**
|
|
1414
|
+
* Transaction identifier that is missing.
|
|
1415
|
+
*/
|
|
1416
|
+
readonly transactionIdentifier: XOTemplateTransactionIdentifier;
|
|
1417
|
+
constructor(templateIdentifier: XOTemplateIdentifier, transactionIdentifier: XOTemplateTransactionIdentifier);
|
|
1418
|
+
}
|
|
1419
|
+
/**
|
|
1420
|
+
* Thrown when a template action names no transaction.
|
|
1421
|
+
*
|
|
1422
|
+
* @group Errors
|
|
1423
|
+
*/
|
|
1424
|
+
declare class TemplateActionTransactionNotFoundError extends Error {
|
|
1425
|
+
/**
|
|
1426
|
+
* Template that defines the action.
|
|
1427
|
+
*/
|
|
1428
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
1429
|
+
/**
|
|
1430
|
+
* Action identifier whose transaction is missing.
|
|
1431
|
+
*/
|
|
1432
|
+
readonly actionIdentifier: XOTemplateActionIdentifier;
|
|
1433
|
+
constructor(templateIdentifier: XOTemplateIdentifier, actionIdentifier: XOTemplateActionIdentifier);
|
|
1434
|
+
}
|
|
1435
|
+
/**
|
|
1436
|
+
* Thrown when a template output has no locking script.
|
|
1437
|
+
*
|
|
1438
|
+
* @group Errors
|
|
1439
|
+
*/
|
|
1440
|
+
declare class TemplateOutputLockingScriptNotFoundError extends Error {
|
|
1441
|
+
/**
|
|
1442
|
+
* Template that defines the output.
|
|
1443
|
+
*/
|
|
1444
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
1445
|
+
/**
|
|
1446
|
+
* Output identifier whose locking script is missing.
|
|
1447
|
+
*/
|
|
1448
|
+
readonly outputIdentifier: XOTemplateOutputIdentifier;
|
|
1449
|
+
constructor(templateIdentifier: XOTemplateIdentifier, outputIdentifier: XOTemplateOutputIdentifier);
|
|
1450
|
+
}
|
|
1451
|
+
/**
|
|
1452
|
+
* Thrown when a locking script role identifier is absent from the template.
|
|
1453
|
+
*
|
|
1454
|
+
* @group Errors
|
|
1455
|
+
*/
|
|
1456
|
+
declare class TemplateLockingScriptRoleNotFoundError extends Error {
|
|
1457
|
+
/**
|
|
1458
|
+
* Template that defines the locking script.
|
|
1459
|
+
*/
|
|
1460
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
1461
|
+
/**
|
|
1462
|
+
* Locking script identifier that was searched.
|
|
1463
|
+
*/
|
|
1464
|
+
readonly lockingScriptIdentifier: XOTemplateLockingScriptIdentifier;
|
|
1465
|
+
/**
|
|
1466
|
+
* Role identifier that is missing.
|
|
1467
|
+
*/
|
|
1468
|
+
readonly roleIdentifier: XOTemplateRoleIdentifier;
|
|
1469
|
+
constructor(templateIdentifier: XOTemplateIdentifier, lockingScriptIdentifier: XOTemplateLockingScriptIdentifier, roleIdentifier: XOTemplateRoleIdentifier);
|
|
1470
|
+
}
|
|
1471
|
+
/**
|
|
1472
|
+
* Thrown when a role sets `relevant` to CashAssembly that the engine cannot evaluate yet.
|
|
1473
|
+
*
|
|
1474
|
+
* @group Errors
|
|
1475
|
+
*/
|
|
1476
|
+
declare class TemplateRoleRelevantCashAssemblyUnsupportedError extends Error {
|
|
1477
|
+
/**
|
|
1478
|
+
* Template that defines the role.
|
|
431
1479
|
*/
|
|
432
|
-
|
|
1480
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
433
1481
|
/**
|
|
434
|
-
*
|
|
435
|
-
*
|
|
436
|
-
* Finds own inputs and prepares a list for the lookup in the store.
|
|
437
|
-
*
|
|
438
|
-
* @param {XOInvitationInput[]} inputs - The inputs to find resources for.
|
|
439
|
-
* @returns {Promise<XOInvitationInput[]>} The list of own inputs for reservation.
|
|
1482
|
+
* Output whose role declared the unsupported expression.
|
|
440
1483
|
*/
|
|
441
|
-
|
|
1484
|
+
readonly outputIdentifier: XOTemplateOutputIdentifier;
|
|
442
1485
|
/**
|
|
443
|
-
*
|
|
444
|
-
* engine's own entity, persists the updated invitation to the store, and returns the result.
|
|
445
|
-
*
|
|
446
|
-
* This is the shared implementation used by both the public {@link appendInvitation} method
|
|
447
|
-
* and internal callers that already hold the stored invitation in memory.
|
|
448
|
-
*
|
|
449
|
-
* @param {StoredInvitation} storedInvitation - The stored invitation to append to.
|
|
450
|
-
* @param {AppendInvitationParameters} params - The parameters to append.
|
|
451
|
-
* @returns {Promise<XOInvitation>} The updated invitation after the new commit is applied.
|
|
1486
|
+
* Role whose `relevant` field is a CashAssembly string.
|
|
452
1487
|
*/
|
|
453
|
-
|
|
1488
|
+
readonly roleIdentifier: XOTemplateRoleIdentifier;
|
|
454
1489
|
/**
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
* @param {XOInvitationInput[]} inputs - The inputs to reserve.
|
|
458
|
-
* @param {string} invitationIdentifier - The identifier of the invitation for which the resources are being reserved.
|
|
459
|
-
* @returns {Promise<void>} Resolves when the reservation is complete.
|
|
1490
|
+
* CashAssembly expression from the role `relevant` field.
|
|
460
1491
|
*/
|
|
461
|
-
|
|
1492
|
+
readonly relevantExpression: string;
|
|
1493
|
+
constructor(templateIdentifier: XOTemplateIdentifier, outputIdentifier: XOTemplateOutputIdentifier, roleIdentifier: XOTemplateRoleIdentifier, relevantExpression: string);
|
|
462
1494
|
}
|
|
463
|
-
//#endregion
|
|
464
|
-
//#region source/errors.d.ts
|
|
465
1495
|
/**
|
|
466
|
-
*
|
|
1496
|
+
* Thrown when a template output token omits a category.
|
|
1497
|
+
*
|
|
1498
|
+
* @group Errors
|
|
467
1499
|
*/
|
|
468
|
-
declare class
|
|
469
|
-
|
|
1500
|
+
declare class TemplateTokenCategoryMissingError extends Error {
|
|
1501
|
+
/**
|
|
1502
|
+
* Template that defines the output.
|
|
1503
|
+
*/
|
|
1504
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
1505
|
+
/**
|
|
1506
|
+
* Output whose token omits the category.
|
|
1507
|
+
*/
|
|
1508
|
+
readonly outputIdentifier: XOTemplateOutputIdentifier;
|
|
1509
|
+
constructor(templateIdentifier: XOTemplateIdentifier, outputIdentifier: XOTemplateOutputIdentifier);
|
|
470
1510
|
}
|
|
471
1511
|
/**
|
|
472
|
-
*
|
|
1512
|
+
* Thrown when a template output NFT omits capability.
|
|
1513
|
+
*
|
|
1514
|
+
* @group Errors
|
|
473
1515
|
*/
|
|
474
|
-
declare class
|
|
475
|
-
|
|
1516
|
+
declare class TemplateTokenNftCapabilityMissingError extends Error {
|
|
1517
|
+
/**
|
|
1518
|
+
* Template that defines the output.
|
|
1519
|
+
*/
|
|
1520
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
1521
|
+
/**
|
|
1522
|
+
* Output whose NFT omits the capability.
|
|
1523
|
+
*/
|
|
1524
|
+
readonly outputIdentifier: XOTemplateOutputIdentifier;
|
|
1525
|
+
constructor(templateIdentifier: XOTemplateIdentifier, outputIdentifier: XOTemplateOutputIdentifier);
|
|
476
1526
|
}
|
|
477
1527
|
/**
|
|
478
|
-
*
|
|
1528
|
+
* Thrown when a template output NFT capability is not recognized.
|
|
1529
|
+
*
|
|
1530
|
+
* @group Errors
|
|
479
1531
|
*/
|
|
480
|
-
declare class
|
|
481
|
-
|
|
1532
|
+
declare class TemplateTokenNftCapabilityInvalidError extends Error {
|
|
1533
|
+
/**
|
|
1534
|
+
* Template that defines the output.
|
|
1535
|
+
*/
|
|
1536
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
1537
|
+
/**
|
|
1538
|
+
* Output whose NFT capability was rejected.
|
|
1539
|
+
*/
|
|
1540
|
+
readonly outputIdentifier: XOTemplateOutputIdentifier;
|
|
1541
|
+
/**
|
|
1542
|
+
* Capability value that was rejected.
|
|
1543
|
+
*/
|
|
1544
|
+
readonly capabilityValue: string;
|
|
1545
|
+
constructor(templateIdentifier: XOTemplateIdentifier, outputIdentifier: XOTemplateOutputIdentifier, capabilityValue: string);
|
|
482
1546
|
}
|
|
483
1547
|
/**
|
|
484
|
-
*
|
|
1548
|
+
* Thrown when a template output `valueSatoshis` string is neither CashAssembly nor a decimal integer.
|
|
1549
|
+
*
|
|
1550
|
+
* @group Errors
|
|
485
1551
|
*/
|
|
486
|
-
declare class
|
|
487
|
-
|
|
1552
|
+
declare class TemplateValueSatoshisInvalidError extends Error {
|
|
1553
|
+
/**
|
|
1554
|
+
* Template that defines the output.
|
|
1555
|
+
*/
|
|
1556
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
1557
|
+
/**
|
|
1558
|
+
* Output identifier whose valueSatoshis could not be resolved.
|
|
1559
|
+
*/
|
|
1560
|
+
readonly outputIdentifier: string;
|
|
1561
|
+
/**
|
|
1562
|
+
* Passed valueSatoshis string.
|
|
1563
|
+
*/
|
|
1564
|
+
readonly templateValueSatoshis: string;
|
|
1565
|
+
constructor(templateIdentifier: XOTemplateIdentifier, outputIdentifier: string, templateValueSatoshis: string, options?: {
|
|
1566
|
+
cause?: unknown;
|
|
1567
|
+
});
|
|
1568
|
+
}
|
|
1569
|
+
/**
|
|
1570
|
+
* Thrown when a template output token amount does not resolve to a valid fungible token amount.
|
|
1571
|
+
*
|
|
1572
|
+
* @group Errors
|
|
1573
|
+
*/
|
|
1574
|
+
declare class TemplateTokenAmountInvalidError extends Error {
|
|
1575
|
+
/**
|
|
1576
|
+
* Template that defines the output.
|
|
1577
|
+
*/
|
|
1578
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
1579
|
+
/**
|
|
1580
|
+
* Output identifier whose token amount could not be resolved.
|
|
1581
|
+
*/
|
|
1582
|
+
readonly outputIdentifier: string;
|
|
1583
|
+
/**
|
|
1584
|
+
* Template amount, or the value its CashAssembly expression evaluated to.
|
|
1585
|
+
*/
|
|
1586
|
+
readonly tokenAmount: string;
|
|
1587
|
+
constructor(templateIdentifier: XOTemplateIdentifier, outputIdentifier: string, tokenAmount: string);
|
|
1588
|
+
}
|
|
1589
|
+
/**
|
|
1590
|
+
* Thrown when a role is not defined on the template action an entity tries to take.
|
|
1591
|
+
*
|
|
1592
|
+
* @group Errors
|
|
1593
|
+
*/
|
|
1594
|
+
declare class TemplateActionRoleNotFoundError extends Error {
|
|
1595
|
+
/**
|
|
1596
|
+
* Template that defines the action.
|
|
1597
|
+
*/
|
|
1598
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
1599
|
+
/**
|
|
1600
|
+
* Action whose role is missing.
|
|
1601
|
+
*/
|
|
1602
|
+
readonly actionIdentifier: XOTemplateActionIdentifier;
|
|
1603
|
+
/**
|
|
1604
|
+
* Role that is missing.
|
|
1605
|
+
*/
|
|
1606
|
+
readonly roleIdentifier: XOTemplateRoleIdentifier;
|
|
1607
|
+
constructor(templateIdentifier: XOTemplateIdentifier, actionIdentifier: XOTemplateActionIdentifier, roleIdentifier: XOTemplateRoleIdentifier);
|
|
1608
|
+
}
|
|
1609
|
+
/**
|
|
1610
|
+
* Thrown when a template action role asks the engine to generate variables that are not private keys.
|
|
1611
|
+
*
|
|
1612
|
+
* @group Errors
|
|
1613
|
+
*/
|
|
1614
|
+
declare class TemplateGeneratedVariableTypeUnsupportedError extends Error {
|
|
1615
|
+
/**
|
|
1616
|
+
* Template that defines the variables.
|
|
1617
|
+
*/
|
|
1618
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
1619
|
+
/**
|
|
1620
|
+
* Action the variables are generated for.
|
|
1621
|
+
*/
|
|
1622
|
+
readonly actionIdentifier: XOTemplateActionIdentifier;
|
|
1623
|
+
/**
|
|
1624
|
+
* Role the entity takes in the action, when it takes one.
|
|
1625
|
+
*/
|
|
1626
|
+
readonly roleIdentifier: XOTemplateRoleIdentifier | undefined;
|
|
1627
|
+
/**
|
|
1628
|
+
* Generated variables that are not defined as private keys.
|
|
1629
|
+
*/
|
|
1630
|
+
readonly variableIdentifiers: XOTemplateVariableIdentifier[];
|
|
1631
|
+
/**
|
|
1632
|
+
* Defined type of each of those variables, undefined when the template does not define the variable.
|
|
1633
|
+
*/
|
|
1634
|
+
readonly variableTypes: Array<string | undefined>;
|
|
1635
|
+
constructor(templateIdentifier: XOTemplateIdentifier, actionIdentifier: XOTemplateActionIdentifier, variableIdentifiers: XOTemplateVariableIdentifier[], variableTypes: Array<string | undefined>, roleIdentifier?: XOTemplateRoleIdentifier);
|
|
1636
|
+
}
|
|
1637
|
+
/**
|
|
1638
|
+
* Thrown when a wallet default policy names a template whose defaults do not define that policy.
|
|
1639
|
+
*
|
|
1640
|
+
* @group Errors
|
|
1641
|
+
*/
|
|
1642
|
+
declare class TemplateDefaultPolicyMissingError extends Error {
|
|
1643
|
+
/**
|
|
1644
|
+
* Template whose default policy is missing.
|
|
1645
|
+
*/
|
|
1646
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
1647
|
+
/**
|
|
1648
|
+
* Default policy that is missing.
|
|
1649
|
+
*/
|
|
1650
|
+
readonly policy: keyof WalletDefaultPolicies;
|
|
1651
|
+
constructor(templateIdentifier: XOTemplateIdentifier, policy: keyof WalletDefaultPolicies);
|
|
488
1652
|
}
|
|
489
1653
|
/**
|
|
490
|
-
*
|
|
1654
|
+
* Thrown when a template locking script omits its locking type.
|
|
1655
|
+
*
|
|
1656
|
+
* @group Errors
|
|
491
1657
|
*/
|
|
492
1658
|
declare class TemplateLockingScriptTypeNotFoundError extends Error {
|
|
493
|
-
|
|
1659
|
+
/**
|
|
1660
|
+
* Template that defines the locking script.
|
|
1661
|
+
*/
|
|
1662
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
1663
|
+
/**
|
|
1664
|
+
* Locking script that has no locking type.
|
|
1665
|
+
*/
|
|
1666
|
+
readonly lockingScriptIdentifier: XOTemplateLockingScriptIdentifier;
|
|
1667
|
+
constructor(templateIdentifier: XOTemplateIdentifier, lockingScriptIdentifier: XOTemplateLockingScriptIdentifier);
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* Thrown when a template locking script omits its locking bytecode.
|
|
1671
|
+
*
|
|
1672
|
+
* @group Errors
|
|
1673
|
+
*/
|
|
1674
|
+
declare class TemplateLockingScriptBytecodeNotFoundError extends Error {
|
|
1675
|
+
/**
|
|
1676
|
+
* Template that defines the locking script.
|
|
1677
|
+
*/
|
|
1678
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
1679
|
+
/**
|
|
1680
|
+
* Locking script that has no locking bytecode.
|
|
1681
|
+
*/
|
|
1682
|
+
readonly lockingScriptIdentifier: XOTemplateLockingScriptIdentifier;
|
|
1683
|
+
constructor(templateIdentifier: XOTemplateIdentifier, lockingScriptIdentifier: XOTemplateLockingScriptIdentifier);
|
|
1684
|
+
}
|
|
1685
|
+
/**
|
|
1686
|
+
* Thrown when a template output names a locking script, or a locking script names a script, that the template does not define.
|
|
1687
|
+
*
|
|
1688
|
+
* @group Errors
|
|
1689
|
+
*/
|
|
1690
|
+
declare class TemplateOutputLockingScriptReferenceInvalidError extends Error {
|
|
1691
|
+
/**
|
|
1692
|
+
* Template that defines the output.
|
|
1693
|
+
*/
|
|
1694
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
1695
|
+
/**
|
|
1696
|
+
* Template output whose locking script definition holds the reference.
|
|
1697
|
+
*/
|
|
1698
|
+
readonly outputIdentifier: XOTemplateOutputIdentifier;
|
|
1699
|
+
/**
|
|
1700
|
+
* Locking script or script identifier the template does not define.
|
|
1701
|
+
*/
|
|
1702
|
+
readonly lockingScriptReference: string;
|
|
1703
|
+
constructor(templateIdentifier: XOTemplateIdentifier, outputIdentifier: XOTemplateOutputIdentifier, lockingScriptReference: string);
|
|
1704
|
+
}
|
|
1705
|
+
//#endregion
|
|
1706
|
+
//#region source/errors/invitation.d.ts
|
|
1707
|
+
/**
|
|
1708
|
+
* One field that a later commit tried to set after an earlier commit already committed a value for it.
|
|
1709
|
+
*/
|
|
1710
|
+
type InvitationItemFieldConflict = {
|
|
1711
|
+
/**
|
|
1712
|
+
* Whether the conflicting field belongs to an input or an output.
|
|
1713
|
+
*/
|
|
1714
|
+
itemType: 'input' | 'output';
|
|
1715
|
+
/**
|
|
1716
|
+
* Name of the conflicting field.
|
|
1717
|
+
*/
|
|
1718
|
+
fieldName: string;
|
|
1719
|
+
/**
|
|
1720
|
+
* Commit identifier and position of the funding item that introduced the input or output.
|
|
1721
|
+
*/
|
|
1722
|
+
fundingItemKey: string;
|
|
1723
|
+
/**
|
|
1724
|
+
* Commit that set the field first.
|
|
1725
|
+
*/
|
|
1726
|
+
earlierCommitIdentifier: XOInvitationCommitIdentifier;
|
|
1727
|
+
/**
|
|
1728
|
+
* Commit that tried to set the field again.
|
|
1729
|
+
*/
|
|
1730
|
+
laterCommitIdentifier: XOInvitationCommitIdentifier;
|
|
1731
|
+
};
|
|
1732
|
+
/**
|
|
1733
|
+
* One variable a commit provides for roles its entity does not hold.
|
|
1734
|
+
*/
|
|
1735
|
+
type RoleVariableEntityMismatch = {
|
|
1736
|
+
/**
|
|
1737
|
+
* Commit that provides the variable.
|
|
1738
|
+
*/
|
|
1739
|
+
commitIdentifier: XOInvitationCommitIdentifier;
|
|
1740
|
+
/**
|
|
1741
|
+
* Entity that made the commit.
|
|
1742
|
+
*/
|
|
1743
|
+
entityIdentifier: XOInvitationEntityIdentifier;
|
|
1744
|
+
/**
|
|
1745
|
+
* Variable the commit provides.
|
|
1746
|
+
*/
|
|
1747
|
+
variableIdentifier: XOTemplateVariableIdentifier;
|
|
1748
|
+
/**
|
|
1749
|
+
* Roles the variable belongs to, each taken by other entities.
|
|
1750
|
+
*/
|
|
1751
|
+
roleIdentifiers: XOTemplateRoleIdentifier[];
|
|
1752
|
+
};
|
|
1753
|
+
/**
|
|
1754
|
+
* One entity that holds more than one role with a follow up in an invitation.
|
|
1755
|
+
*/
|
|
1756
|
+
type EntityRolesMultipleEntry = {
|
|
1757
|
+
/**
|
|
1758
|
+
* Entity that takes the roles.
|
|
1759
|
+
*/
|
|
1760
|
+
entityIdentifier: XOInvitationEntityIdentifier;
|
|
1761
|
+
/**
|
|
1762
|
+
* Every role with a follow up the entity holds, in the order its commits take them.
|
|
1763
|
+
*/
|
|
1764
|
+
roleIdentifiers: XOTemplateRoleIdentifier[];
|
|
1765
|
+
};
|
|
1766
|
+
/**
|
|
1767
|
+
* Thrown when no commit in the invitation introduced a merged input, so there is no commit for a new commit to extend.
|
|
1768
|
+
*
|
|
1769
|
+
* @group Errors
|
|
1770
|
+
*/
|
|
1771
|
+
declare class MergedInputCommitNotFoundError extends Error {
|
|
1772
|
+
/**
|
|
1773
|
+
* Invitation whose commits were searched.
|
|
1774
|
+
*/
|
|
1775
|
+
readonly invitationIdentifier: XOInvitationIdentifier;
|
|
1776
|
+
/**
|
|
1777
|
+
* Position of the input in the merged input list.
|
|
1778
|
+
*/
|
|
1779
|
+
readonly inputIndex: number;
|
|
1780
|
+
constructor(invitationIdentifier: XOInvitationIdentifier, inputIndex: number);
|
|
494
1781
|
}
|
|
495
1782
|
/**
|
|
496
|
-
*
|
|
1783
|
+
* Thrown when an updated invitation diverges from the commit history already stored locally.
|
|
1784
|
+
*
|
|
1785
|
+
* @group Errors
|
|
497
1786
|
*/
|
|
498
|
-
declare class
|
|
499
|
-
|
|
1787
|
+
declare class InvitationHistoryConflictError extends Error {
|
|
1788
|
+
/**
|
|
1789
|
+
* Invitation whose stored and updated histories diverge.
|
|
1790
|
+
*/
|
|
1791
|
+
readonly invitationIdentifier: XOInvitationIdentifier;
|
|
1792
|
+
/**
|
|
1793
|
+
* Stored commit at which the histories diverged.
|
|
1794
|
+
*/
|
|
1795
|
+
readonly commitIdentifier: XOInvitationCommitIdentifier;
|
|
1796
|
+
constructor(invitationIdentifier: XOInvitationIdentifier, commitIdentifier: XOInvitationCommitIdentifier);
|
|
500
1797
|
}
|
|
501
1798
|
/**
|
|
502
|
-
*
|
|
1799
|
+
* Thrown when append invitation parameters omit every appendable field.
|
|
1800
|
+
*
|
|
1801
|
+
* @group Errors
|
|
503
1802
|
*/
|
|
504
|
-
declare class
|
|
505
|
-
constructor(
|
|
1803
|
+
declare class AppendInvitationParametersEmptyError extends Error {
|
|
1804
|
+
constructor();
|
|
506
1805
|
}
|
|
507
1806
|
/**
|
|
508
|
-
*
|
|
1807
|
+
* Thrown when one or more invitation validation checks fail.
|
|
1808
|
+
* Holds one error for each failed check, in the order the checks ran.
|
|
1809
|
+
*
|
|
1810
|
+
* @group Errors
|
|
509
1811
|
*/
|
|
510
|
-
declare class
|
|
511
|
-
|
|
1812
|
+
declare class InvitationValidationFailedError extends AggregateError {
|
|
1813
|
+
/**
|
|
1814
|
+
* Invitation that failed validation.
|
|
1815
|
+
*/
|
|
1816
|
+
readonly invitationIdentifier: XOInvitationIdentifier;
|
|
1817
|
+
/**
|
|
1818
|
+
* Validation errors collected before the throw.
|
|
1819
|
+
*/
|
|
1820
|
+
readonly errors: Error[];
|
|
1821
|
+
constructor(invitationIdentifier: XOInvitationIdentifier, errors: Error[]);
|
|
512
1822
|
}
|
|
513
1823
|
/**
|
|
514
|
-
*
|
|
1824
|
+
* Collected during invitation validation when an invitation field does not construct a valid primitive.
|
|
1825
|
+
*
|
|
1826
|
+
* @group Errors
|
|
515
1827
|
*/
|
|
516
|
-
declare class
|
|
517
|
-
|
|
1828
|
+
declare class InvitationFieldInvalidError extends Error {
|
|
1829
|
+
/**
|
|
1830
|
+
* Location of the field inside the invitation, as object keys and array indexes.
|
|
1831
|
+
*/
|
|
1832
|
+
readonly path: readonly (string | number)[];
|
|
1833
|
+
/**
|
|
1834
|
+
* Error thrown by the primitive that rejected the field value.
|
|
1835
|
+
*/
|
|
1836
|
+
readonly cause: Error;
|
|
1837
|
+
constructor(path: readonly (string | number)[], cause: Error);
|
|
1838
|
+
}
|
|
1839
|
+
/**
|
|
1840
|
+
* Collected during invitation validation when a commit signature does not verify or verification throws.
|
|
1841
|
+
*
|
|
1842
|
+
* @group Errors
|
|
1843
|
+
*/
|
|
1844
|
+
declare class CommitSignatureInvalidError extends Error {
|
|
1845
|
+
/**
|
|
1846
|
+
* Identifier of the commit whose signature failed.
|
|
1847
|
+
*/
|
|
1848
|
+
readonly commitIdentifier: XOInvitationCommitIdentifier;
|
|
1849
|
+
/**
|
|
1850
|
+
* Error thrown by signature verification, when verification threw.
|
|
1851
|
+
*/
|
|
1852
|
+
readonly cause?: Error;
|
|
1853
|
+
constructor(commitIdentifier: XOInvitationCommitIdentifier, cause?: Error);
|
|
1854
|
+
}
|
|
1855
|
+
/**
|
|
1856
|
+
* Collected during invitation validation when a transaction result created signature does not verify or verification throws.
|
|
1857
|
+
*
|
|
1858
|
+
* @group Errors
|
|
1859
|
+
*/
|
|
1860
|
+
declare class TransactionCreatedSignatureInvalidError extends Error {
|
|
1861
|
+
/**
|
|
1862
|
+
* Template transaction identifier of the result whose signature failed.
|
|
1863
|
+
*/
|
|
1864
|
+
readonly transactionIdentifier: XOTemplateTransactionIdentifier;
|
|
1865
|
+
/**
|
|
1866
|
+
* Error thrown by signature verification, when verification threw.
|
|
1867
|
+
*/
|
|
1868
|
+
readonly cause?: Error;
|
|
1869
|
+
constructor(transactionIdentifier: XOTemplateTransactionIdentifier, cause?: Error);
|
|
1870
|
+
}
|
|
1871
|
+
/**
|
|
1872
|
+
* Collected during invitation validation when a transaction result broadcast signature does not verify or verification throws.
|
|
1873
|
+
*
|
|
1874
|
+
* @group Errors
|
|
1875
|
+
*/
|
|
1876
|
+
declare class TransactionBroadcastSignatureInvalidError extends Error {
|
|
1877
|
+
/**
|
|
1878
|
+
* Template transaction identifier of the result whose signature failed.
|
|
1879
|
+
*/
|
|
1880
|
+
readonly transactionIdentifier: XOTemplateTransactionIdentifier;
|
|
1881
|
+
/**
|
|
1882
|
+
* Error thrown by signature verification, when verification threw.
|
|
1883
|
+
*/
|
|
1884
|
+
readonly cause?: Error;
|
|
1885
|
+
constructor(transactionIdentifier: XOTemplateTransactionIdentifier, cause?: Error);
|
|
1886
|
+
}
|
|
1887
|
+
/**
|
|
1888
|
+
* Collected during invitation validation when a transaction result has some but not all broadcast fields.
|
|
1889
|
+
*
|
|
1890
|
+
* @group Errors
|
|
1891
|
+
*/
|
|
1892
|
+
declare class TransactionBroadcastMetadataIncompleteError extends Error {
|
|
1893
|
+
/**
|
|
1894
|
+
* Template transaction identifier of the result with incomplete broadcast fields.
|
|
1895
|
+
*/
|
|
1896
|
+
readonly transactionIdentifier: XOTemplateTransactionIdentifier;
|
|
1897
|
+
constructor(transactionIdentifier: XOTemplateTransactionIdentifier);
|
|
1898
|
+
}
|
|
1899
|
+
/**
|
|
1900
|
+
* Collected during invitation validation when a data result signature does not verify or verification throws.
|
|
1901
|
+
*
|
|
1902
|
+
* @group Errors
|
|
1903
|
+
*/
|
|
1904
|
+
declare class DataResultSignatureInvalidError extends Error {
|
|
1905
|
+
/**
|
|
1906
|
+
* Template data identifier of the result whose signature failed.
|
|
1907
|
+
*/
|
|
1908
|
+
readonly dataIdentifier: XOTemplateDataIdentifier;
|
|
1909
|
+
/**
|
|
1910
|
+
* Error thrown by signature verification, when verification threw.
|
|
1911
|
+
*/
|
|
1912
|
+
readonly cause?: Error;
|
|
1913
|
+
constructor(dataIdentifier: XOTemplateDataIdentifier, cause?: Error);
|
|
1914
|
+
}
|
|
1915
|
+
/**
|
|
1916
|
+
* Thrown when the root commit for an entity cannot be found in the invitation.
|
|
1917
|
+
*
|
|
1918
|
+
* @group Errors
|
|
1919
|
+
*/
|
|
1920
|
+
declare class RootCommitNotFoundError extends Error {
|
|
1921
|
+
/**
|
|
1922
|
+
* Invitation identifier that was searched.
|
|
1923
|
+
*/
|
|
1924
|
+
readonly invitationIdentifier: XOInvitationIdentifier;
|
|
1925
|
+
/**
|
|
1926
|
+
* Entity whose root commit was searched.
|
|
1927
|
+
*/
|
|
1928
|
+
readonly entityIdentifier: XOInvitationEntityIdentifier;
|
|
1929
|
+
constructor(invitationIdentifier: XOInvitationIdentifier, entityIdentifier: XOInvitationEntityIdentifier);
|
|
1930
|
+
}
|
|
1931
|
+
/**
|
|
1932
|
+
* Thrown when a parent commit identifier is absent from the invitation.
|
|
1933
|
+
*
|
|
1934
|
+
* @group Errors
|
|
1935
|
+
*/
|
|
1936
|
+
declare class ParentCommitNotFoundError extends Error {
|
|
1937
|
+
/**
|
|
1938
|
+
* Parent commit identifier that was looked up.
|
|
1939
|
+
*/
|
|
1940
|
+
readonly parentCommitIdentifier: XOInvitationCommitIdentifier;
|
|
1941
|
+
/**
|
|
1942
|
+
* Commit that referenced the missing parent.
|
|
1943
|
+
*/
|
|
1944
|
+
readonly commitIdentifier: XOInvitationCommitIdentifier;
|
|
1945
|
+
constructor(parentCommitIdentifier: XOInvitationCommitIdentifier, commitIdentifier: XOInvitationCommitIdentifier);
|
|
1946
|
+
}
|
|
1947
|
+
/**
|
|
1948
|
+
* Thrown when two or more merged inputs or outputs share the same transactionIndex.
|
|
1949
|
+
*
|
|
1950
|
+
* @group Errors
|
|
1951
|
+
*/
|
|
1952
|
+
declare class TransactionIndexDuplicatedError extends Error {
|
|
1953
|
+
/**
|
|
1954
|
+
* Whether the conflict is among inputs or outputs.
|
|
1955
|
+
*/
|
|
1956
|
+
readonly itemType: 'input' | 'output';
|
|
1957
|
+
/**
|
|
1958
|
+
* Groups of merged array positions that share one transactionIndex.
|
|
1959
|
+
*/
|
|
1960
|
+
readonly duplicateGroups: Array<{
|
|
1961
|
+
transactionIndex: number;
|
|
1962
|
+
itemPositions: number[];
|
|
1963
|
+
}>;
|
|
1964
|
+
constructor(itemType: 'input' | 'output', duplicateGroups: Array<{
|
|
1965
|
+
transactionIndex: number;
|
|
1966
|
+
itemPositions: number[];
|
|
1967
|
+
}>);
|
|
1968
|
+
}
|
|
1969
|
+
/**
|
|
1970
|
+
* Thrown when a mergesWith commit identifier is absent from the invitation.
|
|
1971
|
+
*
|
|
1972
|
+
* @group Errors
|
|
1973
|
+
*/
|
|
1974
|
+
declare class MergesWithCommitNotFoundError extends Error {
|
|
1975
|
+
/**
|
|
1976
|
+
* Invitation whose commits were searched.
|
|
1977
|
+
*/
|
|
1978
|
+
readonly invitationIdentifier: XOInvitationIdentifier;
|
|
1979
|
+
/**
|
|
1980
|
+
* Commit identifier that mergesWith pointed at.
|
|
1981
|
+
*/
|
|
1982
|
+
readonly mergesWithCommitIdentifier: XOInvitationCommitIdentifier;
|
|
1983
|
+
/**
|
|
1984
|
+
* Commit that referenced the missing mergesWith commit, undefined when that commit is still being built.
|
|
1985
|
+
*/
|
|
1986
|
+
readonly currentCommitIdentifier: XOInvitationCommitIdentifier | undefined;
|
|
1987
|
+
constructor(invitationIdentifier: XOInvitationIdentifier, mergesWithCommitIdentifier: XOInvitationCommitIdentifier, currentCommitIdentifier?: XOInvitationCommitIdentifier);
|
|
1988
|
+
}
|
|
1989
|
+
/**
|
|
1990
|
+
* Thrown when an input or output at a given index is absent from a commit.
|
|
1991
|
+
*
|
|
1992
|
+
* @group Errors
|
|
1993
|
+
*/
|
|
1994
|
+
declare class CommitItemNotFoundError extends Error {
|
|
1995
|
+
/**
|
|
1996
|
+
* Whether the missing item is an input or an output.
|
|
1997
|
+
*/
|
|
1998
|
+
readonly itemType: 'input' | 'output';
|
|
1999
|
+
/**
|
|
2000
|
+
* Index that was looked up in the commit.
|
|
2001
|
+
*/
|
|
2002
|
+
readonly itemIndex: number;
|
|
2003
|
+
/**
|
|
2004
|
+
* Commit that was searched.
|
|
2005
|
+
*/
|
|
2006
|
+
readonly commitIdentifier: XOInvitationCommitIdentifier;
|
|
2007
|
+
constructor(itemType: 'input' | 'output', itemIndex: number, commitIdentifier: XOInvitationCommitIdentifier);
|
|
2008
|
+
}
|
|
2009
|
+
/**
|
|
2010
|
+
* Thrown when transaction version is defined in more than one commit.
|
|
2011
|
+
*
|
|
2012
|
+
* @group Errors
|
|
2013
|
+
*/
|
|
2014
|
+
declare class TransactionVersionDuplicatedError extends Error {
|
|
2015
|
+
/**
|
|
2016
|
+
* Commit identifiers that each defined transaction version.
|
|
2017
|
+
*/
|
|
2018
|
+
readonly commitIdentifiers: XOInvitationCommitIdentifier[];
|
|
2019
|
+
constructor(commitIdentifiers: XOInvitationCommitIdentifier[]);
|
|
518
2020
|
}
|
|
519
2021
|
/**
|
|
520
|
-
*
|
|
2022
|
+
* Thrown when transaction locktime is defined in more than one commit.
|
|
2023
|
+
*
|
|
2024
|
+
* @group Errors
|
|
521
2025
|
*/
|
|
522
|
-
declare class
|
|
523
|
-
|
|
2026
|
+
declare class TransactionLocktimeDuplicatedError extends Error {
|
|
2027
|
+
/**
|
|
2028
|
+
* Commit identifiers that each defined transaction locktime.
|
|
2029
|
+
*/
|
|
2030
|
+
readonly commitIdentifiers: XOInvitationCommitIdentifier[];
|
|
2031
|
+
constructor(commitIdentifiers: XOInvitationCommitIdentifier[]);
|
|
524
2032
|
}
|
|
525
2033
|
/**
|
|
526
|
-
*
|
|
2034
|
+
* Thrown when a provided template identifier does not match the invitation template identifier.
|
|
2035
|
+
*
|
|
2036
|
+
* @group Errors
|
|
527
2037
|
*/
|
|
528
|
-
declare class
|
|
529
|
-
|
|
2038
|
+
declare class InvitationTemplateMismatchError extends Error {
|
|
2039
|
+
/**
|
|
2040
|
+
* Template identifier stored on the invitation.
|
|
2041
|
+
*/
|
|
2042
|
+
readonly expectedTemplateIdentifier: XOTemplateIdentifier;
|
|
2043
|
+
/**
|
|
2044
|
+
* Template identifier that was supplied for validation.
|
|
2045
|
+
*/
|
|
2046
|
+
readonly receivedTemplateIdentifier: XOTemplateIdentifier;
|
|
2047
|
+
constructor(expectedTemplateIdentifier: XOTemplateIdentifier, receivedTemplateIdentifier: XOTemplateIdentifier);
|
|
530
2048
|
}
|
|
531
2049
|
/**
|
|
532
|
-
*
|
|
2050
|
+
* Thrown when a merged input to unlock has no outpoint, so there is no output for it to spend.
|
|
2051
|
+
*
|
|
2052
|
+
* @group Errors
|
|
533
2053
|
*/
|
|
534
|
-
declare class
|
|
535
|
-
|
|
2054
|
+
declare class MergedInputOutpointMissingError extends Error {
|
|
2055
|
+
/**
|
|
2056
|
+
* Invitation that owns the input.
|
|
2057
|
+
*/
|
|
2058
|
+
readonly invitationIdentifier: XOInvitationIdentifier;
|
|
2059
|
+
/**
|
|
2060
|
+
* Position of the input in the merged input list.
|
|
2061
|
+
*/
|
|
2062
|
+
readonly inputIndex: number;
|
|
2063
|
+
constructor(invitationIdentifier: XOInvitationIdentifier, inputIndex: number);
|
|
536
2064
|
}
|
|
537
2065
|
/**
|
|
538
|
-
*
|
|
2066
|
+
* Thrown when the output a merged input spends is not tracked by this account, or is reserved by another invitation.
|
|
2067
|
+
*
|
|
2068
|
+
* @group Errors
|
|
539
2069
|
*/
|
|
540
|
-
declare class
|
|
541
|
-
|
|
2070
|
+
declare class InputUnspentOutputUnavailableError extends Error {
|
|
2071
|
+
/**
|
|
2072
|
+
* Invitation that owns the input.
|
|
2073
|
+
*/
|
|
2074
|
+
readonly invitationIdentifier: XOInvitationIdentifier;
|
|
2075
|
+
/**
|
|
2076
|
+
* Position of the input in the merged input list.
|
|
2077
|
+
*/
|
|
2078
|
+
readonly inputIndex: number;
|
|
2079
|
+
/**
|
|
2080
|
+
* Hash of the transaction that holds the spent output, as hexadecimal.
|
|
2081
|
+
*/
|
|
2082
|
+
readonly outpointTransactionHash: string;
|
|
2083
|
+
/**
|
|
2084
|
+
* Index of the spent output in that transaction.
|
|
2085
|
+
*/
|
|
2086
|
+
readonly outpointIndex: number;
|
|
2087
|
+
/**
|
|
2088
|
+
* Invitation that reserves the output, undefined when this account does not track the output.
|
|
2089
|
+
*/
|
|
2090
|
+
readonly reservedBy: XOInvitationIdentifier | undefined;
|
|
2091
|
+
constructor(invitationIdentifier: XOInvitationIdentifier, inputIndex: number, outpointTransactionHash: string, outpointIndex: number, reservedBy?: XOInvitationIdentifier);
|
|
542
2092
|
}
|
|
543
2093
|
/**
|
|
544
|
-
*
|
|
2094
|
+
* Thrown when an invitation result signature fails verification.
|
|
2095
|
+
*
|
|
2096
|
+
* @group Errors
|
|
545
2097
|
*/
|
|
546
|
-
declare class
|
|
547
|
-
|
|
2098
|
+
declare class InvitationResultSignatureInvalidError extends Error {
|
|
2099
|
+
/**
|
|
2100
|
+
* Invitation whose result signature failed.
|
|
2101
|
+
*/
|
|
2102
|
+
readonly invitationIdentifier: XOInvitationIdentifier;
|
|
2103
|
+
/**
|
|
2104
|
+
* Kind of invitation result that was verified.
|
|
2105
|
+
*/
|
|
2106
|
+
readonly resultKind: 'transaction_created' | 'transaction_broadcasted' | 'data';
|
|
2107
|
+
/**
|
|
2108
|
+
* Result identifier whose signature failed.
|
|
2109
|
+
*/
|
|
2110
|
+
readonly resultIdentifier: string;
|
|
2111
|
+
constructor(invitationIdentifier: XOInvitationIdentifier, resultKind: 'transaction_created' | 'transaction_broadcasted' | 'data', resultIdentifier: string);
|
|
548
2112
|
}
|
|
549
2113
|
/**
|
|
550
|
-
*
|
|
2114
|
+
* Thrown when the same commit identifier appears more than once in an invitation.
|
|
2115
|
+
*
|
|
2116
|
+
* @group Errors
|
|
551
2117
|
*/
|
|
552
|
-
declare class
|
|
553
|
-
|
|
2118
|
+
declare class CommitIdentifierDuplicatedError extends Error {
|
|
2119
|
+
/**
|
|
2120
|
+
* Commit identifiers that appear more than once.
|
|
2121
|
+
*/
|
|
2122
|
+
readonly commitIdentifiers: XOInvitationCommitIdentifier[];
|
|
2123
|
+
constructor(commitIdentifiers: XOInvitationCommitIdentifier[]);
|
|
554
2124
|
}
|
|
555
2125
|
/**
|
|
556
|
-
*
|
|
2126
|
+
* Thrown when a commit does not name the commit stored immediately before it as its previous commit.
|
|
2127
|
+
*
|
|
2128
|
+
* @group Errors
|
|
557
2129
|
*/
|
|
558
|
-
declare class
|
|
559
|
-
|
|
2130
|
+
declare class CommitChainOrderInvalidError extends Error {
|
|
2131
|
+
/**
|
|
2132
|
+
* Commit whose previous commit identifier breaks the chain.
|
|
2133
|
+
*/
|
|
2134
|
+
readonly commitIdentifier: XOInvitationCommitIdentifier;
|
|
2135
|
+
/**
|
|
2136
|
+
* Identifier of the commit stored immediately before it, or undefined for the first commit.
|
|
2137
|
+
*/
|
|
2138
|
+
readonly expectedPreviousCommitIdentifier: XOInvitationCommitIdentifier | undefined;
|
|
2139
|
+
/**
|
|
2140
|
+
* Previous commit identifier the commit actually carries.
|
|
2141
|
+
*/
|
|
2142
|
+
readonly receivedPreviousCommitIdentifier: XOInvitationCommitIdentifier | undefined;
|
|
2143
|
+
constructor(commitIdentifier: XOInvitationCommitIdentifier, expectedPreviousCommitIdentifier?: XOInvitationCommitIdentifier, receivedPreviousCommitIdentifier?: XOInvitationCommitIdentifier);
|
|
560
2144
|
}
|
|
561
2145
|
/**
|
|
562
|
-
*
|
|
2146
|
+
* Thrown when a mergesWith reference points at the same commit or a later commit instead of an earlier one.
|
|
2147
|
+
*
|
|
2148
|
+
* @group Errors
|
|
563
2149
|
*/
|
|
564
|
-
declare class
|
|
565
|
-
|
|
2150
|
+
declare class MergesWithCommitNotEarlierError extends Error {
|
|
2151
|
+
/**
|
|
2152
|
+
* Commit identifier that mergesWith pointed at.
|
|
2153
|
+
*/
|
|
2154
|
+
readonly mergesWithCommitIdentifier: XOInvitationCommitIdentifier;
|
|
2155
|
+
/**
|
|
2156
|
+
* Commit that contains the mergesWith reference.
|
|
2157
|
+
*/
|
|
2158
|
+
readonly currentCommitIdentifier: XOInvitationCommitIdentifier;
|
|
2159
|
+
constructor(mergesWithCommitIdentifier: XOInvitationCommitIdentifier, currentCommitIdentifier: XOInvitationCommitIdentifier);
|
|
566
2160
|
}
|
|
567
2161
|
/**
|
|
568
|
-
*
|
|
2162
|
+
* Thrown when invitation commits carry variable identifiers that contain a dot.
|
|
2163
|
+
*
|
|
2164
|
+
* The compiler reads a dotted identifier as an operation on a variable, such as `someKey.public_key`, and looks that
|
|
2165
|
+
* identifier up in the same bytecode map as variable values. A dotted variable would replace the value that operation
|
|
2166
|
+
* derives from a key.
|
|
2167
|
+
*
|
|
2168
|
+
* @group Errors
|
|
569
2169
|
*/
|
|
570
|
-
declare class
|
|
571
|
-
|
|
2170
|
+
declare class InvitationVariableIdentifierInvalidError extends Error {
|
|
2171
|
+
/**
|
|
2172
|
+
* Each invalid variable identifier with the commit that supplied it.
|
|
2173
|
+
*/
|
|
2174
|
+
readonly invalidVariables: Array<{
|
|
2175
|
+
variableIdentifier: string;
|
|
2176
|
+
commitIdentifier: XOInvitationCommitIdentifier;
|
|
2177
|
+
}>;
|
|
2178
|
+
constructor(invalidVariables: Array<{
|
|
2179
|
+
variableIdentifier: string;
|
|
2180
|
+
commitIdentifier: XOInvitationCommitIdentifier;
|
|
2181
|
+
}>);
|
|
572
2182
|
}
|
|
573
2183
|
/**
|
|
574
|
-
*
|
|
2184
|
+
* Thrown when a later commit sets an input or output field that an earlier commit already set, even to the same value.
|
|
2185
|
+
*
|
|
2186
|
+
* @group Errors
|
|
575
2187
|
*/
|
|
576
|
-
declare class
|
|
577
|
-
|
|
2188
|
+
declare class InvitationItemFieldConflictError extends Error {
|
|
2189
|
+
/**
|
|
2190
|
+
* Every conflicting field with the commits involved.
|
|
2191
|
+
*/
|
|
2192
|
+
readonly conflicts: InvitationItemFieldConflict[];
|
|
2193
|
+
constructor(conflicts: InvitationItemFieldConflict[]);
|
|
578
2194
|
}
|
|
579
2195
|
/**
|
|
580
|
-
*
|
|
2196
|
+
* Thrown when an intent passed with an invitation names a different template or action than the invitation.
|
|
2197
|
+
*
|
|
2198
|
+
* @group Errors
|
|
581
2199
|
*/
|
|
582
|
-
declare class
|
|
583
|
-
|
|
2200
|
+
declare class InvitationIntentMismatchError extends Error {
|
|
2201
|
+
/**
|
|
2202
|
+
* Intent field that does not match the invitation.
|
|
2203
|
+
*/
|
|
2204
|
+
readonly field: 'templateIdentifier' | 'action';
|
|
2205
|
+
/**
|
|
2206
|
+
* Value the invitation has for the field.
|
|
2207
|
+
*/
|
|
2208
|
+
readonly invitationValue: string;
|
|
2209
|
+
/**
|
|
2210
|
+
* Value the intent has for the field.
|
|
2211
|
+
*/
|
|
2212
|
+
readonly intentValue: string;
|
|
2213
|
+
constructor(field: 'templateIdentifier' | 'action', invitationValue: string, intentValue: string);
|
|
584
2214
|
}
|
|
585
2215
|
/**
|
|
586
|
-
*
|
|
2216
|
+
* Thrown when the role an entity takes is given both directly and on the intent.
|
|
2217
|
+
*
|
|
2218
|
+
* @group Errors
|
|
587
2219
|
*/
|
|
588
|
-
declare class
|
|
589
|
-
|
|
2220
|
+
declare class InvitationRoleDuplicatedError extends Error {
|
|
2221
|
+
/**
|
|
2222
|
+
* Role given directly.
|
|
2223
|
+
*/
|
|
2224
|
+
readonly roleIdentifier: XOTemplateRoleIdentifier;
|
|
2225
|
+
/**
|
|
2226
|
+
* Role given on the intent.
|
|
2227
|
+
*/
|
|
2228
|
+
readonly intentRoleIdentifier: XOTemplateRoleIdentifier;
|
|
2229
|
+
constructor(roleIdentifier: XOTemplateRoleIdentifier, intentRoleIdentifier: XOTemplateRoleIdentifier);
|
|
590
2230
|
}
|
|
591
2231
|
/**
|
|
592
|
-
*
|
|
2232
|
+
* Thrown when a resolution names something other than an operation on a template key, since only key operations can be
|
|
2233
|
+
* resolved by the participant holding the key.
|
|
2234
|
+
*
|
|
2235
|
+
* @group Errors
|
|
593
2236
|
*/
|
|
594
|
-
declare class
|
|
595
|
-
|
|
2237
|
+
declare class InvitationResolutionIdentifierInvalidError extends Error {
|
|
2238
|
+
/**
|
|
2239
|
+
* Identifiers that are not operations on a template key.
|
|
2240
|
+
*/
|
|
2241
|
+
readonly resolutionIdentifiers: XOInvitationResolutionIdentifier[];
|
|
2242
|
+
constructor(resolutionIdentifiers: XOInvitationResolutionIdentifier[]);
|
|
596
2243
|
}
|
|
597
2244
|
/**
|
|
598
|
-
*
|
|
2245
|
+
* Thrown when a commit provides a variable that belongs to a role its entity does not hold, since only an entity
|
|
2246
|
+
* holding the role may provide its variables.
|
|
2247
|
+
*
|
|
2248
|
+
* @group Errors
|
|
599
2249
|
*/
|
|
600
|
-
declare class
|
|
601
|
-
|
|
2250
|
+
declare class RoleVariableEntityMismatchError extends Error {
|
|
2251
|
+
/**
|
|
2252
|
+
* Every variable provided by an entity that does not hold its role.
|
|
2253
|
+
*/
|
|
2254
|
+
readonly mismatches: RoleVariableEntityMismatch[];
|
|
2255
|
+
constructor(mismatches: RoleVariableEntityMismatch[]);
|
|
602
2256
|
}
|
|
603
2257
|
/**
|
|
604
|
-
*
|
|
2258
|
+
* Thrown when an entity holds more than one role with a follow up action.
|
|
2259
|
+
*
|
|
2260
|
+
* @group Errors
|
|
605
2261
|
*/
|
|
606
|
-
declare class
|
|
607
|
-
|
|
2262
|
+
declare class EntityMultipleRolesWithFollowUpUnsupportedError extends Error {
|
|
2263
|
+
/**
|
|
2264
|
+
* Every entity that holds more than one role with a follow up, with those roles.
|
|
2265
|
+
*/
|
|
2266
|
+
readonly entities: EntityRolesMultipleEntry[];
|
|
2267
|
+
constructor(entities: EntityRolesMultipleEntry[]);
|
|
608
2268
|
}
|
|
609
2269
|
/**
|
|
610
|
-
*
|
|
2270
|
+
* Thrown when an entity tries to join an invitation with a role that has no free slot left.
|
|
2271
|
+
*
|
|
2272
|
+
* @group Errors
|
|
611
2273
|
*/
|
|
612
|
-
declare class
|
|
613
|
-
|
|
2274
|
+
declare class InvitationRoleUnavailableError extends Error {
|
|
2275
|
+
/**
|
|
2276
|
+
* Invitation the entity tries to join.
|
|
2277
|
+
*/
|
|
2278
|
+
readonly invitationIdentifier: XOInvitationIdentifier;
|
|
2279
|
+
/**
|
|
2280
|
+
* Role that has no free slot.
|
|
2281
|
+
*/
|
|
2282
|
+
readonly roleIdentifier: XOTemplateRoleIdentifier;
|
|
2283
|
+
/**
|
|
2284
|
+
* Roles that still have a free slot.
|
|
2285
|
+
*/
|
|
2286
|
+
readonly availableRoleIdentifiers: XOTemplateRoleIdentifier[];
|
|
2287
|
+
constructor(invitationIdentifier: XOInvitationIdentifier, roleIdentifier: XOTemplateRoleIdentifier, availableRoleIdentifiers: XOTemplateRoleIdentifier[]);
|
|
614
2288
|
}
|
|
615
2289
|
/**
|
|
616
|
-
*
|
|
2290
|
+
* Thrown when an output appended to an invitation names a template output but carries no locking bytecode.
|
|
2291
|
+
*
|
|
2292
|
+
* @group Errors
|
|
617
2293
|
*/
|
|
618
|
-
declare class
|
|
619
|
-
|
|
2294
|
+
declare class OutputLockingBytecodeNotProvidedError extends Error {
|
|
2295
|
+
/**
|
|
2296
|
+
* Invitation the output is appended to.
|
|
2297
|
+
*/
|
|
2298
|
+
readonly invitationIdentifier: XOInvitationIdentifier;
|
|
2299
|
+
/**
|
|
2300
|
+
* Template output that has no locking bytecode.
|
|
2301
|
+
*/
|
|
2302
|
+
readonly outputIdentifier: XOTemplateOutputIdentifier;
|
|
2303
|
+
constructor(invitationIdentifier: XOInvitationIdentifier, outputIdentifier: XOTemplateOutputIdentifier);
|
|
620
2304
|
}
|
|
621
2305
|
/**
|
|
622
|
-
*
|
|
2306
|
+
* Thrown when the merged invitation has no input at the index asked to be unlocked.
|
|
2307
|
+
*
|
|
2308
|
+
* @group Errors
|
|
623
2309
|
*/
|
|
624
|
-
declare class
|
|
625
|
-
|
|
2310
|
+
declare class MergedInputNotFoundError extends Error {
|
|
2311
|
+
/**
|
|
2312
|
+
* Invitation whose merged inputs were searched.
|
|
2313
|
+
*/
|
|
2314
|
+
readonly invitationIdentifier: XOInvitationIdentifier;
|
|
2315
|
+
/**
|
|
2316
|
+
* Position in the merged input list that has no input.
|
|
2317
|
+
*/
|
|
2318
|
+
readonly inputIndex: number;
|
|
2319
|
+
constructor(invitationIdentifier: XOInvitationIdentifier, inputIndex: number);
|
|
626
2320
|
}
|
|
627
2321
|
/**
|
|
628
|
-
*
|
|
2322
|
+
* Thrown when change is added to an invitation but no locking bytecode was provided, the template defines no change policy,
|
|
2323
|
+
* and the wallet has no default change policy.
|
|
2324
|
+
*
|
|
2325
|
+
* @group Errors
|
|
629
2326
|
*/
|
|
630
|
-
declare class
|
|
631
|
-
|
|
2327
|
+
declare class ChangeLockingBytecodeMissingError extends Error {
|
|
2328
|
+
/**
|
|
2329
|
+
* Invitation the change was added to.
|
|
2330
|
+
*/
|
|
2331
|
+
readonly invitationIdentifier: XOInvitationIdentifier;
|
|
2332
|
+
/**
|
|
2333
|
+
* Template of the invitation, which defines no change policy.
|
|
2334
|
+
*/
|
|
2335
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
2336
|
+
constructor(invitationIdentifier: XOInvitationIdentifier, templateIdentifier: XOTemplateIdentifier);
|
|
632
2337
|
}
|
|
633
2338
|
/**
|
|
634
|
-
*
|
|
2339
|
+
* Thrown when a merged input has neither valueSatoshis nor an outpoint, or a merged output has no valueSatoshis.
|
|
2340
|
+
*
|
|
2341
|
+
* @group Errors
|
|
635
2342
|
*/
|
|
636
|
-
declare class
|
|
637
|
-
|
|
2343
|
+
declare class MergedItemValueSatoshisMissingError extends Error {
|
|
2344
|
+
/**
|
|
2345
|
+
* Whether the item is a merged input or a merged output.
|
|
2346
|
+
*/
|
|
2347
|
+
readonly itemType: 'input' | 'output';
|
|
2348
|
+
/**
|
|
2349
|
+
* Position of the item in the merged input or output list.
|
|
2350
|
+
*/
|
|
2351
|
+
readonly itemIndex: number;
|
|
2352
|
+
/**
|
|
2353
|
+
* Commit that last wrote the item.
|
|
2354
|
+
*/
|
|
2355
|
+
readonly commitIdentifier: XOInvitationCommitIdentifier;
|
|
2356
|
+
constructor(itemType: 'input' | 'output', itemIndex: number, commitIdentifier: XOInvitationCommitIdentifier);
|
|
638
2357
|
}
|
|
639
2358
|
/**
|
|
640
|
-
*
|
|
2359
|
+
* Thrown when a merged output names a template output that defines no locking script and the commit that last wrote it provides no locking bytecode.
|
|
2360
|
+
*
|
|
2361
|
+
* @group Errors
|
|
641
2362
|
*/
|
|
642
|
-
declare class
|
|
643
|
-
|
|
2363
|
+
declare class MergedOutputLockingBytecodeMissingError extends Error {
|
|
2364
|
+
/**
|
|
2365
|
+
* Template output the merged output names.
|
|
2366
|
+
*/
|
|
2367
|
+
readonly outputIdentifier: XOTemplateOutputIdentifier;
|
|
2368
|
+
/**
|
|
2369
|
+
* Position of the output in the merged output list.
|
|
2370
|
+
*/
|
|
2371
|
+
readonly outputIndex: number;
|
|
2372
|
+
/**
|
|
2373
|
+
* Position of the output in the transaction when the commit or the template action sets it.
|
|
2374
|
+
*/
|
|
2375
|
+
readonly transactionIndex: number | undefined;
|
|
2376
|
+
/**
|
|
2377
|
+
* Commit that last wrote the output.
|
|
2378
|
+
*/
|
|
2379
|
+
readonly commitIdentifier: XOInvitationCommitIdentifier;
|
|
2380
|
+
/**
|
|
2381
|
+
* Template whose output defines no locking script.
|
|
2382
|
+
*/
|
|
2383
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
2384
|
+
constructor(outputIdentifier: XOTemplateOutputIdentifier, outputIndex: number, transactionIndex: number | undefined, commitIdentifier: XOInvitationCommitIdentifier, templateIdentifier: XOTemplateIdentifier);
|
|
644
2385
|
}
|
|
645
2386
|
/**
|
|
646
|
-
*
|
|
2387
|
+
* Thrown when the token on a merged input or output is missing its category or amount.
|
|
2388
|
+
*
|
|
2389
|
+
* @group Errors
|
|
647
2390
|
*/
|
|
648
|
-
declare class
|
|
649
|
-
|
|
2391
|
+
declare class MergedItemTokenIncompleteError extends Error {
|
|
2392
|
+
/**
|
|
2393
|
+
* Whether the item is a merged input or a merged output.
|
|
2394
|
+
*/
|
|
2395
|
+
readonly itemType: 'input' | 'output';
|
|
2396
|
+
/**
|
|
2397
|
+
* Position of the item in the merged input or output list.
|
|
2398
|
+
*/
|
|
2399
|
+
readonly itemIndex: number;
|
|
2400
|
+
/**
|
|
2401
|
+
* Commit that last wrote the item.
|
|
2402
|
+
*/
|
|
2403
|
+
readonly commitIdentifier: XOInvitationCommitIdentifier;
|
|
2404
|
+
constructor(itemType: 'input' | 'output', itemIndex: number, commitIdentifier: XOInvitationCommitIdentifier);
|
|
650
2405
|
}
|
|
651
2406
|
/**
|
|
652
|
-
*
|
|
2407
|
+
* Thrown when a token a commit supplies on an output has no category.
|
|
2408
|
+
*
|
|
2409
|
+
* @group Errors
|
|
653
2410
|
*/
|
|
654
|
-
declare class
|
|
655
|
-
|
|
2411
|
+
declare class CommitTokenCategoryMissingError extends Error {
|
|
2412
|
+
/**
|
|
2413
|
+
* Commit that last wrote the output.
|
|
2414
|
+
*/
|
|
2415
|
+
readonly commitIdentifier: XOInvitationCommitIdentifier;
|
|
2416
|
+
/**
|
|
2417
|
+
* Position of the output in the merged output list.
|
|
2418
|
+
*/
|
|
2419
|
+
readonly outputIndex: number;
|
|
2420
|
+
constructor(commitIdentifier: XOInvitationCommitIdentifier, outputIndex: number);
|
|
656
2421
|
}
|
|
657
2422
|
/**
|
|
658
|
-
*
|
|
2423
|
+
* Thrown when an NFT a commit supplies on an output has no capability.
|
|
2424
|
+
*
|
|
2425
|
+
* @group Errors
|
|
659
2426
|
*/
|
|
660
|
-
declare class
|
|
661
|
-
|
|
2427
|
+
declare class CommitTokenNftCapabilityMissingError extends Error {
|
|
2428
|
+
/**
|
|
2429
|
+
* Commit that last wrote the output.
|
|
2430
|
+
*/
|
|
2431
|
+
readonly commitIdentifier: XOInvitationCommitIdentifier;
|
|
2432
|
+
/**
|
|
2433
|
+
* Position of the output in the merged output list.
|
|
2434
|
+
*/
|
|
2435
|
+
readonly outputIndex: number;
|
|
2436
|
+
constructor(commitIdentifier: XOInvitationCommitIdentifier, outputIndex: number);
|
|
662
2437
|
}
|
|
2438
|
+
//#endregion
|
|
2439
|
+
//#region source/errors/compilation.d.ts
|
|
663
2440
|
/**
|
|
664
|
-
*
|
|
2441
|
+
* Thrown when a number variable value is not a valid integer for CashAssembly compilation.
|
|
2442
|
+
*
|
|
2443
|
+
* @group Errors
|
|
665
2444
|
*/
|
|
666
|
-
declare class
|
|
667
|
-
|
|
2445
|
+
declare class CashAssemblyVariableNotIntegerError extends Error {
|
|
2446
|
+
/**
|
|
2447
|
+
* Variable name whose value was rejected.
|
|
2448
|
+
*/
|
|
2449
|
+
readonly variableName: XOTemplateVariableIdentifier;
|
|
2450
|
+
/**
|
|
2451
|
+
* Numeric value that was not an integer.
|
|
2452
|
+
*/
|
|
2453
|
+
readonly value: number;
|
|
2454
|
+
constructor(variableName: XOTemplateVariableIdentifier, value: number);
|
|
668
2455
|
}
|
|
669
2456
|
/**
|
|
670
|
-
*
|
|
2457
|
+
* Thrown when a template locking script compiled from variables alone fails to compile.
|
|
2458
|
+
*
|
|
2459
|
+
* @group Errors
|
|
671
2460
|
*/
|
|
672
|
-
declare class
|
|
673
|
-
|
|
2461
|
+
declare class LockingScriptCompilationFailedError extends Error {
|
|
2462
|
+
/**
|
|
2463
|
+
* Template that defines the locking script.
|
|
2464
|
+
*/
|
|
2465
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
2466
|
+
/**
|
|
2467
|
+
* Locking script that failed to compile.
|
|
2468
|
+
*/
|
|
2469
|
+
readonly lockingScriptIdentifier: XOTemplateLockingScriptIdentifier;
|
|
2470
|
+
/**
|
|
2471
|
+
* Every error message the compiler reported.
|
|
2472
|
+
*/
|
|
2473
|
+
readonly compilationErrorMessages: string[];
|
|
2474
|
+
constructor(templateIdentifier: XOTemplateIdentifier, lockingScriptIdentifier: XOTemplateLockingScriptIdentifier, compilationErrorMessages: string[]);
|
|
674
2475
|
}
|
|
675
2476
|
/**
|
|
676
|
-
*
|
|
2477
|
+
* Thrown when a locking script stops compiling before it produces bytecode.
|
|
2478
|
+
*
|
|
2479
|
+
* @group Errors
|
|
677
2480
|
*/
|
|
678
|
-
declare class
|
|
679
|
-
|
|
2481
|
+
declare class LockingBytecodeGenerationFailedError extends Error {
|
|
2482
|
+
/**
|
|
2483
|
+
* Template that defines the locking script.
|
|
2484
|
+
*/
|
|
2485
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
2486
|
+
/**
|
|
2487
|
+
* Locking script that failed to compile.
|
|
2488
|
+
*/
|
|
2489
|
+
readonly lockingScriptIdentifier: XOTemplateLockingScriptIdentifier;
|
|
2490
|
+
/**
|
|
2491
|
+
* Script the compiler was compiling.
|
|
2492
|
+
*/
|
|
2493
|
+
readonly scriptId: string;
|
|
2494
|
+
/**
|
|
2495
|
+
* Compiler stage that stopped.
|
|
2496
|
+
*/
|
|
2497
|
+
readonly compilationStage: IncompleteScriptCompilation['compilationStage'];
|
|
2498
|
+
/**
|
|
2499
|
+
* Every error the compiler reported, with its source range.
|
|
2500
|
+
*/
|
|
2501
|
+
readonly compilationErrors: ScriptCompilationErrorDetail[];
|
|
2502
|
+
constructor(templateIdentifier: XOTemplateIdentifier, lockingScriptIdentifier: XOTemplateLockingScriptIdentifier, incompleteCompilation: IncompleteScriptCompilation);
|
|
680
2503
|
}
|
|
681
2504
|
/**
|
|
682
|
-
*
|
|
2505
|
+
* Thrown when an unlocking script stops compiling before it produces bytecode.
|
|
2506
|
+
*
|
|
2507
|
+
* @group Errors
|
|
683
2508
|
*/
|
|
684
|
-
declare class
|
|
685
|
-
|
|
2509
|
+
declare class UnlockingBytecodeGenerationFailedError extends Error {
|
|
2510
|
+
/**
|
|
2511
|
+
* Merged input whose unlocking script failed to compile.
|
|
2512
|
+
*/
|
|
2513
|
+
readonly inputIndex: number;
|
|
2514
|
+
/**
|
|
2515
|
+
* Script the compiler was compiling.
|
|
2516
|
+
*/
|
|
2517
|
+
readonly scriptId: string;
|
|
2518
|
+
/**
|
|
2519
|
+
* Compiler stage that stopped.
|
|
2520
|
+
*/
|
|
2521
|
+
readonly compilationStage: IncompleteScriptCompilation['compilationStage'];
|
|
2522
|
+
/**
|
|
2523
|
+
* Every error the compiler reported, with its source range.
|
|
2524
|
+
*/
|
|
2525
|
+
readonly compilationErrors: ScriptCompilationErrorDetail[];
|
|
2526
|
+
constructor(inputIndex: number, incompleteCompilation: IncompleteScriptCompilation);
|
|
686
2527
|
}
|
|
687
2528
|
/**
|
|
688
|
-
*
|
|
2529
|
+
* Thrown when a locking script uses existing secrets that this account has not generated for the invitation it is built for.
|
|
2530
|
+
* Only a generate list creates a secret, so a secret the script expects to exist is never generated in its place.
|
|
2531
|
+
*
|
|
2532
|
+
* @group Errors
|
|
689
2533
|
*/
|
|
690
|
-
declare class
|
|
691
|
-
|
|
2534
|
+
declare class LockingScriptSecretsNotFoundError extends Error {
|
|
2535
|
+
/**
|
|
2536
|
+
* Template that defines the locking script.
|
|
2537
|
+
*/
|
|
2538
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
2539
|
+
/**
|
|
2540
|
+
* Locking script that uses the secrets.
|
|
2541
|
+
*/
|
|
2542
|
+
readonly lockingScriptIdentifier: XOTemplateLockingScriptIdentifier;
|
|
2543
|
+
/**
|
|
2544
|
+
* Secrets the locking script uses that the invitation does not hold.
|
|
2545
|
+
*/
|
|
2546
|
+
readonly secretIdentifiers: XOTemplateSecretIdentifier[];
|
|
2547
|
+
/**
|
|
2548
|
+
* Role the locking script was built for, when one was given.
|
|
2549
|
+
*/
|
|
2550
|
+
readonly roleIdentifier: XOTemplateRoleIdentifier | undefined;
|
|
2551
|
+
/**
|
|
2552
|
+
* Invitation whose secrets were searched, when it is known.
|
|
2553
|
+
*/
|
|
2554
|
+
readonly invitationIdentifier: XOInvitationIdentifier | undefined;
|
|
2555
|
+
constructor(templateIdentifier: XOTemplateIdentifier, lockingScriptIdentifier: XOTemplateLockingScriptIdentifier, secretIdentifiers: XOTemplateSecretIdentifier[], roleIdentifier?: XOTemplateRoleIdentifier, invitationIdentifier?: XOInvitationIdentifier);
|
|
692
2556
|
}
|
|
693
2557
|
/**
|
|
694
|
-
*
|
|
2558
|
+
* Thrown when a locking script cannot be compiled yet because the compiler reports identifiers missing from the
|
|
2559
|
+
* compilation data, such as a public key of a key another entity holds. The operations the compiler resolved from this
|
|
2560
|
+
* account's keys are carried so they can be provided to the invitation.
|
|
2561
|
+
*
|
|
2562
|
+
* @group Errors
|
|
695
2563
|
*/
|
|
696
|
-
declare class
|
|
697
|
-
|
|
2564
|
+
declare class LockingScriptResolutionsMissingError extends Error {
|
|
2565
|
+
/**
|
|
2566
|
+
* Locking script that could not be compiled.
|
|
2567
|
+
*/
|
|
2568
|
+
readonly lockingScriptIdentifier: XOTemplateLockingScriptIdentifier;
|
|
2569
|
+
/**
|
|
2570
|
+
* Identifiers the compiler reports as missing.
|
|
2571
|
+
*/
|
|
2572
|
+
readonly missingIdentifiers: XOInvitationResolutionIdentifier[];
|
|
2573
|
+
/**
|
|
2574
|
+
* Operations on this account's keys the compiler resolved, keyed by their full identifier.
|
|
2575
|
+
*/
|
|
2576
|
+
readonly resolvedKeyOperations: Record<XOInvitationResolutionIdentifier, Uint8Array>;
|
|
2577
|
+
/**
|
|
2578
|
+
* Compiler errors with their source position, missing identifier, and owning entity.
|
|
2579
|
+
*/
|
|
2580
|
+
readonly compilationErrors: ScriptCompilationErrorDetail[];
|
|
2581
|
+
constructor(lockingScriptIdentifier: XOTemplateLockingScriptIdentifier, missingIdentifiers: XOInvitationResolutionIdentifier[], resolvedKeyOperations: Record<XOInvitationResolutionIdentifier, Uint8Array>, compilationErrors: ScriptCompilationErrorDetail[]);
|
|
698
2582
|
}
|
|
699
2583
|
/**
|
|
700
|
-
*
|
|
2584
|
+
* Thrown when an input's unlocking script cannot be compiled yet because the compiler reports identifiers missing from
|
|
2585
|
+
* the compilation data, such as a signature of a key another entity holds. The operations the compiler resolved from
|
|
2586
|
+
* this account's keys are carried so they can be provided to the invitation.
|
|
2587
|
+
*
|
|
2588
|
+
* @group Errors
|
|
701
2589
|
*/
|
|
702
|
-
declare class
|
|
703
|
-
|
|
2590
|
+
declare class UnlockingScriptResolutionsMissingError extends Error {
|
|
2591
|
+
/**
|
|
2592
|
+
* Merged input whose unlocking script could not be compiled.
|
|
2593
|
+
*/
|
|
2594
|
+
readonly inputIndex: number;
|
|
2595
|
+
/**
|
|
2596
|
+
* Identifiers the compiler reports as missing.
|
|
2597
|
+
*/
|
|
2598
|
+
readonly missingIdentifiers: XOInvitationResolutionIdentifier[];
|
|
2599
|
+
/**
|
|
2600
|
+
* Operations on this account's keys the compiler resolved, keyed by their full identifier.
|
|
2601
|
+
*/
|
|
2602
|
+
readonly resolvedKeyOperations: Record<XOInvitationResolutionIdentifier, Uint8Array>;
|
|
2603
|
+
/**
|
|
2604
|
+
* Compiler errors with their source position, missing identifier, and owning entity.
|
|
2605
|
+
*/
|
|
2606
|
+
readonly compilationErrors: ScriptCompilationErrorDetail[];
|
|
2607
|
+
constructor(inputIndex: number, missingIdentifiers: XOInvitationResolutionIdentifier[], resolvedKeyOperations: Record<XOInvitationResolutionIdentifier, Uint8Array>, compilationErrors: ScriptCompilationErrorDetail[]);
|
|
704
2608
|
}
|
|
705
2609
|
/**
|
|
706
|
-
*
|
|
2610
|
+
* Thrown when an unlocking bytecode built with values other participants provided does not unlock the output it spends.
|
|
2611
|
+
*
|
|
2612
|
+
* @group Errors
|
|
707
2613
|
*/
|
|
708
|
-
declare class
|
|
709
|
-
|
|
2614
|
+
declare class UnlockingBytecodeVerificationFailedError extends Error {
|
|
2615
|
+
/**
|
|
2616
|
+
* Merged input whose unlocking bytecode failed.
|
|
2617
|
+
*/
|
|
2618
|
+
readonly inputIndex: number;
|
|
2619
|
+
/**
|
|
2620
|
+
* Hash of the transaction that holds the spent output, as hexadecimal.
|
|
2621
|
+
*/
|
|
2622
|
+
readonly outpointTransactionHash: string;
|
|
2623
|
+
/**
|
|
2624
|
+
* Index of the spent output in that transaction.
|
|
2625
|
+
*/
|
|
2626
|
+
readonly outpointIndex: number;
|
|
2627
|
+
/**
|
|
2628
|
+
* Failure reported by the virtual machine.
|
|
2629
|
+
*/
|
|
2630
|
+
readonly reason: string;
|
|
2631
|
+
constructor(inputIndex: number, outpointTransactionHash: string, outpointIndex: number, reason: string);
|
|
710
2632
|
}
|
|
711
2633
|
/**
|
|
712
|
-
*
|
|
2634
|
+
* Thrown when the unlocking compilation of a merged input carries no compilation context to verify the unlocking bytecode against.
|
|
2635
|
+
*
|
|
2636
|
+
* @group Errors
|
|
713
2637
|
*/
|
|
714
|
-
declare class
|
|
715
|
-
|
|
2638
|
+
declare class UnlockingCompilationContextMissingError extends Error {
|
|
2639
|
+
/**
|
|
2640
|
+
* Invitation that owns the input.
|
|
2641
|
+
*/
|
|
2642
|
+
readonly invitationIdentifier: XOInvitationIdentifier;
|
|
2643
|
+
/**
|
|
2644
|
+
* Merged input whose compilation has no context.
|
|
2645
|
+
*/
|
|
2646
|
+
readonly inputIndex: number;
|
|
2647
|
+
constructor(invitationIdentifier: XOInvitationIdentifier, inputIndex: number);
|
|
716
2648
|
}
|
|
717
2649
|
/**
|
|
718
|
-
*
|
|
2650
|
+
* Thrown when this account is asked to add its own resolutions for an output, but it resolved none that the invitation
|
|
2651
|
+
* does not already hold.
|
|
2652
|
+
*
|
|
2653
|
+
* @group Errors
|
|
719
2654
|
*/
|
|
720
|
-
declare class
|
|
721
|
-
|
|
2655
|
+
declare class OutputOwnResolutionsNotFoundError extends Error {
|
|
2656
|
+
/**
|
|
2657
|
+
* Invitation the output belongs to.
|
|
2658
|
+
*/
|
|
2659
|
+
readonly invitationIdentifier: XOInvitationIdentifier;
|
|
2660
|
+
/**
|
|
2661
|
+
* Template output the resolutions were asked for.
|
|
2662
|
+
*/
|
|
2663
|
+
readonly outputIdentifier: XOTemplateOutputIdentifier;
|
|
2664
|
+
constructor(invitationIdentifier: XOInvitationIdentifier, outputIdentifier: XOTemplateOutputIdentifier);
|
|
722
2665
|
}
|
|
723
2666
|
/**
|
|
724
|
-
*
|
|
2667
|
+
* Thrown when this account is asked to add its own resolutions for an input, but it resolved none that the invitation
|
|
2668
|
+
* does not already hold.
|
|
2669
|
+
*
|
|
2670
|
+
* @group Errors
|
|
725
2671
|
*/
|
|
726
|
-
declare class
|
|
727
|
-
|
|
2672
|
+
declare class InputOwnResolutionsNotFoundError extends Error {
|
|
2673
|
+
/**
|
|
2674
|
+
* Invitation the input belongs to.
|
|
2675
|
+
*/
|
|
2676
|
+
readonly invitationIdentifier: XOInvitationIdentifier;
|
|
2677
|
+
/**
|
|
2678
|
+
* Merged input the resolutions were asked for.
|
|
2679
|
+
*/
|
|
2680
|
+
readonly inputIndex: number;
|
|
2681
|
+
constructor(invitationIdentifier: XOInvitationIdentifier, inputIndex: number);
|
|
728
2682
|
}
|
|
729
2683
|
/**
|
|
730
|
-
*
|
|
2684
|
+
* Thrown when a secret used to derive a key is declared in the template with a type other than private_key.
|
|
2685
|
+
*
|
|
2686
|
+
* @group Errors
|
|
731
2687
|
*/
|
|
732
|
-
declare class
|
|
733
|
-
|
|
2688
|
+
declare class SecretIdentifierTypeInvalidError extends Error {
|
|
2689
|
+
/**
|
|
2690
|
+
* Template that declares the secret.
|
|
2691
|
+
*/
|
|
2692
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
2693
|
+
/**
|
|
2694
|
+
* Secret identifier whose template variable is not a private key.
|
|
2695
|
+
*/
|
|
2696
|
+
readonly secretIdentifier: XOTemplateSecretIdentifier;
|
|
2697
|
+
/**
|
|
2698
|
+
* Type the template declares for the secret, undefined when the template does not declare it.
|
|
2699
|
+
*/
|
|
2700
|
+
readonly declaredType: string | undefined;
|
|
2701
|
+
constructor(templateIdentifier: XOTemplateIdentifier, secretIdentifier: XOTemplateSecretIdentifier, declaredType?: string);
|
|
734
2702
|
}
|
|
735
2703
|
/**
|
|
736
|
-
*
|
|
2704
|
+
* Thrown when variables an intent requires are missing from the provided values.
|
|
2705
|
+
*
|
|
2706
|
+
* @group Errors
|
|
737
2707
|
*/
|
|
738
|
-
declare class
|
|
739
|
-
|
|
2708
|
+
declare class IntentVariablesMissingError extends Error {
|
|
2709
|
+
/**
|
|
2710
|
+
* Template that defines the intent.
|
|
2711
|
+
*/
|
|
2712
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
2713
|
+
/**
|
|
2714
|
+
* Locking script the intent generates.
|
|
2715
|
+
*/
|
|
2716
|
+
readonly lockingScriptIdentifier: XOTemplateLockingScriptIdentifier;
|
|
2717
|
+
/**
|
|
2718
|
+
* Variables the intent requires that have no provided value.
|
|
2719
|
+
*/
|
|
2720
|
+
readonly variableIdentifiers: XOTemplateVariableIdentifier[];
|
|
2721
|
+
constructor(templateIdentifier: XOTemplateIdentifier, lockingScriptIdentifier: XOTemplateLockingScriptIdentifier, variableIdentifiers: XOTemplateVariableIdentifier[]);
|
|
740
2722
|
}
|
|
2723
|
+
//#endregion
|
|
2724
|
+
//#region source/errors/transaction.d.ts
|
|
741
2725
|
/**
|
|
742
|
-
*
|
|
2726
|
+
* Thrown when a parent transaction has no output at the requested index.
|
|
2727
|
+
*
|
|
2728
|
+
* @group Errors
|
|
743
2729
|
*/
|
|
744
|
-
declare class
|
|
745
|
-
|
|
2730
|
+
declare class TransactionOutputNotFoundError extends Error {
|
|
2731
|
+
/**
|
|
2732
|
+
* Parent transaction hash that was searched.
|
|
2733
|
+
*/
|
|
2734
|
+
readonly transactionHash: string;
|
|
2735
|
+
/**
|
|
2736
|
+
* Output index that was looked up.
|
|
2737
|
+
*/
|
|
2738
|
+
readonly outputIndex: number;
|
|
2739
|
+
constructor(transactionHash: string, outputIndex: number);
|
|
746
2740
|
}
|
|
747
2741
|
/**
|
|
748
|
-
*
|
|
2742
|
+
* Thrown when transaction generation fails.
|
|
2743
|
+
*
|
|
2744
|
+
* @group Errors
|
|
749
2745
|
*/
|
|
750
|
-
declare class
|
|
751
|
-
|
|
2746
|
+
declare class TransactionGenerationFailedError extends Error {
|
|
2747
|
+
/**
|
|
2748
|
+
* Template that defines the action.
|
|
2749
|
+
*/
|
|
2750
|
+
readonly templateIdentifier: XOTemplateIdentifier;
|
|
2751
|
+
/**
|
|
2752
|
+
* Action whose transaction failed to generate.
|
|
2753
|
+
*/
|
|
2754
|
+
readonly actionIdentifier: XOTemplateActionIdentifier;
|
|
2755
|
+
/**
|
|
2756
|
+
* Generation failure reported by Libauth.
|
|
2757
|
+
*/
|
|
2758
|
+
readonly reason: string;
|
|
2759
|
+
constructor(templateIdentifier: XOTemplateIdentifier, actionIdentifier: XOTemplateActionIdentifier, reason: string);
|
|
752
2760
|
}
|
|
753
2761
|
/**
|
|
754
|
-
*
|
|
2762
|
+
* Thrown when a transaction result already exists for the given template transaction identifier.
|
|
2763
|
+
*
|
|
2764
|
+
* @group Errors
|
|
755
2765
|
*/
|
|
756
|
-
declare class
|
|
757
|
-
|
|
2766
|
+
declare class TransactionResultAlreadyExistsError extends Error {
|
|
2767
|
+
/**
|
|
2768
|
+
* Invitation that already has the result.
|
|
2769
|
+
*/
|
|
2770
|
+
readonly invitationIdentifier: XOInvitationIdentifier;
|
|
2771
|
+
/**
|
|
2772
|
+
* Template transaction identifier that already has a result.
|
|
2773
|
+
*/
|
|
2774
|
+
readonly transactionIdentifier: XOTemplateTransactionIdentifier;
|
|
2775
|
+
constructor(invitationIdentifier: XOInvitationIdentifier, transactionIdentifier: XOTemplateTransactionIdentifier);
|
|
758
2776
|
}
|
|
759
2777
|
/**
|
|
760
|
-
*
|
|
2778
|
+
* Thrown when a transaction result is absent for the given template transaction identifier.
|
|
2779
|
+
*
|
|
2780
|
+
* @group Errors
|
|
761
2781
|
*/
|
|
762
|
-
declare class
|
|
763
|
-
|
|
2782
|
+
declare class TransactionResultNotFoundError extends Error {
|
|
2783
|
+
/**
|
|
2784
|
+
* Invitation that was searched.
|
|
2785
|
+
*/
|
|
2786
|
+
readonly invitationIdentifier: XOInvitationIdentifier;
|
|
2787
|
+
/**
|
|
2788
|
+
* Template transaction identifier whose result was missing.
|
|
2789
|
+
*/
|
|
2790
|
+
readonly transactionIdentifier: XOTemplateTransactionIdentifier;
|
|
2791
|
+
constructor(invitationIdentifier: XOInvitationIdentifier, transactionIdentifier: XOTemplateTransactionIdentifier);
|
|
764
2792
|
}
|
|
765
2793
|
/**
|
|
766
|
-
*
|
|
2794
|
+
* Thrown when a built invitation transaction cannot be broadcast to the network.
|
|
2795
|
+
*
|
|
2796
|
+
* @group Errors
|
|
767
2797
|
*/
|
|
768
|
-
declare class
|
|
769
|
-
|
|
2798
|
+
declare class TransactionBroadcastFailedError extends Error {
|
|
2799
|
+
/**
|
|
2800
|
+
* Invitation the transaction was built from.
|
|
2801
|
+
*/
|
|
2802
|
+
readonly invitationIdentifier: XOInvitationIdentifier;
|
|
2803
|
+
/**
|
|
2804
|
+
* Hash of the transaction that was broadcast.
|
|
2805
|
+
*/
|
|
2806
|
+
readonly transactionHash: string;
|
|
2807
|
+
/**
|
|
2808
|
+
* Reason the Electrum servers reported for rejecting the transaction.
|
|
2809
|
+
*/
|
|
2810
|
+
readonly reason: string;
|
|
2811
|
+
constructor(invitationIdentifier: XOInvitationIdentifier, transactionHash: string, reason: string, options?: {
|
|
2812
|
+
cause?: unknown;
|
|
2813
|
+
});
|
|
770
2814
|
}
|
|
2815
|
+
//#endregion
|
|
2816
|
+
//#region source/errors/wallet.d.ts
|
|
771
2817
|
/**
|
|
772
|
-
*
|
|
2818
|
+
* Thrown when a wallet default policy is used before it has been set.
|
|
2819
|
+
*
|
|
2820
|
+
* @group Errors
|
|
773
2821
|
*/
|
|
774
|
-
declare class
|
|
775
|
-
|
|
2822
|
+
declare class DefaultPolicyNotSetError extends Error {
|
|
2823
|
+
/**
|
|
2824
|
+
* Default policy that was looked up.
|
|
2825
|
+
*/
|
|
2826
|
+
readonly policy: keyof WalletDefaultPolicies;
|
|
2827
|
+
constructor(policy: keyof WalletDefaultPolicies);
|
|
776
2828
|
}
|
|
777
2829
|
/**
|
|
778
|
-
*
|
|
2830
|
+
* Thrown when a wallet name is empty or contains only whitespace.
|
|
2831
|
+
*
|
|
2832
|
+
* @group Errors
|
|
779
2833
|
*/
|
|
780
|
-
declare class
|
|
2834
|
+
declare class WalletNameMissingError extends Error {
|
|
781
2835
|
constructor();
|
|
782
2836
|
}
|
|
2837
|
+
//#endregion
|
|
2838
|
+
//#region source/invitation/generation/locking-bytecode.d.ts
|
|
783
2839
|
/**
|
|
784
|
-
*
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
2840
|
+
* Resolves the locking bytecode an invitation output compiles to, without generating or storing anything.
|
|
2841
|
+
*
|
|
2842
|
+
* The locking script compiles with the template constants, the invitation variables, and the keys this account already
|
|
2843
|
+
* generated for the invitation, which is what appending the output uses. It is the keyed counterpart of resolving a
|
|
2844
|
+
* template output from variables alone. The script's secrets are existing secrets and are never generated for it, so a
|
|
2845
|
+
* secret the invitation does not hold fails the resolution the same way adding the output would.
|
|
2846
|
+
*
|
|
2847
|
+
* @param {Pick<Required<AccountContext>, 'state' | 'crypto'>} context - State that stores the invitation and crypto that compiles with its keys.
|
|
2848
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - Invitation the output belongs to.
|
|
2849
|
+
* @param {XOTemplateOutputIdentifier} outputIdentifier - Template output to resolve.
|
|
2850
|
+
* @param {XOTemplateRoleIdentifier} [roleIdentifier] - Role on the output, when one is set.
|
|
2851
|
+
* @returns {Promise<string>} - The locking bytecode as a hexadecimal string.
|
|
2852
|
+
* @throws {@link InvitationNotFoundInStoreError} - If the invitation is not found in the store.
|
|
2853
|
+
* @throws {@link TemplateOutputNotFoundError} - If the template does not define the output.
|
|
2854
|
+
* @throws {@link TemplateLockingScriptRoleNotFoundError} - If the role is not defined on the output's locking script.
|
|
2855
|
+
* @throws {@link LockingScriptSecretsNotFoundError} - If the locking script uses secrets this account has not generated for the invitation.
|
|
2856
|
+
* @throws {@link LockingScriptResolutionsMissingError} - If the script uses key operations other participants have not resolved yet.
|
|
2857
|
+
* @throws {@link LockingBytecodeGenerationFailedError} - If the locking bytecode cannot be compiled.
|
|
2858
|
+
* @throws {@link SecretDataNotFoundError} - If a secret recorded for this invitation is not in the secret store.
|
|
2859
|
+
* @throws {@link CashAssemblyCompilationFailedError} - If the output locking script is a CashAssembly expression that cannot be compiled.
|
|
2860
|
+
* @throws {@link LockingScriptCompilationFailedError} - If the template locking script the output names cannot be compiled.
|
|
2861
|
+
*/
|
|
2862
|
+
declare const resolveInvitationOutputLockingBytecode: (context: Pick<Required<AccountContext>, "state" | "crypto">, invitationIdentifier: XOInvitationIdentifier, outputIdentifier: XOTemplateOutputIdentifier, roleIdentifier?: XOTemplateRoleIdentifier) => Promise<string>;
|
|
2863
|
+
/**
|
|
2864
|
+
* Lists the key operations an invitation output's locking script needs from participants, without adding anything.
|
|
2865
|
+
*
|
|
2866
|
+
* The output compiles with the same variables, keys, and resolutions as when it is added. Each operation is reported as
|
|
2867
|
+
* provided when the invitation holds it, as this account's own when only this account's keys resolve it, or as missing
|
|
2868
|
+
* when another participant holds the key. An output whose locking script is a CashAssembly expression uses no keys.
|
|
2869
|
+
*
|
|
2870
|
+
* @param {Pick<Required<AccountContext>, 'state' | 'crypto'>} context - State that stores the invitation and crypto that compiles with its keys.
|
|
2871
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - Invitation the output belongs to.
|
|
2872
|
+
* @param {XOTemplateOutputIdentifier} outputIdentifier - Template output to check.
|
|
2873
|
+
* @param {XOTemplateRoleIdentifier} [roleIdentifier] - Role on the output, when one is set.
|
|
2874
|
+
* @returns {Promise<InvitationResolutionRequirements>} - Provided identifiers, values this account can add, and identifiers others still owe.
|
|
2875
|
+
* @throws {@link InvitationNotFoundInStoreError} - If the invitation is not found in the store.
|
|
2876
|
+
* @throws {@link TemplateOutputNotFoundError} - If the template does not define the output.
|
|
2877
|
+
* @throws {@link TemplateLockingScriptRoleNotFoundError} - If the role is not defined on the output's locking script.
|
|
2878
|
+
* @throws {@link LockingScriptSecretsNotFoundError} - If the locking script uses secrets this account has not generated for the invitation.
|
|
2879
|
+
* @throws {@link LockingBytecodeGenerationFailedError} - If the locking script fails to compile for a reason other than a missing identifier.
|
|
2880
|
+
* @throws {@link SecretDataNotFoundError} - If a secret recorded for this invitation is not in the secret store.
|
|
2881
|
+
*/
|
|
2882
|
+
declare const listOutputResolutions: (context: Pick<Required<AccountContext>, "state" | "crypto">, invitationIdentifier: XOInvitationIdentifier, outputIdentifier: XOTemplateOutputIdentifier, roleIdentifier?: XOTemplateRoleIdentifier) => Promise<InvitationResolutionRequirements>;
|
|
2883
|
+
/**
|
|
2884
|
+
* Adds the key operations this account resolved for an invitation output to the invitation, so other participants can
|
|
2885
|
+
* compile the same locking script.
|
|
2886
|
+
*
|
|
2887
|
+
* Only values the invitation does not hold yet are added, in one commit. Use {@link listOutputResolutions}
|
|
2888
|
+
* first to check that there is something to add.
|
|
2889
|
+
*
|
|
2890
|
+
* @param {Required<AccountContext>} context - State, signing, and network for this account.
|
|
2891
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - Invitation the output belongs to.
|
|
2892
|
+
* @param {XOTemplateOutputIdentifier} outputIdentifier - Template output whose locking script the values are for.
|
|
2893
|
+
* @param {XOTemplateRoleIdentifier} [roleIdentifier] - Role on the output, when one is set.
|
|
2894
|
+
* @returns {Promise<StoredInvitation>} - The invitation as stored after the commit with the values.
|
|
2895
|
+
* @throws {@link OutputOwnResolutionsNotFoundError} - If this account resolved nothing the invitation does not already hold.
|
|
2896
|
+
* @throws {@link InvitationNotFoundInStoreError} - If the invitation is not found in the store.
|
|
2897
|
+
* @throws {@link TemplateOutputNotFoundError} - If the template does not define the output.
|
|
2898
|
+
* @throws {@link TemplateLockingScriptRoleNotFoundError} - If the role is not defined on the output's locking script.
|
|
2899
|
+
* @throws {@link LockingScriptSecretsNotFoundError} - If the locking script uses secrets this account has not generated for the invitation.
|
|
2900
|
+
* @throws {@link LockingBytecodeGenerationFailedError} - If the locking script fails to compile for a reason other than a missing identifier.
|
|
2901
|
+
* @throws {@link SecretDataNotFoundError} - If a secret recorded for this invitation is not in the secret store.
|
|
2902
|
+
*/
|
|
2903
|
+
declare const appendOwnOutputResolutions: (context: Required<AccountContext>, invitationIdentifier: XOInvitationIdentifier, outputIdentifier: XOTemplateOutputIdentifier, roleIdentifier?: XOTemplateRoleIdentifier) => Promise<StoredInvitation>;
|
|
2904
|
+
//#endregion
|
|
2905
|
+
//#region source/invitation/helpers/commits.d.ts
|
|
789
2906
|
/**
|
|
790
|
-
*
|
|
2907
|
+
* Comparison between the locally stored invitation and incoming shared invitation JSON.
|
|
791
2908
|
*/
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
2909
|
+
type InvitationCommitHistoryComparison = {
|
|
2910
|
+
storedCommitCount: number;
|
|
2911
|
+
incomingCommitCount: number;
|
|
2912
|
+
sharedHistoryCommitCount: number;
|
|
2913
|
+
newCommitCount: number;
|
|
2914
|
+
newCommits: XOInvitationCommit[];
|
|
2915
|
+
historyConflictCommitIdentifier: XOInvitationCommitIdentifier | null;
|
|
2916
|
+
};
|
|
795
2917
|
/**
|
|
796
|
-
*
|
|
2918
|
+
* Compares stored and incoming commit chains for shared prefix history and appended commits.
|
|
2919
|
+
*
|
|
2920
|
+
* @param {XOInvitation} storedInvitation - Invitation currently in local storage.
|
|
2921
|
+
* @param {XOInvitation} incomingInvitation - Invitation from shared JSON or remote sync.
|
|
2922
|
+
* @returns {InvitationCommitHistoryComparison} - Diff of the shared commit prefix and the commits that were appended.
|
|
797
2923
|
*/
|
|
798
|
-
declare
|
|
799
|
-
constructor();
|
|
800
|
-
}
|
|
2924
|
+
declare const compareInvitationCommitHistories: (storedInvitation: XOInvitation, incomingInvitation: XOInvitation) => InvitationCommitHistoryComparison;
|
|
801
2925
|
/**
|
|
802
|
-
*
|
|
2926
|
+
* Finds the root commit identifier for a given entity in an invitation. The root commit is
|
|
2927
|
+
* the first commit the entity added to the invitation.
|
|
2928
|
+
*
|
|
2929
|
+
* @param {XOInvitation} invitation - The invitation whose commits are searched.
|
|
2930
|
+
* @param {XOInvitationEntityIdentifier} entityIdentifier - The entity identifier to search for among the invitation commits.
|
|
2931
|
+
* @returns {XOInvitationCommitIdentifier | undefined} - The root commit identifier if the entity has a commit in the invitation, otherwise undefined.
|
|
803
2932
|
*/
|
|
804
|
-
declare
|
|
805
|
-
constructor();
|
|
806
|
-
}
|
|
2933
|
+
declare const findRootCommitIdentifierInInvitation: (invitation: XOInvitation, entityIdentifier: XOInvitationEntityIdentifier) => XOInvitationCommitIdentifier | undefined;
|
|
807
2934
|
/**
|
|
808
|
-
*
|
|
2935
|
+
* Finds all commits in the invitation that were made by the specified entity.
|
|
2936
|
+
* The returned array preserves the original commit order.
|
|
2937
|
+
*
|
|
2938
|
+
* @param {XOInvitation} invitation - The invitation to examine.
|
|
2939
|
+
* @param {XOInvitationEntityIdentifier} entityIdentifier - The entity whose commits should be returned.
|
|
2940
|
+
* @returns {XOInvitationCommit[]} - Commits that belong to the entity, in the order they appear in the invitation.
|
|
809
2941
|
*/
|
|
810
|
-
declare
|
|
811
|
-
|
|
812
|
-
|
|
2942
|
+
declare const listCommitsForEntity: (invitation: XOInvitation, entityIdentifier: XOInvitationEntityIdentifier) => XOInvitationCommit[];
|
|
2943
|
+
//#endregion
|
|
2944
|
+
//#region source/invitation/helpers/identifiers.d.ts
|
|
813
2945
|
/**
|
|
814
|
-
*
|
|
2946
|
+
* Generates a random invitation identifier from {@link INVITATION_IDENTIFIER_BYTE_LENGTH} random bytes.
|
|
2947
|
+
*
|
|
2948
|
+
* @returns {XOInvitationIdentifier} - The generated invitation identifier as a hex string.
|
|
2949
|
+
* @throws {@link InvitationIdentifierAllZeroesError} - If the random bytes are all zeroes.
|
|
2950
|
+
* @throws {@link InvitationIdentifierMaximumError} - If the random bytes are all 0xFF.
|
|
2951
|
+
* @throws {Error} - If {@link generateRandomBytes} rejects the environment cryptographically secure pseudo-random number generator.
|
|
815
2952
|
*/
|
|
816
|
-
declare
|
|
817
|
-
constructor();
|
|
818
|
-
}
|
|
2953
|
+
declare const generateInvitationIdentifier: () => XOInvitationIdentifier;
|
|
819
2954
|
/**
|
|
820
|
-
*
|
|
2955
|
+
* Generates a random commit identifier from {@link COMMIT_IDENTIFIER_BYTE_LENGTH} random bytes.
|
|
2956
|
+
*
|
|
2957
|
+
* @returns {XOInvitationCommitIdentifier} - The generated commit identifier as a hex string.
|
|
2958
|
+
* @throws {@link CommitIdentifierAllZeroesError} - If the random bytes are all zeroes.
|
|
2959
|
+
* @throws {@link CommitIdentifierMaximumError} - If the random bytes are all 0xFF.
|
|
2960
|
+
* @throws {Error} - If {@link generateRandomBytes} rejects the environment cryptographically secure pseudo-random number generator.
|
|
821
2961
|
*/
|
|
822
|
-
declare
|
|
823
|
-
|
|
824
|
-
|
|
2962
|
+
declare const generateCommitIdentifier: () => XOInvitationCommitIdentifier;
|
|
2963
|
+
//#endregion
|
|
2964
|
+
//#region source/invitation/helpers/outputs.d.ts
|
|
825
2965
|
/**
|
|
826
|
-
*
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
2966
|
+
* Lists the outputs of an invitation that are relevant to this account, but not stored yet.
|
|
2967
|
+
*
|
|
2968
|
+
* An output is relevant to this account when the account holds secrets the locking script declares for one of its roles,
|
|
2969
|
+
* and compiling the script for that role with those keys and the invitation's resolutions gives the output's locking bytecode.
|
|
2970
|
+
* Each such output is returned as the script hash data to store, so the account can track it and later unlock it with the same keys.
|
|
2971
|
+
*
|
|
2972
|
+
* @param {Pick<Required<AccountContext>, 'state' | 'crypto'>} context - State that stores the invitation and crypto that compiles with its keys.
|
|
2973
|
+
* @param {StoredInvitation} storedInvitation - Invitation whose outputs are checked.
|
|
2974
|
+
* @returns {Promise<ScriptHashData[]>} - Script hash data of every output relevant to this account that is not stored yet.
|
|
2975
|
+
* @throws {@link TemplateNotFoundInStoreError} - If the invitation template is not stored.
|
|
2976
|
+
* @throws {@link SecretDataNotFoundError} - If a secret recorded for this invitation is not in the secret store.
|
|
2977
|
+
* @throws {@link InvitationResolutionIdentifierInvalidError} - If a resolution is not an operation on a template key.
|
|
2978
|
+
*/
|
|
2979
|
+
declare const listRelevantInvitationOutputsMissingFromStore: (context: Pick<Required<AccountContext>, "state" | "crypto">, storedInvitation: StoredInvitation) => Promise<ScriptHashData[]>;
|
|
2980
|
+
//#endregion
|
|
2981
|
+
//#region source/invitation/helpers/roles.d.ts
|
|
831
2982
|
/**
|
|
832
|
-
*
|
|
2983
|
+
* Lists the roles a commit takes for its entity.
|
|
2984
|
+
*
|
|
2985
|
+
* A commit takes a role when it names the role in its data, or when it tags a variable, input, output, or resolution
|
|
2986
|
+
* with the role. This is the same rule the slot count of a role uses.
|
|
2987
|
+
*
|
|
2988
|
+
* @param {XOInvitationCommit} commit - Commit whose roles are read.
|
|
2989
|
+
* @returns {Set<XOTemplateRoleIdentifier>} - Every role the commit takes.
|
|
833
2990
|
*/
|
|
834
|
-
declare
|
|
835
|
-
constructor(entityIdentifier?: string);
|
|
836
|
-
}
|
|
2991
|
+
declare const listCommitRoleIdentifiers: (commit: XOInvitationCommit) => Set<XOTemplateRoleIdentifier>;
|
|
837
2992
|
/**
|
|
838
|
-
*
|
|
2993
|
+
* Lists the entities holding each role of an invitation's action.
|
|
2994
|
+
*
|
|
2995
|
+
* Roles are taken in commit order, by naming the role in the commit data or by tagging an item with it, and a role
|
|
2996
|
+
* holds at most the maximum number of entities its slots allow. This is who may provide each role's variables.
|
|
2997
|
+
*
|
|
2998
|
+
* @param {XOInvitation} invitation - Invitation whose commits take the roles.
|
|
2999
|
+
* @param {XOTemplate} template - Template that defines the invitation action and its slots.
|
|
3000
|
+
* @returns {Record<XOTemplateRoleIdentifier, XOInvitationEntityIdentifier[]>} - Entities holding each taken role, in the order they took it.
|
|
3001
|
+
* @throws {@link TemplateActionNotFoundError} - When the template does not define the invitation action.
|
|
839
3002
|
*/
|
|
840
|
-
declare
|
|
841
|
-
constructor();
|
|
842
|
-
}
|
|
3003
|
+
declare const listRoleHolderEntities: (invitation: XOInvitation, template: XOTemplate) => Record<XOTemplateRoleIdentifier, XOInvitationEntityIdentifier[]>;
|
|
843
3004
|
/**
|
|
844
|
-
*
|
|
3005
|
+
* Lists the roles that have a follow up in the outputs an action produces.
|
|
3006
|
+
*
|
|
3007
|
+
* A locking script names, for each role it declares, what that role does with an output locked to it, such as the
|
|
3008
|
+
* state it saves, the actions it can take next, and how the output counts toward its balance. A role has a follow up
|
|
3009
|
+
* when the locking script of any output in the action's transaction declares it. An output whose locking script is a
|
|
3010
|
+
* CashAssembly expression declares no roles.
|
|
3011
|
+
*
|
|
3012
|
+
* @param {XOTemplate} template - Template that defines the action, its transaction, outputs, and locking scripts.
|
|
3013
|
+
* @param {XOTemplateActionIdentifier} actionIdentifier - Action whose produced outputs are read.
|
|
3014
|
+
* @returns {Set<XOTemplateRoleIdentifier>} - Roles declared by a locking script of the action's outputs.
|
|
3015
|
+
* @throws {@link TemplateActionNotFoundError} - When the template does not define the action.
|
|
845
3016
|
*/
|
|
846
|
-
declare
|
|
847
|
-
constructor();
|
|
848
|
-
}
|
|
3017
|
+
declare const listFollowUpRoleIdentifiers: (template: XOTemplate, actionIdentifier: XOTemplateActionIdentifier) => Set<XOTemplateRoleIdentifier>;
|
|
849
3018
|
/**
|
|
850
|
-
*
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
3019
|
+
* Finds the role an entity holds in an invitation that a locking script declares.
|
|
3020
|
+
*
|
|
3021
|
+
* An output added without a role is built for the role its entity already holds, when the output's locking script
|
|
3022
|
+
* declares exactly one of the entity's roles. That role decides the keys the script is built with and the follow up
|
|
3023
|
+
* stored for it.
|
|
3024
|
+
*
|
|
3025
|
+
* @param {XOInvitation} invitation - Invitation whose commits give the entity its roles.
|
|
3026
|
+
* @param {XOTemplate} template - Template that defines the invitation action and the locking script.
|
|
3027
|
+
* @param {XOInvitationEntityIdentifier} entityIdentifier - Entity whose role is looked up.
|
|
3028
|
+
* @param {XOTemplateLockingScriptIdentifier} lockingScriptIdentifier - Locking script whose declared roles are read.
|
|
3029
|
+
* @returns {XOTemplateRoleIdentifier | undefined} - The one role the entity holds that the locking script declares, or undefined when
|
|
3030
|
+
* there is none or more than one.
|
|
3031
|
+
* @throws {@link TemplateActionNotFoundError} - When the template does not define the invitation action.
|
|
3032
|
+
*/
|
|
3033
|
+
declare const findEntityLockingScriptRole: (invitation: XOInvitation, template: XOTemplate, entityIdentifier: XOInvitationEntityIdentifier, lockingScriptIdentifier: XOTemplateLockingScriptIdentifier) => XOTemplateRoleIdentifier | undefined;
|
|
3034
|
+
//#endregion
|
|
3035
|
+
//#region source/invitation/helpers/transaction-result.d.ts
|
|
855
3036
|
/**
|
|
856
|
-
*
|
|
3037
|
+
* Reads the persisted transaction hash for one template transaction.
|
|
3038
|
+
*
|
|
3039
|
+
* Write paths construct {@link TransactionHash} before persist, so a stored hash is already valid.
|
|
3040
|
+
*
|
|
3041
|
+
* @param {XOInvitation} invitation - Invitation that may store the hash under `result.transactions`.
|
|
3042
|
+
* @param {XOTemplateTransactionIdentifier} transactionIdentifier - Template transaction identifier for the action.
|
|
3043
|
+
* @returns {XOInvitationTransactionHash | undefined} - Transaction hash when present, otherwise undefined.
|
|
857
3044
|
*/
|
|
858
|
-
declare
|
|
859
|
-
constructor(outputIdentifier: string);
|
|
860
|
-
}
|
|
3045
|
+
declare const getInvitationTransactionHash: (invitation: XOInvitation, transactionIdentifier: XOTemplateTransactionIdentifier) => XOInvitationTransactionHash | undefined;
|
|
861
3046
|
/**
|
|
862
|
-
*
|
|
3047
|
+
* Returns true when a stored transaction created result has a verifiable Schnorr signature.
|
|
3048
|
+
*
|
|
3049
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - Invitation that owns the transaction result.
|
|
3050
|
+
* @param {XOInvitationTransactionResult} transactionResult - Transaction result to inspect.
|
|
3051
|
+
* @returns {boolean} - Whether the created result is complete enough to treat as persisted execution output.
|
|
863
3052
|
*/
|
|
864
|
-
declare
|
|
865
|
-
constructor(outputIdentifier: string, expectedType: string, actualType: string);
|
|
866
|
-
}
|
|
3053
|
+
declare const isInvitationTransactionCreatedResultComplete: (invitationIdentifier: XOInvitationIdentifier, transactionResult: XOInvitationTransactionResult) => boolean;
|
|
867
3054
|
/**
|
|
868
|
-
*
|
|
3055
|
+
* Attaches one transaction result to an invitation under `result.transactions`.
|
|
3056
|
+
*
|
|
3057
|
+
* @param {XOInvitation} invitation - Invitation to update.
|
|
3058
|
+
* @param {XOTemplateTransactionIdentifier} transactionIdentifier - Template transaction identifier for the action.
|
|
3059
|
+
* @param {XOInvitationTransactionResult} transactionResult - Transaction result to store.
|
|
3060
|
+
* @returns {XOInvitation} - Invitation with the transaction result merged into `result`.
|
|
869
3061
|
*/
|
|
870
|
-
declare
|
|
871
|
-
constructor(outputIdentifier: string, validTypes: string[], actualType: string | undefined);
|
|
872
|
-
}
|
|
3062
|
+
declare const applyInvitationTransactionResultToInvitation: (invitation: XOInvitation, transactionIdentifier: XOTemplateTransactionIdentifier, transactionResult: XOInvitationTransactionResult) => XOInvitation;
|
|
873
3063
|
/**
|
|
874
|
-
*
|
|
3064
|
+
* Returns true when an update changes only the persisted transaction hash and leaves commit history unchanged.
|
|
3065
|
+
*
|
|
3066
|
+
* @param {XOInvitation} storedInvitation - Invitation currently in local storage.
|
|
3067
|
+
* @param {XOInvitation} incomingInvitation - Invitation from shared JSON or remote sync.
|
|
3068
|
+
* @param {XOTemplate} template - Template that defines the action transaction key.
|
|
3069
|
+
* @param {InvitationCommitHistoryComparison} invitationCommitHistoryComparison - Commit history diff from compareInvitationCommitHistories.
|
|
3070
|
+
* @returns {boolean} - Whether validation can be skipped for a hash only write.
|
|
875
3071
|
*/
|
|
876
|
-
declare
|
|
877
|
-
constructor(expectedType: string, actualType: string);
|
|
878
|
-
}
|
|
3072
|
+
declare const isInvitationTransactionHashOnlyUpdate: (storedInvitation: XOInvitation, incomingInvitation: XOInvitation, template: XOTemplate, invitationCommitHistoryComparison: InvitationCommitHistoryComparison) => boolean;
|
|
879
3073
|
/**
|
|
880
|
-
*
|
|
3074
|
+
* Merges an incoming hash only update into the stored invitation result while preserving other result metadata.
|
|
3075
|
+
*
|
|
3076
|
+
* A hash is written only onto an existing created result. Incomplete entity or signature placeholders are never synthesized.
|
|
3077
|
+
*
|
|
3078
|
+
* @param {XOInvitation} storedInvitation - Shared invitation currently in local storage.
|
|
3079
|
+
* @param {XOInvitation} incomingInvitation - Shared invitation carrying the new hash.
|
|
3080
|
+
* @param {XOTemplate} template - Template that defines the action transaction key.
|
|
3081
|
+
* @returns {XOInvitation} - Shared invitation ready for persistence with the updated transaction hash.
|
|
3082
|
+
* @throws {Error} - When the incoming hash fails {@link TransactionHash} construction.
|
|
881
3083
|
*/
|
|
882
|
-
declare
|
|
883
|
-
|
|
884
|
-
|
|
3084
|
+
declare const mergeInvitationTransactionHashOnlyUpdate: (storedInvitation: XOInvitation, incomingInvitation: XOInvitation, template: XOTemplate) => XOInvitation;
|
|
3085
|
+
//#endregion
|
|
3086
|
+
//#region source/invitation/participation/builder.d.ts
|
|
885
3087
|
/**
|
|
886
|
-
*
|
|
3088
|
+
* Data an unsigned commit is created from.
|
|
887
3089
|
*/
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
3090
|
+
type UnsignedCommitParameters = {
|
|
3091
|
+
inputs?: XOInvitationInput[];
|
|
3092
|
+
outputs?: XOInvitationOutput[];
|
|
3093
|
+
variables?: XOInvitationVariable[];
|
|
3094
|
+
resolutions?: XOInvitationResolution[];
|
|
3095
|
+
roleIdentifier?: XOTemplateRoleIdentifier;
|
|
3096
|
+
transactionVersion?: XOInvitationTransactionVersion;
|
|
3097
|
+
transactionLocktime?: XOInvitationTransactionLocktime;
|
|
3098
|
+
expiresAtTimestamp?: XOInvitationTimestamp;
|
|
3099
|
+
};
|
|
893
3100
|
/**
|
|
894
|
-
*
|
|
3101
|
+
* Builder for the XOInvitation
|
|
895
3102
|
*/
|
|
896
|
-
declare class
|
|
3103
|
+
declare class InvitationBuilder {
|
|
3104
|
+
#private;
|
|
897
3105
|
/**
|
|
898
|
-
* The
|
|
3106
|
+
* The identifier of the current invitation.
|
|
899
3107
|
*/
|
|
900
|
-
|
|
3108
|
+
invitationIdentifier: XOInvitationIdentifier;
|
|
901
3109
|
/**
|
|
902
|
-
*
|
|
3110
|
+
* The identifier of the template for the invitation.
|
|
903
3111
|
*/
|
|
904
|
-
|
|
3112
|
+
templateIdentifier: XOTemplateIdentifier;
|
|
905
3113
|
/**
|
|
906
|
-
*
|
|
907
|
-
*
|
|
908
|
-
* @param {State} state - The State instance for data persistence.
|
|
3114
|
+
* The identifier of the action for the invitation.
|
|
909
3115
|
*/
|
|
910
|
-
|
|
3116
|
+
actionIdentifier: XOTemplateActionIdentifier;
|
|
911
3117
|
/**
|
|
912
|
-
*
|
|
913
|
-
*
|
|
914
|
-
*
|
|
915
|
-
* This should be called after the electrum application is initialized.
|
|
916
|
-
* Note: Event data is not stored, listeners are registered but remain empty.
|
|
917
|
-
*
|
|
918
|
-
* @returns {void}
|
|
3118
|
+
* Create a new InvitationBuilder.
|
|
3119
|
+
* @param {InvitationParameters} params - Context for invitation creation.
|
|
3120
|
+
* @param {XONetwork} network - Engine network that selects xpub or tpub for entity identifiers.
|
|
919
3121
|
*/
|
|
920
|
-
|
|
3122
|
+
constructor(params: InvitationParameters, network: XONetwork);
|
|
921
3123
|
/**
|
|
922
|
-
*
|
|
923
|
-
* @
|
|
3124
|
+
* Create a builder from an existing invitation.
|
|
3125
|
+
* @param {XOInvitation} invitation - An existing invitation.
|
|
3126
|
+
* @param {XONetwork} network - Engine network that selects xpub or tpub for entity identifiers.
|
|
3127
|
+
* @returns {InvitationBuilder} - A builder initialized from the invitation.
|
|
924
3128
|
*/
|
|
925
|
-
|
|
3129
|
+
static fromInvitation(invitation: XOInvitation, network: XONetwork): InvitationBuilder;
|
|
926
3130
|
/**
|
|
927
|
-
*
|
|
928
|
-
*
|
|
929
|
-
* @param {UnspentOutputData} data - The unspent output data to store.
|
|
930
|
-
* @returns {Promise<void>} Resolves when the unspent output data is stored.
|
|
3131
|
+
* Build the invitation object to be shared.
|
|
3132
|
+
* @returns {XOInvitation} - The built invitation.
|
|
931
3133
|
*/
|
|
932
|
-
|
|
3134
|
+
build(): XOInvitation;
|
|
933
3135
|
/**
|
|
934
|
-
*
|
|
935
|
-
* When a script hash update is received, this method finds the scriptHash and updates the unspent outputs for it.
|
|
3136
|
+
* Replaces the entire invitation result.
|
|
936
3137
|
*
|
|
937
|
-
* @param {
|
|
938
|
-
* @returns {
|
|
3138
|
+
* @param {XOInvitationResult} result - Result to attach to the invitation.
|
|
3139
|
+
* @returns {this} - Builder instance for chaining.
|
|
939
3140
|
*/
|
|
940
|
-
|
|
941
|
-
}
|
|
942
|
-
//#endregion
|
|
943
|
-
//#region source/invitation/builder.d.ts
|
|
944
|
-
/**
|
|
945
|
-
* Builder for the XOInvitation
|
|
946
|
-
*/
|
|
947
|
-
declare class InvitationBuilder {
|
|
3141
|
+
setResult(result: XOInvitationResult): this;
|
|
948
3142
|
/**
|
|
949
|
-
*
|
|
3143
|
+
* Returns the current invitation result, if any.
|
|
950
3144
|
*
|
|
951
|
-
*
|
|
3145
|
+
* @returns {XOInvitationResult | undefined} - Invitation result or undefined when no result is attached.
|
|
952
3146
|
*/
|
|
953
|
-
|
|
3147
|
+
getResult(): XOInvitationResult | undefined;
|
|
954
3148
|
/**
|
|
955
|
-
*
|
|
3149
|
+
* Removes one transaction result from the invitation result.
|
|
956
3150
|
*
|
|
957
|
-
*
|
|
958
|
-
|
|
959
|
-
templateIdentifier: string;
|
|
960
|
-
/**
|
|
961
|
-
* The identifier of the action for the invitation.
|
|
3151
|
+
* @param {XOTemplateTransactionIdentifier} transactionIdentifier - Template transaction identifier to remove.
|
|
3152
|
+
* @returns {this} - Builder instance for chaining.
|
|
962
3153
|
*/
|
|
963
|
-
|
|
3154
|
+
removeTransactionResult(transactionIdentifier: XOTemplateTransactionIdentifier): this;
|
|
964
3155
|
/**
|
|
965
|
-
*
|
|
3156
|
+
* Adds one transaction result to the invitation result.
|
|
966
3157
|
*
|
|
3158
|
+
* @param {XOTemplateTransactionIdentifier} transactionIdentifier - Template transaction identifier for the action.
|
|
3159
|
+
* @param {InvitationTransactionCreatedResultInput} transactionResult - Transaction result payload to store.
|
|
3160
|
+
* @returns {this} - Builder instance for chaining.
|
|
3161
|
+
* @throws {@link TransactionResultAlreadyExistsError} - When a result already exists for this transaction identifier.
|
|
3162
|
+
* @throws {@link InvitationResultSignatureInvalidError} - When the created result signature does not verify.
|
|
3163
|
+
* @throws {Error} - When a present field fails {@link TransactionHash}, {@link Timestamp},
|
|
3164
|
+
* {@link ExtendedPublicKey}, or {@link SchnorrSignature} construction.
|
|
967
3165
|
*/
|
|
968
|
-
|
|
969
|
-
/**
|
|
970
|
-
* The commits in the invitation.
|
|
971
|
-
*/
|
|
972
|
-
private commits;
|
|
973
|
-
/**
|
|
974
|
-
* Create a new InvitationBuilder.
|
|
975
|
-
* @param invitation Context for invitation creation.
|
|
976
|
-
*/
|
|
977
|
-
constructor(invitation: InvitationCreationParameters);
|
|
978
|
-
/**
|
|
979
|
-
* Create a builder from an existing invitation.
|
|
980
|
-
* @param invitation An existing XOInvitation.
|
|
981
|
-
*/
|
|
982
|
-
static fromInvitation(invitation: XOInvitation): InvitationBuilder;
|
|
3166
|
+
addTransactionCreatedResult(transactionIdentifier: XOTemplateTransactionIdentifier, transactionResult: InvitationTransactionCreatedResultInput): this;
|
|
983
3167
|
/**
|
|
984
|
-
*
|
|
985
|
-
* @returns The built XOInvitation.
|
|
986
|
-
*/
|
|
987
|
-
build(): XOInvitation;
|
|
988
|
-
/**
|
|
989
|
-
* Fully validates a given XOInvitation.
|
|
3168
|
+
* Records broadcast metadata on an existing invitation transaction result.
|
|
990
3169
|
*
|
|
991
|
-
* @param
|
|
992
|
-
* @
|
|
993
|
-
* @
|
|
994
|
-
* @throws {
|
|
995
|
-
* @throws {
|
|
3170
|
+
* @param {XOTemplateTransactionIdentifier} transactionIdentifier - Template transaction identifier for the action.
|
|
3171
|
+
* @param {InvitationTransactionBroadcastedResultInput} transactionResult - Broadcast result fields to merge into the stored transaction result.
|
|
3172
|
+
* @returns {this} - Builder instance for chaining.
|
|
3173
|
+
* @throws {@link TransactionResultNotFoundError} - When no created transaction result exists for this identifier.
|
|
3174
|
+
* @throws {@link InvitationResultSignatureInvalidError} - When the broadcast result signature does not verify.
|
|
3175
|
+
* @throws {Error} - When a present field fails {@link Timestamp}, {@link ExtendedPublicKey}, or {@link SchnorrSignature} construction.
|
|
996
3176
|
*/
|
|
997
|
-
|
|
3177
|
+
addTransactionBroadcastedResult(transactionIdentifier: XOTemplateTransactionIdentifier, transactionResult: InvitationTransactionBroadcastedResultInput): this;
|
|
998
3178
|
/**
|
|
999
3179
|
* Add a commit to the invitation.
|
|
1000
|
-
* @param commit The commit to add.
|
|
1001
|
-
* @returns The builder instance.
|
|
3180
|
+
* @param {XOInvitationCommit} commit - The commit to add.
|
|
3181
|
+
* @returns {this} - The builder instance.
|
|
1002
3182
|
*/
|
|
1003
3183
|
addCommit(commit: XOInvitationCommit): this;
|
|
1004
3184
|
/**
|
|
1005
|
-
* Returns the
|
|
1006
|
-
* @returns The
|
|
3185
|
+
* Returns the commit identifier of the last commit in the invitation.
|
|
3186
|
+
* @returns {XOInvitationCommitIdentifier | undefined} - The last commit identifier, or undefined if there are no commits.
|
|
1007
3187
|
*/
|
|
1008
|
-
getLastCommitIdentifier():
|
|
3188
|
+
getLastCommitIdentifier(): XOInvitationCommitIdentifier | undefined;
|
|
1009
3189
|
/**
|
|
1010
|
-
* Returns the last
|
|
1011
|
-
* @returns The last
|
|
3190
|
+
* Returns the last commit in the invitation.
|
|
3191
|
+
* @returns {XOInvitationCommit | undefined} - The last commit, or undefined if there are no commits.
|
|
1012
3192
|
*/
|
|
1013
3193
|
getLastCommit(): XOInvitationCommit | undefined;
|
|
1014
3194
|
/**
|
|
1015
3195
|
* Creates an unsigned commit without adding it to the invitation.
|
|
1016
3196
|
* This allows for atomic commit creation with signature.
|
|
1017
3197
|
*
|
|
1018
|
-
* @param params - Parameters for creating the commit
|
|
1019
|
-
* @param params.inputs - Optional array of inputs to add
|
|
1020
|
-
* @param params.outputs - Optional array of outputs to add
|
|
1021
|
-
* @param params.variables - Optional array of variables to add
|
|
1022
|
-
* @param params.transactionVersion - Optional transaction version
|
|
1023
|
-
* @param params.transactionLocktime - Optional transaction locktime
|
|
1024
|
-
* @param params.expiresAtTimestamp - Optional expiration timestamp
|
|
1025
|
-
*
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
outputs?: XOInvitationOutput[];
|
|
1030
|
-
variables?: XOInvitationVariable[];
|
|
1031
|
-
transactionVersion?: number;
|
|
1032
|
-
transactionLocktime?: number;
|
|
1033
|
-
expiresAtTimestamp?: number;
|
|
1034
|
-
}): Omit<XOInvitationCommit, 'signature' | 'entityIdentifier'>;
|
|
1035
|
-
/**
|
|
1036
|
-
* Creates a new commit from the provided data.
|
|
1037
|
-
* This is a private helper method that initializes the commit building logic.
|
|
1038
|
-
*/
|
|
1039
|
-
private createCommit;
|
|
1040
|
-
/**
|
|
1041
|
-
* Validates mergesWith references for inputs and outputs.
|
|
1042
|
-
* @private
|
|
1043
|
-
*/
|
|
1044
|
-
private validateMergesWithReferences;
|
|
3198
|
+
* @param {object} params - Parameters for creating the commit.
|
|
3199
|
+
* @param {XOInvitationInput[]} [params.inputs] - Optional array of inputs to add.
|
|
3200
|
+
* @param {XOInvitationOutput[]} [params.outputs] - Optional array of outputs to add.
|
|
3201
|
+
* @param {XOInvitationVariable[]} [params.variables] - Optional array of variables to add.
|
|
3202
|
+
* @param {number} [params.transactionVersion] - Optional transaction version.
|
|
3203
|
+
* @param {number} [params.transactionLocktime] - Optional transaction locktime.
|
|
3204
|
+
* @param {number} [params.expiresAtTimestamp] - Optional expiration timestamp.
|
|
3205
|
+
* Defaults to now plus {@link DEFAULT_COMMIT_EXPIRATION_IN_MILLISECONDS}.
|
|
3206
|
+
* @returns {Omit<XOInvitationCommit, 'signature' | 'entityIdentifier'>} - The unsigned commit without signature.
|
|
3207
|
+
*/
|
|
3208
|
+
createUnsignedCommit(params: UnsignedCommitParameters): Omit<XOInvitationCommit, 'signature' | 'entityIdentifier'>;
|
|
1045
3209
|
}
|
|
1046
3210
|
//#endregion
|
|
1047
|
-
//#region source/invitation/
|
|
3211
|
+
//#region source/invitation/participation/execute.d.ts
|
|
1048
3212
|
/**
|
|
1049
|
-
*
|
|
3213
|
+
* Executes an action for a given invitation.
|
|
1050
3214
|
*
|
|
1051
|
-
* @
|
|
1052
|
-
|
|
1053
|
-
|
|
3215
|
+
* @param {Required<AccountContext>} context - State, signing, and network for this account.
|
|
3216
|
+
* @param {XOInvitationIdentifier} invitationIdentifier - The identifier of the invitation whose action to execute.
|
|
3217
|
+
* @param {ExecuteActionParameters} params - Parameters for executing the action.
|
|
3218
|
+
* @returns {Promise<ExecuteActionResult>} - Encoded transaction metadata and the persisted invitation.
|
|
3219
|
+
* @throws {@link InvitationNotFoundInStoreError} - If the invitation is not found in the store.
|
|
3220
|
+
* @throws {@link TemplateNotFoundInStoreError} - If the invitation's template is not found in the store.
|
|
3221
|
+
* @throws {@link TransactionResultAlreadyExistsError} - If a different transaction was already recorded for the action.
|
|
3222
|
+
* @throws {@link TransactionBroadcastFailedError} - If the network rejects the transaction.
|
|
3223
|
+
* @throws {@link TransactionResultNotFoundError} - If the created result is missing when the broadcast is recorded.
|
|
3224
|
+
*/
|
|
3225
|
+
declare const executeAction: (context: Required<AccountContext>, invitationIdentifier: XOInvitationIdentifier, params: ExecuteActionParameters) => Promise<ExecuteActionResult>;
|
|
3226
|
+
//#endregion
|
|
3227
|
+
//#region source/invitation/participation/update.d.ts
|
|
1054
3228
|
/**
|
|
1055
|
-
*
|
|
1056
|
-
*
|
|
3229
|
+
* Updates the stored invitation with a newer version received from an external participant or through some subscription.
|
|
3230
|
+
* The updated invitation should have the shared history with the stored invitation.
|
|
1057
3231
|
*
|
|
1058
|
-
*
|
|
1059
|
-
*
|
|
1060
|
-
*
|
|
1061
|
-
|
|
1062
|
-
|
|
3232
|
+
* An output another participant added that locks to one of this account's scripts is stored and tracked like a script
|
|
3233
|
+
* this account built, so its funds are seen and it can be unlocked later.
|
|
3234
|
+
*
|
|
3235
|
+
* @param {Required<AccountContext>} context - State, signing, and network for this account.
|
|
3236
|
+
* @param {XOInvitation} receivedInvitation - Shared invitation to store. The local entity identifier and archive fields keep their stored values.
|
|
3237
|
+
* @returns {Promise<StoredInvitation>} - The updated invitation as stored, including the local entity identifier when present.
|
|
3238
|
+
* @throws {@link InvitationNotFoundInStoreError} - If the invitation is not already in the store.
|
|
3239
|
+
* @throws {@link TemplateNotFoundInStoreError} - If the template is not found.
|
|
3240
|
+
* @throws {@link InvitationInvalidError} - If the updated invitation does not match the XOInvitation type.
|
|
3241
|
+
* @throws {@link InvitationValidationFailedError} - If the updated invitation fails validation.
|
|
3242
|
+
* @throws {@link InvitationHistoryConflictError} - If a stored commit is missing, reordered, or differs at its expected position.
|
|
3243
|
+
* @throws {@link InvitationItemFieldConflictError} - If a commit changes a value an earlier commit set.
|
|
3244
|
+
* @throws {@link RoleVariableEntityMismatchError} - If a commit provides a variable of a role its entity does not hold.
|
|
3245
|
+
* @throws {@link EntityMultipleRolesWithFollowUpUnsupportedError} - If a commit gives an entity more than one role with a follow up.
|
|
3246
|
+
*/
|
|
3247
|
+
declare const updateInvitation: (context: Required<AccountContext>, receivedInvitation: XOInvitation) => Promise<StoredInvitation>;
|
|
1063
3248
|
//#endregion
|
|
1064
|
-
//#region source/invitation/
|
|
3249
|
+
//#region source/invitation/requirements/roles.d.ts
|
|
1065
3250
|
/**
|
|
1066
|
-
*
|
|
3251
|
+
* Lists role identifiers for roles that still have capacity for additional participants.
|
|
3252
|
+
* A role is considered available if the number of distinct entities that have filled it
|
|
3253
|
+
* is less than the role's maximum slot count. If max is undefined, the role has unlimited capacity.
|
|
3254
|
+
*
|
|
3255
|
+
* @param {XOInvitation} invitation - The invitation object to check for available roles.
|
|
3256
|
+
* @param {XOTemplateAction} action - The template action being analyzed to determine which roles are expected.
|
|
3257
|
+
* @returns {XOTemplateRoleIdentifier[]} - Role identifiers for roles that can still accept participants.
|
|
3258
|
+
* Returns an empty array if no roles are defined in the action.
|
|
1067
3259
|
*/
|
|
1068
|
-
|
|
1069
|
-
inputs: XOInvitationInput[];
|
|
1070
|
-
outputs: XOInvitationOutput[];
|
|
1071
|
-
variables: XOInvitationVariable[];
|
|
1072
|
-
transactionVersion: number;
|
|
1073
|
-
transactionLocktime: number;
|
|
1074
|
-
};
|
|
3260
|
+
declare const listAvailableRolesForInvitation: (invitation: XOInvitation, action: XOTemplateAction) => XOTemplateRoleIdentifier[];
|
|
1075
3261
|
/**
|
|
1076
|
-
*
|
|
1077
|
-
* where each key is the variable's identifier and the value is the variable's value.
|
|
3262
|
+
* Lists the roles of an action that fewer entities have taken than the action requires.
|
|
1078
3263
|
*
|
|
1079
|
-
*
|
|
1080
|
-
*
|
|
3264
|
+
* Each role in the action's participants needs at least its minimum number of entities before the action can
|
|
3265
|
+
* complete, so a role below its minimum is waiting for someone to join the invitation with it.
|
|
3266
|
+
*
|
|
3267
|
+
* @param {XOInvitation} invitation - The invitation whose participants are counted.
|
|
3268
|
+
* @param {XOTemplateAction} action - The template action that declares the participants.
|
|
3269
|
+
* @returns {InvitationMissingParticipant[]} - Every role below its minimum, in the order the action lists them.
|
|
1081
3270
|
*/
|
|
1082
|
-
declare const
|
|
3271
|
+
declare const listMissingParticipants: (invitation: XOInvitation, action: XOTemplateAction) => InvitationMissingParticipant[];
|
|
3272
|
+
//#endregion
|
|
3273
|
+
//#region source/invitation/requirements/signatures.d.ts
|
|
1083
3274
|
/**
|
|
1084
|
-
*
|
|
3275
|
+
* Lists inputs that have a real UTXO outpoint committed to the invitation but no unlocking bytecode yet.
|
|
3276
|
+
* These inputs have been reserved by their committing entity but have not been signed.
|
|
3277
|
+
*
|
|
3278
|
+
* Detection uses the merged invitation state. An input is considered unsigned when its
|
|
3279
|
+
* unlocking bytecode in the merged result is absent or is the placeholder (an empty Uint8Array).
|
|
3280
|
+
* Attribution is taken directly from the sourceCommitIdentifier on each merged input.
|
|
1085
3281
|
*
|
|
1086
|
-
* @param invitation - The invitation
|
|
1087
|
-
* @param template - The template
|
|
1088
|
-
* @returns
|
|
1089
|
-
* @throws {Error} If merge conflicts or missing references are detected.
|
|
3282
|
+
* @param {XOInvitation} invitation - The invitation to examine.
|
|
3283
|
+
* @param {XOTemplate} template - The template for this invitation, required by the merger.
|
|
3284
|
+
* @returns {InvitationInputMissingSignature[]} - Descriptors for each unsigned input, including which entity committed it.
|
|
1090
3285
|
*/
|
|
1091
|
-
declare const
|
|
3286
|
+
declare const listInputsMissingSignatures: (invitation: XOInvitation, template: XOTemplate) => InvitationInputMissingSignature[];
|
|
1092
3287
|
//#endregion
|
|
1093
|
-
//#region source/invitation/
|
|
3288
|
+
//#region source/invitation/requirements/template.d.ts
|
|
3289
|
+
type InvitationRequirementIdentifier = XOTemplateVariableIdentifier | XOTemplateInputIdentifier | XOTemplateOutputIdentifier;
|
|
3290
|
+
/**
|
|
3291
|
+
* Unions requirement identifiers from the top level and every role for one field kind.
|
|
3292
|
+
*
|
|
3293
|
+
* Template actions may list a requirement at the top level while commits store it under a role
|
|
3294
|
+
* bucket. Missing requirement checks and unexpected requirement checks both need the same union
|
|
3295
|
+
* so populated ids are recognized when they appear anywhere in the structure.
|
|
3296
|
+
*
|
|
3297
|
+
* @param {InvitationRequirementIdentifierLists} requirements - Requirement lists from the template or from populated commits.
|
|
3298
|
+
* @param {InvitationRequirementFieldName} requirementFieldName - Which requirement list to union (variables, inputs, or outputs).
|
|
3299
|
+
* @returns {InvitationRequirementIdentifier[]} - De duplicated identifiers from the top level list and every role list.
|
|
3300
|
+
*/
|
|
3301
|
+
declare const listRequirementIdentifiersAcrossRoles: (requirements: InvitationRequirementIdentifierLists, requirementFieldName: InvitationRequirementFieldName) => InvitationRequirementIdentifier[];
|
|
1094
3302
|
/**
|
|
1095
3303
|
* Extracts and lists all requirements from the template and action for an invitation.
|
|
1096
3304
|
* Analyzes the template action to determine what variables, inputs, outputs, and role-specific
|
|
1097
3305
|
* requirements are needed to fulfill the action.
|
|
1098
3306
|
*
|
|
1099
|
-
* @param template - The template.
|
|
1100
|
-
* @param action - The action that has requirements.
|
|
1101
|
-
* @returns {
|
|
3307
|
+
* @param {XOTemplate} template - The template.
|
|
3308
|
+
* @param {XOTemplateAction} action - The action that has requirements.
|
|
3309
|
+
* @returns {InvitationRequirementIdentifierLists} - An object containing all the requirements.
|
|
3310
|
+
* @todo Support minimum and maximum role slots.
|
|
1102
3311
|
*/
|
|
1103
|
-
declare const listRequirementsFromTemplate: (template: XOTemplate, action: XOTemplateAction) =>
|
|
3312
|
+
declare const listRequirementsFromTemplate: (template: XOTemplate, action: XOTemplateAction) => InvitationRequirementIdentifierLists;
|
|
1104
3313
|
/**
|
|
1105
3314
|
* Lists all requirements that have been populated in the invitation by examining all commits.
|
|
1106
3315
|
* Extracts variable, input, and output identifiers from all commits in the invitation and
|
|
1107
3316
|
* organizes them into top-level and role-specific requirements.
|
|
1108
3317
|
*
|
|
1109
|
-
* @param invitation - The invitation object to analyze for populated requirements.
|
|
1110
|
-
* @returns An object containing all populated requirements found in the invitation's commits,
|
|
3318
|
+
* @param {XOInvitation} invitation - The invitation object to analyze for populated requirements.
|
|
3319
|
+
* @returns {InvitationRequirementIdentifierLists} - An object containing all populated requirements found in the invitation's commits,
|
|
1111
3320
|
* including top-level requirements and role-specific requirements. Only includes roles
|
|
1112
3321
|
* that have at least one requirement populated.
|
|
1113
3322
|
*/
|
|
1114
|
-
declare const listPopulatedRequirementsInInvitation: (invitation: XOInvitation) =>
|
|
3323
|
+
declare const listPopulatedRequirementsInInvitation: (invitation: XOInvitation) => InvitationRequirementIdentifierLists;
|
|
1115
3324
|
/**
|
|
1116
3325
|
* Lists all missing requirements for the invitation that have not yet been supplied.
|
|
1117
3326
|
* Compares the requirements expected from the template with what has been populated in the invitation
|
|
1118
3327
|
* to determine what is still needed.
|
|
1119
3328
|
*
|
|
1120
|
-
*
|
|
3329
|
+
* The missing requirements are the template requirements that the invitation has not populated.
|
|
1121
3330
|
*
|
|
1122
|
-
* @param invitation - The invitation object to check for missing requirements.
|
|
1123
|
-
* @param template - The template defining what requirements are expected.
|
|
1124
|
-
* @param action - The template action being analyzed to determine required requirements.
|
|
1125
|
-
* @returns An object containing all missing requirements, including top-level missing requirements
|
|
3331
|
+
* @param {XOInvitation} invitation - The invitation object to check for missing requirements.
|
|
3332
|
+
* @param {XOTemplate} template - The template defining what requirements are expected.
|
|
3333
|
+
* @param {XOTemplateAction} action - The template action being analyzed to determine required requirements.
|
|
3334
|
+
* @returns {InvitationRequirementIdentifierLists} - An object containing all missing requirements, including top-level missing requirements
|
|
1126
3335
|
* and role-specific missing requirements. Only includes roles that have at least one missing requirement.
|
|
1127
3336
|
*/
|
|
1128
|
-
declare const
|
|
3337
|
+
declare const listUnfilledRequirements: (invitation: XOInvitation, template: XOTemplate, action: XOTemplateAction) => InvitationRequirementIdentifierLists;
|
|
3338
|
+
//#endregion
|
|
3339
|
+
//#region source/invitation/validation/committed-fields.d.ts
|
|
1129
3340
|
/**
|
|
1130
|
-
*
|
|
1131
|
-
* A role is considered available if the number of distinct entities that have filled it
|
|
1132
|
-
* is less than the role's maximum slot count. If max is undefined, the role has unlimited capacity.
|
|
3341
|
+
* Checks that no commit changes a value an earlier commit already set on the same input or output.
|
|
1133
3342
|
*
|
|
1134
|
-
*
|
|
1135
|
-
*
|
|
1136
|
-
*
|
|
1137
|
-
*
|
|
1138
|
-
*
|
|
3343
|
+
* The merge keeps the earliest value and ignores a changed one, so a changed value never takes effect. Rejecting it
|
|
3344
|
+
* before the commit is stored surfaces the defect, and keeps an invitation free of commits whose values are ignored.
|
|
3345
|
+
* A later commit may still fill an unset field or repeat a value that is already set.
|
|
3346
|
+
*
|
|
3347
|
+
* @param {XOInvitation} invitation - Invitation whose commits are checked in stored order, including the commit being added.
|
|
3348
|
+
* @returns {void}
|
|
3349
|
+
* @throws {@link CommitIdentifierDuplicatedError} - When a commit identifier appears more than once.
|
|
3350
|
+
* @throws {@link ParentCommitNotFoundError} - When a commit names a previous commit that is not in the invitation.
|
|
3351
|
+
* @throws {@link CommitChainOrderInvalidError} - When a commit does not name the commit stored before it.
|
|
3352
|
+
* @throws {@link MergesWithCommitNotFoundError} - When a mergesWith reference names a missing commit.
|
|
3353
|
+
* @throws {@link MergesWithCommitNotEarlierError} - When a mergesWith reference names the same commit or a later one.
|
|
3354
|
+
* @throws {@link CommitItemNotFoundError} - When a mergesWith reference points at an item that does not exist.
|
|
3355
|
+
* @throws {@link InvitationItemFieldConflictError} - When any commit changes a value an earlier commit set.
|
|
3356
|
+
*/
|
|
3357
|
+
declare const assertCommitsDoNotChangeCommittedFields: (invitation: XOInvitation) => void;
|
|
3358
|
+
//#endregion
|
|
3359
|
+
//#region source/invitation/validation/follow-up-roles.d.ts
|
|
3360
|
+
/**
|
|
3361
|
+
* Checks that no entity in an invitation holds more than one role with a follow up.
|
|
3362
|
+
*
|
|
3363
|
+
* Any role identifier in a commit means its entity joins as that role, whether the commit names the role in its data
|
|
3364
|
+
* or tags a variable, input, output, or resolution with it. An entity may hold several roles, but at most one of them
|
|
3365
|
+
* may have a follow up in the outputs the action produces, so every produced output has one role that decides what
|
|
3366
|
+
* happens with it next.
|
|
3367
|
+
*
|
|
3368
|
+
* Allowing a single account to hold more than one role with a follow up is not supported yet.
|
|
3369
|
+
*
|
|
3370
|
+
* @param {XOInvitation} invitation - Invitation whose commits are checked, including the commits being added.
|
|
3371
|
+
* @param {XOTemplate} template - Template that defines the invitation action and the locking scripts of its outputs.
|
|
3372
|
+
* @returns {void}
|
|
3373
|
+
* @throws {@link TemplateActionNotFoundError} - When the template does not define the invitation action.
|
|
3374
|
+
* @throws {@link EntityMultipleRolesWithFollowUpUnsupportedError} - When an entity holds more than one role with a follow up.
|
|
1139
3375
|
*/
|
|
1140
|
-
declare const
|
|
3376
|
+
declare const assertEntityFollowUpRoles: (invitation: XOInvitation, template: XOTemplate) => void;
|
|
1141
3377
|
//#endregion
|
|
1142
|
-
//#region source/invitation/validation.d.ts
|
|
3378
|
+
//#region source/invitation/validation/invitation.d.ts
|
|
1143
3379
|
/**
|
|
1144
|
-
*
|
|
3380
|
+
* Runs every invitation content validation and returns all discovered errors.
|
|
1145
3381
|
*
|
|
1146
|
-
* @param invitation - The
|
|
1147
|
-
* @
|
|
3382
|
+
* @param {XOInvitation} invitation - The built invitation object to validate.
|
|
3383
|
+
* @param {XONetwork} network - Engine network that selects xpub or tpub for entity identifiers.
|
|
3384
|
+
* @returns {Error[]} - Every validation error found. An empty array means the invitation content is valid.
|
|
1148
3385
|
*/
|
|
1149
|
-
declare const
|
|
3386
|
+
declare const listInvitationContentValidationIssues: (invitation: XOInvitation, network: XONetwork) => Error[];
|
|
1150
3387
|
/**
|
|
1151
|
-
*
|
|
1152
|
-
* Extracts unique entity identifiers from all commits.
|
|
3388
|
+
* Resolves the template action and collects every validation error for an invitation.
|
|
1153
3389
|
*
|
|
1154
|
-
* @param invitation - The invitation to validate.
|
|
1155
|
-
* @
|
|
3390
|
+
* @param {XOInvitation} invitation - The invitation to validate.
|
|
3391
|
+
* @param {XOTemplate} template - The template to validate against.
|
|
3392
|
+
* @param {XONetwork} network - Engine network that selects xpub or tpub for entity identifiers.
|
|
3393
|
+
* @returns {Error[]} - Every validation error found. An empty array means the invitation content is valid.
|
|
1156
3394
|
*/
|
|
1157
|
-
declare const
|
|
3395
|
+
declare const listInvitationValidationIssues: (invitation: XOInvitation, template: XOTemplate, network: XONetwork) => Error[];
|
|
1158
3396
|
/**
|
|
1159
|
-
* Validates
|
|
3397
|
+
* Validates an invitation against a template and throws when any check fails.
|
|
1160
3398
|
*
|
|
1161
|
-
* @param invitation - The invitation to validate.
|
|
1162
|
-
* @param template - The template to validate against.
|
|
1163
|
-
* @param
|
|
1164
|
-
* @
|
|
3399
|
+
* @param {XOInvitation} invitation - The invitation to validate.
|
|
3400
|
+
* @param {XOTemplate} template - The template to validate against.
|
|
3401
|
+
* @param {XONetwork} network - Engine network that selects xpub or tpub for entity identifiers.
|
|
3402
|
+
* @throws {@link InvitationValidationFailedError} - If one or more validation checks fail.
|
|
1165
3403
|
*/
|
|
1166
|
-
declare const
|
|
3404
|
+
declare const validateInvitation: (invitation: XOInvitation, template: XOTemplate, network: XONetwork) => void;
|
|
3405
|
+
//#endregion
|
|
3406
|
+
//#region source/invitation/validation/role-variables.d.ts
|
|
1167
3407
|
/**
|
|
1168
|
-
*
|
|
1169
|
-
* Signature signs: stringify(data) + templateIdentifier + actionIdentifier + invitationIdentifier + commitIdentifier + previousCommitIdentifier
|
|
3408
|
+
* Checks that every variable of a role is provided by an entity holding that role.
|
|
1170
3409
|
*
|
|
1171
|
-
*
|
|
1172
|
-
*
|
|
3410
|
+
* A variable belongs to the role it is tagged with. An untagged variable belongs to every role whose requirements in
|
|
3411
|
+
* the action list it. Roles are taken in commit order, and a role holds at most the maximum number of entities its
|
|
3412
|
+
* slots allow, so an entity that tries to take a full role does not hold it. A commit may provide a variable of a role
|
|
3413
|
+
* only when its entity holds one of the variable's roles. A variable that belongs to no role may be provided by anyone.
|
|
3414
|
+
*
|
|
3415
|
+
* @param {XOInvitation} invitation - Invitation whose commits are checked, including the commits being added.
|
|
3416
|
+
* @param {XOTemplate} template - Template that defines the invitation action, its roles, and their slots.
|
|
3417
|
+
* @returns {void}
|
|
3418
|
+
* @throws {@link TemplateActionNotFoundError} - When the template does not define the invitation action.
|
|
3419
|
+
* @throws {@link RoleVariableEntityMismatchError} - When a commit provides a variable of a role its entity does not hold.
|
|
1173
3420
|
*/
|
|
1174
|
-
declare const
|
|
3421
|
+
declare const assertRoleVariablesProvidedByRoleEntities: (invitation: XOInvitation, template: XOTemplate) => void;
|
|
1175
3422
|
//#endregion
|
|
1176
|
-
//#region source/
|
|
3423
|
+
//#region source/invitation/merge/merge-commits.d.ts
|
|
1177
3424
|
/**
|
|
1178
|
-
*
|
|
3425
|
+
* Returns true when unlocking bytecode is absent or still the merge placeholder.
|
|
3426
|
+
*
|
|
3427
|
+
* @param {MergedInvitationInput['unlockingBytecode']} unlockingBytecode - Unlocking script on a merged input.
|
|
3428
|
+
* @returns {boolean} - True when the input is not signed yet.
|
|
1179
3429
|
*/
|
|
1180
|
-
declare
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
*/
|
|
1202
|
-
getOutputOrThrow(outputIdentifier: string): XOTemplateOutput;
|
|
1203
|
-
/**
|
|
1204
|
-
* Retrieves the locking script identifier from an output.
|
|
1205
|
-
* @throws {TemplateOutputNotFoundError} If the output is not found.
|
|
1206
|
-
* @throws {TemplateLockingScriptInOutputNotFoundError} If the output has no locking script reference.
|
|
1207
|
-
*/
|
|
1208
|
-
getLockingScriptIdentifierOrThrow(outputIdentifier: string): string;
|
|
1209
|
-
/**
|
|
1210
|
-
* Retrieves a locking script definition by identifier.
|
|
1211
|
-
* @throws {TemplateLockingScriptNotFoundError} If the locking script is not found.
|
|
1212
|
-
*/
|
|
1213
|
-
getLockingScriptOrThrow(lockingScriptIdentifier: string): XOTemplateLockingScript;
|
|
1214
|
-
/**
|
|
1215
|
-
* Retrieves the locking script for a given output.
|
|
1216
|
-
* @throws {TemplateOutputNotFoundError} If the output is not found.
|
|
1217
|
-
* @throws {TemplateLockingScriptInOutputNotFoundError} If the output has no locking script reference.
|
|
1218
|
-
* @throws {TemplateLockingScriptNotFoundError} If the locking script definition is not found.
|
|
1219
|
-
*/
|
|
1220
|
-
getLockingScriptForOutputOrThrow(outputIdentifier: string): XOTemplateLockingScript;
|
|
1221
|
-
/**
|
|
1222
|
-
* Retrieves a role within a locking script.
|
|
1223
|
-
* @param lockingScriptIdentifier - The locking script identifier.
|
|
1224
|
-
* @param roleIdentifier - The role identifier.
|
|
1225
|
-
* @throws {TemplateLockingScriptNotFoundError} If the locking script is not found.
|
|
1226
|
-
* @throws {TemplateLockingScriptRoleNotFoundError} If the role is not found.
|
|
1227
|
-
*/
|
|
1228
|
-
getRoleOrThrow(lockingScriptIdentifier: string, roleIdentifier: string): XOTemplateLockingScriptRole;
|
|
1229
|
-
/**
|
|
1230
|
-
* Retrieves the first available role in a locking script, or throws if none exist.
|
|
1231
|
-
* @param lockingScriptIdentifier - The locking script identifier.
|
|
1232
|
-
* @returns A tuple of [roleIdentifier, role].
|
|
1233
|
-
* @throws {TemplateLockingScriptNotFoundError} If the locking script is not found.
|
|
1234
|
-
* @throws {TemplateLockingScriptRoleNotFoundError} If no roles exist.
|
|
1235
|
-
*/
|
|
1236
|
-
getFirstRoleOrThrow(lockingScriptIdentifier: string): [string, XOTemplateLockingScriptRole];
|
|
1237
|
-
/**
|
|
1238
|
-
* Retrieves secrets for a locking script.
|
|
1239
|
-
* If roleIdentifier is provided, returns secrets from the role's state.
|
|
1240
|
-
* Otherwise, returns secrets from the locking script itself.
|
|
1241
|
-
* @param lockingScriptIdentifier - The locking script identifier.
|
|
1242
|
-
* @param roleIdentifier - The role identifier (optional, if not provided uses locking script secrets).
|
|
1243
|
-
* @returns Array of secret identifiers.
|
|
1244
|
-
* @throws {TemplateLockingScriptNotFoundError} If the locking script is not found.
|
|
1245
|
-
* @throws {TemplateLockingScriptRoleNotFoundError} If roleIdentifier is provided but the role is not found.
|
|
1246
|
-
*/
|
|
1247
|
-
getSecrets(lockingScriptIdentifier: string, roleIdentifier?: string): string[];
|
|
1248
|
-
/**
|
|
1249
|
-
* Retrieves an action definition by identifier.
|
|
1250
|
-
* @param actionIdentifier - The identifier of the action.
|
|
1251
|
-
* @throws {TemplateActionNotFoundError} If the action is not found.
|
|
1252
|
-
*/
|
|
1253
|
-
getActionOrThrow(actionIdentifier: string): XOTemplateAction;
|
|
1254
|
-
/**
|
|
1255
|
-
* Retrieves a transaction definition by identifier.
|
|
1256
|
-
* @param transactionIdentifier - The identifier of the transaction.
|
|
1257
|
-
* @throws {TemplateTransactionNotFoundError} If the transaction is not found.
|
|
1258
|
-
*/
|
|
1259
|
-
getTransactionOrThrow(transactionIdentifier: string): XOTemplateTransaction;
|
|
1260
|
-
/**
|
|
1261
|
-
* Retrieves the transaction for a given action.
|
|
1262
|
-
* @param actionIdentifier - The identifier of the action.
|
|
1263
|
-
* @throws {TemplateActionNotFoundError} If the action is not found.
|
|
1264
|
-
* @throws {TemplateTransactionNotFoundError} If the action has no transaction defined or the transaction is not found.
|
|
1265
|
-
*/
|
|
1266
|
-
getTransactionForActionOrThrow(actionIdentifier: string): XOTemplateTransaction;
|
|
1267
|
-
}
|
|
3430
|
+
declare const isUnlockingBytecodeMissingOrPlaceholder: (unlockingBytecode: MergedInvitationInput["unlockingBytecode"]) => boolean;
|
|
3431
|
+
/**
|
|
3432
|
+
* Merges invitation commits and transforms it into MergedInvitation structure.
|
|
3433
|
+
*
|
|
3434
|
+
* @param {XOInvitation} invitation - The invitation containing commits to merge.
|
|
3435
|
+
* @param {XOTemplate} template - The template used for resolving output identifiers.
|
|
3436
|
+
* @returns {MergedInvitation} - Merged invitation structure.
|
|
3437
|
+
* @throws {@link CommitIdentifierDuplicatedError} - When a commit identifier appears more than once.
|
|
3438
|
+
* @throws {@link ParentCommitNotFoundError} - When a commit names a previous commit that is not in the invitation.
|
|
3439
|
+
* @throws {@link CommitChainOrderInvalidError} - When a commit does not name the commit stored before it.
|
|
3440
|
+
* @throws {@link InvitationVariableIdentifierInvalidError} - When any variable identifier contains a dot.
|
|
3441
|
+
* @throws {@link TransactionVersionDuplicatedError} - When more than one commit sets the transaction version.
|
|
3442
|
+
* @throws {@link TransactionLocktimeDuplicatedError} - When more than one commit sets the transaction locktime.
|
|
3443
|
+
* @throws {@link MergesWithCommitNotFoundError} - When a mergesWith reference names a missing commit.
|
|
3444
|
+
* @throws {@link MergesWithCommitNotEarlierError} - When a mergesWith reference names the same commit or a later one.
|
|
3445
|
+
* @throws {@link CommitItemNotFoundError} - When a mergesWith reference points at an item that does not exist.
|
|
3446
|
+
* @throws {@link MergedOutputLockingBytecodeMissingError} - When neither the template output nor its commit provides locking bytecode.
|
|
3447
|
+
* @throws {@link TransactionIndexDuplicatedError} - When two merged inputs or two merged outputs claim the same transactionIndex.
|
|
3448
|
+
* @todo Handle different variables with the same identifier according to the minimum and maximum the template sets.
|
|
3449
|
+
*/
|
|
3450
|
+
declare const mergeInvitationCommits: (invitation: XOInvitation, template: XOTemplate) => MergedInvitation;
|
|
1268
3451
|
//#endregion
|
|
1269
|
-
//#region source/
|
|
3452
|
+
//#region source/invitation/merge/complete.d.ts
|
|
1270
3453
|
/**
|
|
1271
|
-
*
|
|
3454
|
+
* Completes one merged input with the values its commits left unset.
|
|
3455
|
+
*
|
|
3456
|
+
* The transaction index comes from the template when the input fills a template input. Libauth reads the sequence
|
|
3457
|
+
* number and the unlocking script length of every input, so a missing sequence number becomes
|
|
3458
|
+
* {@link DEFAULT_SEQUENCE_NUMBER}, meaning no relative locktime, and a missing unlocking script becomes
|
|
3459
|
+
* {@link PLACEHOLDER_UNLOCKING_BYTECODE}, so the transaction can be built before that signature exists.
|
|
3460
|
+
*
|
|
3461
|
+
* @param {InvitationInputWithSpentOutputFields} input - Merged input.
|
|
3462
|
+
* @param {XOTemplate} [template] - Template used to resolve the transaction index from inputIndex.
|
|
3463
|
+
* @param {string} [actionIdentifier] - Invitation action whose transaction definition supplies inputIndex.
|
|
3464
|
+
* @returns {InvitationInputWithSpentOutputFields} - Input with the template transaction index and the defaults applied.
|
|
1272
3465
|
*/
|
|
1273
|
-
|
|
3466
|
+
declare const completeMergedInput: (input: InvitationInputWithSpentOutputFields, template?: XOTemplate, actionIdentifier?: string) => InvitationInputWithSpentOutputFields;
|
|
1274
3467
|
/**
|
|
1275
|
-
*
|
|
3468
|
+
* Completes one merged output with the values its commits left unset.
|
|
3469
|
+
*
|
|
3470
|
+
* Outputs without an output identifier keep the fields already on the commit, and only their token is completed.
|
|
3471
|
+
* When an identifier is present, the locking bytecode, value, token, and transaction index the commits left unset are
|
|
3472
|
+
* taken from the template and the merged variables.
|
|
3473
|
+
*
|
|
3474
|
+
* @param {MergedInvitationOutput} output - Merged output, including an output that only names a template slot.
|
|
3475
|
+
* @param {number} outputIndex - Position of the output in the merged output list.
|
|
3476
|
+
* @param {XOInvitationVariable[]} variables - Merged invitation variables used to evaluate CashAssembly.
|
|
3477
|
+
* @param {XOTemplate} template - Template that defines output locking scripts.
|
|
3478
|
+
* @param {string} actionIdentifier - Invitation action whose transaction definition supplies the output index.
|
|
3479
|
+
* @returns {XOInvitationOutput} - Output with the template values and a complete token applied.
|
|
3480
|
+
* @throws {@link MergedOutputLockingBytecodeMissingError} - When neither the template output nor its commit provides locking bytecode.
|
|
3481
|
+
* @throws {@link CommitTokenCategoryMissingError} - When a token the commit supplies has no category.
|
|
3482
|
+
* @throws {@link CommitTokenNftCapabilityMissingError} - When an NFT the commit supplies has no capability.
|
|
3483
|
+
*/
|
|
3484
|
+
declare const completeMergedOutput: (output: MergedInvitationOutput, outputIndex: number, variables: XOInvitationVariable[], template: XOTemplate, actionIdentifier: string) => XOInvitationOutput;
|
|
3485
|
+
//#endregion
|
|
3486
|
+
//#region source/invitation/merge/merge-targets.d.ts
|
|
3487
|
+
/**
|
|
3488
|
+
* Resolves the mergesWith target for one merged input or output.
|
|
3489
|
+
*
|
|
3490
|
+
* @param {XOInvitation} invitation - Invitation that contains source commits.
|
|
3491
|
+
* @param {MergedInvitation} mergedCommit - Full merged transaction.
|
|
3492
|
+
* @param {'input' | 'output'} itemType - Whether the item is a merged input or a merged output.
|
|
3493
|
+
* @param {number} mergedItemIndex - Position in mergedCommit.inputs or mergedCommit.outputs.
|
|
3494
|
+
* @returns {XOInvitationMergesWithReference | undefined} - Merge target for the merged item, or undefined when the item cannot be matched.
|
|
1276
3495
|
*/
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
3496
|
+
declare const resolveMergedItemMergeTarget: (invitation: XOInvitation, mergedCommit: MergedInvitation, itemType: "input" | "output", mergedItemIndex: number) => XOInvitationMergesWithReference | undefined;
|
|
3497
|
+
//#endregion
|
|
3498
|
+
//#region source/resolutions/combine.d.ts
|
|
3499
|
+
/**
|
|
3500
|
+
* Collects the resolutions every commit of an invitation provides in its commit data, keyed by the key operation.
|
|
3501
|
+
*
|
|
3502
|
+
* These are the public keys and data signatures participants shared. When two commits resolve one operation, the
|
|
3503
|
+
* earlier value is kept, the same way an earlier commit's input and output fields are kept.
|
|
3504
|
+
*
|
|
3505
|
+
* @param {readonly XOInvitationCommit[]} commits - Invitation commits in stored order.
|
|
3506
|
+
* @returns {Record<XOInvitationResolutionIdentifier, Uint8Array>} - The resolved value of each key operation.
|
|
3507
|
+
*/
|
|
3508
|
+
declare const listInvitationResolutions: (commits: readonly XOInvitationCommit[]) => Record<XOInvitationResolutionIdentifier, Uint8Array>;
|
|
3509
|
+
/**
|
|
3510
|
+
* Combines two versions of one input's resolutions into one list.
|
|
3511
|
+
*
|
|
3512
|
+
* Each entity extends the input with its own resolutions, so the later list adds the operations the earlier list does
|
|
3513
|
+
* not resolve. An operation both lists resolve keeps the earlier value.
|
|
3514
|
+
*
|
|
3515
|
+
* @param {XOInvitationResolution[]} earlierResolutions - Resolutions of the earlier version.
|
|
3516
|
+
* @param {XOInvitationResolution[]} laterResolutions - Resolutions of the later version.
|
|
3517
|
+
* @returns {XOInvitationResolution[]} - Every operation either list resolves, earlier resolutions first.
|
|
3518
|
+
*/
|
|
3519
|
+
declare const combineResolutions: (earlierResolutions: XOInvitationResolution[], laterResolutions: XOInvitationResolution[]) => XOInvitationResolution[];
|
|
3520
|
+
//#endregion
|
|
3521
|
+
//#region source/template.d.ts
|
|
3522
|
+
/**
|
|
3523
|
+
* Returns an output definition by identifier.
|
|
3524
|
+
*
|
|
3525
|
+
* @param {XOTemplate} template - Template whose outputs are searched.
|
|
3526
|
+
* @param {XOTemplateOutputIdentifier} outputIdentifier - Output identifier to look up.
|
|
3527
|
+
* @returns {XOTemplateOutput} - Output definition for that identifier.
|
|
3528
|
+
* @throws {@link TemplateOutputNotFoundError} - When the output is absent from the template.
|
|
3529
|
+
*/
|
|
3530
|
+
declare const getTemplateOutputOrThrow: (template: XOTemplate, outputIdentifier: XOTemplateOutputIdentifier) => XOTemplateOutput;
|
|
3531
|
+
/**
|
|
3532
|
+
* Returns the locking script identifier declared on an output.
|
|
3533
|
+
*
|
|
3534
|
+
* @param {XOTemplate} template - Template whose outputs are searched.
|
|
3535
|
+
* @param {XOTemplateOutputIdentifier} outputIdentifier - Output whose locking script is read.
|
|
3536
|
+
* @returns {XOTemplateLockingScriptIdentifier} - Locking script identifier on that output.
|
|
3537
|
+
* @throws {@link TemplateOutputNotFoundError} - When the output is absent from the template.
|
|
3538
|
+
* @throws {@link TemplateOutputLockingScriptNotFoundError} - When the output has no locking script reference.
|
|
3539
|
+
*/
|
|
3540
|
+
declare const getTemplateLockingScriptIdentifierOrThrow: (template: XOTemplate, outputIdentifier: XOTemplateOutputIdentifier) => XOTemplateLockingScriptIdentifier;
|
|
3541
|
+
/**
|
|
3542
|
+
* Returns a locking script definition by identifier.
|
|
3543
|
+
*
|
|
3544
|
+
* @param {XOTemplate} template - Template whose locking scripts are searched.
|
|
3545
|
+
* @param {XOTemplateLockingScriptIdentifier} lockingScriptIdentifier - Locking script identifier to look up.
|
|
3546
|
+
* @returns {XOTemplateLockingScript} - Locking script definition for that identifier.
|
|
3547
|
+
* @throws {@link TemplateLockingScriptNotFoundError} - When the locking script is absent from the template.
|
|
3548
|
+
* @throws {@link TemplateLockingScriptTypeNotFoundError} - When the locking script omits lockingType.
|
|
3549
|
+
*/
|
|
3550
|
+
declare const getTemplateLockingScriptOrThrow: (template: XOTemplate, lockingScriptIdentifier: XOTemplateLockingScriptIdentifier) => XOTemplateLockingScript;
|
|
3551
|
+
/**
|
|
3552
|
+
* Returns a role definition on a locking script.
|
|
3553
|
+
*
|
|
3554
|
+
* @param {XOTemplate} template - Template whose locking scripts are searched.
|
|
3555
|
+
* @param {XOTemplateLockingScriptIdentifier} lockingScriptIdentifier - Locking script that owns the role.
|
|
3556
|
+
* @param {XOTemplateRoleIdentifier} roleIdentifier - Role identifier to look up.
|
|
3557
|
+
* @returns {XOTemplateLockingScriptRole} - Role definition on that locking script.
|
|
3558
|
+
* @throws {@link TemplateLockingScriptNotFoundError} - When the locking script is absent from the template.
|
|
3559
|
+
* @throws {@link TemplateLockingScriptRoleNotFoundError} - When the role is absent from the locking script.
|
|
3560
|
+
*/
|
|
3561
|
+
declare const getTemplateRoleOrThrow: (template: XOTemplate, lockingScriptIdentifier: XOTemplateLockingScriptIdentifier, roleIdentifier: XOTemplateRoleIdentifier) => XOTemplateLockingScriptRole;
|
|
1282
3562
|
/**
|
|
1283
|
-
*
|
|
3563
|
+
* Returns secret identifiers tracked for a locking script or one of its roles.
|
|
1284
3564
|
*
|
|
1285
|
-
* @param
|
|
1286
|
-
* @
|
|
3565
|
+
* @param {XOTemplate} template - Template whose locking scripts are searched.
|
|
3566
|
+
* @param {XOTemplateLockingScriptIdentifier} lockingScriptIdentifier - Locking script whose secrets are read.
|
|
3567
|
+
* @param {XOTemplateRoleIdentifier} [roleIdentifier] - Role whose secrets are used when provided.
|
|
3568
|
+
* @returns {string[]} - Secret identifiers from the role or from the locking script.
|
|
3569
|
+
* @throws {@link TemplateLockingScriptNotFoundError} - When the locking script is absent from the template.
|
|
3570
|
+
* @throws {@link TemplateLockingScriptRoleNotFoundError} - When a role is provided but is absent.
|
|
1287
3571
|
*/
|
|
1288
|
-
declare const
|
|
3572
|
+
declare const listTemplateSecrets: (template: XOTemplate, lockingScriptIdentifier: XOTemplateLockingScriptIdentifier, roleIdentifier?: XOTemplateRoleIdentifier) => string[];
|
|
1289
3573
|
/**
|
|
1290
|
-
*
|
|
3574
|
+
* Returns an action definition by identifier.
|
|
1291
3575
|
*
|
|
1292
|
-
* @param
|
|
1293
|
-
* @
|
|
3576
|
+
* @param {XOTemplate} template - Template whose actions are searched.
|
|
3577
|
+
* @param {XOTemplateActionIdentifier} actionIdentifier - Action identifier to look up.
|
|
3578
|
+
* @returns {XOTemplateAction} - Action definition for that identifier.
|
|
3579
|
+
* @throws {@link TemplateActionNotFoundError} - When the action is absent from the template.
|
|
3580
|
+
*/
|
|
3581
|
+
declare const getTemplateActionOrThrow: (template: XOTemplate, actionIdentifier: XOTemplateActionIdentifier) => XOTemplateAction;
|
|
3582
|
+
/**
|
|
3583
|
+
* Returns the transaction identifier an action names.
|
|
1294
3584
|
*
|
|
1295
|
-
* @
|
|
1296
|
-
*
|
|
1297
|
-
*
|
|
3585
|
+
* @param {XOTemplate} template - Template that defines the action.
|
|
3586
|
+
* @param {XOTemplateActionIdentifier} actionIdentifier - Action whose transaction is read.
|
|
3587
|
+
* @returns {XOTemplateTransactionIdentifier} - Transaction identifier the action names.
|
|
3588
|
+
* @throws {@link TemplateActionNotFoundError} - When the action is absent from the template.
|
|
3589
|
+
* @throws {@link TemplateActionTransactionNotFoundError} - When the action names no transaction.
|
|
1298
3590
|
*/
|
|
1299
|
-
declare const
|
|
3591
|
+
declare const getTemplateActionTransactionIdentifierOrThrow: (template: XOTemplate, actionIdentifier: XOTemplateActionIdentifier) => XOTemplateTransactionIdentifier;
|
|
1300
3592
|
/**
|
|
1301
|
-
*
|
|
3593
|
+
* Lists one action intent for every action the template defines.
|
|
1302
3594
|
*
|
|
1303
|
-
*
|
|
1304
|
-
*
|
|
3595
|
+
* Each intent names only its action. It carries no role, constants, variables, or generate list.
|
|
3596
|
+
*
|
|
3597
|
+
* @param {XOTemplate} template - Template whose actions are listed.
|
|
3598
|
+
* @returns {XOTemplateActionIntent[]} - One intent per action identifier, in the order the template declares them.
|
|
3599
|
+
*/
|
|
3600
|
+
declare const listTemplateActionIntents: (template: XOTemplate) => XOTemplateActionIntent[];
|
|
3601
|
+
/**
|
|
3602
|
+
* Returns a transaction definition by identifier.
|
|
1305
3603
|
*
|
|
1306
|
-
* @param
|
|
1307
|
-
* @
|
|
3604
|
+
* @param {XOTemplate} template - Template whose transactions are searched.
|
|
3605
|
+
* @param {XOTemplateTransactionIdentifier} transactionIdentifier - Transaction identifier to look up.
|
|
3606
|
+
* @returns {XOTemplateTransaction} - Transaction definition for that identifier.
|
|
3607
|
+
* @throws {@link TemplateTransactionNotFoundError} - When the transaction is absent from the template.
|
|
1308
3608
|
*/
|
|
1309
|
-
declare const
|
|
3609
|
+
declare const getTemplateTransactionOrThrow: (template: XOTemplate, transactionIdentifier: XOTemplateTransactionIdentifier) => XOTemplateTransaction;
|
|
1310
3610
|
/**
|
|
1311
|
-
*
|
|
3611
|
+
* Lists the variables to generate for an entity that takes part in an action.
|
|
3612
|
+
*
|
|
3613
|
+
* Combines the generate list of an intent with the generate list of the action role. A variable in both, or listed
|
|
3614
|
+
* twice, is one variable. The action role's list comes from the template, so an intent can add variables but never drop one the
|
|
3615
|
+
* action needs.
|
|
1312
3616
|
*
|
|
1313
|
-
*
|
|
1314
|
-
*
|
|
1315
|
-
*
|
|
1316
|
-
*
|
|
3617
|
+
* Every variable is checked, and all variables that are not declared as private keys are reported together as private_key type
|
|
3618
|
+
* is the only supported type.
|
|
3619
|
+
*
|
|
3620
|
+
* @param {XOTemplate} template - Template that defines the action and declares the variables.
|
|
3621
|
+
* @param {XOTemplateActionIdentifier} actionIdentifier - Action the entity takes part in.
|
|
3622
|
+
* @param {XOTemplateRoleIdentifier} [roleIdentifier] - Role the entity takes, when it takes one.
|
|
3623
|
+
* @param {XOTemplateVariableIdentifier[]} [intentGenerate] - Generate list of an intent, when one is given.
|
|
3624
|
+
* @returns {XOTemplateVariableIdentifier[]} - Variables to generate, each listed once, empty when nothing is asked for.
|
|
3625
|
+
* @throws {@link TemplateActionNotFoundError} - When the template does not define the action.
|
|
3626
|
+
* @throws {@link TemplateActionRoleNotFoundError} - When the action does not define the role.
|
|
3627
|
+
* @throws {@link TemplateGeneratedVariableTypeUnsupportedError} - When a listed variable is not declared as a private key.
|
|
3628
|
+
*/
|
|
3629
|
+
declare const listVariableIdentifiersToGenerate: (template: XOTemplate, actionIdentifier: XOTemplateActionIdentifier, roleIdentifier?: XOTemplateRoleIdentifier, intentGenerate?: XOTemplateVariableIdentifier[]) => XOTemplateVariableIdentifier[];
|
|
3630
|
+
//#endregion
|
|
3631
|
+
//#region source/invitation/generation/transaction.d.ts
|
|
3632
|
+
/**
|
|
3633
|
+
* Encodes the merged invitation as a libauth transaction for size and hash measurement.
|
|
1317
3634
|
*
|
|
1318
|
-
* @param
|
|
1319
|
-
* @param
|
|
1320
|
-
* @
|
|
3635
|
+
* @param {MergedInvitation} mergedCommit - Merged commit whose inputs and outputs are encoded.
|
|
3636
|
+
* @param {XOTemplate} template - Template that defines the action.
|
|
3637
|
+
* @param {XOTemplateActionIdentifier} actionIdentifier - Action the transaction is built for, used to complete outputs without locking bytecode.
|
|
3638
|
+
* @returns {Uint8Array} - Serialized transaction bytes.
|
|
3639
|
+
* @throws {@link TemplateActionNotFoundError} - When the action is not on the template.
|
|
3640
|
+
* @throws {@link TemplateActionTransactionNotFoundError} - When the action has no transaction definition.
|
|
3641
|
+
* @throws {@link TransactionGenerationFailedError} - When libauth cannot build the transaction.
|
|
1321
3642
|
*/
|
|
1322
|
-
declare const
|
|
3643
|
+
declare const encodeMergedInvitationTransaction: (mergedCommit: MergedInvitation, template: XOTemplate, actionIdentifier: XOTemplateActionIdentifier) => Uint8Array;
|
|
3644
|
+
/**
|
|
3645
|
+
* Encodes the merged invitation commit as a transaction and returns hex plus size metadata.
|
|
3646
|
+
*
|
|
3647
|
+
* @param {MergedInvitation} mergedCommit - Merged inputs and outputs from the invitation.
|
|
3648
|
+
* @param {XOTemplate} template - Template that defines the action transaction shape.
|
|
3649
|
+
* @param {XOTemplateActionIdentifier} actionIdentifier - Action used to validate that a transaction is defined.
|
|
3650
|
+
* @returns {BuiltInvitationTransaction} - Serialized transaction hex, byte length, and hash.
|
|
3651
|
+
* @throws {@link TemplateActionTransactionNotFoundError} - When the action has no transaction definition.
|
|
3652
|
+
* @throws {@link TransactionGenerationFailedError} - When libauth cannot build the transaction.
|
|
3653
|
+
*/
|
|
3654
|
+
declare const buildInvitationTransactionFromMergedCommit: (mergedCommit: MergedInvitation, template: XOTemplate, actionIdentifier: XOTemplateActionIdentifier) => BuiltInvitationTransaction;
|
|
3655
|
+
//#endregion
|
|
3656
|
+
//#region source/resolutions/transaction-index.d.ts
|
|
1323
3657
|
/**
|
|
1324
|
-
*
|
|
1325
|
-
* with a decoded string representation.
|
|
3658
|
+
* Resolves the transaction index declared for one template input or output slot on the active action transaction.
|
|
1326
3659
|
*
|
|
1327
|
-
* @param
|
|
1328
|
-
* @param
|
|
1329
|
-
* @param
|
|
1330
|
-
* @
|
|
1331
|
-
* @
|
|
3660
|
+
* @param {XOTemplate} template - Imported template for the invitation.
|
|
3661
|
+
* @param {XOTemplateActionIdentifier} actionIdentifier - Action on the invitation.
|
|
3662
|
+
* @param {'input' | 'output'} itemType - Whether the slot is an input or an output.
|
|
3663
|
+
* @param {XOTemplateInputIdentifier | XOTemplateOutputIdentifier} itemIdentifier - Template input or output slot being provided.
|
|
3664
|
+
* @returns {number | undefined} - Input or output index from the transaction definition when present.
|
|
1332
3665
|
*/
|
|
1333
|
-
declare const
|
|
3666
|
+
declare const resolveTemplateTransactionItemIndex: (template: XOTemplate, actionIdentifier: XOTemplateActionIdentifier, itemType: "input" | "output", itemIdentifier: XOTemplateInputIdentifier | XOTemplateOutputIdentifier) => number | undefined;
|
|
1334
3667
|
//#endregion
|
|
1335
|
-
//#region source/
|
|
3668
|
+
//#region source/compilation/template-locking-bytecode.d.ts
|
|
1336
3669
|
/**
|
|
1337
|
-
*
|
|
1338
|
-
* Returns libauth result or error string.
|
|
3670
|
+
* Builds the variable map used to evaluate template CashAssembly and compile locking bytecode.
|
|
1339
3671
|
*
|
|
1340
|
-
*
|
|
1341
|
-
*
|
|
1342
|
-
*
|
|
1343
|
-
* @
|
|
3672
|
+
* Template constant defaults are applied first. Invitation commit variables overwrite constants when identifiers collide.
|
|
3673
|
+
* A constant whose value is not a string, number, bigint, or boolean is left out of the map.
|
|
3674
|
+
*
|
|
3675
|
+
* @param {XOTemplate} template - Imported template definition.
|
|
3676
|
+
* @param {XOInvitationVariable[]} invitationVariables - Variables collected from invitation commits.
|
|
3677
|
+
* @returns {Record<XOTemplateVariableIdentifier | XOTemplateConstantIdentifier, XOInvitationVariableValue>} - Map from identifier to value for
|
|
3678
|
+
* compilation.
|
|
1344
3679
|
*/
|
|
1345
|
-
declare const
|
|
3680
|
+
declare const mergeTemplateConstantsWithInvitationVariables: (template: XOTemplate, invitationVariables: XOInvitationVariable[]) => Record<XOTemplateVariableIdentifier | XOTemplateConstantIdentifier, XOInvitationVariableValue>;
|
|
1346
3681
|
/**
|
|
1347
|
-
*
|
|
3682
|
+
* Collects invitation variables from stored commits and optional append parameters.
|
|
1348
3683
|
*
|
|
1349
|
-
* @param
|
|
1350
|
-
* @
|
|
3684
|
+
* @param {readonly XOInvitationCommit[]} commits - Invitation commits to read variables from.
|
|
3685
|
+
* @param {XOInvitationVariable[]} [additionalVariables] - Extra variables mixed with variables already on commits.
|
|
3686
|
+
* @returns {XOInvitationVariable[]} - Flat list of variables in commit order.
|
|
1351
3687
|
*/
|
|
1352
|
-
declare const
|
|
3688
|
+
declare const listInvitationVariablesFromCommits: (commits: readonly XOInvitationCommit[], additionalVariables?: XOInvitationVariable[]) => XOInvitationVariable[];
|
|
1353
3689
|
/**
|
|
1354
|
-
*
|
|
3690
|
+
* Builds the libauth `data.bytecode` map from invitation and template constant values.
|
|
1355
3691
|
*
|
|
1356
|
-
* @param template -
|
|
1357
|
-
* @param
|
|
1358
|
-
* @
|
|
3692
|
+
* @param {XOTemplate} template - Imported template definition.
|
|
3693
|
+
* @param {Record<XOTemplateVariableIdentifier | XOTemplateConstantIdentifier, XOInvitationVariableValue>} compilationVariables - Map built by
|
|
3694
|
+
* {@link mergeTemplateConstantsWithInvitationVariables}.
|
|
3695
|
+
* @returns {Record<XOTemplateVariableIdentifier | XOTemplateConstantIdentifier, Uint8Array>} - Bytecode map keyed by template variable identifiers.
|
|
1359
3696
|
*/
|
|
1360
|
-
declare const
|
|
3697
|
+
declare const buildCompilerBytecodeDataFromCompilationVariables: (template: XOTemplate, compilationVariables: Record<XOTemplateVariableIdentifier | XOTemplateConstantIdentifier, XOInvitationVariableValue>) => Record<XOTemplateVariableIdentifier | XOTemplateConstantIdentifier, Uint8Array>;
|
|
1361
3698
|
/**
|
|
1362
|
-
*
|
|
3699
|
+
* Compiles locking bytecode from a template locking script definition and invitation variable context.
|
|
3700
|
+
*
|
|
3701
|
+
* Used when an output references a locking script by identifier rather than a CashAssembly expression on the output
|
|
3702
|
+
* itself.
|
|
1363
3703
|
*
|
|
1364
|
-
* @param template -
|
|
1365
|
-
* @
|
|
3704
|
+
* @param {XOTemplate} template - Template whose locking scripts are compiled.
|
|
3705
|
+
* @param {XOTemplateLockingScriptIdentifier} lockingScriptIdentifier - Locking script identifier from the template output definition.
|
|
3706
|
+
* @param {Record<XOTemplateVariableIdentifier | XOTemplateConstantIdentifier, XOInvitationVariableValue>} compilationVariables - Variable map
|
|
3707
|
+
* including template constants and commit variables.
|
|
3708
|
+
* @returns {Uint8Array} - Compiled locking bytecode bytes for the merged output.
|
|
3709
|
+
* @throws {@link LockingScriptCompilationFailedError} - When Libauth compilation of the locking script fails.
|
|
1366
3710
|
*/
|
|
1367
|
-
declare const
|
|
3711
|
+
declare const compileLockingBytecodeFromTemplateLockingScriptIdentifier: (template: XOTemplate, lockingScriptIdentifier: XOTemplateLockingScriptIdentifier, compilationVariables: Record<XOTemplateVariableIdentifier | XOTemplateConstantIdentifier, XOInvitationVariableValue>) => Uint8Array;
|
|
1368
3712
|
/**
|
|
1369
|
-
*
|
|
3713
|
+
* Resolves locking bytecode for a template output from invitation variables and template constants.
|
|
1370
3714
|
*
|
|
1371
|
-
* @param template -
|
|
1372
|
-
* @
|
|
3715
|
+
* @param {XOTemplate} template - Template for the invitation.
|
|
3716
|
+
* @param {XOTemplateOutputIdentifier} outputIdentifier - Template output identifier.
|
|
3717
|
+
* @param {XOInvitationVariable[]} invitationVariables - Variables from merged commits and the current append.
|
|
3718
|
+
* @returns {Uint8Array} - Locking bytecode bytes for the output.
|
|
3719
|
+
* @throws {@link TemplateOutputNotFoundError} - When the output is absent from the template.
|
|
3720
|
+
* @throws {@link TemplateOutputLockingScriptNotFoundError} - When the template output has no locking script reference.
|
|
3721
|
+
* @throws {@link CashAssemblyCompilationFailedError} - When a CashAssembly expression fails to compile.
|
|
3722
|
+
* @throws {@link LockingScriptCompilationFailedError} - When the template locking script fails to compile.
|
|
3723
|
+
* @throws {@link TemplateLockingScriptTypeNotFoundError} - When the locking script definition is incomplete.
|
|
3724
|
+
* @throws {@link TemplateOutputLockingScriptReferenceInvalidError} - When a locking script or script the output references is not in the template.
|
|
3725
|
+
*/
|
|
3726
|
+
declare const resolveTemplateOutputLockingBytecode: (template: XOTemplate, outputIdentifier: XOTemplateOutputIdentifier, invitationVariables: XOInvitationVariable[]) => Uint8Array;
|
|
3727
|
+
//#endregion
|
|
3728
|
+
//#region source/compilation/intent-variables.d.ts
|
|
3729
|
+
/**
|
|
3730
|
+
* Variable values an intent sets itself and the variables it leaves for the caller to provide.
|
|
1373
3731
|
*/
|
|
1374
|
-
|
|
3732
|
+
type IntentVariableRequirements = {
|
|
3733
|
+
/**
|
|
3734
|
+
* Values the intent fixes for its variables.
|
|
3735
|
+
*/
|
|
3736
|
+
presetVariableValues: Record<XOTemplateVariableIdentifier, XOInvitationVariableValue>;
|
|
3737
|
+
/**
|
|
3738
|
+
* Variables the intent lists with a null value, which the caller must provide.
|
|
3739
|
+
*/
|
|
3740
|
+
requiredVariableIdentifiers: XOTemplateVariableIdentifier[];
|
|
3741
|
+
};
|
|
1375
3742
|
/**
|
|
1376
|
-
*
|
|
3743
|
+
* Reads the variables an intent declares.
|
|
3744
|
+
*
|
|
3745
|
+
* An intent lists variables as single entry objects. A null value marks a variable the caller must provide
|
|
3746
|
+
* when something is created from the intent. Any other value is a preset used as is.
|
|
1377
3747
|
*
|
|
1378
|
-
* @param
|
|
1379
|
-
* @returns
|
|
3748
|
+
* @param {XOTemplateIntent} intent - Intent from the template defaults.
|
|
3749
|
+
* @returns {IntentVariableRequirements} - Preset values and the identifiers the caller must provide.
|
|
1380
3750
|
*/
|
|
1381
|
-
declare const
|
|
3751
|
+
declare const readIntentVariableRequirements: (intent: XOTemplateIntent) => IntentVariableRequirements;
|
|
1382
3752
|
/**
|
|
1383
|
-
*
|
|
3753
|
+
* Lists every variable a caller must provide to create a locking bytecode from an intent.
|
|
1384
3754
|
*
|
|
1385
|
-
*
|
|
1386
|
-
*
|
|
1387
|
-
*
|
|
1388
|
-
* @
|
|
1389
|
-
*
|
|
1390
|
-
*
|
|
1391
|
-
*
|
|
1392
|
-
* }
|
|
3755
|
+
* These are the variables the intent marks with a null value, plus any the target locking script needs
|
|
3756
|
+
* that neither the template constants nor the intent presets supply.
|
|
3757
|
+
*
|
|
3758
|
+
* @param {XOTemplate} template - Template that defines the intent target.
|
|
3759
|
+
* @param {XOTemplateIntent} intent - Intent from the template defaults.
|
|
3760
|
+
* @param {XOTemplateLockingScriptIdentifier} lockingScriptIdentifier - Locking script the intent generates.
|
|
3761
|
+
* @returns {XOTemplateVariableIdentifier[]} - Required variable identifiers, intent variables first.
|
|
3762
|
+
* @throws {@link TemplateLockingScriptNotFoundError} - When the locking script is not defined by the template.
|
|
1393
3763
|
*/
|
|
1394
|
-
declare const
|
|
1395
|
-
compiler: CompilerBch;
|
|
1396
|
-
script: string;
|
|
1397
|
-
valueSatoshis: bigint;
|
|
1398
|
-
}>;
|
|
3764
|
+
declare const listIntentRequiredVariableIdentifiers: (template: XOTemplate, intent: XOTemplateIntent, lockingScriptIdentifier: XOTemplateLockingScriptIdentifier) => XOTemplateVariableIdentifier[];
|
|
1399
3765
|
//#endregion
|
|
1400
|
-
//#region source/
|
|
3766
|
+
//#region source/compilation/libauth-utils.d.ts
|
|
3767
|
+
/**
|
|
3768
|
+
* Collects every secret identifier declared on locking scripts and their roles.
|
|
3769
|
+
*
|
|
3770
|
+
* Template variable `type` is optional. Secrets listed under locking script state still identify
|
|
3771
|
+
* Key material for Libauth even when `private_key` was never stored on the variable.
|
|
3772
|
+
*
|
|
3773
|
+
* @param {XOTemplate} template - Template whose locking script secrets are read.
|
|
3774
|
+
* @returns {Set<string>} - Deduplicated secret identifiers from locking script state.
|
|
3775
|
+
*/
|
|
3776
|
+
declare const listTemplateSecretIdentifiers: (template: XOTemplate) => Set<string>;
|
|
1401
3777
|
/**
|
|
1402
|
-
*
|
|
3778
|
+
* Returns whether a template variable should compile as a Libauth Key.
|
|
1403
3779
|
*
|
|
1404
|
-
*
|
|
1405
|
-
*
|
|
1406
|
-
* 2. Fetches the current list of unspent outputs for the script hash from the state.
|
|
1407
|
-
* 3. Queries the blockchain for all unspent transaction outputs associated with the script hash.
|
|
1408
|
-
* 4. Adds any new unspent outputs found on the blockchain but missing from the state to the state.
|
|
1409
|
-
* 5. Removes any unspent outputs present in the state but no longer in the blockchain.
|
|
3780
|
+
* Prefers an explicit `private_key` type. Also treats locking script secrets as Key so older
|
|
3781
|
+
* stored templates without a type still unlock with `data.keys` instead of WalletData bytecode.
|
|
1410
3782
|
*
|
|
1411
|
-
* @param
|
|
1412
|
-
* @param
|
|
1413
|
-
* @param
|
|
1414
|
-
* @
|
|
3783
|
+
* @param {string} variableIdentifier - Variable or secret identifier.
|
|
3784
|
+
* @param {Set<string>} templateSecretIdentifiers - Secrets from {@link listTemplateSecretIdentifiers}.
|
|
3785
|
+
* @param {XOTemplateVariable} [variableDefinition] - Template variable when present.
|
|
3786
|
+
* @returns {boolean} - True when Libauth must resolve this identifier through private keys.
|
|
1415
3787
|
*/
|
|
1416
|
-
declare const
|
|
3788
|
+
declare const isLibauthKeyTemplateVariable: (variableIdentifier: string, templateSecretIdentifiers: Set<string>, variableDefinition?: XOTemplateVariable) => boolean;
|
|
1417
3789
|
//#endregion
|
|
1418
|
-
export {
|
|
3790
|
+
export { type AccountContext, type AppendInvitationParameters, AppendInvitationParametersEmptyError, type BuiltInvitationTransaction, CashAssemblyVariableNotIntegerError, type ChainStatus, type ChangeAvailability, ChangeLockingBytecodeMissingError, type ChangeUnavailableReason, CommitChainOrderInvalidError, CommitIdentifierDuplicatedError, CommitItemNotFoundError, CommitSignatureInvalidError, CommitTokenCategoryMissingError, CommitTokenNftCapabilityMissingError, DEFAULT_ACCOUNT_DATABASE_FILENAME, DEFAULT_COMMIT_EXPIRATION_IN_MILLISECONDS, DEFAULT_ELECTRUM_APPLICATION_IDENTIFIER, DEFAULT_ELECTRUM_CACHE_DATABASE_FILENAME, DEFAULT_FEE_SATOSHIS_PER_INPUT, DEFAULT_FEE_SATOSHIS_PER_OUTPUT, DEFAULT_LOCKTIME, DEFAULT_SEQUENCE_NUMBER, DEFAULT_STORAGE_TYPE, DEFAULT_VERSION, DEFAULT_XO_NETWORK, DUST_LIMIT_SATOSHIS, DataResultSignatureInvalidError, DefaultPolicyNotSetError, DefaultPolicyTemplate, ELECTRUM_CONNECTION_STATUSES, EMPTY_BYTECODE, type ElectrumConnection, type ElectrumConnectionStatus, Engine, EntityMultipleRolesWithFollowUpUnsupportedError, EntityRolesMultipleEntry, type ExecuteActionParameters, type ExecuteActionResult, type FungibleTokenChangeSurplus, INVITATION_REQUIREMENT_FIELD_NAMES, INVITATION_REQUIREMENT_FIELD_NAME_LIST, InputOwnResolutionsNotFoundError, InputUnspentOutputUnavailableError, IntentVariablesMissingError, type InvitationAcceptanceParameters, InvitationBuilder, type InvitationCommitHistoryComparison, type InvitationCreationParameters, InvitationFieldInvalidError, InvitationHistoryConflictError, type InvitationInputMissingSignature, type InvitationInputSpentOutputFields, type InvitationInputWithSpentOutputFields, InvitationIntentMismatchError, InvitationItemFieldConflict, InvitationItemFieldConflictError, type InvitationMissingParticipant, type InvitationMissingRequirements, type InvitationParameters, InvitationRequirementFieldName, type InvitationRequirementIdentifierLists, InvitationResolutionIdentifierInvalidError, type InvitationResolutionRequirements, InvitationResultSignatureInvalidError, InvitationRoleDuplicatedError, type InvitationRoleRequirementIdentifierLists, InvitationRoleUnavailableError, InvitationTemplateMismatchError, type InvitationTransactionBroadcastedResultInput, type InvitationTransactionCreatedResultInput, InvitationValidationFailedError, InvitationVariableIdentifierInvalidError, ListSpendableUnspentOutputsParameters, LockingBytecodeGenerationFailedError, LockingScriptCompilationFailedError, LockingScriptResolutionsMissingError, LockingScriptSecretsNotFoundError, MergedInputCommitNotFoundError, MergedInputNotFoundError, MergedInputOutpointMissingError, type MergedInvitation, type MergedInvitationChange, type MergedInvitationInput, type MergedInvitationOutput, MergedItemTokenIncompleteError, MergedItemValueSatoshisMissingError, MergedOutputLockingBytecodeMissingError, MergesWithCommitNotEarlierError, MergesWithCommitNotFoundError, OutputLockingBytecodeNotProvidedError, OutputOwnResolutionsNotFoundError, PLACEHOLDER_UNLOCKING_BYTECODE, ParentCommitNotFoundError, RoleVariableEntityMismatch, RoleVariableEntityMismatchError, RootCommitNotFoundError, SecretIdentifierTypeInvalidError, TOKEN_BEARING_OUTPUT_MINIMUM_SATOSHIS, TemplateActionNotFoundError, TemplateActionRoleNotFoundError, TemplateActionTransactionNotFoundError, TemplateDefaultPolicyMissingError, TemplateGeneratedVariableTypeUnsupportedError, TemplateLockingScriptBytecodeNotFoundError, TemplateLockingScriptNotFoundError, TemplateLockingScriptRoleNotFoundError, TemplateLockingScriptTypeNotFoundError, TemplateOutputLockingScriptNotFoundError, TemplateOutputLockingScriptReferenceInvalidError, TemplateOutputNotFoundError, TemplateRoleRelevantCashAssemblyUnsupportedError, TemplateTokenAmountInvalidError, TemplateTokenCategoryMissingError, TemplateTokenNftCapabilityInvalidError, TemplateTokenNftCapabilityMissingError, TemplateTransactionNotFoundError, TemplateUnlockingScriptNotFoundError, TemplateValueSatoshisInvalidError, TransactionBroadcastFailedError, TransactionBroadcastMetadataIncompleteError, TransactionBroadcastSignatureInvalidError, TransactionCreatedSignatureInvalidError, TransactionGenerationFailedError, TransactionIndexDuplicatedError, TransactionLocktimeDuplicatedError, TransactionOutputNotFoundError, TransactionResultAlreadyExistsError, TransactionResultNotFoundError, TransactionVersionDuplicatedError, UNDEFINED_TRANSACTION_INDEX_SORT_VALUE, UnlockingBytecodeGenerationFailedError, UnlockingBytecodeVerificationFailedError, UnlockingCompilationContextMissingError, UnlockingScriptResolutionsMissingError, WalletDefaultPolicies, WalletNameMissingError, XOEngineOptions, XONetwork, XO_SUPPORTED_NETWORKS, ZERO_FUNGIBLE_TOKEN_AMOUNT, appendOwnOutputResolutions, applyInvitationTransactionResultToInvitation, assertCommitsDoNotChangeCommittedFields, assertEntityFollowUpRoles, assertRoleVariablesProvidedByRoleEntities, buildAccountDatabaseName, buildCompilerBytecodeDataFromCompilationVariables, buildElectrumCacheDatabaseFilename, buildInvitationTransactionFromMergedCommit, buildNetworkDatabaseFilename, combineResolutions, compareInvitationCommitHistories, compileLockingBytecodeFromTemplateLockingScriptIdentifier, completeMergedInput, completeMergedOutput, encodeMergedInvitationTransaction, executeAction, fetchDecodedTransactionOutput, fetchScriptHashUnspentOutputs, fetchUnspentOutputsForLockingBytecode, findEntityLockingScriptRole, findRootCommitIdentifierInInvitation, generateCommitIdentifier, generateInvitationIdentifier, getInvitationTransactionHash, getTemplateActionOrThrow, getTemplateActionTransactionIdentifierOrThrow, getTemplateLockingScriptIdentifierOrThrow, getTemplateLockingScriptOrThrow, getTemplateOutputOrThrow, getTemplateRoleOrThrow, getTemplateTransactionOrThrow, isInvitationTransactionCreatedResultComplete, isInvitationTransactionHashOnlyUpdate, isLibauthKeyTemplateVariable, isUnlockingBytecodeMissingOrPlaceholder, isXOSupportedNetwork, listAvailableRolesForInvitation, listCommitRoleIdentifiers, listCommitsForEntity, listElectrumConnections, listFollowUpRoleIdentifiers, listInputsMissingSignatures, listIntentRequiredVariableIdentifiers, listInvitationContentValidationIssues, listInvitationResolutions, listInvitationValidationIssues, listInvitationVariablesFromCommits, listMissingParticipants, listOutputResolutions, listPopulatedRequirementsInInvitation, listRelevantInvitationOutputsMissingFromStore, listRequirementIdentifiersAcrossRoles, listRequirementsFromTemplate, listRoleHolderEntities, listTemplateActionIntents, listTemplateSecretIdentifiers, listTemplateSecrets, listUnfilledRequirements, listVariableIdentifiersToGenerate, mergeInvitationCommits, mergeInvitationTransactionHashOnlyUpdate, mergeTemplateConstantsWithInvitationVariables, readIntentVariableRequirements, resolveElectrumServersForNetwork, resolveHdKeyNetwork, resolveInvitationOutputLockingBytecode, resolveMergedItemMergeTarget, resolveTemplateOutputLockingBytecode, resolveTemplateTransactionItemIndex, updateInvitation, validateInvitation };
|
|
1419
3791
|
//# sourceMappingURL=index.d.mts.map
|