@anastasia-labs/cardano-multiplatform-lib-nodejs 6.0.2-1 → 6.0.2-3
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 +363 -363
- package/cardano_multiplatform_lib.js +737 -735
- package/cardano_multiplatform_lib_bg.wasm +0 -0
- package/package.json +1 -1
|
@@ -17,6 +17,64 @@ 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
|
+
*
|
|
33
|
+
* * Min fee for JUST the script, NOT including ref inputs
|
|
34
|
+
*
|
|
35
|
+
* @param {Transaction} tx
|
|
36
|
+
* @param {ExUnitPrices} ex_unit_prices
|
|
37
|
+
* @returns {bigint}
|
|
38
|
+
*/
|
|
39
|
+
export function min_script_fee(tx: Transaction, ex_unit_prices: ExUnitPrices): bigint;
|
|
40
|
+
/**
|
|
41
|
+
* @param {Transaction} tx
|
|
42
|
+
* @param {LinearFee} linear_fee
|
|
43
|
+
* @returns {bigint}
|
|
44
|
+
*/
|
|
45
|
+
export function min_no_script_fee(tx: Transaction, linear_fee: LinearFee): bigint;
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* * Calculates the cost of all ref scripts
|
|
49
|
+
* * * `total_ref_script_size` - Total size (original, not hashes) of all ref scripts. Duplicate scripts are counted as many times as they occur
|
|
50
|
+
*
|
|
51
|
+
* @param {Transaction} tx
|
|
52
|
+
* @param {LinearFee} linear_fee
|
|
53
|
+
* @param {ExUnitPrices} ex_unit_prices
|
|
54
|
+
* @param {bigint} total_ref_script_size
|
|
55
|
+
* @returns {bigint}
|
|
56
|
+
*/
|
|
57
|
+
export function min_fee(tx: Transaction, linear_fee: LinearFee, ex_unit_prices: ExUnitPrices, total_ref_script_size: bigint): bigint;
|
|
58
|
+
/**
|
|
59
|
+
* @param {TransactionHash} tx_body_hash
|
|
60
|
+
* @param {ByronAddress} addr
|
|
61
|
+
* @param {LegacyDaedalusPrivateKey} key
|
|
62
|
+
* @returns {BootstrapWitness}
|
|
63
|
+
*/
|
|
64
|
+
export function make_daedalus_bootstrap_witness(tx_body_hash: TransactionHash, addr: ByronAddress, key: LegacyDaedalusPrivateKey): BootstrapWitness;
|
|
65
|
+
/**
|
|
66
|
+
* @param {TransactionHash} tx_body_hash
|
|
67
|
+
* @param {ByronAddress} addr
|
|
68
|
+
* @param {Bip32PrivateKey} key
|
|
69
|
+
* @returns {BootstrapWitness}
|
|
70
|
+
*/
|
|
71
|
+
export function make_icarus_bootstrap_witness(tx_body_hash: TransactionHash, addr: ByronAddress, key: Bip32PrivateKey): BootstrapWitness;
|
|
72
|
+
/**
|
|
73
|
+
* @param {Redeemers} redeemers
|
|
74
|
+
* @returns {ExUnits}
|
|
75
|
+
*/
|
|
76
|
+
export function compute_total_ex_units(redeemers: Redeemers): ExUnits;
|
|
77
|
+
/**
|
|
20
78
|
* @param {AuxiliaryData} auxiliary_data
|
|
21
79
|
* @returns {AuxiliaryDataHash}
|
|
22
80
|
*/
|
|
@@ -78,6 +136,12 @@ export function calc_script_data_hash(redeemers: Redeemers, datums: PlutusDataLi
|
|
|
78
136
|
*/
|
|
79
137
|
export function calc_script_data_hash_from_witness(witnesses: TransactionWitnessSet, cost_models: CostModels): ScriptDataHash | undefined;
|
|
80
138
|
/**
|
|
139
|
+
* @param {TransactionHash} tx_body_hash
|
|
140
|
+
* @param {PrivateKey} sk
|
|
141
|
+
* @returns {Vkeywitness}
|
|
142
|
+
*/
|
|
143
|
+
export function make_vkey_witness(tx_body_hash: TransactionHash, sk: PrivateKey): Vkeywitness;
|
|
144
|
+
/**
|
|
81
145
|
* @param {TransactionBody} txbody
|
|
82
146
|
* @param {bigint} pool_deposit
|
|
83
147
|
* @param {bigint} key_deposit
|
|
@@ -124,74 +188,96 @@ export function decode_plutus_datum_to_json_str(datum: PlutusData, schema: Carda
|
|
|
124
188
|
*/
|
|
125
189
|
export function min_ada_required(output: TransactionOutput, coins_per_utxo_byte: bigint): bigint;
|
|
126
190
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
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}
|
|
191
|
+
* JSON <-> PlutusData conversion schemas.
|
|
192
|
+
* Follows ScriptDataJsonSchema in cardano-cli defined at:
|
|
193
|
+
* https://github.com/input-output-hk/cardano-node/blob/master/cardano-api/src/Cardano/Api/ScriptData.hs#L254
|
|
194
|
+
*
|
|
195
|
+
* All methods here have the following restrictions due to limitations on dependencies:
|
|
196
|
+
* * JSON numbers above u64::MAX (positive) or below i64::MIN (negative) will throw errors
|
|
197
|
+
* * Hex strings for bytes don't accept odd-length (half-byte) strings.
|
|
198
|
+
* cardano-cli seems to support these however but it seems to be different than just 0-padding
|
|
199
|
+
* on either side when tested so proceed with caution
|
|
141
200
|
*/
|
|
142
|
-
export
|
|
201
|
+
export enum CardanoNodePlutusDatumSchema {
|
|
143
202
|
/**
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
203
|
+
* ScriptDataJsonNoSchema in cardano-node.
|
|
204
|
+
*
|
|
205
|
+
* This is the format used by --script-data-value in cardano-cli
|
|
206
|
+
* This tries to accept most JSON but does not support the full spectrum of Plutus datums.
|
|
207
|
+
* From JSON:
|
|
208
|
+
* * null/true/false/floats NOT supported
|
|
209
|
+
* * strings starting with 0x are treated as hex bytes. All other strings are encoded as their utf8 bytes.
|
|
210
|
+
* To JSON:
|
|
211
|
+
* * ConstrPlutusData not supported in ANY FORM (neither keys nor values)
|
|
212
|
+
* * Lists not supported in keys
|
|
213
|
+
* * Maps not supported in keys
|
|
147
214
|
*/
|
|
148
|
-
|
|
215
|
+
BasicConversions = 0,
|
|
149
216
|
/**
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
217
|
+
* ScriptDataJsonDetailedSchema in cardano-node.
|
|
218
|
+
*
|
|
219
|
+
* This is the format used by --script-data-file in cardano-cli
|
|
220
|
+
* This covers almost all (only minor exceptions) Plutus datums, but the JSON must conform to a strict schema.
|
|
221
|
+
* The schema specifies that ALL keys and ALL values must be contained in a JSON map with 2 cases:
|
|
222
|
+
* 1. For ConstrPlutusData there must be two fields "constructor" contianing a number and "fields" containing its fields
|
|
223
|
+
* e.g. { "constructor": 2, "fields": [{"int": 2}, {"list": [{"bytes": "CAFEF00D"}]}]}
|
|
224
|
+
* 2. For all other cases there must be only one field named "int", "bytes", "list" or "map"
|
|
225
|
+
* BigInteger's value is a JSON number e.g. {"int": 100}
|
|
226
|
+
* Bytes' value is a hex string representing the bytes WITHOUT any prefix e.g. {"bytes": "CAFEF00D"}
|
|
227
|
+
* Lists' value is a JSON list of its elements encoded via the same schema e.g. {"list": [{"bytes": "CAFEF00D"}]}
|
|
228
|
+
* Maps' value is a JSON list of objects, one for each key-value pair in the map, with keys "k" and "v"
|
|
229
|
+
* respectively with their values being the plutus datum encoded via this same schema
|
|
230
|
+
* e.g. {"map": [
|
|
231
|
+
* {"k": {"int": 2}, "v": {"int": 5}},
|
|
232
|
+
* {"k": {"map": [{"k": {"list": [{"int": 1}]}, "v": {"bytes": "FF03"}}]}, "v": {"list": []}}
|
|
233
|
+
* ]}
|
|
234
|
+
* From JSON:
|
|
235
|
+
* * null/true/false/floats NOT supported
|
|
236
|
+
* * the JSON must conform to a very specific schema
|
|
237
|
+
* To JSON:
|
|
238
|
+
* * all Plutus datums should be fully supported outside of the integer range limitations outlined above.
|
|
154
239
|
*/
|
|
155
|
-
|
|
240
|
+
DetailedSchema = 1,
|
|
241
|
+
}
|
|
156
242
|
/**
|
|
157
|
-
* @param {TransactionHash} tx_body_hash
|
|
158
|
-
* @param {ByronAddress} addr
|
|
159
|
-
* @param {Bip32PrivateKey} key
|
|
160
|
-
* @returns {BootstrapWitness}
|
|
161
243
|
*/
|
|
162
|
-
export
|
|
244
|
+
export enum Language {
|
|
245
|
+
PlutusV1 = 0,
|
|
246
|
+
PlutusV2 = 1,
|
|
247
|
+
PlutusV3 = 2,
|
|
248
|
+
}
|
|
163
249
|
/**
|
|
164
|
-
*
|
|
165
|
-
* * Min fee for JUST the script, NOT including ref inputs
|
|
166
|
-
*
|
|
167
|
-
* @param {Transaction} tx
|
|
168
|
-
* @param {ExUnitPrices} ex_unit_prices
|
|
169
|
-
* @returns {bigint}
|
|
170
250
|
*/
|
|
171
|
-
export
|
|
251
|
+
export enum DelegationDistributionKind {
|
|
252
|
+
Weighted = 0,
|
|
253
|
+
Legacy = 1,
|
|
254
|
+
}
|
|
172
255
|
/**
|
|
173
|
-
* @param {Transaction} tx
|
|
174
|
-
* @param {LinearFee} linear_fee
|
|
175
|
-
* @returns {bigint}
|
|
176
256
|
*/
|
|
177
|
-
export
|
|
257
|
+
export enum RedeemerTag {
|
|
258
|
+
Spend = 0,
|
|
259
|
+
Mint = 1,
|
|
260
|
+
Cert = 2,
|
|
261
|
+
Reward = 3,
|
|
262
|
+
Voting = 4,
|
|
263
|
+
Proposing = 5,
|
|
264
|
+
}
|
|
178
265
|
/**
|
|
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}
|
|
188
266
|
*/
|
|
189
|
-
export
|
|
267
|
+
export enum ScriptKind {
|
|
268
|
+
Native = 0,
|
|
269
|
+
PlutusV1 = 1,
|
|
270
|
+
PlutusV2 = 2,
|
|
271
|
+
PlutusV3 = 3,
|
|
272
|
+
}
|
|
190
273
|
/**
|
|
191
274
|
*/
|
|
192
|
-
export enum
|
|
193
|
-
|
|
194
|
-
|
|
275
|
+
export enum TransactionMetadatumKind {
|
|
276
|
+
Map = 0,
|
|
277
|
+
List = 1,
|
|
278
|
+
Int = 2,
|
|
279
|
+
Bytes = 3,
|
|
280
|
+
Text = 4,
|
|
195
281
|
}
|
|
196
282
|
/**
|
|
197
283
|
*/
|
|
@@ -208,6 +294,15 @@ export enum ChunkableStringKind {
|
|
|
208
294
|
}
|
|
209
295
|
/**
|
|
210
296
|
*/
|
|
297
|
+
export enum VoterKind {
|
|
298
|
+
ConstitutionalCommitteeHotKeyHash = 0,
|
|
299
|
+
ConstitutionalCommitteeHotScriptHash = 1,
|
|
300
|
+
DRepKeyHash = 2,
|
|
301
|
+
DRepScriptHash = 3,
|
|
302
|
+
StakingPoolKeyHash = 4,
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
*/
|
|
211
306
|
export enum CertificateKind {
|
|
212
307
|
StakeRegistration = 0,
|
|
213
308
|
StakeDeregistration = 1,
|
|
@@ -229,61 +324,19 @@ export enum CertificateKind {
|
|
|
229
324
|
}
|
|
230
325
|
/**
|
|
231
326
|
*/
|
|
232
|
-
export enum
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
PlutusV3 = 3,
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
*/
|
|
240
|
-
export enum AddressKind {
|
|
241
|
-
Base = 0,
|
|
242
|
-
Ptr = 1,
|
|
243
|
-
Enterprise = 2,
|
|
244
|
-
Reward = 3,
|
|
245
|
-
Byron = 4,
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Which version of the CIP25 spec to use. See CIP25 for details.
|
|
249
|
-
* This will change how things are encoded but for the most part contains
|
|
250
|
-
* the same information.
|
|
251
|
-
*/
|
|
252
|
-
export enum CIP25Version {
|
|
253
|
-
/**
|
|
254
|
-
* Initial version of CIP25 with only string (utf8) asset names allowed.
|
|
255
|
-
*/
|
|
256
|
-
V1 = 0,
|
|
257
|
-
/**
|
|
258
|
-
* Second version of CIP25. Supports any type of asset names.
|
|
259
|
-
*/
|
|
260
|
-
V2 = 1,
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
*/
|
|
264
|
-
export enum DatumOptionKind {
|
|
265
|
-
Hash = 0,
|
|
266
|
-
Datum = 1,
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
*/
|
|
270
|
-
export enum TransactionOutputKind {
|
|
271
|
-
AlonzoFormatTxOut = 0,
|
|
272
|
-
ConwayFormatTxOut = 1,
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
*/
|
|
276
|
-
export enum MetadataJsonSchema {
|
|
277
|
-
NoConversions = 0,
|
|
278
|
-
BasicConversions = 1,
|
|
279
|
-
DetailedSchema = 2,
|
|
327
|
+
export enum ByronAddrType {
|
|
328
|
+
PublicKey = 0,
|
|
329
|
+
Script = 1,
|
|
330
|
+
Redeem = 2,
|
|
280
331
|
}
|
|
281
332
|
/**
|
|
282
333
|
*/
|
|
283
|
-
export enum
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
334
|
+
export enum PlutusDataKind {
|
|
335
|
+
ConstrPlutusData = 0,
|
|
336
|
+
Map = 1,
|
|
337
|
+
List = 2,
|
|
338
|
+
Integer = 3,
|
|
339
|
+
Bytes = 4,
|
|
287
340
|
}
|
|
288
341
|
/**
|
|
289
342
|
*/
|
|
@@ -295,14 +348,16 @@ export enum DRepKind {
|
|
|
295
348
|
}
|
|
296
349
|
/**
|
|
297
350
|
*/
|
|
298
|
-
export enum
|
|
299
|
-
|
|
300
|
-
|
|
351
|
+
export enum MetadataJsonSchema {
|
|
352
|
+
NoConversions = 0,
|
|
353
|
+
BasicConversions = 1,
|
|
354
|
+
DetailedSchema = 2,
|
|
301
355
|
}
|
|
302
356
|
/**
|
|
303
357
|
*/
|
|
304
|
-
export enum
|
|
305
|
-
|
|
358
|
+
export enum DatumOptionKind {
|
|
359
|
+
Hash = 0,
|
|
360
|
+
Datum = 1,
|
|
306
361
|
}
|
|
307
362
|
/**
|
|
308
363
|
*/
|
|
@@ -326,29 +381,17 @@ export enum CoinSelectionStrategyCIP2 {
|
|
|
326
381
|
}
|
|
327
382
|
/**
|
|
328
383
|
*/
|
|
329
|
-
export enum
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
*/
|
|
336
|
-
export enum RedeemerTag {
|
|
337
|
-
Spend = 0,
|
|
338
|
-
Mint = 1,
|
|
339
|
-
Cert = 2,
|
|
340
|
-
Reward = 3,
|
|
341
|
-
Voting = 4,
|
|
342
|
-
Proposing = 5,
|
|
384
|
+
export enum Vote {
|
|
385
|
+
No = 0,
|
|
386
|
+
Yes = 1,
|
|
387
|
+
Abstain = 2,
|
|
343
388
|
}
|
|
344
389
|
/**
|
|
345
390
|
*/
|
|
346
|
-
export enum
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
DRepScriptHash = 3,
|
|
351
|
-
StakingPoolKeyHash = 4,
|
|
391
|
+
export enum RelayKind {
|
|
392
|
+
SingleHostAddr = 0,
|
|
393
|
+
SingleHostName = 1,
|
|
394
|
+
MultiHostName = 2,
|
|
352
395
|
}
|
|
353
396
|
/**
|
|
354
397
|
*/
|
|
@@ -358,73 +401,52 @@ export enum RedeemersKind {
|
|
|
358
401
|
}
|
|
359
402
|
/**
|
|
360
403
|
*/
|
|
404
|
+
export enum StakeDistributionKind {
|
|
405
|
+
SingleKey = 0,
|
|
406
|
+
BootstrapEra = 1,
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
*/
|
|
410
|
+
export enum AddressKind {
|
|
411
|
+
Base = 0,
|
|
412
|
+
Ptr = 1,
|
|
413
|
+
Enterprise = 2,
|
|
414
|
+
Reward = 3,
|
|
415
|
+
Byron = 4,
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
*/
|
|
361
419
|
export enum SpendingDataKind {
|
|
362
420
|
SpendingDataPubKey = 0,
|
|
363
421
|
SpendingDataScript = 1,
|
|
364
422
|
SpendingDataRedeem = 2,
|
|
365
423
|
}
|
|
366
424
|
/**
|
|
367
|
-
* JSON <-> PlutusData conversion schemas.
|
|
368
|
-
* Follows ScriptDataJsonSchema in cardano-cli defined at:
|
|
369
|
-
* https://github.com/input-output-hk/cardano-node/blob/master/cardano-api/src/Cardano/Api/ScriptData.hs#L254
|
|
370
|
-
*
|
|
371
|
-
* All methods here have the following restrictions due to limitations on dependencies:
|
|
372
|
-
* * JSON numbers above u64::MAX (positive) or below i64::MIN (negative) will throw errors
|
|
373
|
-
* * Hex strings for bytes don't accept odd-length (half-byte) strings.
|
|
374
|
-
* cardano-cli seems to support these however but it seems to be different than just 0-padding
|
|
375
|
-
* on either side when tested so proceed with caution
|
|
376
425
|
*/
|
|
377
|
-
export enum
|
|
426
|
+
export enum TransactionOutputKind {
|
|
427
|
+
AlonzoFormatTxOut = 0,
|
|
428
|
+
ConwayFormatTxOut = 1,
|
|
429
|
+
}
|
|
378
430
|
/**
|
|
379
|
-
* ScriptDataJsonNoSchema in cardano-node.
|
|
380
|
-
*
|
|
381
|
-
* This is the format used by --script-data-value in cardano-cli
|
|
382
|
-
* This tries to accept most JSON but does not support the full spectrum of Plutus datums.
|
|
383
|
-
* From JSON:
|
|
384
|
-
* * null/true/false/floats NOT supported
|
|
385
|
-
* * strings starting with 0x are treated as hex bytes. All other strings are encoded as their utf8 bytes.
|
|
386
|
-
* To JSON:
|
|
387
|
-
* * ConstrPlutusData not supported in ANY FORM (neither keys nor values)
|
|
388
|
-
* * Lists not supported in keys
|
|
389
|
-
* * Maps not supported in keys
|
|
390
431
|
*/
|
|
391
|
-
|
|
432
|
+
export enum ChangeSelectionAlgo {
|
|
433
|
+
Default = 0,
|
|
434
|
+
}
|
|
392
435
|
/**
|
|
393
|
-
* ScriptDataJsonDetailedSchema in cardano-node.
|
|
394
|
-
*
|
|
395
|
-
* This is the format used by --script-data-file in cardano-cli
|
|
396
|
-
* This covers almost all (only minor exceptions) Plutus datums, but the JSON must conform to a strict schema.
|
|
397
|
-
* The schema specifies that ALL keys and ALL values must be contained in a JSON map with 2 cases:
|
|
398
|
-
* 1. For ConstrPlutusData there must be two fields "constructor" contianing a number and "fields" containing its fields
|
|
399
|
-
* e.g. { "constructor": 2, "fields": [{"int": 2}, {"list": [{"bytes": "CAFEF00D"}]}]}
|
|
400
|
-
* 2. For all other cases there must be only one field named "int", "bytes", "list" or "map"
|
|
401
|
-
* BigInteger's value is a JSON number e.g. {"int": 100}
|
|
402
|
-
* Bytes' value is a hex string representing the bytes WITHOUT any prefix e.g. {"bytes": "CAFEF00D"}
|
|
403
|
-
* Lists' value is a JSON list of its elements encoded via the same schema e.g. {"list": [{"bytes": "CAFEF00D"}]}
|
|
404
|
-
* Maps' value is a JSON list of objects, one for each key-value pair in the map, with keys "k" and "v"
|
|
405
|
-
* respectively with their values being the plutus datum encoded via this same schema
|
|
406
|
-
* e.g. {"map": [
|
|
407
|
-
* {"k": {"int": 2}, "v": {"int": 5}},
|
|
408
|
-
* {"k": {"map": [{"k": {"list": [{"int": 1}]}, "v": {"bytes": "FF03"}}]}, "v": {"list": []}}
|
|
409
|
-
* ]}
|
|
410
|
-
* From JSON:
|
|
411
|
-
* * null/true/false/floats NOT supported
|
|
412
|
-
* * the JSON must conform to a very specific schema
|
|
413
|
-
* To JSON:
|
|
414
|
-
* * all Plutus datums should be fully supported outside of the integer range limitations outlined above.
|
|
415
436
|
*/
|
|
416
|
-
|
|
437
|
+
export enum NativeScriptKind {
|
|
438
|
+
ScriptPubkey = 0,
|
|
439
|
+
ScriptAll = 1,
|
|
440
|
+
ScriptAny = 2,
|
|
441
|
+
ScriptNOfK = 3,
|
|
442
|
+
ScriptInvalidBefore = 4,
|
|
443
|
+
ScriptInvalidHereafter = 5,
|
|
417
444
|
}
|
|
418
445
|
/**
|
|
419
446
|
*/
|
|
420
|
-
export enum
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
TreasuryWithdrawalsAction = 2,
|
|
424
|
-
NoConfidence = 3,
|
|
425
|
-
UpdateCommittee = 4,
|
|
426
|
-
NewConstitution = 5,
|
|
427
|
-
InfoAction = 6,
|
|
447
|
+
export enum CredentialKind {
|
|
448
|
+
PubKey = 0,
|
|
449
|
+
Script = 1,
|
|
428
450
|
}
|
|
429
451
|
/**
|
|
430
452
|
* Careful: this enum doesn't include the network ID part of the header
|
|
@@ -446,62 +468,53 @@ export enum AddressHeaderKind {
|
|
|
446
468
|
}
|
|
447
469
|
/**
|
|
448
470
|
*/
|
|
449
|
-
export enum
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
Int = 2,
|
|
453
|
-
Bytes = 3,
|
|
454
|
-
Text = 4,
|
|
471
|
+
export enum NonceKind {
|
|
472
|
+
Identity = 0,
|
|
473
|
+
Hash = 1,
|
|
455
474
|
}
|
|
456
475
|
/**
|
|
476
|
+
* Which version of the CIP25 spec to use. See CIP25 for details.
|
|
477
|
+
* This will change how things are encoded but for the most part contains
|
|
478
|
+
* the same information.
|
|
457
479
|
*/
|
|
458
|
-
export enum
|
|
459
|
-
PlutusV1 = 0,
|
|
460
|
-
PlutusV2 = 1,
|
|
461
|
-
PlutusV3 = 2,
|
|
462
|
-
}
|
|
480
|
+
export enum CIP25Version {
|
|
463
481
|
/**
|
|
482
|
+
* Initial version of CIP25 with only string (utf8) asset names allowed.
|
|
464
483
|
*/
|
|
465
|
-
|
|
466
|
-
ScriptPubkey = 0,
|
|
467
|
-
ScriptAll = 1,
|
|
468
|
-
ScriptAny = 2,
|
|
469
|
-
ScriptNOfK = 3,
|
|
470
|
-
ScriptInvalidBefore = 4,
|
|
471
|
-
ScriptInvalidHereafter = 5,
|
|
472
|
-
}
|
|
484
|
+
V1 = 0,
|
|
473
485
|
/**
|
|
486
|
+
* Second version of CIP25. Supports any type of asset names.
|
|
474
487
|
*/
|
|
475
|
-
|
|
476
|
-
PubKey = 0,
|
|
477
|
-
Script = 1,
|
|
488
|
+
V2 = 1,
|
|
478
489
|
}
|
|
479
490
|
/**
|
|
480
491
|
*/
|
|
481
|
-
export enum
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
492
|
+
export enum GovActionKind {
|
|
493
|
+
ParameterChangeAction = 0,
|
|
494
|
+
HardForkInitiationAction = 1,
|
|
495
|
+
TreasuryWithdrawalsAction = 2,
|
|
496
|
+
NoConfidence = 3,
|
|
497
|
+
UpdateCommittee = 4,
|
|
498
|
+
NewConstitution = 5,
|
|
499
|
+
InfoAction = 6,
|
|
485
500
|
}
|
|
486
501
|
/**
|
|
487
502
|
*/
|
|
488
|
-
export
|
|
489
|
-
|
|
490
|
-
Map = 1,
|
|
491
|
-
List = 2,
|
|
492
|
-
Integer = 3,
|
|
493
|
-
Bytes = 4,
|
|
494
|
-
}
|
|
503
|
+
export class AddrAttributes {
|
|
504
|
+
free(): void;
|
|
495
505
|
/**
|
|
506
|
+
* @param {HDAddressPayload | undefined} [hdap]
|
|
507
|
+
* @param {ProtocolMagic | undefined} [protocol_magic]
|
|
508
|
+
* @returns {AddrAttributes}
|
|
496
509
|
*/
|
|
497
|
-
|
|
498
|
-
Identity = 0,
|
|
499
|
-
Hash = 1,
|
|
500
|
-
}
|
|
510
|
+
static new_bootstrap_era(hdap?: HDAddressPayload, protocol_magic?: ProtocolMagic): AddrAttributes;
|
|
501
511
|
/**
|
|
512
|
+
* @param {Bip32PublicKey} pubk
|
|
513
|
+
* @param {HDAddressPayload | undefined} hdap
|
|
514
|
+
* @param {ProtocolMagic} protocol_magic
|
|
515
|
+
* @returns {AddrAttributes}
|
|
502
516
|
*/
|
|
503
|
-
|
|
504
|
-
free(): void;
|
|
517
|
+
static new_single_key(pubk: Bip32PublicKey, hdap: HDAddressPayload | undefined, protocol_magic: ProtocolMagic): AddrAttributes;
|
|
505
518
|
/**
|
|
506
519
|
*
|
|
507
520
|
* * Serialize this type to CBOR bytes.
|
|
@@ -556,28 +569,15 @@ export class AddrAttributes {
|
|
|
556
569
|
/**
|
|
557
570
|
* @param {ProtocolMagic} protocol_magic
|
|
558
571
|
*/
|
|
559
|
-
set_protocol_magic(protocol_magic: ProtocolMagic): void;
|
|
560
|
-
/**
|
|
561
|
-
* @returns {ProtocolMagic | undefined}
|
|
562
|
-
*/
|
|
563
|
-
protocol_magic(): ProtocolMagic | undefined;
|
|
564
|
-
/**
|
|
565
|
-
* @returns {AddrAttributes}
|
|
566
|
-
*/
|
|
567
|
-
static new(): AddrAttributes;
|
|
568
|
-
/**
|
|
569
|
-
* @param {HDAddressPayload | undefined} [hdap]
|
|
570
|
-
* @param {ProtocolMagic | undefined} [protocol_magic]
|
|
571
|
-
* @returns {AddrAttributes}
|
|
572
|
+
set_protocol_magic(protocol_magic: ProtocolMagic): void;
|
|
573
|
+
/**
|
|
574
|
+
* @returns {ProtocolMagic | undefined}
|
|
572
575
|
*/
|
|
573
|
-
|
|
576
|
+
protocol_magic(): ProtocolMagic | undefined;
|
|
574
577
|
/**
|
|
575
|
-
* @param {Bip32PublicKey} pubk
|
|
576
|
-
* @param {HDAddressPayload | undefined} hdap
|
|
577
|
-
* @param {ProtocolMagic} protocol_magic
|
|
578
578
|
* @returns {AddrAttributes}
|
|
579
579
|
*/
|
|
580
|
-
static
|
|
580
|
+
static new(): AddrAttributes;
|
|
581
581
|
}
|
|
582
582
|
/**
|
|
583
583
|
*/
|
|
@@ -699,6 +699,52 @@ export class Address {
|
|
|
699
699
|
export class AddressContent {
|
|
700
700
|
free(): void;
|
|
701
701
|
/**
|
|
702
|
+
* @param {ByronAddrType} addr_type
|
|
703
|
+
* @param {SpendingData} spending_data
|
|
704
|
+
* @param {AddrAttributes} attributes
|
|
705
|
+
* @returns {AddressContent}
|
|
706
|
+
*/
|
|
707
|
+
static hash_and_create(addr_type: ByronAddrType, spending_data: SpendingData, attributes: AddrAttributes): AddressContent;
|
|
708
|
+
/**
|
|
709
|
+
* @param {PublicKey} pubkey
|
|
710
|
+
* @param {ProtocolMagic | undefined} [protocol_magic]
|
|
711
|
+
* @returns {AddressContent}
|
|
712
|
+
*/
|
|
713
|
+
static new_redeem(pubkey: PublicKey, protocol_magic?: ProtocolMagic): AddressContent;
|
|
714
|
+
/**
|
|
715
|
+
* @param {Bip32PublicKey} xpub
|
|
716
|
+
* @param {ProtocolMagic | undefined} [protocol_magic]
|
|
717
|
+
* @returns {AddressContent}
|
|
718
|
+
*/
|
|
719
|
+
static new_simple(xpub: Bip32PublicKey, protocol_magic?: ProtocolMagic): AddressContent;
|
|
720
|
+
/**
|
|
721
|
+
* Do we want to remove this or keep it for people who were using old Byron code?
|
|
722
|
+
* @returns {ByronAddress}
|
|
723
|
+
*/
|
|
724
|
+
to_address(): ByronAddress;
|
|
725
|
+
/**
|
|
726
|
+
* returns the byron protocol magic embedded in the address, or mainnet id if none is present
|
|
727
|
+
* note: for bech32 addresses, you need to use network_id instead
|
|
728
|
+
* @returns {ProtocolMagic}
|
|
729
|
+
*/
|
|
730
|
+
byron_protocol_magic(): ProtocolMagic;
|
|
731
|
+
/**
|
|
732
|
+
* @returns {number}
|
|
733
|
+
*/
|
|
734
|
+
network_id(): number;
|
|
735
|
+
/**
|
|
736
|
+
* @param {Bip32PublicKey} key
|
|
737
|
+
* @param {ProtocolMagic} protocol_magic
|
|
738
|
+
* @returns {AddressContent}
|
|
739
|
+
*/
|
|
740
|
+
static icarus_from_key(key: Bip32PublicKey, protocol_magic: ProtocolMagic): AddressContent;
|
|
741
|
+
/**
|
|
742
|
+
* Check if the Addr can be reconstructed with a specific xpub
|
|
743
|
+
* @param {Bip32PublicKey} xpub
|
|
744
|
+
* @returns {boolean}
|
|
745
|
+
*/
|
|
746
|
+
identical_with_pubkey(xpub: Bip32PublicKey): boolean;
|
|
747
|
+
/**
|
|
702
748
|
*
|
|
703
749
|
* * Serialize this type to CBOR bytes.
|
|
704
750
|
* * This type does NOT support fine-tuned encoding options so this may or may not be
|
|
@@ -752,52 +798,6 @@ export class AddressContent {
|
|
|
752
798
|
* @returns {AddressContent}
|
|
753
799
|
*/
|
|
754
800
|
static new(address_id: AddressId, addr_attributes: AddrAttributes, addr_type: ByronAddrType): AddressContent;
|
|
755
|
-
/**
|
|
756
|
-
* @param {ByronAddrType} addr_type
|
|
757
|
-
* @param {SpendingData} spending_data
|
|
758
|
-
* @param {AddrAttributes} attributes
|
|
759
|
-
* @returns {AddressContent}
|
|
760
|
-
*/
|
|
761
|
-
static hash_and_create(addr_type: ByronAddrType, spending_data: SpendingData, attributes: AddrAttributes): AddressContent;
|
|
762
|
-
/**
|
|
763
|
-
* @param {PublicKey} pubkey
|
|
764
|
-
* @param {ProtocolMagic | undefined} [protocol_magic]
|
|
765
|
-
* @returns {AddressContent}
|
|
766
|
-
*/
|
|
767
|
-
static new_redeem(pubkey: PublicKey, protocol_magic?: ProtocolMagic): AddressContent;
|
|
768
|
-
/**
|
|
769
|
-
* @param {Bip32PublicKey} xpub
|
|
770
|
-
* @param {ProtocolMagic | undefined} [protocol_magic]
|
|
771
|
-
* @returns {AddressContent}
|
|
772
|
-
*/
|
|
773
|
-
static new_simple(xpub: Bip32PublicKey, protocol_magic?: ProtocolMagic): AddressContent;
|
|
774
|
-
/**
|
|
775
|
-
* Do we want to remove this or keep it for people who were using old Byron code?
|
|
776
|
-
* @returns {ByronAddress}
|
|
777
|
-
*/
|
|
778
|
-
to_address(): ByronAddress;
|
|
779
|
-
/**
|
|
780
|
-
* returns the byron protocol magic embedded in the address, or mainnet id if none is present
|
|
781
|
-
* note: for bech32 addresses, you need to use network_id instead
|
|
782
|
-
* @returns {ProtocolMagic}
|
|
783
|
-
*/
|
|
784
|
-
byron_protocol_magic(): ProtocolMagic;
|
|
785
|
-
/**
|
|
786
|
-
* @returns {number}
|
|
787
|
-
*/
|
|
788
|
-
network_id(): number;
|
|
789
|
-
/**
|
|
790
|
-
* @param {Bip32PublicKey} key
|
|
791
|
-
* @param {ProtocolMagic} protocol_magic
|
|
792
|
-
* @returns {AddressContent}
|
|
793
|
-
*/
|
|
794
|
-
static icarus_from_key(key: Bip32PublicKey, protocol_magic: ProtocolMagic): AddressContent;
|
|
795
|
-
/**
|
|
796
|
-
* Check if the Addr can be reconstructed with a specific xpub
|
|
797
|
-
* @param {Bip32PublicKey} xpub
|
|
798
|
-
* @returns {boolean}
|
|
799
|
-
*/
|
|
800
|
-
identical_with_pubkey(xpub: Bip32PublicKey): boolean;
|
|
801
801
|
}
|
|
802
802
|
/**
|
|
803
803
|
*/
|
|
@@ -1072,51 +1072,6 @@ 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
|
-
*
|
|
1120
1075
|
* * Serialize this type to CBOR bytes
|
|
1121
1076
|
* * This type type supports encoding preservation so this will preserve round-trip CBOR formats.
|
|
1122
1077
|
* * If created from scratch the CBOR will be canonical.
|
|
@@ -1177,6 +1132,51 @@ export class AssetName {
|
|
|
1177
1132
|
* @returns {AssetName}
|
|
1178
1133
|
*/
|
|
1179
1134
|
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
|
*/
|
|
@@ -1935,10 +1935,6 @@ export class BlockHeaderHash {
|
|
|
1935
1935
|
export class BootstrapWitness {
|
|
1936
1936
|
free(): void;
|
|
1937
1937
|
/**
|
|
1938
|
-
* @returns {AddressContent}
|
|
1939
|
-
*/
|
|
1940
|
-
to_address(): AddressContent;
|
|
1941
|
-
/**
|
|
1942
1938
|
*
|
|
1943
1939
|
* * Serialize this type to CBOR bytes
|
|
1944
1940
|
* * This type type supports encoding preservation so this will preserve round-trip CBOR formats.
|
|
@@ -2024,6 +2020,10 @@ export class BootstrapWitness {
|
|
|
2024
2020
|
* @returns {BootstrapWitness}
|
|
2025
2021
|
*/
|
|
2026
2022
|
static new(public_key: PublicKey, signature: Ed25519Signature, chain_code: Uint8Array, attributes: AddrAttributes): BootstrapWitness;
|
|
2023
|
+
/**
|
|
2024
|
+
* @returns {AddressContent}
|
|
2025
|
+
*/
|
|
2026
|
+
to_address(): AddressContent;
|
|
2027
2027
|
}
|
|
2028
2028
|
/**
|
|
2029
2029
|
*/
|
|
@@ -2052,6 +2052,34 @@ export class BootstrapWitnessList {
|
|
|
2052
2052
|
export class ByronAddress {
|
|
2053
2053
|
free(): void;
|
|
2054
2054
|
/**
|
|
2055
|
+
* @returns {string}
|
|
2056
|
+
*/
|
|
2057
|
+
to_base58(): string;
|
|
2058
|
+
/**
|
|
2059
|
+
* @param {string} s
|
|
2060
|
+
* @returns {ByronAddress}
|
|
2061
|
+
*/
|
|
2062
|
+
static from_base58(s: string): ByronAddress;
|
|
2063
|
+
/**
|
|
2064
|
+
* @param {string} s
|
|
2065
|
+
* @returns {boolean}
|
|
2066
|
+
*/
|
|
2067
|
+
static is_valid(s: string): boolean;
|
|
2068
|
+
/**
|
|
2069
|
+
* @returns {Address}
|
|
2070
|
+
*/
|
|
2071
|
+
to_address(): Address;
|
|
2072
|
+
/**
|
|
2073
|
+
* @param {Address} addr
|
|
2074
|
+
* @returns {ByronAddress | undefined}
|
|
2075
|
+
*/
|
|
2076
|
+
static from_address(addr: Address): ByronAddress | undefined;
|
|
2077
|
+
/**
|
|
2078
|
+
* @param {AddressContent} address_content
|
|
2079
|
+
* @returns {ByronAddress}
|
|
2080
|
+
*/
|
|
2081
|
+
static from_address_content(address_content: AddressContent): ByronAddress;
|
|
2082
|
+
/**
|
|
2055
2083
|
*
|
|
2056
2084
|
* * Serialize this type to CBOR bytes.
|
|
2057
2085
|
* * This type does NOT support fine-tuned encoding options so this may or may not be
|
|
@@ -2100,34 +2128,6 @@ export class ByronAddress {
|
|
|
2100
2128
|
* @returns {ByronAddress}
|
|
2101
2129
|
*/
|
|
2102
2130
|
static new(content: AddressContent, crc: Crc32): ByronAddress;
|
|
2103
|
-
/**
|
|
2104
|
-
* @returns {string}
|
|
2105
|
-
*/
|
|
2106
|
-
to_base58(): string;
|
|
2107
|
-
/**
|
|
2108
|
-
* @param {string} s
|
|
2109
|
-
* @returns {ByronAddress}
|
|
2110
|
-
*/
|
|
2111
|
-
static from_base58(s: string): ByronAddress;
|
|
2112
|
-
/**
|
|
2113
|
-
* @param {string} s
|
|
2114
|
-
* @returns {boolean}
|
|
2115
|
-
*/
|
|
2116
|
-
static is_valid(s: string): boolean;
|
|
2117
|
-
/**
|
|
2118
|
-
* @returns {Address}
|
|
2119
|
-
*/
|
|
2120
|
-
to_address(): Address;
|
|
2121
|
-
/**
|
|
2122
|
-
* @param {Address} addr
|
|
2123
|
-
* @returns {ByronAddress | undefined}
|
|
2124
|
-
*/
|
|
2125
|
-
static from_address(addr: Address): ByronAddress | undefined;
|
|
2126
|
-
/**
|
|
2127
|
-
* @param {AddressContent} address_content
|
|
2128
|
-
* @returns {ByronAddress}
|
|
2129
|
-
*/
|
|
2130
|
-
static from_address_content(address_content: AddressContent): ByronAddress;
|
|
2131
2131
|
}
|
|
2132
2132
|
/**
|
|
2133
2133
|
*/
|