@anastasia-labs/cardano-multiplatform-lib-browser 6.0.2-2 → 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 +350 -350
- package/cardano_multiplatform_lib_bg.js +546 -546
- package/cardano_multiplatform_lib_bg.wasm +0 -0
- package/package.json +1 -1
|
@@ -29,6 +29,52 @@ export function encode_arbitrary_bytes_as_metadatum(bytes: Uint8Array): Transact
|
|
|
29
29
|
*/
|
|
30
30
|
export function decode_arbitrary_bytes_from_metadatum(metadata: TransactionMetadatum): Uint8Array | undefined;
|
|
31
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
|
+
/**
|
|
32
78
|
* @param {AuxiliaryData} auxiliary_data
|
|
33
79
|
* @returns {AuxiliaryDataHash}
|
|
34
80
|
*/
|
|
@@ -90,6 +136,12 @@ export function calc_script_data_hash(redeemers: Redeemers, datums: PlutusDataLi
|
|
|
90
136
|
*/
|
|
91
137
|
export function calc_script_data_hash_from_witness(witnesses: TransactionWitnessSet, cost_models: CostModels): ScriptDataHash | undefined;
|
|
92
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
|
+
/**
|
|
93
145
|
* @param {TransactionBody} txbody
|
|
94
146
|
* @param {bigint} pool_deposit
|
|
95
147
|
* @param {bigint} key_deposit
|
|
@@ -104,33 +156,6 @@ export function get_implicit_input(txbody: TransactionBody, pool_deposit: bigint
|
|
|
104
156
|
*/
|
|
105
157
|
export function get_deposit(txbody: TransactionBody, pool_deposit: bigint, key_deposit: bigint): bigint;
|
|
106
158
|
/**
|
|
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
159
|
* Converts JSON to Metadata according to MetadataJsonSchema
|
|
135
160
|
* @param {string} json
|
|
136
161
|
* @param {MetadataJsonSchema} schema
|
|
@@ -145,30 +170,17 @@ export function encode_json_str_to_metadatum(json: string, schema: MetadataJsonS
|
|
|
145
170
|
*/
|
|
146
171
|
export function decode_metadatum_to_json_str(metadatum: TransactionMetadatum, schema: MetadataJsonSchema): string;
|
|
147
172
|
/**
|
|
148
|
-
* @param {
|
|
149
|
-
* @
|
|
150
|
-
|
|
151
|
-
export function compute_total_ex_units(redeemers: Redeemers): ExUnits;
|
|
152
|
-
/**
|
|
153
|
-
* @param {TransactionHash} tx_body_hash
|
|
154
|
-
* @param {ByronAddress} addr
|
|
155
|
-
* @param {LegacyDaedalusPrivateKey} key
|
|
156
|
-
* @returns {BootstrapWitness}
|
|
157
|
-
*/
|
|
158
|
-
export function make_daedalus_bootstrap_witness(tx_body_hash: TransactionHash, addr: ByronAddress, key: LegacyDaedalusPrivateKey): BootstrapWitness;
|
|
159
|
-
/**
|
|
160
|
-
* @param {TransactionHash} tx_body_hash
|
|
161
|
-
* @param {ByronAddress} addr
|
|
162
|
-
* @param {Bip32PrivateKey} key
|
|
163
|
-
* @returns {BootstrapWitness}
|
|
173
|
+
* @param {string} json
|
|
174
|
+
* @param {CardanoNodePlutusDatumSchema} schema
|
|
175
|
+
* @returns {PlutusData}
|
|
164
176
|
*/
|
|
165
|
-
export function
|
|
177
|
+
export function encode_json_str_to_plutus_datum(json: string, schema: CardanoNodePlutusDatumSchema): PlutusData;
|
|
166
178
|
/**
|
|
167
|
-
* @param {
|
|
168
|
-
* @param {
|
|
169
|
-
* @returns {
|
|
179
|
+
* @param {PlutusData} datum
|
|
180
|
+
* @param {CardanoNodePlutusDatumSchema} schema
|
|
181
|
+
* @returns {string}
|
|
170
182
|
*/
|
|
171
|
-
export function
|
|
183
|
+
export function decode_plutus_datum_to_json_str(datum: PlutusData, schema: CardanoNodePlutusDatumSchema): string;
|
|
172
184
|
/**
|
|
173
185
|
* @param {TransactionOutput} output
|
|
174
186
|
* @param {bigint} coins_per_utxo_byte
|
|
@@ -176,17 +188,25 @@ export function make_vkey_witness(tx_body_hash: TransactionHash, sk: PrivateKey)
|
|
|
176
188
|
*/
|
|
177
189
|
export function min_ada_required(output: TransactionOutput, coins_per_utxo_byte: bigint): bigint;
|
|
178
190
|
/**
|
|
179
|
-
* @param {string} json
|
|
180
|
-
* @param {CardanoNodePlutusDatumSchema} schema
|
|
181
|
-
* @returns {PlutusData}
|
|
182
191
|
*/
|
|
183
|
-
export
|
|
192
|
+
export enum ChangeSelectionAlgo {
|
|
193
|
+
Default = 0,
|
|
194
|
+
}
|
|
184
195
|
/**
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
196
|
+
* Which version of the CIP25 spec to use. See CIP25 for details.
|
|
197
|
+
* This will change how things are encoded but for the most part contains
|
|
198
|
+
* the same information.
|
|
188
199
|
*/
|
|
189
|
-
export
|
|
200
|
+
export enum CIP25Version {
|
|
201
|
+
/**
|
|
202
|
+
* Initial version of CIP25 with only string (utf8) asset names allowed.
|
|
203
|
+
*/
|
|
204
|
+
V1 = 0,
|
|
205
|
+
/**
|
|
206
|
+
* Second version of CIP25. Supports any type of asset names.
|
|
207
|
+
*/
|
|
208
|
+
V2 = 1,
|
|
209
|
+
}
|
|
190
210
|
/**
|
|
191
211
|
*/
|
|
192
212
|
export enum PlutusDataKind {
|
|
@@ -198,118 +218,73 @@ export enum PlutusDataKind {
|
|
|
198
218
|
}
|
|
199
219
|
/**
|
|
200
220
|
*/
|
|
201
|
-
export enum
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
221
|
+
export enum GovActionKind {
|
|
222
|
+
ParameterChangeAction = 0,
|
|
223
|
+
HardForkInitiationAction = 1,
|
|
224
|
+
TreasuryWithdrawalsAction = 2,
|
|
225
|
+
NoConfidence = 3,
|
|
226
|
+
UpdateCommittee = 4,
|
|
227
|
+
NewConstitution = 5,
|
|
228
|
+
InfoAction = 6,
|
|
205
229
|
}
|
|
206
230
|
/**
|
|
207
231
|
*/
|
|
208
|
-
export enum
|
|
209
|
-
|
|
210
|
-
|
|
232
|
+
export enum ScriptKind {
|
|
233
|
+
Native = 0,
|
|
234
|
+
PlutusV1 = 1,
|
|
235
|
+
PlutusV2 = 2,
|
|
236
|
+
PlutusV3 = 3,
|
|
211
237
|
}
|
|
212
238
|
/**
|
|
213
239
|
*/
|
|
214
|
-
export enum
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
PoolRegistration = 3,
|
|
219
|
-
PoolRetirement = 4,
|
|
220
|
-
RegCert = 5,
|
|
221
|
-
UnregCert = 6,
|
|
222
|
-
VoteDelegCert = 7,
|
|
223
|
-
StakeVoteDelegCert = 8,
|
|
224
|
-
StakeRegDelegCert = 9,
|
|
225
|
-
VoteRegDelegCert = 10,
|
|
226
|
-
StakeVoteRegDelegCert = 11,
|
|
227
|
-
AuthCommitteeHotCert = 12,
|
|
228
|
-
ResignCommitteeColdCert = 13,
|
|
229
|
-
RegDrepCert = 14,
|
|
230
|
-
UnregDrepCert = 15,
|
|
231
|
-
UpdateDrepCert = 16,
|
|
240
|
+
export enum Vote {
|
|
241
|
+
No = 0,
|
|
242
|
+
Yes = 1,
|
|
243
|
+
Abstain = 2,
|
|
232
244
|
}
|
|
233
245
|
/**
|
|
234
246
|
*/
|
|
235
|
-
export enum
|
|
236
|
-
|
|
237
|
-
|
|
247
|
+
export enum Language {
|
|
248
|
+
PlutusV1 = 0,
|
|
249
|
+
PlutusV2 = 1,
|
|
250
|
+
PlutusV3 = 2,
|
|
238
251
|
}
|
|
239
252
|
/**
|
|
253
|
+
* Careful: this enum doesn't include the network ID part of the header
|
|
254
|
+
* ex: base address isn't 0b0000_0000 but instead 0b0000
|
|
255
|
+
* Use `header_matches_kind` if you don't want to implement the bitwise operators yourself
|
|
240
256
|
*/
|
|
241
|
-
export enum
|
|
242
|
-
|
|
243
|
-
|
|
257
|
+
export enum AddressHeaderKind {
|
|
258
|
+
BasePaymentKeyStakeKey = 0,
|
|
259
|
+
BasePaymentScriptStakeKey = 1,
|
|
260
|
+
BasePaymentKeyStakeScript = 2,
|
|
261
|
+
BasePaymentScriptStakeScript = 3,
|
|
262
|
+
PointerKey = 4,
|
|
263
|
+
PointerScript = 5,
|
|
264
|
+
EnterpriseKey = 6,
|
|
265
|
+
EnterpriseScript = 7,
|
|
266
|
+
Byron = 8,
|
|
267
|
+
RewardKey = 14,
|
|
268
|
+
RewardScript = 15,
|
|
244
269
|
}
|
|
245
270
|
/**
|
|
246
271
|
*/
|
|
247
|
-
export enum
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
DRepScriptHash = 3,
|
|
252
|
-
StakingPoolKeyHash = 4,
|
|
272
|
+
export enum AuxiliaryDataKind {
|
|
273
|
+
Shelley = 0,
|
|
274
|
+
ShelleyMA = 1,
|
|
275
|
+
Conway = 2,
|
|
253
276
|
}
|
|
254
277
|
/**
|
|
255
278
|
*/
|
|
256
|
-
export enum
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
PlutusV2 = 2,
|
|
260
|
-
PlutusV3 = 3,
|
|
279
|
+
export enum DatumOptionKind {
|
|
280
|
+
Hash = 0,
|
|
281
|
+
Datum = 1,
|
|
261
282
|
}
|
|
262
283
|
/**
|
|
263
|
-
* JSON <-> PlutusData conversion schemas.
|
|
264
|
-
* Follows ScriptDataJsonSchema in cardano-cli defined at:
|
|
265
|
-
* https://github.com/input-output-hk/cardano-node/blob/master/cardano-api/src/Cardano/Api/ScriptData.hs#L254
|
|
266
|
-
*
|
|
267
|
-
* All methods here have the following restrictions due to limitations on dependencies:
|
|
268
|
-
* * JSON numbers above u64::MAX (positive) or below i64::MIN (negative) will throw errors
|
|
269
|
-
* * Hex strings for bytes don't accept odd-length (half-byte) strings.
|
|
270
|
-
* cardano-cli seems to support these however but it seems to be different than just 0-padding
|
|
271
|
-
* on either side when tested so proceed with caution
|
|
272
|
-
*/
|
|
273
|
-
export enum CardanoNodePlutusDatumSchema {
|
|
274
|
-
/**
|
|
275
|
-
* ScriptDataJsonNoSchema in cardano-node.
|
|
276
|
-
*
|
|
277
|
-
* This is the format used by --script-data-value in cardano-cli
|
|
278
|
-
* This tries to accept most JSON but does not support the full spectrum of Plutus datums.
|
|
279
|
-
* From JSON:
|
|
280
|
-
* * null/true/false/floats NOT supported
|
|
281
|
-
* * strings starting with 0x are treated as hex bytes. All other strings are encoded as their utf8 bytes.
|
|
282
|
-
* To JSON:
|
|
283
|
-
* * ConstrPlutusData not supported in ANY FORM (neither keys nor values)
|
|
284
|
-
* * Lists not supported in keys
|
|
285
|
-
* * Maps not supported in keys
|
|
286
|
-
*/
|
|
287
|
-
BasicConversions = 0,
|
|
288
|
-
/**
|
|
289
|
-
* ScriptDataJsonDetailedSchema in cardano-node.
|
|
290
|
-
*
|
|
291
|
-
* This is the format used by --script-data-file in cardano-cli
|
|
292
|
-
* This covers almost all (only minor exceptions) Plutus datums, but the JSON must conform to a strict schema.
|
|
293
|
-
* The schema specifies that ALL keys and ALL values must be contained in a JSON map with 2 cases:
|
|
294
|
-
* 1. For ConstrPlutusData there must be two fields "constructor" contianing a number and "fields" containing its fields
|
|
295
|
-
* e.g. { "constructor": 2, "fields": [{"int": 2}, {"list": [{"bytes": "CAFEF00D"}]}]}
|
|
296
|
-
* 2. For all other cases there must be only one field named "int", "bytes", "list" or "map"
|
|
297
|
-
* BigInteger's value is a JSON number e.g. {"int": 100}
|
|
298
|
-
* Bytes' value is a hex string representing the bytes WITHOUT any prefix e.g. {"bytes": "CAFEF00D"}
|
|
299
|
-
* Lists' value is a JSON list of its elements encoded via the same schema e.g. {"list": [{"bytes": "CAFEF00D"}]}
|
|
300
|
-
* Maps' value is a JSON list of objects, one for each key-value pair in the map, with keys "k" and "v"
|
|
301
|
-
* respectively with their values being the plutus datum encoded via this same schema
|
|
302
|
-
* e.g. {"map": [
|
|
303
|
-
* {"k": {"int": 2}, "v": {"int": 5}},
|
|
304
|
-
* {"k": {"map": [{"k": {"list": [{"int": 1}]}, "v": {"bytes": "FF03"}}]}, "v": {"list": []}}
|
|
305
|
-
* ]}
|
|
306
|
-
* From JSON:
|
|
307
|
-
* * null/true/false/floats NOT supported
|
|
308
|
-
* * the JSON must conform to a very specific schema
|
|
309
|
-
* To JSON:
|
|
310
|
-
* * all Plutus datums should be fully supported outside of the integer range limitations outlined above.
|
|
311
284
|
*/
|
|
312
|
-
|
|
285
|
+
export enum NonceKind {
|
|
286
|
+
Identity = 0,
|
|
287
|
+
Hash = 1,
|
|
313
288
|
}
|
|
314
289
|
/**
|
|
315
290
|
*/
|
|
@@ -321,104 +296,83 @@ export enum DRepKind {
|
|
|
321
296
|
}
|
|
322
297
|
/**
|
|
323
298
|
*/
|
|
324
|
-
export enum
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
Conway = 2,
|
|
299
|
+
export enum ChunkableStringKind {
|
|
300
|
+
Single = 0,
|
|
301
|
+
Chunked = 1,
|
|
328
302
|
}
|
|
329
303
|
/**
|
|
330
304
|
*/
|
|
331
|
-
export enum
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
Reward = 3,
|
|
336
|
-
Voting = 4,
|
|
337
|
-
Proposing = 5,
|
|
305
|
+
export enum RelayKind {
|
|
306
|
+
SingleHostAddr = 0,
|
|
307
|
+
SingleHostName = 1,
|
|
308
|
+
MultiHostName = 2,
|
|
338
309
|
}
|
|
339
310
|
/**
|
|
340
|
-
* Which version of the CIP25 spec to use. See CIP25 for details.
|
|
341
|
-
* This will change how things are encoded but for the most part contains
|
|
342
|
-
* the same information.
|
|
343
311
|
*/
|
|
344
|
-
export enum
|
|
312
|
+
export enum RedeemersKind {
|
|
313
|
+
ArrLegacyRedeemer = 0,
|
|
314
|
+
MapRedeemerKeyToRedeemerVal = 1,
|
|
315
|
+
}
|
|
345
316
|
/**
|
|
346
|
-
* Initial version of CIP25 with only string (utf8) asset names allowed.
|
|
347
317
|
*/
|
|
348
|
-
|
|
318
|
+
export enum CoinSelectionStrategyCIP2 {
|
|
349
319
|
/**
|
|
350
|
-
*
|
|
320
|
+
* Performs CIP2's Largest First ada-only selection. Will error if outputs contain non-ADA assets.
|
|
351
321
|
*/
|
|
352
|
-
|
|
353
|
-
}
|
|
322
|
+
LargestFirst = 0,
|
|
354
323
|
/**
|
|
324
|
+
* Performs CIP2's Random Improve ada-only selection. Will error if outputs contain non-ADA assets.
|
|
355
325
|
*/
|
|
356
|
-
|
|
357
|
-
ScriptPubkey = 0,
|
|
358
|
-
ScriptAll = 1,
|
|
359
|
-
ScriptAny = 2,
|
|
360
|
-
ScriptNOfK = 3,
|
|
361
|
-
ScriptInvalidBefore = 4,
|
|
362
|
-
ScriptInvalidHereafter = 5,
|
|
363
|
-
}
|
|
326
|
+
RandomImprove = 1,
|
|
364
327
|
/**
|
|
328
|
+
* Same as LargestFirst, but before adding ADA, will insert by largest-first for each asset type.
|
|
365
329
|
*/
|
|
366
|
-
|
|
367
|
-
Map = 0,
|
|
368
|
-
List = 1,
|
|
369
|
-
Int = 2,
|
|
370
|
-
Bytes = 3,
|
|
371
|
-
Text = 4,
|
|
372
|
-
}
|
|
330
|
+
LargestFirstMultiAsset = 2,
|
|
373
331
|
/**
|
|
332
|
+
* Same as RandomImprove, but before adding ADA, will insert by random-improve for each asset type.
|
|
374
333
|
*/
|
|
375
|
-
|
|
376
|
-
Hash = 0,
|
|
377
|
-
Datum = 1,
|
|
334
|
+
RandomImproveMultiAsset = 3,
|
|
378
335
|
}
|
|
379
336
|
/**
|
|
380
337
|
*/
|
|
381
|
-
export enum
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
PlutusV3 = 2,
|
|
338
|
+
export enum CredentialKind {
|
|
339
|
+
PubKey = 0,
|
|
340
|
+
Script = 1,
|
|
385
341
|
}
|
|
386
342
|
/**
|
|
387
343
|
*/
|
|
388
|
-
export enum
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
344
|
+
export enum AddressKind {
|
|
345
|
+
Base = 0,
|
|
346
|
+
Ptr = 1,
|
|
347
|
+
Enterprise = 2,
|
|
348
|
+
Reward = 3,
|
|
349
|
+
Byron = 4,
|
|
392
350
|
}
|
|
393
351
|
/**
|
|
394
352
|
*/
|
|
395
|
-
export enum
|
|
396
|
-
|
|
397
|
-
|
|
353
|
+
export enum RedeemerTag {
|
|
354
|
+
Spend = 0,
|
|
355
|
+
Mint = 1,
|
|
356
|
+
Cert = 2,
|
|
357
|
+
Reward = 3,
|
|
358
|
+
Voting = 4,
|
|
359
|
+
Proposing = 5,
|
|
398
360
|
}
|
|
399
361
|
/**
|
|
400
|
-
* Careful: this enum doesn't include the network ID part of the header
|
|
401
|
-
* ex: base address isn't 0b0000_0000 but instead 0b0000
|
|
402
|
-
* Use `header_matches_kind` if you don't want to implement the bitwise operators yourself
|
|
403
362
|
*/
|
|
404
|
-
export enum
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
BasePaymentScriptStakeScript = 3,
|
|
409
|
-
PointerKey = 4,
|
|
410
|
-
PointerScript = 5,
|
|
411
|
-
EnterpriseKey = 6,
|
|
412
|
-
EnterpriseScript = 7,
|
|
413
|
-
Byron = 8,
|
|
414
|
-
RewardKey = 14,
|
|
415
|
-
RewardScript = 15,
|
|
363
|
+
export enum ByronAddrType {
|
|
364
|
+
PublicKey = 0,
|
|
365
|
+
Script = 1,
|
|
366
|
+
Redeem = 2,
|
|
416
367
|
}
|
|
417
368
|
/**
|
|
418
369
|
*/
|
|
419
|
-
export enum
|
|
420
|
-
|
|
421
|
-
|
|
370
|
+
export enum TransactionMetadatumKind {
|
|
371
|
+
Map = 0,
|
|
372
|
+
List = 1,
|
|
373
|
+
Int = 2,
|
|
374
|
+
Bytes = 3,
|
|
375
|
+
Text = 4,
|
|
422
376
|
}
|
|
423
377
|
/**
|
|
424
378
|
*/
|
|
@@ -429,79 +383,138 @@ export enum SpendingDataKind {
|
|
|
429
383
|
}
|
|
430
384
|
/**
|
|
431
385
|
*/
|
|
432
|
-
export enum
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
386
|
+
export enum MetadataJsonSchema {
|
|
387
|
+
NoConversions = 0,
|
|
388
|
+
BasicConversions = 1,
|
|
389
|
+
DetailedSchema = 2,
|
|
436
390
|
}
|
|
437
391
|
/**
|
|
438
392
|
*/
|
|
439
|
-
export enum
|
|
440
|
-
|
|
441
|
-
|
|
393
|
+
export enum NativeScriptKind {
|
|
394
|
+
ScriptPubkey = 0,
|
|
395
|
+
ScriptAll = 1,
|
|
396
|
+
ScriptAny = 2,
|
|
397
|
+
ScriptNOfK = 3,
|
|
398
|
+
ScriptInvalidBefore = 4,
|
|
399
|
+
ScriptInvalidHereafter = 5,
|
|
442
400
|
}
|
|
443
401
|
/**
|
|
444
402
|
*/
|
|
445
|
-
export enum
|
|
403
|
+
export enum TransactionOutputKind {
|
|
404
|
+
AlonzoFormatTxOut = 0,
|
|
405
|
+
ConwayFormatTxOut = 1,
|
|
406
|
+
}
|
|
446
407
|
/**
|
|
447
|
-
* Performs CIP2's Largest First ada-only selection. Will error if outputs contain non-ADA assets.
|
|
448
408
|
*/
|
|
449
|
-
|
|
409
|
+
export enum VoterKind {
|
|
410
|
+
ConstitutionalCommitteeHotKeyHash = 0,
|
|
411
|
+
ConstitutionalCommitteeHotScriptHash = 1,
|
|
412
|
+
DRepKeyHash = 2,
|
|
413
|
+
DRepScriptHash = 3,
|
|
414
|
+
StakingPoolKeyHash = 4,
|
|
415
|
+
}
|
|
450
416
|
/**
|
|
451
|
-
* Performs CIP2's Random Improve ada-only selection. Will error if outputs contain non-ADA assets.
|
|
452
417
|
*/
|
|
453
|
-
|
|
418
|
+
export enum DelegationDistributionKind {
|
|
419
|
+
Weighted = 0,
|
|
420
|
+
Legacy = 1,
|
|
421
|
+
}
|
|
454
422
|
/**
|
|
455
|
-
* Same as LargestFirst, but before adding ADA, will insert by largest-first for each asset type.
|
|
456
423
|
*/
|
|
457
|
-
|
|
424
|
+
export enum StakeDistributionKind {
|
|
425
|
+
SingleKey = 0,
|
|
426
|
+
BootstrapEra = 1,
|
|
427
|
+
}
|
|
458
428
|
/**
|
|
459
|
-
*
|
|
429
|
+
* JSON <-> PlutusData conversion schemas.
|
|
430
|
+
* Follows ScriptDataJsonSchema in cardano-cli defined at:
|
|
431
|
+
* https://github.com/input-output-hk/cardano-node/blob/master/cardano-api/src/Cardano/Api/ScriptData.hs#L254
|
|
432
|
+
*
|
|
433
|
+
* All methods here have the following restrictions due to limitations on dependencies:
|
|
434
|
+
* * JSON numbers above u64::MAX (positive) or below i64::MIN (negative) will throw errors
|
|
435
|
+
* * Hex strings for bytes don't accept odd-length (half-byte) strings.
|
|
436
|
+
* cardano-cli seems to support these however but it seems to be different than just 0-padding
|
|
437
|
+
* on either side when tested so proceed with caution
|
|
460
438
|
*/
|
|
461
|
-
|
|
462
|
-
}
|
|
439
|
+
export enum CardanoNodePlutusDatumSchema {
|
|
463
440
|
/**
|
|
441
|
+
* ScriptDataJsonNoSchema in cardano-node.
|
|
442
|
+
*
|
|
443
|
+
* This is the format used by --script-data-value in cardano-cli
|
|
444
|
+
* This tries to accept most JSON but does not support the full spectrum of Plutus datums.
|
|
445
|
+
* From JSON:
|
|
446
|
+
* * null/true/false/floats NOT supported
|
|
447
|
+
* * strings starting with 0x are treated as hex bytes. All other strings are encoded as their utf8 bytes.
|
|
448
|
+
* To JSON:
|
|
449
|
+
* * ConstrPlutusData not supported in ANY FORM (neither keys nor values)
|
|
450
|
+
* * Lists not supported in keys
|
|
451
|
+
* * Maps not supported in keys
|
|
464
452
|
*/
|
|
465
|
-
|
|
466
|
-
SingleKey = 0,
|
|
467
|
-
BootstrapEra = 1,
|
|
468
|
-
}
|
|
453
|
+
BasicConversions = 0,
|
|
469
454
|
/**
|
|
455
|
+
* ScriptDataJsonDetailedSchema in cardano-node.
|
|
456
|
+
*
|
|
457
|
+
* This is the format used by --script-data-file in cardano-cli
|
|
458
|
+
* This covers almost all (only minor exceptions) Plutus datums, but the JSON must conform to a strict schema.
|
|
459
|
+
* The schema specifies that ALL keys and ALL values must be contained in a JSON map with 2 cases:
|
|
460
|
+
* 1. For ConstrPlutusData there must be two fields "constructor" contianing a number and "fields" containing its fields
|
|
461
|
+
* e.g. { "constructor": 2, "fields": [{"int": 2}, {"list": [{"bytes": "CAFEF00D"}]}]}
|
|
462
|
+
* 2. For all other cases there must be only one field named "int", "bytes", "list" or "map"
|
|
463
|
+
* BigInteger's value is a JSON number e.g. {"int": 100}
|
|
464
|
+
* Bytes' value is a hex string representing the bytes WITHOUT any prefix e.g. {"bytes": "CAFEF00D"}
|
|
465
|
+
* Lists' value is a JSON list of its elements encoded via the same schema e.g. {"list": [{"bytes": "CAFEF00D"}]}
|
|
466
|
+
* Maps' value is a JSON list of objects, one for each key-value pair in the map, with keys "k" and "v"
|
|
467
|
+
* respectively with their values being the plutus datum encoded via this same schema
|
|
468
|
+
* e.g. {"map": [
|
|
469
|
+
* {"k": {"int": 2}, "v": {"int": 5}},
|
|
470
|
+
* {"k": {"map": [{"k": {"list": [{"int": 1}]}, "v": {"bytes": "FF03"}}]}, "v": {"list": []}}
|
|
471
|
+
* ]}
|
|
472
|
+
* From JSON:
|
|
473
|
+
* * null/true/false/floats NOT supported
|
|
474
|
+
* * the JSON must conform to a very specific schema
|
|
475
|
+
* To JSON:
|
|
476
|
+
* * all Plutus datums should be fully supported outside of the integer range limitations outlined above.
|
|
470
477
|
*/
|
|
471
|
-
|
|
472
|
-
Default = 0,
|
|
478
|
+
DetailedSchema = 1,
|
|
473
479
|
}
|
|
474
480
|
/**
|
|
475
481
|
*/
|
|
476
|
-
export enum
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
482
|
+
export enum CertificateKind {
|
|
483
|
+
StakeRegistration = 0,
|
|
484
|
+
StakeDeregistration = 1,
|
|
485
|
+
StakeDelegation = 2,
|
|
486
|
+
PoolRegistration = 3,
|
|
487
|
+
PoolRetirement = 4,
|
|
488
|
+
RegCert = 5,
|
|
489
|
+
UnregCert = 6,
|
|
490
|
+
VoteDelegCert = 7,
|
|
491
|
+
StakeVoteDelegCert = 8,
|
|
492
|
+
StakeRegDelegCert = 9,
|
|
493
|
+
VoteRegDelegCert = 10,
|
|
494
|
+
StakeVoteRegDelegCert = 11,
|
|
495
|
+
AuthCommitteeHotCert = 12,
|
|
496
|
+
ResignCommitteeColdCert = 13,
|
|
497
|
+
RegDrepCert = 14,
|
|
498
|
+
UnregDrepCert = 15,
|
|
499
|
+
UpdateDrepCert = 16,
|
|
484
500
|
}
|
|
485
501
|
/**
|
|
486
502
|
*/
|
|
487
|
-
export
|
|
488
|
-
|
|
489
|
-
Ptr = 1,
|
|
490
|
-
Enterprise = 2,
|
|
491
|
-
Reward = 3,
|
|
492
|
-
Byron = 4,
|
|
493
|
-
}
|
|
503
|
+
export class AddrAttributes {
|
|
504
|
+
free(): void;
|
|
494
505
|
/**
|
|
506
|
+
* @param {HDAddressPayload | undefined} [hdap]
|
|
507
|
+
* @param {ProtocolMagic | undefined} [protocol_magic]
|
|
508
|
+
* @returns {AddrAttributes}
|
|
495
509
|
*/
|
|
496
|
-
|
|
497
|
-
No = 0,
|
|
498
|
-
Yes = 1,
|
|
499
|
-
Abstain = 2,
|
|
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.
|
|
@@ -565,19 +578,6 @@ export class AddrAttributes {
|
|
|
565
578
|
* @returns {AddrAttributes}
|
|
566
579
|
*/
|
|
567
580
|
static new(): AddrAttributes;
|
|
568
|
-
/**
|
|
569
|
-
* @param {HDAddressPayload | undefined} [hdap]
|
|
570
|
-
* @param {ProtocolMagic | undefined} [protocol_magic]
|
|
571
|
-
* @returns {AddrAttributes}
|
|
572
|
-
*/
|
|
573
|
-
static new_bootstrap_era(hdap?: HDAddressPayload, protocol_magic?: ProtocolMagic): AddrAttributes;
|
|
574
|
-
/**
|
|
575
|
-
* @param {Bip32PublicKey} pubk
|
|
576
|
-
* @param {HDAddressPayload | undefined} hdap
|
|
577
|
-
* @param {ProtocolMagic} protocol_magic
|
|
578
|
-
* @returns {AddrAttributes}
|
|
579
|
-
*/
|
|
580
|
-
static new_single_key(pubk: Bip32PublicKey, hdap: HDAddressPayload | undefined, protocol_magic: ProtocolMagic): 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
|
*/
|
|
@@ -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
|
*/
|