@emurgo/cardano-serialization-lib-browser-inlined-gc 16.0.0 → 17.0.0
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.
|
@@ -5,17 +5,24 @@
|
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
declare export function decode_plutus_datum_to_json_str(
|
|
9
|
-
datum: PlutusData,
|
|
10
|
-
schema: $Values<typeof PlutusDatumSchema>
|
|
11
|
-
): string;
|
|
12
8
|
declare export function encode_json_str_to_plutus_datum(
|
|
13
9
|
json: string,
|
|
14
10
|
schema: $Values<typeof PlutusDatumSchema>
|
|
15
11
|
): PlutusData;
|
|
16
|
-
declare export function
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
declare export function decode_plutus_datum_to_json_str(
|
|
13
|
+
datum: PlutusData,
|
|
14
|
+
schema: $Values<typeof PlutusDatumSchema>
|
|
15
|
+
): string;
|
|
16
|
+
declare export function encrypt_with_password(
|
|
17
|
+
password: string,
|
|
18
|
+
salt: string,
|
|
19
|
+
nonce: string,
|
|
20
|
+
data: string
|
|
21
|
+
): string;
|
|
22
|
+
declare export function decrypt_with_password(
|
|
23
|
+
password: string,
|
|
24
|
+
data: string
|
|
25
|
+
): string;
|
|
19
26
|
declare export function decode_metadatum_to_json_str(
|
|
20
27
|
metadatum: TransactionMetadatum,
|
|
21
28
|
schema: $Values<typeof MetadataJsonSchema>
|
|
@@ -24,14 +31,13 @@ declare export function encode_json_str_to_metadatum(
|
|
|
24
31
|
json: string,
|
|
25
32
|
schema: $Values<typeof MetadataJsonSchema>
|
|
26
33
|
): TransactionMetadatum;
|
|
34
|
+
declare export function encode_arbitrary_bytes_as_metadatum(
|
|
35
|
+
bytes: Uint8Array
|
|
36
|
+
): TransactionMetadatum;
|
|
27
37
|
declare export function decode_arbitrary_bytes_from_metadatum(
|
|
28
38
|
metadata: TransactionMetadatum
|
|
29
39
|
): Uint8Array;
|
|
30
40
|
declare export function min_fee(tx: Transaction, linear_fee: LinearFee): BigNum;
|
|
31
|
-
declare export function min_ref_script_fee(
|
|
32
|
-
total_ref_scripts_size: number,
|
|
33
|
-
ref_script_coins_per_byte: UnitInterval
|
|
34
|
-
): BigNum;
|
|
35
41
|
declare export function min_script_fee(
|
|
36
42
|
tx: Transaction,
|
|
37
43
|
ex_unit_prices: ExUnitPrices
|
|
@@ -40,39 +46,23 @@ declare export function calculate_ex_units_ceil_cost(
|
|
|
40
46
|
ex_units: ExUnits,
|
|
41
47
|
ex_unit_prices: ExUnitPrices
|
|
42
48
|
): BigNum;
|
|
43
|
-
declare export function
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
redeemers: Redeemers,
|
|
61
|
-
cost_models: Costmdls,
|
|
62
|
-
datums?: PlutusList | null
|
|
63
|
-
): ScriptDataHash;
|
|
64
|
-
declare export function hash_auxiliary_data(
|
|
65
|
-
auxiliary_data: AuxiliaryData
|
|
66
|
-
): AuxiliaryDataHash;
|
|
67
|
-
declare export function make_vkey_witness(
|
|
68
|
-
tx_body_hash: TransactionHash,
|
|
69
|
-
sk: PrivateKey
|
|
70
|
-
): Vkeywitness;
|
|
71
|
-
declare export function get_implicit_input(
|
|
72
|
-
txbody: TransactionBody,
|
|
73
|
-
pool_deposit: BigNum,
|
|
74
|
-
key_deposit: BigNum
|
|
75
|
-
): Value;
|
|
49
|
+
declare export function min_ref_script_fee(
|
|
50
|
+
total_ref_scripts_size: number,
|
|
51
|
+
ref_script_coins_per_byte: UnitInterval
|
|
52
|
+
): BigNum;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Returns the state of the transaction sets.
|
|
56
|
+
* If all sets have a tag, it returns AllSetsHaveTag.
|
|
57
|
+
* If all sets have no tag, it returns AllSetsHaveNoTag.
|
|
58
|
+
* If there is a mix of tagged and untagged sets, it returns MixedSets.
|
|
59
|
+
* This function is useful for checking if a transaction might be signed by a hardware wallet.
|
|
60
|
+
* And for checking which parameter should be used in a hardware wallet api.
|
|
61
|
+
* WARNING this function will be deleted after all tags for set types will be mandatory. Approx after next hf
|
|
62
|
+
*/
|
|
63
|
+
declare export function has_transaction_set_tag(
|
|
64
|
+
tx_bytes: Uint8Array
|
|
65
|
+
): $Values<typeof TransactionSetsState>;
|
|
76
66
|
|
|
77
67
|
/**
|
|
78
68
|
* Receives a script JSON string
|
|
@@ -94,6 +84,11 @@ declare export function get_deposit(
|
|
|
94
84
|
pool_deposit: BigNum,
|
|
95
85
|
key_deposit: BigNum
|
|
96
86
|
): BigNum;
|
|
87
|
+
declare export function hash_script_data(
|
|
88
|
+
redeemers: Redeemers,
|
|
89
|
+
cost_models: Costmdls,
|
|
90
|
+
datums?: PlutusList | null
|
|
91
|
+
): ScriptDataHash;
|
|
97
92
|
|
|
98
93
|
/**
|
|
99
94
|
* returns minimal amount of ada for the output for case when the amount is included to the output
|
|
@@ -102,24 +97,29 @@ declare export function min_ada_for_output(
|
|
|
102
97
|
output: TransactionOutput,
|
|
103
98
|
data_cost: DataCost
|
|
104
99
|
): BigNum;
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Returns the state of the transaction sets.
|
|
108
|
-
* If all sets have a tag, it returns AllSetsHaveTag.
|
|
109
|
-
* If all sets have no tag, it returns AllSetsHaveNoTag.
|
|
110
|
-
* If there is a mix of tagged and untagged sets, it returns MixedSets.
|
|
111
|
-
* This function is useful for checking if a transaction might be signed by a hardware wallet.
|
|
112
|
-
* And for checking which parameter should be used in a hardware wallet api.
|
|
113
|
-
* WARNING this function will be deleted after all tags for set types will be mandatory. Approx after next hf
|
|
114
|
-
*/
|
|
115
|
-
declare export function has_transaction_set_tag(
|
|
116
|
-
tx_bytes: Uint8Array
|
|
117
|
-
): $Values<typeof TransactionSetsState>;
|
|
100
|
+
declare export function hash_plutus_data(plutus_data: PlutusData): DataHash;
|
|
118
101
|
declare export function make_icarus_bootstrap_witness(
|
|
119
102
|
tx_body_hash: TransactionHash,
|
|
120
103
|
addr: ByronAddress,
|
|
121
104
|
key: Bip32PrivateKey
|
|
122
105
|
): BootstrapWitness;
|
|
106
|
+
declare export function get_implicit_input(
|
|
107
|
+
txbody: TransactionBody,
|
|
108
|
+
pool_deposit: BigNum,
|
|
109
|
+
key_deposit: BigNum
|
|
110
|
+
): Value;
|
|
111
|
+
declare export function make_vkey_witness(
|
|
112
|
+
tx_body_hash: TransactionHash,
|
|
113
|
+
sk: PrivateKey
|
|
114
|
+
): Vkeywitness;
|
|
115
|
+
declare export function make_daedalus_bootstrap_witness(
|
|
116
|
+
tx_body_hash: TransactionHash,
|
|
117
|
+
addr: ByronAddress,
|
|
118
|
+
key: LegacyDaedalusPrivateKey
|
|
119
|
+
): BootstrapWitness;
|
|
120
|
+
declare export function hash_auxiliary_data(
|
|
121
|
+
auxiliary_data: AuxiliaryData
|
|
122
|
+
): AuxiliaryDataHash;
|
|
123
123
|
declare export function create_send_all(
|
|
124
124
|
address: Address,
|
|
125
125
|
utxos: TransactionUnspentOutputs,
|
|
@@ -4573,12 +4573,13 @@ export type NativeScriptJSON =
|
|
|
4573
4573
|
TimelockExpiry: TimelockExpiryJSON,
|
|
4574
4574
|
...
|
|
4575
4575
|
};
|
|
4576
|
+
export type LanguageJSON = "PlutusV1" | "PlutusV2" | "PlutusV3";
|
|
4576
4577
|
export interface AuxiliaryDataJSON {
|
|
4577
4578
|
metadata?: {
|
|
4578
4579
|
[k: string]: string,
|
|
4579
4580
|
} | null;
|
|
4580
4581
|
native_scripts?: NativeScriptJSON[] | null;
|
|
4581
|
-
plutus_scripts?:
|
|
4582
|
+
plutus_scripts?: PlutusScriptJSON[] | null;
|
|
4582
4583
|
prefer_alonzo_format: boolean;
|
|
4583
4584
|
}
|
|
4584
4585
|
export interface ScriptPubkeyJSON {
|
|
@@ -4600,6 +4601,13 @@ export interface TimelockStartJSON {
|
|
|
4600
4601
|
export interface TimelockExpiryJSON {
|
|
4601
4602
|
slot: string;
|
|
4602
4603
|
}
|
|
4604
|
+
/**
|
|
4605
|
+
* JSON form: `{ "bytes": "<hex>", "language": "PlutusV1" }`, the same shape for every language version. The hex is the raw compiled script, without the CBOR bytes tag around it.
|
|
4606
|
+
*/
|
|
4607
|
+
export interface PlutusScriptJSON {
|
|
4608
|
+
bytes: string;
|
|
4609
|
+
language: LanguageJSON;
|
|
4610
|
+
}
|
|
4603
4611
|
export type AuxiliaryDataHashJSON = string;
|
|
4604
4612
|
export interface AuxiliaryDataSetJSON {
|
|
4605
4613
|
[k: string]: AuxiliaryDataJSON;
|
|
@@ -4776,7 +4784,7 @@ export type ScriptRefJSON =
|
|
|
4776
4784
|
...
|
|
4777
4785
|
}
|
|
4778
4786
|
| {
|
|
4779
|
-
PlutusScript:
|
|
4787
|
+
PlutusScript: PlutusScriptJSON,
|
|
4780
4788
|
...
|
|
4781
4789
|
};
|
|
4782
4790
|
export type MintJSON = [string, MintAssetsJSON][];
|
|
@@ -5215,7 +5223,7 @@ export interface TransactionWitnessSetJSON {
|
|
|
5215
5223
|
bootstraps?: BootstrapWitnessJSON[] | null;
|
|
5216
5224
|
native_scripts?: NativeScriptJSON[] | null;
|
|
5217
5225
|
plutus_data?: PlutusListJSON | null;
|
|
5218
|
-
plutus_scripts?:
|
|
5226
|
+
plutus_scripts?: PlutusScriptJSON[] | null;
|
|
5219
5227
|
redeemers?: RedeemerJSON[] | null;
|
|
5220
5228
|
vkeys?: VkeywitnessJSON[] | null;
|
|
5221
5229
|
}
|
|
@@ -5369,15 +5377,16 @@ export type IntJSON = string;
|
|
|
5369
5377
|
* @maxItems 4
|
|
5370
5378
|
*/
|
|
5371
5379
|
export type KESVKeyJSON = string;
|
|
5372
|
-
export type LanguageJSON = LanguageKindJSON;
|
|
5373
5380
|
export type LanguageKindJSON = "PlutusV1" | "PlutusV2" | "PlutusV3";
|
|
5374
5381
|
export type LanguagesJSON = LanguageJSON[];
|
|
5375
5382
|
export type MIRToStakeCredentialsJSON = StakeToCoinJSON[];
|
|
5376
5383
|
export type MintsAssetsJSON = MintAssetsJSON[];
|
|
5377
5384
|
export type NativeScriptsJSON = NativeScriptJSON[];
|
|
5378
5385
|
export type NetworkIdKindJSON = "Testnet" | "Mainnet";
|
|
5379
|
-
export type
|
|
5380
|
-
|
|
5386
|
+
export type PlutusScriptsJSON = PlutusScriptJSON[];
|
|
5387
|
+
/**
|
|
5388
|
+
* JSON form: `{ "bytes": "<hex>", "language": "PlutusV1" }`, the same shape for every language version. The hex is the raw compiled script, without the CBOR bytes tag around it.
|
|
5389
|
+
*/
|
|
5381
5390
|
export type PoolMetadataHashJSON = string;
|
|
5382
5391
|
export interface ProposedProtocolParameterUpdatesJSON {
|
|
5383
5392
|
[k: string]: ProtocolParamUpdateJSON;
|
|
@@ -5419,7 +5428,7 @@ export type ScriptRefEnumJSON =
|
|
|
5419
5428
|
...
|
|
5420
5429
|
}
|
|
5421
5430
|
| {
|
|
5422
|
-
PlutusScript:
|
|
5431
|
+
PlutusScript: PlutusScriptJSON,
|
|
5423
5432
|
...
|
|
5424
5433
|
};
|
|
5425
5434
|
export interface TransactionJSON {
|
|
@@ -210,6 +210,35 @@ function takeFromExternrefTable0(idx) {
|
|
|
210
210
|
wasm.__externref_table_dealloc(idx);
|
|
211
211
|
return value;
|
|
212
212
|
}
|
|
213
|
+
|
|
214
|
+
let cachedUint32ArrayMemory0 = null;
|
|
215
|
+
|
|
216
|
+
function getUint32ArrayMemory0() {
|
|
217
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
218
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
219
|
+
}
|
|
220
|
+
return cachedUint32ArrayMemory0;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
224
|
+
ptr = ptr >>> 0;
|
|
225
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* @param {string} json
|
|
229
|
+
* @param {PlutusDatumSchema} schema
|
|
230
|
+
* @returns {PlutusData}
|
|
231
|
+
*/
|
|
232
|
+
export function encode_json_str_to_plutus_datum(json, schema) {
|
|
233
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
234
|
+
const len0 = WASM_VECTOR_LEN;
|
|
235
|
+
const ret = wasm.encode_json_str_to_plutus_datum(ptr0, len0, schema);
|
|
236
|
+
if (ret[2]) {
|
|
237
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
238
|
+
}
|
|
239
|
+
return PlutusData.__wrap(ret[0]);
|
|
240
|
+
}
|
|
241
|
+
|
|
213
242
|
/**
|
|
214
243
|
* @param {PlutusData} datum
|
|
215
244
|
* @param {PlutusDatumSchema} schema
|
|
@@ -236,32 +265,65 @@ export function decode_plutus_datum_to_json_str(datum, schema) {
|
|
|
236
265
|
}
|
|
237
266
|
|
|
238
267
|
/**
|
|
239
|
-
* @param {string}
|
|
240
|
-
* @param {
|
|
241
|
-
* @
|
|
268
|
+
* @param {string} password
|
|
269
|
+
* @param {string} salt
|
|
270
|
+
* @param {string} nonce
|
|
271
|
+
* @param {string} data
|
|
272
|
+
* @returns {string}
|
|
242
273
|
*/
|
|
243
|
-
export function
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
274
|
+
export function encrypt_with_password(password, salt, nonce, data) {
|
|
275
|
+
let deferred6_0;
|
|
276
|
+
let deferred6_1;
|
|
277
|
+
try {
|
|
278
|
+
const ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
279
|
+
const len0 = WASM_VECTOR_LEN;
|
|
280
|
+
const ptr1 = passStringToWasm0(salt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
281
|
+
const len1 = WASM_VECTOR_LEN;
|
|
282
|
+
const ptr2 = passStringToWasm0(nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
283
|
+
const len2 = WASM_VECTOR_LEN;
|
|
284
|
+
const ptr3 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
285
|
+
const len3 = WASM_VECTOR_LEN;
|
|
286
|
+
const ret = wasm.encrypt_with_password(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
287
|
+
var ptr5 = ret[0];
|
|
288
|
+
var len5 = ret[1];
|
|
289
|
+
if (ret[3]) {
|
|
290
|
+
ptr5 = 0; len5 = 0;
|
|
291
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
292
|
+
}
|
|
293
|
+
deferred6_0 = ptr5;
|
|
294
|
+
deferred6_1 = len5;
|
|
295
|
+
return getStringFromWasm0(ptr5, len5);
|
|
296
|
+
} finally {
|
|
297
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
249
298
|
}
|
|
250
|
-
return PlutusData.__wrap(ret[0]);
|
|
251
299
|
}
|
|
252
300
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
301
|
+
/**
|
|
302
|
+
* @param {string} password
|
|
303
|
+
* @param {string} data
|
|
304
|
+
* @returns {string}
|
|
305
|
+
*/
|
|
306
|
+
export function decrypt_with_password(password, data) {
|
|
307
|
+
let deferred4_0;
|
|
308
|
+
let deferred4_1;
|
|
309
|
+
try {
|
|
310
|
+
const ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
311
|
+
const len0 = WASM_VECTOR_LEN;
|
|
312
|
+
const ptr1 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
313
|
+
const len1 = WASM_VECTOR_LEN;
|
|
314
|
+
const ret = wasm.decrypt_with_password(ptr0, len0, ptr1, len1);
|
|
315
|
+
var ptr3 = ret[0];
|
|
316
|
+
var len3 = ret[1];
|
|
317
|
+
if (ret[3]) {
|
|
318
|
+
ptr3 = 0; len3 = 0;
|
|
319
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
320
|
+
}
|
|
321
|
+
deferred4_0 = ptr3;
|
|
322
|
+
deferred4_1 = len3;
|
|
323
|
+
return getStringFromWasm0(ptr3, len3);
|
|
324
|
+
} finally {
|
|
325
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
258
326
|
}
|
|
259
|
-
return cachedUint32ArrayMemory0;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
function getArrayU32FromWasm0(ptr, len) {
|
|
263
|
-
ptr = ptr >>> 0;
|
|
264
|
-
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
265
327
|
}
|
|
266
328
|
|
|
267
329
|
function passArray32ToWasm0(arg, malloc) {
|
|
@@ -270,17 +332,6 @@ function passArray32ToWasm0(arg, malloc) {
|
|
|
270
332
|
WASM_VECTOR_LEN = arg.length;
|
|
271
333
|
return ptr;
|
|
272
334
|
}
|
|
273
|
-
/**
|
|
274
|
-
* @param {Uint8Array} bytes
|
|
275
|
-
* @returns {TransactionMetadatum}
|
|
276
|
-
*/
|
|
277
|
-
export function encode_arbitrary_bytes_as_metadatum(bytes) {
|
|
278
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
279
|
-
const len0 = WASM_VECTOR_LEN;
|
|
280
|
-
const ret = wasm.encode_arbitrary_bytes_as_metadatum(ptr0, len0);
|
|
281
|
-
return TransactionMetadatum.__wrap(ret);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
335
|
/**
|
|
285
336
|
* @param {TransactionMetadatum} metadatum
|
|
286
337
|
* @param {MetadataJsonSchema} schema
|
|
@@ -321,6 +372,17 @@ export function encode_json_str_to_metadatum(json, schema) {
|
|
|
321
372
|
return TransactionMetadatum.__wrap(ret[0]);
|
|
322
373
|
}
|
|
323
374
|
|
|
375
|
+
/**
|
|
376
|
+
* @param {Uint8Array} bytes
|
|
377
|
+
* @returns {TransactionMetadatum}
|
|
378
|
+
*/
|
|
379
|
+
export function encode_arbitrary_bytes_as_metadatum(bytes) {
|
|
380
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
381
|
+
const len0 = WASM_VECTOR_LEN;
|
|
382
|
+
const ret = wasm.encode_arbitrary_bytes_as_metadatum(ptr0, len0);
|
|
383
|
+
return TransactionMetadatum.__wrap(ret);
|
|
384
|
+
}
|
|
385
|
+
|
|
324
386
|
/**
|
|
325
387
|
* @param {TransactionMetadatum} metadata
|
|
326
388
|
* @returns {Uint8Array}
|
|
@@ -351,20 +413,6 @@ export function min_fee(tx, linear_fee) {
|
|
|
351
413
|
return BigNum.__wrap(ret[0]);
|
|
352
414
|
}
|
|
353
415
|
|
|
354
|
-
/**
|
|
355
|
-
* @param {number} total_ref_scripts_size
|
|
356
|
-
* @param {UnitInterval} ref_script_coins_per_byte
|
|
357
|
-
* @returns {BigNum}
|
|
358
|
-
*/
|
|
359
|
-
export function min_ref_script_fee(total_ref_scripts_size, ref_script_coins_per_byte) {
|
|
360
|
-
_assertClass(ref_script_coins_per_byte, UnitInterval);
|
|
361
|
-
const ret = wasm.min_ref_script_fee(total_ref_scripts_size, ref_script_coins_per_byte.__wbg_ptr);
|
|
362
|
-
if (ret[2]) {
|
|
363
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
364
|
-
}
|
|
365
|
-
return BigNum.__wrap(ret[0]);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
416
|
/**
|
|
369
417
|
* @param {Transaction} tx
|
|
370
418
|
* @param {ExUnitPrices} ex_unit_prices
|
|
@@ -396,146 +444,38 @@ export function calculate_ex_units_ceil_cost(ex_units, ex_unit_prices) {
|
|
|
396
444
|
}
|
|
397
445
|
|
|
398
446
|
/**
|
|
399
|
-
* @param {
|
|
400
|
-
* @param {
|
|
401
|
-
* @
|
|
402
|
-
* @param {string} data
|
|
403
|
-
* @returns {string}
|
|
404
|
-
*/
|
|
405
|
-
export function encrypt_with_password(password, salt, nonce, data) {
|
|
406
|
-
let deferred6_0;
|
|
407
|
-
let deferred6_1;
|
|
408
|
-
try {
|
|
409
|
-
const ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
410
|
-
const len0 = WASM_VECTOR_LEN;
|
|
411
|
-
const ptr1 = passStringToWasm0(salt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
412
|
-
const len1 = WASM_VECTOR_LEN;
|
|
413
|
-
const ptr2 = passStringToWasm0(nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
414
|
-
const len2 = WASM_VECTOR_LEN;
|
|
415
|
-
const ptr3 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
416
|
-
const len3 = WASM_VECTOR_LEN;
|
|
417
|
-
const ret = wasm.encrypt_with_password(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
418
|
-
var ptr5 = ret[0];
|
|
419
|
-
var len5 = ret[1];
|
|
420
|
-
if (ret[3]) {
|
|
421
|
-
ptr5 = 0; len5 = 0;
|
|
422
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
423
|
-
}
|
|
424
|
-
deferred6_0 = ptr5;
|
|
425
|
-
deferred6_1 = len5;
|
|
426
|
-
return getStringFromWasm0(ptr5, len5);
|
|
427
|
-
} finally {
|
|
428
|
-
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* @param {string} password
|
|
434
|
-
* @param {string} data
|
|
435
|
-
* @returns {string}
|
|
436
|
-
*/
|
|
437
|
-
export function decrypt_with_password(password, data) {
|
|
438
|
-
let deferred4_0;
|
|
439
|
-
let deferred4_1;
|
|
440
|
-
try {
|
|
441
|
-
const ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
442
|
-
const len0 = WASM_VECTOR_LEN;
|
|
443
|
-
const ptr1 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
444
|
-
const len1 = WASM_VECTOR_LEN;
|
|
445
|
-
const ret = wasm.decrypt_with_password(ptr0, len0, ptr1, len1);
|
|
446
|
-
var ptr3 = ret[0];
|
|
447
|
-
var len3 = ret[1];
|
|
448
|
-
if (ret[3]) {
|
|
449
|
-
ptr3 = 0; len3 = 0;
|
|
450
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
451
|
-
}
|
|
452
|
-
deferred4_0 = ptr3;
|
|
453
|
-
deferred4_1 = len3;
|
|
454
|
-
return getStringFromWasm0(ptr3, len3);
|
|
455
|
-
} finally {
|
|
456
|
-
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
/**
|
|
461
|
-
* @param {TransactionHash} tx_body_hash
|
|
462
|
-
* @param {ByronAddress} addr
|
|
463
|
-
* @param {LegacyDaedalusPrivateKey} key
|
|
464
|
-
* @returns {BootstrapWitness}
|
|
465
|
-
*/
|
|
466
|
-
export function make_daedalus_bootstrap_witness(tx_body_hash, addr, key) {
|
|
467
|
-
_assertClass(tx_body_hash, TransactionHash);
|
|
468
|
-
_assertClass(addr, ByronAddress);
|
|
469
|
-
_assertClass(key, LegacyDaedalusPrivateKey);
|
|
470
|
-
const ret = wasm.make_daedalus_bootstrap_witness(tx_body_hash.__wbg_ptr, addr.__wbg_ptr, key.__wbg_ptr);
|
|
471
|
-
return BootstrapWitness.__wrap(ret);
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
/**
|
|
475
|
-
* @param {PlutusData} plutus_data
|
|
476
|
-
* @returns {DataHash}
|
|
477
|
-
*/
|
|
478
|
-
export function hash_plutus_data(plutus_data) {
|
|
479
|
-
_assertClass(plutus_data, PlutusData);
|
|
480
|
-
const ret = wasm.hash_plutus_data(plutus_data.__wbg_ptr);
|
|
481
|
-
return DataHash.__wrap(ret);
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
/**
|
|
485
|
-
* @param {Redeemers} redeemers
|
|
486
|
-
* @param {Costmdls} cost_models
|
|
487
|
-
* @param {PlutusList | null} [datums]
|
|
488
|
-
* @returns {ScriptDataHash}
|
|
447
|
+
* @param {number} total_ref_scripts_size
|
|
448
|
+
* @param {UnitInterval} ref_script_coins_per_byte
|
|
449
|
+
* @returns {BigNum}
|
|
489
450
|
*/
|
|
490
|
-
export function
|
|
491
|
-
_assertClass(
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
_assertClass(datums, PlutusList);
|
|
496
|
-
ptr0 = datums.__destroy_into_raw();
|
|
451
|
+
export function min_ref_script_fee(total_ref_scripts_size, ref_script_coins_per_byte) {
|
|
452
|
+
_assertClass(ref_script_coins_per_byte, UnitInterval);
|
|
453
|
+
const ret = wasm.min_ref_script_fee(total_ref_scripts_size, ref_script_coins_per_byte.__wbg_ptr);
|
|
454
|
+
if (ret[2]) {
|
|
455
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
497
456
|
}
|
|
498
|
-
|
|
499
|
-
return ScriptDataHash.__wrap(ret);
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
/**
|
|
503
|
-
* @param {AuxiliaryData} auxiliary_data
|
|
504
|
-
* @returns {AuxiliaryDataHash}
|
|
505
|
-
*/
|
|
506
|
-
export function hash_auxiliary_data(auxiliary_data) {
|
|
507
|
-
_assertClass(auxiliary_data, AuxiliaryData);
|
|
508
|
-
const ret = wasm.hash_auxiliary_data(auxiliary_data.__wbg_ptr);
|
|
509
|
-
return AuxiliaryDataHash.__wrap(ret);
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
/**
|
|
513
|
-
* @param {TransactionHash} tx_body_hash
|
|
514
|
-
* @param {PrivateKey} sk
|
|
515
|
-
* @returns {Vkeywitness}
|
|
516
|
-
*/
|
|
517
|
-
export function make_vkey_witness(tx_body_hash, sk) {
|
|
518
|
-
_assertClass(tx_body_hash, TransactionHash);
|
|
519
|
-
_assertClass(sk, PrivateKey);
|
|
520
|
-
const ret = wasm.make_vkey_witness(tx_body_hash.__wbg_ptr, sk.__wbg_ptr);
|
|
521
|
-
return Vkeywitness.__wrap(ret);
|
|
457
|
+
return BigNum.__wrap(ret[0]);
|
|
522
458
|
}
|
|
523
459
|
|
|
524
460
|
/**
|
|
525
|
-
*
|
|
526
|
-
*
|
|
527
|
-
*
|
|
528
|
-
*
|
|
461
|
+
* Returns the state of the transaction sets.
|
|
462
|
+
* If all sets have a tag, it returns AllSetsHaveTag.
|
|
463
|
+
* If all sets have no tag, it returns AllSetsHaveNoTag.
|
|
464
|
+
* If there is a mix of tagged and untagged sets, it returns MixedSets.
|
|
465
|
+
* This function is useful for checking if a transaction might be signed by a hardware wallet.
|
|
466
|
+
* And for checking which parameter should be used in a hardware wallet api.
|
|
467
|
+
* WARNING this function will be deleted after all tags for set types will be mandatory. Approx after next hf
|
|
468
|
+
* @param {Uint8Array} tx_bytes
|
|
469
|
+
* @returns {TransactionSetsState}
|
|
529
470
|
*/
|
|
530
|
-
export function
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
const ret = wasm.get_implicit_input(txbody.__wbg_ptr, pool_deposit.__wbg_ptr, key_deposit.__wbg_ptr);
|
|
471
|
+
export function has_transaction_set_tag(tx_bytes) {
|
|
472
|
+
const ptr0 = passArray8ToWasm0(tx_bytes, wasm.__wbindgen_malloc);
|
|
473
|
+
const len0 = WASM_VECTOR_LEN;
|
|
474
|
+
const ret = wasm.has_transaction_set_tag(ptr0, len0);
|
|
535
475
|
if (ret[2]) {
|
|
536
476
|
throw takeFromExternrefTable0(ret[1]);
|
|
537
477
|
}
|
|
538
|
-
return
|
|
478
|
+
return ret[0];
|
|
539
479
|
}
|
|
540
480
|
|
|
541
481
|
/**
|
|
@@ -581,6 +521,24 @@ export function get_deposit(txbody, pool_deposit, key_deposit) {
|
|
|
581
521
|
return BigNum.__wrap(ret[0]);
|
|
582
522
|
}
|
|
583
523
|
|
|
524
|
+
/**
|
|
525
|
+
* @param {Redeemers} redeemers
|
|
526
|
+
* @param {Costmdls} cost_models
|
|
527
|
+
* @param {PlutusList | null} [datums]
|
|
528
|
+
* @returns {ScriptDataHash}
|
|
529
|
+
*/
|
|
530
|
+
export function hash_script_data(redeemers, cost_models, datums) {
|
|
531
|
+
_assertClass(redeemers, Redeemers);
|
|
532
|
+
_assertClass(cost_models, Costmdls);
|
|
533
|
+
let ptr0 = 0;
|
|
534
|
+
if (!isLikeNone(datums)) {
|
|
535
|
+
_assertClass(datums, PlutusList);
|
|
536
|
+
ptr0 = datums.__destroy_into_raw();
|
|
537
|
+
}
|
|
538
|
+
const ret = wasm.hash_script_data(redeemers.__wbg_ptr, cost_models.__wbg_ptr, ptr0);
|
|
539
|
+
return ScriptDataHash.__wrap(ret);
|
|
540
|
+
}
|
|
541
|
+
|
|
584
542
|
/**
|
|
585
543
|
* returns minimal amount of ada for the output for case when the amount is included to the output
|
|
586
544
|
* @param {TransactionOutput} output
|
|
@@ -598,24 +556,13 @@ export function min_ada_for_output(output, data_cost) {
|
|
|
598
556
|
}
|
|
599
557
|
|
|
600
558
|
/**
|
|
601
|
-
*
|
|
602
|
-
*
|
|
603
|
-
* If all sets have no tag, it returns AllSetsHaveNoTag.
|
|
604
|
-
* If there is a mix of tagged and untagged sets, it returns MixedSets.
|
|
605
|
-
* This function is useful for checking if a transaction might be signed by a hardware wallet.
|
|
606
|
-
* And for checking which parameter should be used in a hardware wallet api.
|
|
607
|
-
* WARNING this function will be deleted after all tags for set types will be mandatory. Approx after next hf
|
|
608
|
-
* @param {Uint8Array} tx_bytes
|
|
609
|
-
* @returns {TransactionSetsState}
|
|
559
|
+
* @param {PlutusData} plutus_data
|
|
560
|
+
* @returns {DataHash}
|
|
610
561
|
*/
|
|
611
|
-
export function
|
|
612
|
-
|
|
613
|
-
const
|
|
614
|
-
|
|
615
|
-
if (ret[2]) {
|
|
616
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
617
|
-
}
|
|
618
|
-
return ret[0];
|
|
562
|
+
export function hash_plutus_data(plutus_data) {
|
|
563
|
+
_assertClass(plutus_data, PlutusData);
|
|
564
|
+
const ret = wasm.hash_plutus_data(plutus_data.__wbg_ptr);
|
|
565
|
+
return DataHash.__wrap(ret);
|
|
619
566
|
}
|
|
620
567
|
|
|
621
568
|
/**
|
|
@@ -632,6 +579,59 @@ export function make_icarus_bootstrap_witness(tx_body_hash, addr, key) {
|
|
|
632
579
|
return BootstrapWitness.__wrap(ret);
|
|
633
580
|
}
|
|
634
581
|
|
|
582
|
+
/**
|
|
583
|
+
* @param {TransactionBody} txbody
|
|
584
|
+
* @param {BigNum} pool_deposit
|
|
585
|
+
* @param {BigNum} key_deposit
|
|
586
|
+
* @returns {Value}
|
|
587
|
+
*/
|
|
588
|
+
export function get_implicit_input(txbody, pool_deposit, key_deposit) {
|
|
589
|
+
_assertClass(txbody, TransactionBody);
|
|
590
|
+
_assertClass(pool_deposit, BigNum);
|
|
591
|
+
_assertClass(key_deposit, BigNum);
|
|
592
|
+
const ret = wasm.get_implicit_input(txbody.__wbg_ptr, pool_deposit.__wbg_ptr, key_deposit.__wbg_ptr);
|
|
593
|
+
if (ret[2]) {
|
|
594
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
595
|
+
}
|
|
596
|
+
return Value.__wrap(ret[0]);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* @param {TransactionHash} tx_body_hash
|
|
601
|
+
* @param {PrivateKey} sk
|
|
602
|
+
* @returns {Vkeywitness}
|
|
603
|
+
*/
|
|
604
|
+
export function make_vkey_witness(tx_body_hash, sk) {
|
|
605
|
+
_assertClass(tx_body_hash, TransactionHash);
|
|
606
|
+
_assertClass(sk, PrivateKey);
|
|
607
|
+
const ret = wasm.make_vkey_witness(tx_body_hash.__wbg_ptr, sk.__wbg_ptr);
|
|
608
|
+
return Vkeywitness.__wrap(ret);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* @param {TransactionHash} tx_body_hash
|
|
613
|
+
* @param {ByronAddress} addr
|
|
614
|
+
* @param {LegacyDaedalusPrivateKey} key
|
|
615
|
+
* @returns {BootstrapWitness}
|
|
616
|
+
*/
|
|
617
|
+
export function make_daedalus_bootstrap_witness(tx_body_hash, addr, key) {
|
|
618
|
+
_assertClass(tx_body_hash, TransactionHash);
|
|
619
|
+
_assertClass(addr, ByronAddress);
|
|
620
|
+
_assertClass(key, LegacyDaedalusPrivateKey);
|
|
621
|
+
const ret = wasm.make_daedalus_bootstrap_witness(tx_body_hash.__wbg_ptr, addr.__wbg_ptr, key.__wbg_ptr);
|
|
622
|
+
return BootstrapWitness.__wrap(ret);
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* @param {AuxiliaryData} auxiliary_data
|
|
627
|
+
* @returns {AuxiliaryDataHash}
|
|
628
|
+
*/
|
|
629
|
+
export function hash_auxiliary_data(auxiliary_data) {
|
|
630
|
+
_assertClass(auxiliary_data, AuxiliaryData);
|
|
631
|
+
const ret = wasm.hash_auxiliary_data(auxiliary_data.__wbg_ptr);
|
|
632
|
+
return AuxiliaryDataHash.__wrap(ret);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
635
|
/**
|
|
636
636
|
* @param {Address} address
|
|
637
637
|
* @param {TransactionUnspentOutputs} utxos
|