@anastasia-labs/cardano-multiplatform-lib-nodejs 6.0.1-2 → 6.0.1
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/cardano_multiplatform_lib.d.ts +304 -285
- package/cardano_multiplatform_lib.js +463 -443
- package/cardano_multiplatform_lib_bg.wasm +0 -0
- package/package.json +1 -1
|
@@ -17,18 +17,6 @@ export function emip3_encrypt_with_password(password: string, salt: string, nonc
|
|
|
17
17
|
*/
|
|
18
18
|
export function emip3_decrypt_with_password(password: string, data: string): string;
|
|
19
19
|
/**
|
|
20
|
-
* encodes arbitrary bytes into chunks of 64 bytes (the limit for bytes) as a list to be valid Metadata
|
|
21
|
-
* @param {Uint8Array} bytes
|
|
22
|
-
* @returns {TransactionMetadatum}
|
|
23
|
-
*/
|
|
24
|
-
export function encode_arbitrary_bytes_as_metadatum(bytes: Uint8Array): TransactionMetadatum;
|
|
25
|
-
/**
|
|
26
|
-
* decodes from chunks of bytes in a list to a byte vector if that is the metadata format, otherwise returns None
|
|
27
|
-
* @param {TransactionMetadatum} metadata
|
|
28
|
-
* @returns {Uint8Array | undefined}
|
|
29
|
-
*/
|
|
30
|
-
export function decode_arbitrary_bytes_from_metadatum(metadata: TransactionMetadatum): Uint8Array | undefined;
|
|
31
|
-
/**
|
|
32
20
|
* @param {AuxiliaryData} auxiliary_data
|
|
33
21
|
* @returns {AuxiliaryDataHash}
|
|
34
22
|
*/
|
|
@@ -104,33 +92,6 @@ export function get_implicit_input(txbody: TransactionBody, pool_deposit: bigint
|
|
|
104
92
|
*/
|
|
105
93
|
export function get_deposit(txbody: TransactionBody, pool_deposit: bigint, key_deposit: bigint): bigint;
|
|
106
94
|
/**
|
|
107
|
-
*
|
|
108
|
-
* * Min fee for JUST the script, NOT including ref inputs
|
|
109
|
-
*
|
|
110
|
-
* @param {Transaction} tx
|
|
111
|
-
* @param {ExUnitPrices} ex_unit_prices
|
|
112
|
-
* @returns {bigint}
|
|
113
|
-
*/
|
|
114
|
-
export function min_script_fee(tx: Transaction, ex_unit_prices: ExUnitPrices): bigint;
|
|
115
|
-
/**
|
|
116
|
-
* @param {Transaction} tx
|
|
117
|
-
* @param {LinearFee} linear_fee
|
|
118
|
-
* @returns {bigint}
|
|
119
|
-
*/
|
|
120
|
-
export function min_no_script_fee(tx: Transaction, linear_fee: LinearFee): bigint;
|
|
121
|
-
/**
|
|
122
|
-
*
|
|
123
|
-
* * Calculates the cost of all ref scripts
|
|
124
|
-
* * * `total_ref_script_size` - Total size (original, not hashes) of all ref scripts. Duplicate scripts are counted as many times as they occur
|
|
125
|
-
*
|
|
126
|
-
* @param {Transaction} tx
|
|
127
|
-
* @param {LinearFee} linear_fee
|
|
128
|
-
* @param {ExUnitPrices} ex_unit_prices
|
|
129
|
-
* @param {bigint} total_ref_script_size
|
|
130
|
-
* @returns {bigint}
|
|
131
|
-
*/
|
|
132
|
-
export function min_fee(tx: Transaction, linear_fee: LinearFee, ex_unit_prices: ExUnitPrices, total_ref_script_size: bigint): bigint;
|
|
133
|
-
/**
|
|
134
95
|
* Converts JSON to Metadata according to MetadataJsonSchema
|
|
135
96
|
* @param {string} json
|
|
136
97
|
* @param {MetadataJsonSchema} schema
|
|
@@ -145,11 +106,47 @@ export function encode_json_str_to_metadatum(json: string, schema: MetadataJsonS
|
|
|
145
106
|
*/
|
|
146
107
|
export function decode_metadatum_to_json_str(metadatum: TransactionMetadatum, schema: MetadataJsonSchema): string;
|
|
147
108
|
/**
|
|
109
|
+
* @param {string} json
|
|
110
|
+
* @param {CardanoNodePlutusDatumSchema} schema
|
|
111
|
+
* @returns {PlutusData}
|
|
112
|
+
*/
|
|
113
|
+
export function encode_json_str_to_plutus_datum(json: string, schema: CardanoNodePlutusDatumSchema): PlutusData;
|
|
114
|
+
/**
|
|
115
|
+
* @param {PlutusData} datum
|
|
116
|
+
* @param {CardanoNodePlutusDatumSchema} schema
|
|
117
|
+
* @returns {string}
|
|
118
|
+
*/
|
|
119
|
+
export function decode_plutus_datum_to_json_str(datum: PlutusData, schema: CardanoNodePlutusDatumSchema): string;
|
|
120
|
+
/**
|
|
121
|
+
* @param {TransactionOutput} output
|
|
122
|
+
* @param {bigint} coins_per_utxo_byte
|
|
123
|
+
* @returns {bigint}
|
|
124
|
+
*/
|
|
125
|
+
export function min_ada_required(output: TransactionOutput, coins_per_utxo_byte: bigint): bigint;
|
|
126
|
+
/**
|
|
148
127
|
* @param {Redeemers} redeemers
|
|
149
128
|
* @returns {ExUnits}
|
|
150
129
|
*/
|
|
151
130
|
export function compute_total_ex_units(redeemers: Redeemers): ExUnits;
|
|
152
131
|
/**
|
|
132
|
+
* encodes arbitrary bytes into chunks of 64 bytes (the limit for bytes) as a list to be valid Metadata
|
|
133
|
+
* @param {Uint8Array} bytes
|
|
134
|
+
* @returns {TransactionMetadatum}
|
|
135
|
+
*/
|
|
136
|
+
export function encode_arbitrary_bytes_as_metadatum(bytes: Uint8Array): TransactionMetadatum;
|
|
137
|
+
/**
|
|
138
|
+
* decodes from chunks of bytes in a list to a byte vector if that is the metadata format, otherwise returns None
|
|
139
|
+
* @param {TransactionMetadatum} metadata
|
|
140
|
+
* @returns {Uint8Array | undefined}
|
|
141
|
+
*/
|
|
142
|
+
export function decode_arbitrary_bytes_from_metadatum(metadata: TransactionMetadatum): Uint8Array | undefined;
|
|
143
|
+
/**
|
|
144
|
+
* @param {TransactionHash} tx_body_hash
|
|
145
|
+
* @param {PrivateKey} sk
|
|
146
|
+
* @returns {Vkeywitness}
|
|
147
|
+
*/
|
|
148
|
+
export function make_vkey_witness(tx_body_hash: TransactionHash, sk: PrivateKey): Vkeywitness;
|
|
149
|
+
/**
|
|
153
150
|
* @param {TransactionHash} tx_body_hash
|
|
154
151
|
* @param {ByronAddress} addr
|
|
155
152
|
* @param {LegacyDaedalusPrivateKey} key
|
|
@@ -164,90 +161,53 @@ export function make_daedalus_bootstrap_witness(tx_body_hash: TransactionHash, a
|
|
|
164
161
|
*/
|
|
165
162
|
export function make_icarus_bootstrap_witness(tx_body_hash: TransactionHash, addr: ByronAddress, key: Bip32PrivateKey): BootstrapWitness;
|
|
166
163
|
/**
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* @param {TransactionOutput} output
|
|
174
|
-
* @param {bigint} coins_per_utxo_byte
|
|
164
|
+
*
|
|
165
|
+
* * Min fee for JUST the script, NOT including ref inputs
|
|
166
|
+
*
|
|
167
|
+
* @param {Transaction} tx
|
|
168
|
+
* @param {ExUnitPrices} ex_unit_prices
|
|
175
169
|
* @returns {bigint}
|
|
176
170
|
*/
|
|
177
|
-
export function
|
|
178
|
-
/**
|
|
179
|
-
* @param {string} json
|
|
180
|
-
* @param {CardanoNodePlutusDatumSchema} schema
|
|
181
|
-
* @returns {PlutusData}
|
|
182
|
-
*/
|
|
183
|
-
export function encode_json_str_to_plutus_datum(json: string, schema: CardanoNodePlutusDatumSchema): PlutusData;
|
|
184
|
-
/**
|
|
185
|
-
* @param {PlutusData} datum
|
|
186
|
-
* @param {CardanoNodePlutusDatumSchema} schema
|
|
187
|
-
* @returns {string}
|
|
188
|
-
*/
|
|
189
|
-
export function decode_plutus_datum_to_json_str(datum: PlutusData, schema: CardanoNodePlutusDatumSchema): string;
|
|
171
|
+
export function min_script_fee(tx: Transaction, ex_unit_prices: ExUnitPrices): bigint;
|
|
190
172
|
/**
|
|
173
|
+
* @param {Transaction} tx
|
|
174
|
+
* @param {LinearFee} linear_fee
|
|
175
|
+
* @returns {bigint}
|
|
191
176
|
*/
|
|
192
|
-
export
|
|
193
|
-
Single = 0,
|
|
194
|
-
Chunked = 1,
|
|
195
|
-
}
|
|
177
|
+
export function min_no_script_fee(tx: Transaction, linear_fee: LinearFee): bigint;
|
|
196
178
|
/**
|
|
179
|
+
*
|
|
180
|
+
* * Calculates the cost of all ref scripts
|
|
181
|
+
* * * `total_ref_script_size` - Total size (original, not hashes) of all ref scripts. Duplicate scripts are counted as many times as they occur
|
|
182
|
+
*
|
|
183
|
+
* @param {Transaction} tx
|
|
184
|
+
* @param {LinearFee} linear_fee
|
|
185
|
+
* @param {ExUnitPrices} ex_unit_prices
|
|
186
|
+
* @param {bigint} total_ref_script_size
|
|
187
|
+
* @returns {bigint}
|
|
197
188
|
*/
|
|
198
|
-
export
|
|
199
|
-
Native = 0,
|
|
200
|
-
PlutusV1 = 1,
|
|
201
|
-
PlutusV2 = 2,
|
|
202
|
-
PlutusV3 = 3,
|
|
203
|
-
}
|
|
189
|
+
export function min_fee(tx: Transaction, linear_fee: LinearFee, ex_unit_prices: ExUnitPrices, total_ref_script_size: bigint): bigint;
|
|
204
190
|
/**
|
|
205
|
-
* Careful: this enum doesn't include the network ID part of the header
|
|
206
|
-
* ex: base address isn't 0b0000_0000 but instead 0b0000
|
|
207
|
-
* Use `header_matches_kind` if you don't want to implement the bitwise operators yourself
|
|
208
191
|
*/
|
|
209
|
-
export enum
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
BasePaymentScriptStakeScript = 3,
|
|
214
|
-
PointerKey = 4,
|
|
215
|
-
PointerScript = 5,
|
|
216
|
-
EnterpriseKey = 6,
|
|
217
|
-
EnterpriseScript = 7,
|
|
218
|
-
Byron = 8,
|
|
219
|
-
RewardKey = 14,
|
|
220
|
-
RewardScript = 15,
|
|
192
|
+
export enum MetadataJsonSchema {
|
|
193
|
+
NoConversions = 0,
|
|
194
|
+
BasicConversions = 1,
|
|
195
|
+
DetailedSchema = 2,
|
|
221
196
|
}
|
|
222
197
|
/**
|
|
223
198
|
*/
|
|
224
|
-
export enum
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
199
|
+
export enum AddressKind {
|
|
200
|
+
Base = 0,
|
|
201
|
+
Ptr = 1,
|
|
202
|
+
Enterprise = 2,
|
|
203
|
+
Reward = 3,
|
|
204
|
+
Byron = 4,
|
|
228
205
|
}
|
|
229
206
|
/**
|
|
230
207
|
*/
|
|
231
|
-
export enum
|
|
232
|
-
|
|
208
|
+
export enum CredentialKind {
|
|
209
|
+
PubKey = 0,
|
|
233
210
|
Script = 1,
|
|
234
|
-
AlwaysAbstain = 2,
|
|
235
|
-
AlwaysNoConfidence = 3,
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
*/
|
|
239
|
-
export enum StakeDistributionKind {
|
|
240
|
-
SingleKey = 0,
|
|
241
|
-
BootstrapEra = 1,
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
*/
|
|
245
|
-
export enum VoterKind {
|
|
246
|
-
ConstitutionalCommitteeHotKeyHash = 0,
|
|
247
|
-
ConstitutionalCommitteeHotScriptHash = 1,
|
|
248
|
-
DRepKeyHash = 2,
|
|
249
|
-
DRepScriptHash = 3,
|
|
250
|
-
StakingPoolKeyHash = 4,
|
|
251
211
|
}
|
|
252
212
|
/**
|
|
253
213
|
* Which version of the CIP25 spec to use. See CIP25 for details.
|
|
@@ -266,34 +226,20 @@ export enum CIP25Version {
|
|
|
266
226
|
}
|
|
267
227
|
/**
|
|
268
228
|
*/
|
|
269
|
-
export enum
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
export enum MetadataJsonSchema {
|
|
276
|
-
NoConversions = 0,
|
|
277
|
-
BasicConversions = 1,
|
|
278
|
-
DetailedSchema = 2,
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
*/
|
|
282
|
-
export enum AuxiliaryDataKind {
|
|
283
|
-
Shelley = 0,
|
|
284
|
-
ShelleyMA = 1,
|
|
285
|
-
Conway = 2,
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
*/
|
|
289
|
-
export enum CredentialKind {
|
|
290
|
-
PubKey = 0,
|
|
291
|
-
Script = 1,
|
|
229
|
+
export enum VoterKind {
|
|
230
|
+
ConstitutionalCommitteeHotKeyHash = 0,
|
|
231
|
+
ConstitutionalCommitteeHotScriptHash = 1,
|
|
232
|
+
DRepKeyHash = 2,
|
|
233
|
+
DRepScriptHash = 3,
|
|
234
|
+
StakingPoolKeyHash = 4,
|
|
292
235
|
}
|
|
293
236
|
/**
|
|
294
237
|
*/
|
|
295
|
-
export enum
|
|
296
|
-
|
|
238
|
+
export enum ScriptKind {
|
|
239
|
+
Native = 0,
|
|
240
|
+
PlutusV1 = 1,
|
|
241
|
+
PlutusV2 = 2,
|
|
242
|
+
PlutusV3 = 3,
|
|
297
243
|
}
|
|
298
244
|
/**
|
|
299
245
|
*/
|
|
@@ -304,21 +250,68 @@ export enum Vote {
|
|
|
304
250
|
}
|
|
305
251
|
/**
|
|
306
252
|
*/
|
|
307
|
-
export enum
|
|
308
|
-
|
|
309
|
-
|
|
253
|
+
export enum NonceKind {
|
|
254
|
+
Identity = 0,
|
|
255
|
+
Hash = 1,
|
|
310
256
|
}
|
|
311
257
|
/**
|
|
312
258
|
*/
|
|
313
|
-
export enum
|
|
314
|
-
|
|
315
|
-
|
|
259
|
+
export enum RelayKind {
|
|
260
|
+
SingleHostAddr = 0,
|
|
261
|
+
SingleHostName = 1,
|
|
262
|
+
MultiHostName = 2,
|
|
316
263
|
}
|
|
317
264
|
/**
|
|
265
|
+
* JSON <-> PlutusData conversion schemas.
|
|
266
|
+
* Follows ScriptDataJsonSchema in cardano-cli defined at:
|
|
267
|
+
* https://github.com/input-output-hk/cardano-node/blob/master/cardano-api/src/Cardano/Api/ScriptData.hs#L254
|
|
268
|
+
*
|
|
269
|
+
* All methods here have the following restrictions due to limitations on dependencies:
|
|
270
|
+
* * JSON numbers above u64::MAX (positive) or below i64::MIN (negative) will throw errors
|
|
271
|
+
* * Hex strings for bytes don't accept odd-length (half-byte) strings.
|
|
272
|
+
* cardano-cli seems to support these however but it seems to be different than just 0-padding
|
|
273
|
+
* on either side when tested so proceed with caution
|
|
318
274
|
*/
|
|
319
|
-
export enum
|
|
320
|
-
|
|
321
|
-
|
|
275
|
+
export enum CardanoNodePlutusDatumSchema {
|
|
276
|
+
/**
|
|
277
|
+
* ScriptDataJsonNoSchema in cardano-node.
|
|
278
|
+
*
|
|
279
|
+
* This is the format used by --script-data-value in cardano-cli
|
|
280
|
+
* This tries to accept most JSON but does not support the full spectrum of Plutus datums.
|
|
281
|
+
* From JSON:
|
|
282
|
+
* * null/true/false/floats NOT supported
|
|
283
|
+
* * strings starting with 0x are treated as hex bytes. All other strings are encoded as their utf8 bytes.
|
|
284
|
+
* To JSON:
|
|
285
|
+
* * ConstrPlutusData not supported in ANY FORM (neither keys nor values)
|
|
286
|
+
* * Lists not supported in keys
|
|
287
|
+
* * Maps not supported in keys
|
|
288
|
+
*/
|
|
289
|
+
BasicConversions = 0,
|
|
290
|
+
/**
|
|
291
|
+
* ScriptDataJsonDetailedSchema in cardano-node.
|
|
292
|
+
*
|
|
293
|
+
* This is the format used by --script-data-file in cardano-cli
|
|
294
|
+
* This covers almost all (only minor exceptions) Plutus datums, but the JSON must conform to a strict schema.
|
|
295
|
+
* The schema specifies that ALL keys and ALL values must be contained in a JSON map with 2 cases:
|
|
296
|
+
* 1. For ConstrPlutusData there must be two fields "constructor" contianing a number and "fields" containing its fields
|
|
297
|
+
* e.g. { "constructor": 2, "fields": [{"int": 2}, {"list": [{"bytes": "CAFEF00D"}]}]}
|
|
298
|
+
* 2. For all other cases there must be only one field named "int", "bytes", "list" or "map"
|
|
299
|
+
* BigInteger's value is a JSON number e.g. {"int": 100}
|
|
300
|
+
* Bytes' value is a hex string representing the bytes WITHOUT any prefix e.g. {"bytes": "CAFEF00D"}
|
|
301
|
+
* Lists' value is a JSON list of its elements encoded via the same schema e.g. {"list": [{"bytes": "CAFEF00D"}]}
|
|
302
|
+
* Maps' value is a JSON list of objects, one for each key-value pair in the map, with keys "k" and "v"
|
|
303
|
+
* respectively with their values being the plutus datum encoded via this same schema
|
|
304
|
+
* e.g. {"map": [
|
|
305
|
+
* {"k": {"int": 2}, "v": {"int": 5}},
|
|
306
|
+
* {"k": {"map": [{"k": {"list": [{"int": 1}]}, "v": {"bytes": "FF03"}}]}, "v": {"list": []}}
|
|
307
|
+
* ]}
|
|
308
|
+
* From JSON:
|
|
309
|
+
* * null/true/false/floats NOT supported
|
|
310
|
+
* * the JSON must conform to a very specific schema
|
|
311
|
+
* To JSON:
|
|
312
|
+
* * all Plutus datums should be fully supported outside of the integer range limitations outlined above.
|
|
313
|
+
*/
|
|
314
|
+
DetailedSchema = 1,
|
|
322
315
|
}
|
|
323
316
|
/**
|
|
324
317
|
*/
|
|
@@ -332,60 +325,31 @@ export enum RedeemerTag {
|
|
|
332
325
|
}
|
|
333
326
|
/**
|
|
334
327
|
*/
|
|
335
|
-
export enum
|
|
336
|
-
PlutusV1 = 0,
|
|
337
|
-
PlutusV2 = 1,
|
|
338
|
-
PlutusV3 = 2,
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
*/
|
|
342
|
-
export enum SpendingDataKind {
|
|
343
|
-
SpendingDataPubKey = 0,
|
|
344
|
-
SpendingDataScript = 1,
|
|
345
|
-
SpendingDataRedeem = 2,
|
|
346
|
-
}
|
|
328
|
+
export enum CoinSelectionStrategyCIP2 {
|
|
347
329
|
/**
|
|
330
|
+
* Performs CIP2's Largest First ada-only selection. Will error if outputs contain non-ADA assets.
|
|
348
331
|
*/
|
|
349
|
-
|
|
350
|
-
ParameterChangeAction = 0,
|
|
351
|
-
HardForkInitiationAction = 1,
|
|
352
|
-
TreasuryWithdrawalsAction = 2,
|
|
353
|
-
NoConfidence = 3,
|
|
354
|
-
UpdateCommittee = 4,
|
|
355
|
-
NewConstitution = 5,
|
|
356
|
-
InfoAction = 6,
|
|
357
|
-
}
|
|
332
|
+
LargestFirst = 0,
|
|
358
333
|
/**
|
|
334
|
+
* Performs CIP2's Random Improve ada-only selection. Will error if outputs contain non-ADA assets.
|
|
359
335
|
*/
|
|
360
|
-
|
|
361
|
-
ArrLegacyRedeemer = 0,
|
|
362
|
-
MapRedeemerKeyToRedeemerVal = 1,
|
|
363
|
-
}
|
|
336
|
+
RandomImprove = 1,
|
|
364
337
|
/**
|
|
338
|
+
* Same as LargestFirst, but before adding ADA, will insert by largest-first for each asset type.
|
|
365
339
|
*/
|
|
366
|
-
|
|
367
|
-
Base = 0,
|
|
368
|
-
Ptr = 1,
|
|
369
|
-
Enterprise = 2,
|
|
370
|
-
Reward = 3,
|
|
371
|
-
Byron = 4,
|
|
372
|
-
}
|
|
340
|
+
LargestFirstMultiAsset = 2,
|
|
373
341
|
/**
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
Script = 1,
|
|
378
|
-
Redeem = 2,
|
|
342
|
+
* Same as RandomImprove, but before adding ADA, will insert by random-improve for each asset type.
|
|
343
|
+
*/
|
|
344
|
+
RandomImproveMultiAsset = 3,
|
|
379
345
|
}
|
|
380
346
|
/**
|
|
381
347
|
*/
|
|
382
|
-
export enum
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
ScriptInvalidBefore = 4,
|
|
388
|
-
ScriptInvalidHereafter = 5,
|
|
348
|
+
export enum DRepKind {
|
|
349
|
+
Key = 0,
|
|
350
|
+
Script = 1,
|
|
351
|
+
AlwaysAbstain = 2,
|
|
352
|
+
AlwaysNoConfidence = 3,
|
|
389
353
|
}
|
|
390
354
|
/**
|
|
391
355
|
*/
|
|
@@ -419,6 +383,42 @@ export enum PlutusDataKind {
|
|
|
419
383
|
}
|
|
420
384
|
/**
|
|
421
385
|
*/
|
|
386
|
+
export enum DelegationDistributionKind {
|
|
387
|
+
Weighted = 0,
|
|
388
|
+
Legacy = 1,
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
*/
|
|
392
|
+
export enum GovActionKind {
|
|
393
|
+
ParameterChangeAction = 0,
|
|
394
|
+
HardForkInitiationAction = 1,
|
|
395
|
+
TreasuryWithdrawalsAction = 2,
|
|
396
|
+
NoConfidence = 3,
|
|
397
|
+
UpdateCommittee = 4,
|
|
398
|
+
NewConstitution = 5,
|
|
399
|
+
InfoAction = 6,
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
*/
|
|
403
|
+
export enum Language {
|
|
404
|
+
PlutusV1 = 0,
|
|
405
|
+
PlutusV2 = 1,
|
|
406
|
+
PlutusV3 = 2,
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
*/
|
|
410
|
+
export enum StakeDistributionKind {
|
|
411
|
+
SingleKey = 0,
|
|
412
|
+
BootstrapEra = 1,
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
*/
|
|
416
|
+
export enum ChunkableStringKind {
|
|
417
|
+
Single = 0,
|
|
418
|
+
Chunked = 1,
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
*/
|
|
422
422
|
export enum TransactionMetadatumKind {
|
|
423
423
|
Map = 0,
|
|
424
424
|
List = 1,
|
|
@@ -428,75 +428,75 @@ export enum TransactionMetadatumKind {
|
|
|
428
428
|
}
|
|
429
429
|
/**
|
|
430
430
|
*/
|
|
431
|
-
export enum
|
|
431
|
+
export enum DatumOptionKind {
|
|
432
|
+
Hash = 0,
|
|
433
|
+
Datum = 1,
|
|
434
|
+
}
|
|
432
435
|
/**
|
|
433
|
-
* Performs CIP2's Largest First ada-only selection. Will error if outputs contain non-ADA assets.
|
|
434
436
|
*/
|
|
435
|
-
|
|
437
|
+
export enum SpendingDataKind {
|
|
438
|
+
SpendingDataPubKey = 0,
|
|
439
|
+
SpendingDataScript = 1,
|
|
440
|
+
SpendingDataRedeem = 2,
|
|
441
|
+
}
|
|
436
442
|
/**
|
|
437
|
-
* Performs CIP2's Random Improve ada-only selection. Will error if outputs contain non-ADA assets.
|
|
438
443
|
*/
|
|
439
|
-
|
|
444
|
+
export enum RedeemersKind {
|
|
445
|
+
ArrLegacyRedeemer = 0,
|
|
446
|
+
MapRedeemerKeyToRedeemerVal = 1,
|
|
447
|
+
}
|
|
440
448
|
/**
|
|
441
|
-
*
|
|
449
|
+
* Careful: this enum doesn't include the network ID part of the header
|
|
450
|
+
* ex: base address isn't 0b0000_0000 but instead 0b0000
|
|
451
|
+
* Use `header_matches_kind` if you don't want to implement the bitwise operators yourself
|
|
442
452
|
*/
|
|
443
|
-
|
|
453
|
+
export enum AddressHeaderKind {
|
|
454
|
+
BasePaymentKeyStakeKey = 0,
|
|
455
|
+
BasePaymentScriptStakeKey = 1,
|
|
456
|
+
BasePaymentKeyStakeScript = 2,
|
|
457
|
+
BasePaymentScriptStakeScript = 3,
|
|
458
|
+
PointerKey = 4,
|
|
459
|
+
PointerScript = 5,
|
|
460
|
+
EnterpriseKey = 6,
|
|
461
|
+
EnterpriseScript = 7,
|
|
462
|
+
Byron = 8,
|
|
463
|
+
RewardKey = 14,
|
|
464
|
+
RewardScript = 15,
|
|
465
|
+
}
|
|
444
466
|
/**
|
|
445
|
-
* Same as RandomImprove, but before adding ADA, will insert by random-improve for each asset type.
|
|
446
467
|
*/
|
|
447
|
-
|
|
468
|
+
export enum TransactionOutputKind {
|
|
469
|
+
AlonzoFormatTxOut = 0,
|
|
470
|
+
ConwayFormatTxOut = 1,
|
|
448
471
|
}
|
|
449
472
|
/**
|
|
450
|
-
* JSON <-> PlutusData conversion schemas.
|
|
451
|
-
* Follows ScriptDataJsonSchema in cardano-cli defined at:
|
|
452
|
-
* https://github.com/input-output-hk/cardano-node/blob/master/cardano-api/src/Cardano/Api/ScriptData.hs#L254
|
|
453
|
-
*
|
|
454
|
-
* All methods here have the following restrictions due to limitations on dependencies:
|
|
455
|
-
* * JSON numbers above u64::MAX (positive) or below i64::MIN (negative) will throw errors
|
|
456
|
-
* * Hex strings for bytes don't accept odd-length (half-byte) strings.
|
|
457
|
-
* cardano-cli seems to support these however but it seems to be different than just 0-padding
|
|
458
|
-
* on either side when tested so proceed with caution
|
|
459
473
|
*/
|
|
460
|
-
export enum
|
|
474
|
+
export enum ByronAddrType {
|
|
475
|
+
PublicKey = 0,
|
|
476
|
+
Script = 1,
|
|
477
|
+
Redeem = 2,
|
|
478
|
+
}
|
|
461
479
|
/**
|
|
462
|
-
* ScriptDataJsonNoSchema in cardano-node.
|
|
463
|
-
*
|
|
464
|
-
* This is the format used by --script-data-value in cardano-cli
|
|
465
|
-
* This tries to accept most JSON but does not support the full spectrum of Plutus datums.
|
|
466
|
-
* From JSON:
|
|
467
|
-
* * null/true/false/floats NOT supported
|
|
468
|
-
* * strings starting with 0x are treated as hex bytes. All other strings are encoded as their utf8 bytes.
|
|
469
|
-
* To JSON:
|
|
470
|
-
* * ConstrPlutusData not supported in ANY FORM (neither keys nor values)
|
|
471
|
-
* * Lists not supported in keys
|
|
472
|
-
* * Maps not supported in keys
|
|
473
480
|
*/
|
|
474
|
-
|
|
481
|
+
export enum NativeScriptKind {
|
|
482
|
+
ScriptPubkey = 0,
|
|
483
|
+
ScriptAll = 1,
|
|
484
|
+
ScriptAny = 2,
|
|
485
|
+
ScriptNOfK = 3,
|
|
486
|
+
ScriptInvalidBefore = 4,
|
|
487
|
+
ScriptInvalidHereafter = 5,
|
|
488
|
+
}
|
|
475
489
|
/**
|
|
476
|
-
* ScriptDataJsonDetailedSchema in cardano-node.
|
|
477
|
-
*
|
|
478
|
-
* This is the format used by --script-data-file in cardano-cli
|
|
479
|
-
* This covers almost all (only minor exceptions) Plutus datums, but the JSON must conform to a strict schema.
|
|
480
|
-
* The schema specifies that ALL keys and ALL values must be contained in a JSON map with 2 cases:
|
|
481
|
-
* 1. For ConstrPlutusData there must be two fields "constructor" contianing a number and "fields" containing its fields
|
|
482
|
-
* e.g. { "constructor": 2, "fields": [{"int": 2}, {"list": [{"bytes": "CAFEF00D"}]}]}
|
|
483
|
-
* 2. For all other cases there must be only one field named "int", "bytes", "list" or "map"
|
|
484
|
-
* BigInteger's value is a JSON number e.g. {"int": 100}
|
|
485
|
-
* Bytes' value is a hex string representing the bytes WITHOUT any prefix e.g. {"bytes": "CAFEF00D"}
|
|
486
|
-
* Lists' value is a JSON list of its elements encoded via the same schema e.g. {"list": [{"bytes": "CAFEF00D"}]}
|
|
487
|
-
* Maps' value is a JSON list of objects, one for each key-value pair in the map, with keys "k" and "v"
|
|
488
|
-
* respectively with their values being the plutus datum encoded via this same schema
|
|
489
|
-
* e.g. {"map": [
|
|
490
|
-
* {"k": {"int": 2}, "v": {"int": 5}},
|
|
491
|
-
* {"k": {"map": [{"k": {"list": [{"int": 1}]}, "v": {"bytes": "FF03"}}]}, "v": {"list": []}}
|
|
492
|
-
* ]}
|
|
493
|
-
* From JSON:
|
|
494
|
-
* * null/true/false/floats NOT supported
|
|
495
|
-
* * the JSON must conform to a very specific schema
|
|
496
|
-
* To JSON:
|
|
497
|
-
* * all Plutus datums should be fully supported outside of the integer range limitations outlined above.
|
|
498
490
|
*/
|
|
499
|
-
|
|
491
|
+
export enum AuxiliaryDataKind {
|
|
492
|
+
Shelley = 0,
|
|
493
|
+
ShelleyMA = 1,
|
|
494
|
+
Conway = 2,
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
*/
|
|
498
|
+
export enum ChangeSelectionAlgo {
|
|
499
|
+
Default = 0,
|
|
500
500
|
}
|
|
501
501
|
/**
|
|
502
502
|
*/
|
|
@@ -1072,6 +1072,51 @@ export class AssetName {
|
|
|
1072
1072
|
free(): void;
|
|
1073
1073
|
/**
|
|
1074
1074
|
*
|
|
1075
|
+
* * Create an AssetName from utf8 string. 64 byte (not char!) maximum.
|
|
1076
|
+
*
|
|
1077
|
+
* @param {string} utf8_str
|
|
1078
|
+
* @returns {AssetName}
|
|
1079
|
+
*/
|
|
1080
|
+
static from_str(utf8_str: string): AssetName;
|
|
1081
|
+
/**
|
|
1082
|
+
*
|
|
1083
|
+
* * AssetName as a utf8 string if it's possible. Will error if the asset is not utf8
|
|
1084
|
+
*
|
|
1085
|
+
* @returns {string}
|
|
1086
|
+
*/
|
|
1087
|
+
to_str(): string;
|
|
1088
|
+
/**
|
|
1089
|
+
*
|
|
1090
|
+
* * Direct raw bytes without any CBOR structure
|
|
1091
|
+
*
|
|
1092
|
+
* @returns {Uint8Array}
|
|
1093
|
+
*/
|
|
1094
|
+
to_raw_bytes(): Uint8Array;
|
|
1095
|
+
/**
|
|
1096
|
+
*
|
|
1097
|
+
* * Parse from the direct raw bytes, without any CBOR structure
|
|
1098
|
+
*
|
|
1099
|
+
* @param {Uint8Array} bytes
|
|
1100
|
+
* @returns {AssetName}
|
|
1101
|
+
*/
|
|
1102
|
+
static from_raw_bytes(bytes: Uint8Array): AssetName;
|
|
1103
|
+
/**
|
|
1104
|
+
*
|
|
1105
|
+
* * Direct raw bytes without any CBOR structure, as a hex-encoded string
|
|
1106
|
+
*
|
|
1107
|
+
* @returns {string}
|
|
1108
|
+
*/
|
|
1109
|
+
to_hex(): string;
|
|
1110
|
+
/**
|
|
1111
|
+
*
|
|
1112
|
+
* * Parse from a hex string of the direct raw bytes, without any CBOR structure
|
|
1113
|
+
*
|
|
1114
|
+
* @param {string} input
|
|
1115
|
+
* @returns {AssetName}
|
|
1116
|
+
*/
|
|
1117
|
+
static from_hex(input: string): AssetName;
|
|
1118
|
+
/**
|
|
1119
|
+
*
|
|
1075
1120
|
* * Serialize this type to CBOR bytes
|
|
1076
1121
|
* * This type type supports encoding preservation so this will preserve round-trip CBOR formats.
|
|
1077
1122
|
* * If created from scratch the CBOR will be canonical.
|
|
@@ -1132,51 +1177,6 @@ export class AssetName {
|
|
|
1132
1177
|
* @returns {AssetName}
|
|
1133
1178
|
*/
|
|
1134
1179
|
static from_json(json: string): AssetName;
|
|
1135
|
-
/**
|
|
1136
|
-
*
|
|
1137
|
-
* * Create an AssetName from utf8 string. 64 byte (not char!) maximum.
|
|
1138
|
-
*
|
|
1139
|
-
* @param {string} utf8_str
|
|
1140
|
-
* @returns {AssetName}
|
|
1141
|
-
*/
|
|
1142
|
-
static from_str(utf8_str: string): AssetName;
|
|
1143
|
-
/**
|
|
1144
|
-
*
|
|
1145
|
-
* * AssetName as a utf8 string if it's possible. Will error if the asset is not utf8
|
|
1146
|
-
*
|
|
1147
|
-
* @returns {string}
|
|
1148
|
-
*/
|
|
1149
|
-
to_str(): string;
|
|
1150
|
-
/**
|
|
1151
|
-
*
|
|
1152
|
-
* * Direct raw bytes without any CBOR structure
|
|
1153
|
-
*
|
|
1154
|
-
* @returns {Uint8Array}
|
|
1155
|
-
*/
|
|
1156
|
-
to_raw_bytes(): Uint8Array;
|
|
1157
|
-
/**
|
|
1158
|
-
*
|
|
1159
|
-
* * Parse from the direct raw bytes, without any CBOR structure
|
|
1160
|
-
*
|
|
1161
|
-
* @param {Uint8Array} bytes
|
|
1162
|
-
* @returns {AssetName}
|
|
1163
|
-
*/
|
|
1164
|
-
static from_raw_bytes(bytes: Uint8Array): AssetName;
|
|
1165
|
-
/**
|
|
1166
|
-
*
|
|
1167
|
-
* * Direct raw bytes without any CBOR structure, as a hex-encoded string
|
|
1168
|
-
*
|
|
1169
|
-
* @returns {string}
|
|
1170
|
-
*/
|
|
1171
|
-
to_hex(): string;
|
|
1172
|
-
/**
|
|
1173
|
-
*
|
|
1174
|
-
* * Parse from a hex string of the direct raw bytes, without any CBOR structure
|
|
1175
|
-
*
|
|
1176
|
-
* @param {string} input
|
|
1177
|
-
* @returns {AssetName}
|
|
1178
|
-
*/
|
|
1179
|
-
static from_hex(input: string): AssetName;
|
|
1180
1180
|
}
|
|
1181
1181
|
/**
|
|
1182
1182
|
*/
|
|
@@ -7597,6 +7597,25 @@ export class PlutusData {
|
|
|
7597
7597
|
free(): void;
|
|
7598
7598
|
/**
|
|
7599
7599
|
*
|
|
7600
|
+
* * Convert to a Datum that will serialize equivalent to cardano-node's format
|
|
7601
|
+
* *
|
|
7602
|
+
* * Please VERY STRONGLY consider using PlutusData::from_cbor_bytes() instead wherever possible.
|
|
7603
|
+
* * You should try to never rely on a tool encoding CBOR a certain way as there are many possible,
|
|
7604
|
+
* * and just because it matches with a specific datum, doesn't mean that a different datum won't differ.
|
|
7605
|
+
* * This is critical as that means the datum hash won't match.
|
|
7606
|
+
* * After creation a datum (or other hashable CBOR object) should only be treated as raw CBOR bytes,
|
|
7607
|
+
* * or through a type that respects its specific CBOR format e.g. CML's PlutusData::from_cbor_bytes()
|
|
7608
|
+
* *
|
|
7609
|
+
* * This function is just here in case there's no possible way at all to create from CBOR bytes and
|
|
7610
|
+
* * thus cold only be constructed manually and then had this function called on it.
|
|
7611
|
+
* *
|
|
7612
|
+
* * This is also the format that CSL and Lucid use
|
|
7613
|
+
*
|
|
7614
|
+
* @returns {PlutusData}
|
|
7615
|
+
*/
|
|
7616
|
+
to_cardano_node_format(): PlutusData;
|
|
7617
|
+
/**
|
|
7618
|
+
*
|
|
7600
7619
|
* * Serialize this type to CBOR bytes
|
|
7601
7620
|
* * This type type supports encoding preservation so this will preserve round-trip CBOR formats.
|
|
7602
7621
|
* * If created from scratch the CBOR will be canonical.
|