@anastasia-labs/cardano-multiplatform-lib-nodejs 6.0.1 → 6.0.2-2

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.
@@ -4,26 +4,6 @@ imports['__wbindgen_placeholder__'] = module.exports;
4
4
  let wasm;
5
5
  const { TextDecoder, TextEncoder } = require(`util`);
6
6
 
7
- const heap = new Array(128).fill(undefined);
8
-
9
- heap.push(undefined, null, true, false);
10
-
11
- function getObject(idx) { return heap[idx]; }
12
-
13
- let heap_next = heap.length;
14
-
15
- function dropObject(idx) {
16
- if (idx < 132) return;
17
- heap[idx] = heap_next;
18
- heap_next = idx;
19
- }
20
-
21
- function takeObject(idx) {
22
- const ret = getObject(idx);
23
- dropObject(idx);
24
- return ret;
25
- }
26
-
27
7
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
28
8
 
29
9
  cachedTextDecoder.decode();
@@ -42,6 +22,12 @@ function getStringFromWasm0(ptr, len) {
42
22
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
43
23
  }
44
24
 
25
+ const heap = new Array(128).fill(undefined);
26
+
27
+ heap.push(undefined, null, true, false);
28
+
29
+ let heap_next = heap.length;
30
+
45
31
  function addHeapObject(obj) {
46
32
  if (heap_next === heap.length) heap.push(heap.length + 1);
47
33
  const idx = heap_next;
@@ -51,6 +37,20 @@ function addHeapObject(obj) {
51
37
  return idx;
52
38
  }
53
39
 
40
+ function getObject(idx) { return heap[idx]; }
41
+
42
+ function dropObject(idx) {
43
+ if (idx < 132) return;
44
+ heap[idx] = heap_next;
45
+ heap_next = idx;
46
+ }
47
+
48
+ function takeObject(idx) {
49
+ const ret = getObject(idx);
50
+ dropObject(idx);
51
+ return ret;
52
+ }
53
+
54
54
  function handleError(f, args) {
55
55
  try {
56
56
  return f.apply(this, args);
@@ -217,6 +217,66 @@ function _assertClass(instance, klass) {
217
217
  }
218
218
  return instance.ptr;
219
219
  }
220
+
221
+ let cachedUint16ArrayMemory0 = null;
222
+
223
+ function getUint16ArrayMemory0() {
224
+ if (cachedUint16ArrayMemory0 === null || cachedUint16ArrayMemory0.byteLength === 0) {
225
+ cachedUint16ArrayMemory0 = new Uint16Array(wasm.memory.buffer);
226
+ }
227
+ return cachedUint16ArrayMemory0;
228
+ }
229
+
230
+ function getArrayU16FromWasm0(ptr, len) {
231
+ ptr = ptr >>> 0;
232
+ return getUint16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len);
233
+ }
234
+
235
+ function passArray16ToWasm0(arg, malloc) {
236
+ const ptr = malloc(arg.length * 2, 2) >>> 0;
237
+ getUint16ArrayMemory0().set(arg, ptr / 2);
238
+ WASM_VECTOR_LEN = arg.length;
239
+ return ptr;
240
+ }
241
+
242
+ function isLikeNone(x) {
243
+ return x === undefined || x === null;
244
+ }
245
+ /**
246
+ * encodes arbitrary bytes into chunks of 64 bytes (the limit for bytes) as a list to be valid Metadata
247
+ * @param {Uint8Array} bytes
248
+ * @returns {TransactionMetadatum}
249
+ */
250
+ module.exports.encode_arbitrary_bytes_as_metadatum = function(bytes) {
251
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
252
+ const len0 = WASM_VECTOR_LEN;
253
+ const ret = wasm.encode_arbitrary_bytes_as_metadatum(ptr0, len0);
254
+ return TransactionMetadatum.__wrap(ret);
255
+ };
256
+
257
+ /**
258
+ * decodes from chunks of bytes in a list to a byte vector if that is the metadata format, otherwise returns None
259
+ * @param {TransactionMetadatum} metadata
260
+ * @returns {Uint8Array | undefined}
261
+ */
262
+ module.exports.decode_arbitrary_bytes_from_metadatum = function(metadata) {
263
+ try {
264
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
265
+ _assertClass(metadata, TransactionMetadatum);
266
+ wasm.decode_arbitrary_bytes_from_metadatum(retptr, metadata.__wbg_ptr);
267
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
268
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
269
+ let v1;
270
+ if (r0 !== 0) {
271
+ v1 = getArrayU8FromWasm0(r0, r1).slice();
272
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
273
+ }
274
+ return v1;
275
+ } finally {
276
+ wasm.__wbindgen_add_to_stack_pointer(16);
277
+ }
278
+ };
279
+
220
280
  /**
221
281
  * @param {AuxiliaryData} auxiliary_data
222
282
  * @returns {AuxiliaryDataHash}
@@ -247,9 +307,6 @@ module.exports.hash_plutus_data = function(plutus_data) {
247
307
  return DatumHash.__wrap(ret);
248
308
  };
249
309
 
250
- function isLikeNone(x) {
251
- return x === undefined || x === null;
252
- }
253
310
  /**
254
311
  * Calculates the hash for script data (no plutus scripts) if it is necessary.
255
312
  * Returns None if it was not necessary (no datums/redeemers) to include.
@@ -390,96 +447,121 @@ module.exports.get_deposit = function(txbody, pool_deposit, key_deposit) {
390
447
  };
391
448
 
392
449
  /**
393
- * Converts JSON to Metadata according to MetadataJsonSchema
394
- * @param {string} json
395
- * @param {MetadataJsonSchema} schema
396
- * @returns {TransactionMetadatum}
450
+ *
451
+ * * Min fee for JUST the script, NOT including ref inputs
452
+ *
453
+ * @param {Transaction} tx
454
+ * @param {ExUnitPrices} ex_unit_prices
455
+ * @returns {bigint}
397
456
  */
398
- module.exports.encode_json_str_to_metadatum = function(json, schema) {
457
+ module.exports.min_script_fee = function(tx, ex_unit_prices) {
399
458
  try {
400
459
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
401
- const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
402
- const len0 = WASM_VECTOR_LEN;
403
- wasm.encode_json_str_to_metadatum(retptr, ptr0, len0, schema);
404
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
405
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
460
+ _assertClass(tx, Transaction);
461
+ _assertClass(ex_unit_prices, ExUnitPrices);
462
+ wasm.min_script_fee(retptr, tx.__wbg_ptr, ex_unit_prices.__wbg_ptr);
463
+ var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
406
464
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
407
- if (r2) {
408
- throw takeObject(r1);
465
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
466
+ if (r3) {
467
+ throw takeObject(r2);
409
468
  }
410
- return TransactionMetadatum.__wrap(r0);
469
+ return BigInt.asUintN(64, r0);
411
470
  } finally {
412
471
  wasm.__wbindgen_add_to_stack_pointer(16);
413
472
  }
414
473
  };
415
474
 
416
475
  /**
417
- * Converts Metadata to JSON according to MetadataJsonSchema
418
- * @param {TransactionMetadatum} metadatum
419
- * @param {MetadataJsonSchema} schema
420
- * @returns {string}
476
+ * @param {Transaction} tx
477
+ * @param {LinearFee} linear_fee
478
+ * @returns {bigint}
421
479
  */
422
- module.exports.decode_metadatum_to_json_str = function(metadatum, schema) {
423
- let deferred2_0;
424
- let deferred2_1;
480
+ module.exports.min_no_script_fee = function(tx, linear_fee) {
425
481
  try {
426
482
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
427
- _assertClass(metadatum, TransactionMetadatum);
428
- wasm.decode_metadatum_to_json_str(retptr, metadatum.__wbg_ptr, schema);
429
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
430
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
483
+ _assertClass(tx, Transaction);
484
+ _assertClass(linear_fee, LinearFee);
485
+ wasm.min_no_script_fee(retptr, tx.__wbg_ptr, linear_fee.__wbg_ptr);
486
+ var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
431
487
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
432
488
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
433
- var ptr1 = r0;
434
- var len1 = r1;
435
489
  if (r3) {
436
- ptr1 = 0; len1 = 0;
437
490
  throw takeObject(r2);
438
491
  }
439
- deferred2_0 = ptr1;
440
- deferred2_1 = len1;
441
- return getStringFromWasm0(ptr1, len1);
492
+ return BigInt.asUintN(64, r0);
442
493
  } finally {
443
494
  wasm.__wbindgen_add_to_stack_pointer(16);
444
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
445
495
  }
446
496
  };
447
497
 
448
498
  /**
499
+ *
500
+ * * Calculates the cost of all ref scripts
501
+ * * * `total_ref_script_size` - Total size (original, not hashes) of all ref scripts. Duplicate scripts are counted as many times as they occur
502
+ *
503
+ * @param {Transaction} tx
504
+ * @param {LinearFee} linear_fee
505
+ * @param {ExUnitPrices} ex_unit_prices
506
+ * @param {bigint} total_ref_script_size
507
+ * @returns {bigint}
508
+ */
509
+ module.exports.min_fee = function(tx, linear_fee, ex_unit_prices, total_ref_script_size) {
510
+ try {
511
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
512
+ _assertClass(tx, Transaction);
513
+ _assertClass(linear_fee, LinearFee);
514
+ _assertClass(ex_unit_prices, ExUnitPrices);
515
+ wasm.min_fee(retptr, tx.__wbg_ptr, linear_fee.__wbg_ptr, ex_unit_prices.__wbg_ptr, total_ref_script_size);
516
+ var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
517
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
518
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
519
+ if (r3) {
520
+ throw takeObject(r2);
521
+ }
522
+ return BigInt.asUintN(64, r0);
523
+ } finally {
524
+ wasm.__wbindgen_add_to_stack_pointer(16);
525
+ }
526
+ };
527
+
528
+ /**
529
+ * Converts JSON to Metadata according to MetadataJsonSchema
449
530
  * @param {string} json
450
- * @param {CardanoNodePlutusDatumSchema} schema
451
- * @returns {PlutusData}
531
+ * @param {MetadataJsonSchema} schema
532
+ * @returns {TransactionMetadatum}
452
533
  */
453
- module.exports.encode_json_str_to_plutus_datum = function(json, schema) {
534
+ module.exports.encode_json_str_to_metadatum = function(json, schema) {
454
535
  try {
455
536
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
456
537
  const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
457
538
  const len0 = WASM_VECTOR_LEN;
458
- wasm.encode_json_str_to_plutus_datum(retptr, ptr0, len0, schema);
539
+ wasm.encode_json_str_to_metadatum(retptr, ptr0, len0, schema);
459
540
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
460
541
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
461
542
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
462
543
  if (r2) {
463
544
  throw takeObject(r1);
464
545
  }
465
- return PlutusData.__wrap(r0);
546
+ return TransactionMetadatum.__wrap(r0);
466
547
  } finally {
467
548
  wasm.__wbindgen_add_to_stack_pointer(16);
468
549
  }
469
550
  };
470
551
 
471
552
  /**
472
- * @param {PlutusData} datum
473
- * @param {CardanoNodePlutusDatumSchema} schema
553
+ * Converts Metadata to JSON according to MetadataJsonSchema
554
+ * @param {TransactionMetadatum} metadatum
555
+ * @param {MetadataJsonSchema} schema
474
556
  * @returns {string}
475
557
  */
476
- module.exports.decode_plutus_datum_to_json_str = function(datum, schema) {
558
+ module.exports.decode_metadatum_to_json_str = function(metadatum, schema) {
477
559
  let deferred2_0;
478
560
  let deferred2_1;
479
561
  try {
480
562
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
481
- _assertClass(datum, PlutusData);
482
- wasm.decode_plutus_datum_to_json_str(retptr, datum.__wbg_ptr, schema);
563
+ _assertClass(metadatum, TransactionMetadatum);
564
+ wasm.decode_metadatum_to_json_str(retptr, metadatum.__wbg_ptr, schema);
483
565
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
484
566
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
485
567
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -499,28 +581,6 @@ module.exports.decode_plutus_datum_to_json_str = function(datum, schema) {
499
581
  }
500
582
  };
501
583
 
502
- /**
503
- * @param {TransactionOutput} output
504
- * @param {bigint} coins_per_utxo_byte
505
- * @returns {bigint}
506
- */
507
- module.exports.min_ada_required = function(output, coins_per_utxo_byte) {
508
- try {
509
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
510
- _assertClass(output, TransactionOutput);
511
- wasm.min_ada_required(retptr, output.__wbg_ptr, coins_per_utxo_byte);
512
- var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
513
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
514
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
515
- if (r3) {
516
- throw takeObject(r2);
517
- }
518
- return BigInt.asUintN(64, r0);
519
- } finally {
520
- wasm.__wbindgen_add_to_stack_pointer(16);
521
- }
522
- };
523
-
524
584
  /**
525
585
  * @param {Redeemers} redeemers
526
586
  * @returns {ExUnits}
@@ -542,86 +602,6 @@ module.exports.compute_total_ex_units = function(redeemers) {
542
602
  }
543
603
  };
544
604
 
545
- /**
546
- * encodes arbitrary bytes into chunks of 64 bytes (the limit for bytes) as a list to be valid Metadata
547
- * @param {Uint8Array} bytes
548
- * @returns {TransactionMetadatum}
549
- */
550
- module.exports.encode_arbitrary_bytes_as_metadatum = function(bytes) {
551
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
552
- const len0 = WASM_VECTOR_LEN;
553
- const ret = wasm.encode_arbitrary_bytes_as_metadatum(ptr0, len0);
554
- return TransactionMetadatum.__wrap(ret);
555
- };
556
-
557
- /**
558
- * decodes from chunks of bytes in a list to a byte vector if that is the metadata format, otherwise returns None
559
- * @param {TransactionMetadatum} metadata
560
- * @returns {Uint8Array | undefined}
561
- */
562
- module.exports.decode_arbitrary_bytes_from_metadatum = function(metadata) {
563
- try {
564
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
565
- _assertClass(metadata, TransactionMetadatum);
566
- wasm.decode_arbitrary_bytes_from_metadatum(retptr, metadata.__wbg_ptr);
567
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
568
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
569
- let v1;
570
- if (r0 !== 0) {
571
- v1 = getArrayU8FromWasm0(r0, r1).slice();
572
- wasm.__wbindgen_free(r0, r1 * 1, 1);
573
- }
574
- return v1;
575
- } finally {
576
- wasm.__wbindgen_add_to_stack_pointer(16);
577
- }
578
- };
579
-
580
- let cachedUint16ArrayMemory0 = null;
581
-
582
- function getUint16ArrayMemory0() {
583
- if (cachedUint16ArrayMemory0 === null || cachedUint16ArrayMemory0.byteLength === 0) {
584
- cachedUint16ArrayMemory0 = new Uint16Array(wasm.memory.buffer);
585
- }
586
- return cachedUint16ArrayMemory0;
587
- }
588
-
589
- function getArrayU16FromWasm0(ptr, len) {
590
- ptr = ptr >>> 0;
591
- return getUint16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len);
592
- }
593
-
594
- function passArray16ToWasm0(arg, malloc) {
595
- const ptr = malloc(arg.length * 2, 2) >>> 0;
596
- getUint16ArrayMemory0().set(arg, ptr / 2);
597
- WASM_VECTOR_LEN = arg.length;
598
- return ptr;
599
- }
600
- /**
601
- * @param {TransactionHash} tx_body_hash
602
- * @param {PrivateKey} sk
603
- * @returns {Vkeywitness}
604
- */
605
- module.exports.make_vkey_witness = function(tx_body_hash, sk) {
606
- _assertClass(tx_body_hash, TransactionHash);
607
- _assertClass(sk, PrivateKey);
608
- const ret = wasm.make_vkey_witness(tx_body_hash.__wbg_ptr, sk.__wbg_ptr);
609
- return Vkeywitness.__wrap(ret);
610
- };
611
-
612
- let cachedUint32ArrayMemory0 = null;
613
-
614
- function getUint32ArrayMemory0() {
615
- if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
616
- cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
617
- }
618
- return cachedUint32ArrayMemory0;
619
- }
620
-
621
- function getArrayU32FromWasm0(ptr, len) {
622
- ptr = ptr >>> 0;
623
- return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
624
- }
625
605
  /**
626
606
  * @param {TransactionHash} tx_body_hash
627
607
  * @param {ByronAddress} addr
@@ -653,19 +633,27 @@ module.exports.make_icarus_bootstrap_witness = function(tx_body_hash, addr, key)
653
633
  };
654
634
 
655
635
  /**
656
- *
657
- * * Min fee for JUST the script, NOT including ref inputs
658
- *
659
- * @param {Transaction} tx
660
- * @param {ExUnitPrices} ex_unit_prices
636
+ * @param {TransactionHash} tx_body_hash
637
+ * @param {PrivateKey} sk
638
+ * @returns {Vkeywitness}
639
+ */
640
+ module.exports.make_vkey_witness = function(tx_body_hash, sk) {
641
+ _assertClass(tx_body_hash, TransactionHash);
642
+ _assertClass(sk, PrivateKey);
643
+ const ret = wasm.make_vkey_witness(tx_body_hash.__wbg_ptr, sk.__wbg_ptr);
644
+ return Vkeywitness.__wrap(ret);
645
+ };
646
+
647
+ /**
648
+ * @param {TransactionOutput} output
649
+ * @param {bigint} coins_per_utxo_byte
661
650
  * @returns {bigint}
662
651
  */
663
- module.exports.min_script_fee = function(tx, ex_unit_prices) {
652
+ module.exports.min_ada_required = function(output, coins_per_utxo_byte) {
664
653
  try {
665
654
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
666
- _assertClass(tx, Transaction);
667
- _assertClass(ex_unit_prices, ExUnitPrices);
668
- wasm.min_script_fee(retptr, tx.__wbg_ptr, ex_unit_prices.__wbg_ptr);
655
+ _assertClass(output, TransactionOutput);
656
+ wasm.min_ada_required(retptr, output.__wbg_ptr, coins_per_utxo_byte);
669
657
  var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
670
658
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
671
659
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
@@ -678,56 +666,70 @@ module.exports.min_script_fee = function(tx, ex_unit_prices) {
678
666
  }
679
667
  };
680
668
 
669
+ let cachedUint32ArrayMemory0 = null;
670
+
671
+ function getUint32ArrayMemory0() {
672
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
673
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
674
+ }
675
+ return cachedUint32ArrayMemory0;
676
+ }
677
+
678
+ function getArrayU32FromWasm0(ptr, len) {
679
+ ptr = ptr >>> 0;
680
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
681
+ }
681
682
  /**
682
- * @param {Transaction} tx
683
- * @param {LinearFee} linear_fee
684
- * @returns {bigint}
683
+ * @param {string} json
684
+ * @param {CardanoNodePlutusDatumSchema} schema
685
+ * @returns {PlutusData}
685
686
  */
686
- module.exports.min_no_script_fee = function(tx, linear_fee) {
687
+ module.exports.encode_json_str_to_plutus_datum = function(json, schema) {
687
688
  try {
688
689
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
689
- _assertClass(tx, Transaction);
690
- _assertClass(linear_fee, LinearFee);
691
- wasm.min_no_script_fee(retptr, tx.__wbg_ptr, linear_fee.__wbg_ptr);
692
- var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
690
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
691
+ const len0 = WASM_VECTOR_LEN;
692
+ wasm.encode_json_str_to_plutus_datum(retptr, ptr0, len0, schema);
693
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
694
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
693
695
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
694
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
695
- if (r3) {
696
- throw takeObject(r2);
696
+ if (r2) {
697
+ throw takeObject(r1);
697
698
  }
698
- return BigInt.asUintN(64, r0);
699
+ return PlutusData.__wrap(r0);
699
700
  } finally {
700
701
  wasm.__wbindgen_add_to_stack_pointer(16);
701
702
  }
702
703
  };
703
704
 
704
705
  /**
705
- *
706
- * * Calculates the cost of all ref scripts
707
- * * * `total_ref_script_size` - Total size (original, not hashes) of all ref scripts. Duplicate scripts are counted as many times as they occur
708
- *
709
- * @param {Transaction} tx
710
- * @param {LinearFee} linear_fee
711
- * @param {ExUnitPrices} ex_unit_prices
712
- * @param {bigint} total_ref_script_size
713
- * @returns {bigint}
706
+ * @param {PlutusData} datum
707
+ * @param {CardanoNodePlutusDatumSchema} schema
708
+ * @returns {string}
714
709
  */
715
- module.exports.min_fee = function(tx, linear_fee, ex_unit_prices, total_ref_script_size) {
710
+ module.exports.decode_plutus_datum_to_json_str = function(datum, schema) {
711
+ let deferred2_0;
712
+ let deferred2_1;
716
713
  try {
717
714
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
718
- _assertClass(tx, Transaction);
719
- _assertClass(linear_fee, LinearFee);
720
- _assertClass(ex_unit_prices, ExUnitPrices);
721
- wasm.min_fee(retptr, tx.__wbg_ptr, linear_fee.__wbg_ptr, ex_unit_prices.__wbg_ptr, total_ref_script_size);
722
- var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
715
+ _assertClass(datum, PlutusData);
716
+ wasm.decode_plutus_datum_to_json_str(retptr, datum.__wbg_ptr, schema);
717
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
718
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
723
719
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
724
720
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
721
+ var ptr1 = r0;
722
+ var len1 = r1;
725
723
  if (r3) {
724
+ ptr1 = 0; len1 = 0;
726
725
  throw takeObject(r2);
727
726
  }
728
- return BigInt.asUintN(64, r0);
727
+ deferred2_0 = ptr1;
728
+ deferred2_1 = len1;
729
+ return getStringFromWasm0(ptr1, len1);
729
730
  } finally {
730
731
  wasm.__wbindgen_add_to_stack_pointer(16);
732
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
731
733
  }
732
734
  };
733
735
 
@@ -767,42 +769,10 @@ function getArrayU64FromWasm0(ptr, len) {
767
769
  }
768
770
  /**
769
771
  */
770
- module.exports.MetadataJsonSchema = Object.freeze({ NoConversions:0,"0":"NoConversions",BasicConversions:1,"1":"BasicConversions",DetailedSchema:2,"2":"DetailedSchema", });
771
- /**
772
- */
773
772
  module.exports.AddressKind = Object.freeze({ Base:0,"0":"Base",Ptr:1,"1":"Ptr",Enterprise:2,"2":"Enterprise",Reward:3,"3":"Reward",Byron:4,"4":"Byron", });
774
773
  /**
775
774
  */
776
- module.exports.CredentialKind = Object.freeze({ PubKey:0,"0":"PubKey",Script:1,"1":"Script", });
777
- /**
778
- * Which version of the CIP25 spec to use. See CIP25 for details.
779
- * This will change how things are encoded but for the most part contains
780
- * the same information.
781
- */
782
- module.exports.CIP25Version = Object.freeze({
783
- /**
784
- * Initial version of CIP25 with only string (utf8) asset names allowed.
785
- */
786
- V1:0,"0":"V1",
787
- /**
788
- * Second version of CIP25. Supports any type of asset names.
789
- */
790
- V2:1,"1":"V2", });
791
- /**
792
- */
793
- module.exports.VoterKind = Object.freeze({ ConstitutionalCommitteeHotKeyHash:0,"0":"ConstitutionalCommitteeHotKeyHash",ConstitutionalCommitteeHotScriptHash:1,"1":"ConstitutionalCommitteeHotScriptHash",DRepKeyHash:2,"2":"DRepKeyHash",DRepScriptHash:3,"3":"DRepScriptHash",StakingPoolKeyHash:4,"4":"StakingPoolKeyHash", });
794
- /**
795
- */
796
- module.exports.ScriptKind = Object.freeze({ Native:0,"0":"Native",PlutusV1:1,"1":"PlutusV1",PlutusV2:2,"2":"PlutusV2",PlutusV3:3,"3":"PlutusV3", });
797
- /**
798
- */
799
- module.exports.Vote = Object.freeze({ No:0,"0":"No",Yes:1,"1":"Yes",Abstain:2,"2":"Abstain", });
800
- /**
801
- */
802
- module.exports.NonceKind = Object.freeze({ Identity:0,"0":"Identity",Hash:1,"1":"Hash", });
803
- /**
804
- */
805
- module.exports.RelayKind = Object.freeze({ SingleHostAddr:0,"0":"SingleHostAddr",SingleHostName:1,"1":"SingleHostName",MultiHostName:2,"2":"MultiHostName", });
775
+ module.exports.CertificateKind = Object.freeze({ StakeRegistration:0,"0":"StakeRegistration",StakeDeregistration:1,"1":"StakeDeregistration",StakeDelegation:2,"2":"StakeDelegation",PoolRegistration:3,"3":"PoolRegistration",PoolRetirement:4,"4":"PoolRetirement",RegCert:5,"5":"RegCert",UnregCert:6,"6":"UnregCert",VoteDelegCert:7,"7":"VoteDelegCert",StakeVoteDelegCert:8,"8":"StakeVoteDelegCert",StakeRegDelegCert:9,"9":"StakeRegDelegCert",VoteRegDelegCert:10,"10":"VoteRegDelegCert",StakeVoteRegDelegCert:11,"11":"StakeVoteRegDelegCert",AuthCommitteeHotCert:12,"12":"AuthCommitteeHotCert",ResignCommitteeColdCert:13,"13":"ResignCommitteeColdCert",RegDrepCert:14,"14":"RegDrepCert",UnregDrepCert:15,"15":"UnregDrepCert",UpdateDrepCert:16,"16":"UpdateDrepCert", });
806
776
  /**
807
777
  * JSON <-> PlutusData conversion schemas.
808
778
  * Follows ScriptDataJsonSchema in cardano-cli defined at:
@@ -856,8 +826,32 @@ BasicConversions:0,"0":"BasicConversions",
856
826
  DetailedSchema:1,"1":"DetailedSchema", });
857
827
  /**
858
828
  */
829
+ module.exports.Vote = Object.freeze({ No:0,"0":"No",Yes:1,"1":"Yes",Abstain:2,"2":"Abstain", });
830
+ /**
831
+ */
859
832
  module.exports.RedeemerTag = Object.freeze({ Spend:0,"0":"Spend",Mint:1,"1":"Mint",Cert:2,"2":"Cert",Reward:3,"3":"Reward",Voting:4,"4":"Voting",Proposing:5,"5":"Proposing", });
860
833
  /**
834
+ * Careful: this enum doesn't include the network ID part of the header
835
+ * ex: base address isn't 0b0000_0000 but instead 0b0000
836
+ * Use `header_matches_kind` if you don't want to implement the bitwise operators yourself
837
+ */
838
+ module.exports.AddressHeaderKind = Object.freeze({ BasePaymentKeyStakeKey:0,"0":"BasePaymentKeyStakeKey",BasePaymentScriptStakeKey:1,"1":"BasePaymentScriptStakeKey",BasePaymentKeyStakeScript:2,"2":"BasePaymentKeyStakeScript",BasePaymentScriptStakeScript:3,"3":"BasePaymentScriptStakeScript",PointerKey:4,"4":"PointerKey",PointerScript:5,"5":"PointerScript",EnterpriseKey:6,"6":"EnterpriseKey",EnterpriseScript:7,"7":"EnterpriseScript",Byron:8,"8":"Byron",RewardKey:14,"14":"RewardKey",RewardScript:15,"15":"RewardScript", });
839
+ /**
840
+ */
841
+ module.exports.StakeDistributionKind = Object.freeze({ SingleKey:0,"0":"SingleKey",BootstrapEra:1,"1":"BootstrapEra", });
842
+ /**
843
+ */
844
+ module.exports.NonceKind = Object.freeze({ Identity:0,"0":"Identity",Hash:1,"1":"Hash", });
845
+ /**
846
+ */
847
+ module.exports.SpendingDataKind = Object.freeze({ SpendingDataPubKey:0,"0":"SpendingDataPubKey",SpendingDataScript:1,"1":"SpendingDataScript",SpendingDataRedeem:2,"2":"SpendingDataRedeem", });
848
+ /**
849
+ */
850
+ module.exports.ChunkableStringKind = Object.freeze({ Single:0,"0":"Single",Chunked:1,"1":"Chunked", });
851
+ /**
852
+ */
853
+ module.exports.NativeScriptKind = Object.freeze({ ScriptPubkey:0,"0":"ScriptPubkey",ScriptAll:1,"1":"ScriptAll",ScriptAny:2,"2":"ScriptAny",ScriptNOfK:3,"3":"ScriptNOfK",ScriptInvalidBefore:4,"4":"ScriptInvalidBefore",ScriptInvalidHereafter:5,"5":"ScriptInvalidHereafter", });
854
+ /**
861
855
  */
862
856
  module.exports.CoinSelectionStrategyCIP2 = Object.freeze({
863
857
  /**
@@ -878,61 +872,69 @@ LargestFirstMultiAsset:2,"2":"LargestFirstMultiAsset",
878
872
  RandomImproveMultiAsset:3,"3":"RandomImproveMultiAsset", });
879
873
  /**
880
874
  */
881
- module.exports.DRepKind = Object.freeze({ Key:0,"0":"Key",Script:1,"1":"Script",AlwaysAbstain:2,"2":"AlwaysAbstain",AlwaysNoConfidence:3,"3":"AlwaysNoConfidence", });
875
+ module.exports.RedeemersKind = Object.freeze({ ArrLegacyRedeemer:0,"0":"ArrLegacyRedeemer",MapRedeemerKeyToRedeemerVal:1,"1":"MapRedeemerKeyToRedeemerVal", });
882
876
  /**
883
877
  */
884
- module.exports.CertificateKind = Object.freeze({ StakeRegistration:0,"0":"StakeRegistration",StakeDeregistration:1,"1":"StakeDeregistration",StakeDelegation:2,"2":"StakeDelegation",PoolRegistration:3,"3":"PoolRegistration",PoolRetirement:4,"4":"PoolRetirement",RegCert:5,"5":"RegCert",UnregCert:6,"6":"UnregCert",VoteDelegCert:7,"7":"VoteDelegCert",StakeVoteDelegCert:8,"8":"StakeVoteDelegCert",StakeRegDelegCert:9,"9":"StakeRegDelegCert",VoteRegDelegCert:10,"10":"VoteRegDelegCert",StakeVoteRegDelegCert:11,"11":"StakeVoteRegDelegCert",AuthCommitteeHotCert:12,"12":"AuthCommitteeHotCert",ResignCommitteeColdCert:13,"13":"ResignCommitteeColdCert",RegDrepCert:14,"14":"RegDrepCert",UnregDrepCert:15,"15":"UnregDrepCert",UpdateDrepCert:16,"16":"UpdateDrepCert", });
878
+ module.exports.Language = Object.freeze({ PlutusV1:0,"0":"PlutusV1",PlutusV2:1,"1":"PlutusV2",PlutusV3:2,"2":"PlutusV3", });
885
879
  /**
886
880
  */
887
- module.exports.PlutusDataKind = Object.freeze({ ConstrPlutusData:0,"0":"ConstrPlutusData",Map:1,"1":"Map",List:2,"2":"List",Integer:3,"3":"Integer",Bytes:4,"4":"Bytes", });
881
+ module.exports.RelayKind = Object.freeze({ SingleHostAddr:0,"0":"SingleHostAddr",SingleHostName:1,"1":"SingleHostName",MultiHostName:2,"2":"MultiHostName", });
888
882
  /**
889
883
  */
890
- module.exports.DelegationDistributionKind = Object.freeze({ Weighted:0,"0":"Weighted",Legacy:1,"1":"Legacy", });
884
+ module.exports.CredentialKind = Object.freeze({ PubKey:0,"0":"PubKey",Script:1,"1":"Script", });
891
885
  /**
892
886
  */
893
887
  module.exports.GovActionKind = Object.freeze({ ParameterChangeAction:0,"0":"ParameterChangeAction",HardForkInitiationAction:1,"1":"HardForkInitiationAction",TreasuryWithdrawalsAction:2,"2":"TreasuryWithdrawalsAction",NoConfidence:3,"3":"NoConfidence",UpdateCommittee:4,"4":"UpdateCommittee",NewConstitution:5,"5":"NewConstitution",InfoAction:6,"6":"InfoAction", });
894
888
  /**
895
889
  */
896
- module.exports.Language = Object.freeze({ PlutusV1:0,"0":"PlutusV1",PlutusV2:1,"1":"PlutusV2",PlutusV3:2,"2":"PlutusV3", });
890
+ module.exports.VoterKind = Object.freeze({ ConstitutionalCommitteeHotKeyHash:0,"0":"ConstitutionalCommitteeHotKeyHash",ConstitutionalCommitteeHotScriptHash:1,"1":"ConstitutionalCommitteeHotScriptHash",DRepKeyHash:2,"2":"DRepKeyHash",DRepScriptHash:3,"3":"DRepScriptHash",StakingPoolKeyHash:4,"4":"StakingPoolKeyHash", });
897
891
  /**
898
892
  */
899
- module.exports.StakeDistributionKind = Object.freeze({ SingleKey:0,"0":"SingleKey",BootstrapEra:1,"1":"BootstrapEra", });
893
+ module.exports.DRepKind = Object.freeze({ Key:0,"0":"Key",Script:1,"1":"Script",AlwaysAbstain:2,"2":"AlwaysAbstain",AlwaysNoConfidence:3,"3":"AlwaysNoConfidence", });
900
894
  /**
901
895
  */
902
- module.exports.ChunkableStringKind = Object.freeze({ Single:0,"0":"Single",Chunked:1,"1":"Chunked", });
896
+ module.exports.DatumOptionKind = Object.freeze({ Hash:0,"0":"Hash",Datum:1,"1":"Datum", });
903
897
  /**
898
+ * Which version of the CIP25 spec to use. See CIP25 for details.
899
+ * This will change how things are encoded but for the most part contains
900
+ * the same information.
904
901
  */
905
- module.exports.TransactionMetadatumKind = Object.freeze({ Map:0,"0":"Map",List:1,"1":"List",Int:2,"2":"Int",Bytes:3,"3":"Bytes",Text:4,"4":"Text", });
902
+ module.exports.CIP25Version = Object.freeze({
906
903
  /**
904
+ * Initial version of CIP25 with only string (utf8) asset names allowed.
907
905
  */
908
- module.exports.DatumOptionKind = Object.freeze({ Hash:0,"0":"Hash",Datum:1,"1":"Datum", });
906
+ V1:0,"0":"V1",
907
+ /**
908
+ * Second version of CIP25. Supports any type of asset names.
909
+ */
910
+ V2:1,"1":"V2", });
909
911
  /**
910
912
  */
911
- module.exports.SpendingDataKind = Object.freeze({ SpendingDataPubKey:0,"0":"SpendingDataPubKey",SpendingDataScript:1,"1":"SpendingDataScript",SpendingDataRedeem:2,"2":"SpendingDataRedeem", });
913
+ module.exports.PlutusDataKind = Object.freeze({ ConstrPlutusData:0,"0":"ConstrPlutusData",Map:1,"1":"Map",List:2,"2":"List",Integer:3,"3":"Integer",Bytes:4,"4":"Bytes", });
912
914
  /**
913
915
  */
914
- module.exports.RedeemersKind = Object.freeze({ ArrLegacyRedeemer:0,"0":"ArrLegacyRedeemer",MapRedeemerKeyToRedeemerVal:1,"1":"MapRedeemerKeyToRedeemerVal", });
916
+ module.exports.AuxiliaryDataKind = Object.freeze({ Shelley:0,"0":"Shelley",ShelleyMA:1,"1":"ShelleyMA",Conway:2,"2":"Conway", });
915
917
  /**
916
- * Careful: this enum doesn't include the network ID part of the header
917
- * ex: base address isn't 0b0000_0000 but instead 0b0000
918
- * Use `header_matches_kind` if you don't want to implement the bitwise operators yourself
919
918
  */
920
- module.exports.AddressHeaderKind = Object.freeze({ BasePaymentKeyStakeKey:0,"0":"BasePaymentKeyStakeKey",BasePaymentScriptStakeKey:1,"1":"BasePaymentScriptStakeKey",BasePaymentKeyStakeScript:2,"2":"BasePaymentKeyStakeScript",BasePaymentScriptStakeScript:3,"3":"BasePaymentScriptStakeScript",PointerKey:4,"4":"PointerKey",PointerScript:5,"5":"PointerScript",EnterpriseKey:6,"6":"EnterpriseKey",EnterpriseScript:7,"7":"EnterpriseScript",Byron:8,"8":"Byron",RewardKey:14,"14":"RewardKey",RewardScript:15,"15":"RewardScript", });
919
+ module.exports.DelegationDistributionKind = Object.freeze({ Weighted:0,"0":"Weighted",Legacy:1,"1":"Legacy", });
920
+ /**
921
+ */
922
+ module.exports.ChangeSelectionAlgo = Object.freeze({ Default:0,"0":"Default", });
921
923
  /**
922
924
  */
923
925
  module.exports.TransactionOutputKind = Object.freeze({ AlonzoFormatTxOut:0,"0":"AlonzoFormatTxOut",ConwayFormatTxOut:1,"1":"ConwayFormatTxOut", });
924
926
  /**
925
927
  */
926
- module.exports.ByronAddrType = Object.freeze({ PublicKey:0,"0":"PublicKey",Script:1,"1":"Script",Redeem:2,"2":"Redeem", });
928
+ module.exports.TransactionMetadatumKind = Object.freeze({ Map:0,"0":"Map",List:1,"1":"List",Int:2,"2":"Int",Bytes:3,"3":"Bytes",Text:4,"4":"Text", });
927
929
  /**
928
930
  */
929
- module.exports.NativeScriptKind = Object.freeze({ ScriptPubkey:0,"0":"ScriptPubkey",ScriptAll:1,"1":"ScriptAll",ScriptAny:2,"2":"ScriptAny",ScriptNOfK:3,"3":"ScriptNOfK",ScriptInvalidBefore:4,"4":"ScriptInvalidBefore",ScriptInvalidHereafter:5,"5":"ScriptInvalidHereafter", });
931
+ module.exports.MetadataJsonSchema = Object.freeze({ NoConversions:0,"0":"NoConversions",BasicConversions:1,"1":"BasicConversions",DetailedSchema:2,"2":"DetailedSchema", });
930
932
  /**
931
933
  */
932
- module.exports.AuxiliaryDataKind = Object.freeze({ Shelley:0,"0":"Shelley",ShelleyMA:1,"1":"ShelleyMA",Conway:2,"2":"Conway", });
934
+ module.exports.ByronAddrType = Object.freeze({ PublicKey:0,"0":"PublicKey",Script:1,"1":"Script",Redeem:2,"2":"Redeem", });
933
935
  /**
934
936
  */
935
- module.exports.ChangeSelectionAlgo = Object.freeze({ Default:0,"0":"Default", });
937
+ module.exports.ScriptKind = Object.freeze({ Native:0,"0":"Native",PlutusV1:1,"1":"PlutusV1",PlutusV2:2,"2":"PlutusV2",PlutusV3:3,"3":"PlutusV3", });
936
938
 
937
939
  const AddrAttributesFinalization = (typeof FinalizationRegistry === 'undefined')
938
940
  ? { register: () => {}, unregister: () => {} }
@@ -2630,149 +2632,6 @@ class AssetName {
2630
2632
  }
2631
2633
  /**
2632
2634
  *
2633
- * * Create an AssetName from utf8 string. 64 byte (not char!) maximum.
2634
- *
2635
- * @param {string} utf8_str
2636
- * @returns {AssetName}
2637
- */
2638
- static from_str(utf8_str) {
2639
- try {
2640
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2641
- const ptr0 = passStringToWasm0(utf8_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2642
- const len0 = WASM_VECTOR_LEN;
2643
- wasm.assetname_from_str(retptr, ptr0, len0);
2644
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2645
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2646
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2647
- if (r2) {
2648
- throw takeObject(r1);
2649
- }
2650
- return AssetName.__wrap(r0);
2651
- } finally {
2652
- wasm.__wbindgen_add_to_stack_pointer(16);
2653
- }
2654
- }
2655
- /**
2656
- *
2657
- * * AssetName as a utf8 string if it's possible. Will error if the asset is not utf8
2658
- *
2659
- * @returns {string}
2660
- */
2661
- to_str() {
2662
- let deferred2_0;
2663
- let deferred2_1;
2664
- try {
2665
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2666
- wasm.assetname_to_str(retptr, this.__wbg_ptr);
2667
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2668
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2669
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2670
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2671
- var ptr1 = r0;
2672
- var len1 = r1;
2673
- if (r3) {
2674
- ptr1 = 0; len1 = 0;
2675
- throw takeObject(r2);
2676
- }
2677
- deferred2_0 = ptr1;
2678
- deferred2_1 = len1;
2679
- return getStringFromWasm0(ptr1, len1);
2680
- } finally {
2681
- wasm.__wbindgen_add_to_stack_pointer(16);
2682
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
2683
- }
2684
- }
2685
- /**
2686
- *
2687
- * * Direct raw bytes without any CBOR structure
2688
- *
2689
- * @returns {Uint8Array}
2690
- */
2691
- to_raw_bytes() {
2692
- try {
2693
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2694
- wasm.assetname_to_raw_bytes(retptr, this.__wbg_ptr);
2695
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2696
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2697
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
2698
- wasm.__wbindgen_free(r0, r1 * 1, 1);
2699
- return v1;
2700
- } finally {
2701
- wasm.__wbindgen_add_to_stack_pointer(16);
2702
- }
2703
- }
2704
- /**
2705
- *
2706
- * * Parse from the direct raw bytes, without any CBOR structure
2707
- *
2708
- * @param {Uint8Array} bytes
2709
- * @returns {AssetName}
2710
- */
2711
- static from_raw_bytes(bytes) {
2712
- try {
2713
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2714
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
2715
- const len0 = WASM_VECTOR_LEN;
2716
- wasm.assetname_from_raw_bytes(retptr, ptr0, len0);
2717
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2718
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2719
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2720
- if (r2) {
2721
- throw takeObject(r1);
2722
- }
2723
- return AssetName.__wrap(r0);
2724
- } finally {
2725
- wasm.__wbindgen_add_to_stack_pointer(16);
2726
- }
2727
- }
2728
- /**
2729
- *
2730
- * * Direct raw bytes without any CBOR structure, as a hex-encoded string
2731
- *
2732
- * @returns {string}
2733
- */
2734
- to_hex() {
2735
- let deferred1_0;
2736
- let deferred1_1;
2737
- try {
2738
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2739
- wasm.assetname_to_hex(retptr, this.__wbg_ptr);
2740
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2741
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2742
- deferred1_0 = r0;
2743
- deferred1_1 = r1;
2744
- return getStringFromWasm0(r0, r1);
2745
- } finally {
2746
- wasm.__wbindgen_add_to_stack_pointer(16);
2747
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2748
- }
2749
- }
2750
- /**
2751
- *
2752
- * * Parse from a hex string of the direct raw bytes, without any CBOR structure
2753
- *
2754
- * @param {string} input
2755
- * @returns {AssetName}
2756
- */
2757
- static from_hex(input) {
2758
- try {
2759
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2760
- const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2761
- const len0 = WASM_VECTOR_LEN;
2762
- wasm.assetname_from_hex(retptr, ptr0, len0);
2763
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2764
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2765
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2766
- if (r2) {
2767
- throw takeObject(r1);
2768
- }
2769
- return AssetName.__wrap(r0);
2770
- } finally {
2771
- wasm.__wbindgen_add_to_stack_pointer(16);
2772
- }
2773
- }
2774
- /**
2775
- *
2776
2635
  * * Serialize this type to CBOR bytes
2777
2636
  * * This type type supports encoding preservation so this will preserve round-trip CBOR formats.
2778
2637
  * * If created from scratch the CBOR will be canonical.
@@ -2972,6 +2831,149 @@ class AssetName {
2972
2831
  wasm.__wbindgen_add_to_stack_pointer(16);
2973
2832
  }
2974
2833
  }
2834
+ /**
2835
+ *
2836
+ * * Create an AssetName from utf8 string. 64 byte (not char!) maximum.
2837
+ *
2838
+ * @param {string} utf8_str
2839
+ * @returns {AssetName}
2840
+ */
2841
+ static from_str(utf8_str) {
2842
+ try {
2843
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2844
+ const ptr0 = passStringToWasm0(utf8_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2845
+ const len0 = WASM_VECTOR_LEN;
2846
+ wasm.assetname_from_str(retptr, ptr0, len0);
2847
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2848
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2849
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2850
+ if (r2) {
2851
+ throw takeObject(r1);
2852
+ }
2853
+ return AssetName.__wrap(r0);
2854
+ } finally {
2855
+ wasm.__wbindgen_add_to_stack_pointer(16);
2856
+ }
2857
+ }
2858
+ /**
2859
+ *
2860
+ * * AssetName as a utf8 string if it's possible. Will error if the asset is not utf8
2861
+ *
2862
+ * @returns {string}
2863
+ */
2864
+ to_str() {
2865
+ let deferred2_0;
2866
+ let deferred2_1;
2867
+ try {
2868
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2869
+ wasm.assetname_to_str(retptr, this.__wbg_ptr);
2870
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2871
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2872
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2873
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2874
+ var ptr1 = r0;
2875
+ var len1 = r1;
2876
+ if (r3) {
2877
+ ptr1 = 0; len1 = 0;
2878
+ throw takeObject(r2);
2879
+ }
2880
+ deferred2_0 = ptr1;
2881
+ deferred2_1 = len1;
2882
+ return getStringFromWasm0(ptr1, len1);
2883
+ } finally {
2884
+ wasm.__wbindgen_add_to_stack_pointer(16);
2885
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
2886
+ }
2887
+ }
2888
+ /**
2889
+ *
2890
+ * * Direct raw bytes without any CBOR structure
2891
+ *
2892
+ * @returns {Uint8Array}
2893
+ */
2894
+ to_raw_bytes() {
2895
+ try {
2896
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2897
+ wasm.assetname_to_raw_bytes(retptr, this.__wbg_ptr);
2898
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2899
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2900
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
2901
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2902
+ return v1;
2903
+ } finally {
2904
+ wasm.__wbindgen_add_to_stack_pointer(16);
2905
+ }
2906
+ }
2907
+ /**
2908
+ *
2909
+ * * Parse from the direct raw bytes, without any CBOR structure
2910
+ *
2911
+ * @param {Uint8Array} bytes
2912
+ * @returns {AssetName}
2913
+ */
2914
+ static from_raw_bytes(bytes) {
2915
+ try {
2916
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2917
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
2918
+ const len0 = WASM_VECTOR_LEN;
2919
+ wasm.assetname_from_raw_bytes(retptr, ptr0, len0);
2920
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2921
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2922
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2923
+ if (r2) {
2924
+ throw takeObject(r1);
2925
+ }
2926
+ return AssetName.__wrap(r0);
2927
+ } finally {
2928
+ wasm.__wbindgen_add_to_stack_pointer(16);
2929
+ }
2930
+ }
2931
+ /**
2932
+ *
2933
+ * * Direct raw bytes without any CBOR structure, as a hex-encoded string
2934
+ *
2935
+ * @returns {string}
2936
+ */
2937
+ to_hex() {
2938
+ let deferred1_0;
2939
+ let deferred1_1;
2940
+ try {
2941
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2942
+ wasm.assetname_to_hex(retptr, this.__wbg_ptr);
2943
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2944
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2945
+ deferred1_0 = r0;
2946
+ deferred1_1 = r1;
2947
+ return getStringFromWasm0(r0, r1);
2948
+ } finally {
2949
+ wasm.__wbindgen_add_to_stack_pointer(16);
2950
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2951
+ }
2952
+ }
2953
+ /**
2954
+ *
2955
+ * * Parse from a hex string of the direct raw bytes, without any CBOR structure
2956
+ *
2957
+ * @param {string} input
2958
+ * @returns {AssetName}
2959
+ */
2960
+ static from_hex(input) {
2961
+ try {
2962
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2963
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2964
+ const len0 = WASM_VECTOR_LEN;
2965
+ wasm.assetname_from_hex(retptr, ptr0, len0);
2966
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2967
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2968
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2969
+ if (r2) {
2970
+ throw takeObject(r1);
2971
+ }
2972
+ return AssetName.__wrap(r0);
2973
+ } finally {
2974
+ wasm.__wbindgen_add_to_stack_pointer(16);
2975
+ }
2976
+ }
2975
2977
  }
2976
2978
  module.exports.AssetName = AssetName;
2977
2979
 
@@ -44528,21 +44530,15 @@ class WithdrawalBuilderResult {
44528
44530
  }
44529
44531
  module.exports.WithdrawalBuilderResult = WithdrawalBuilderResult;
44530
44532
 
44531
- module.exports.__wbindgen_is_object = function(arg0) {
44532
- const val = getObject(arg0);
44533
- const ret = typeof(val) === 'object' && val !== null;
44534
- return ret;
44533
+ module.exports.__wbindgen_string_new = function(arg0, arg1) {
44534
+ const ret = getStringFromWasm0(arg0, arg1);
44535
+ return addHeapObject(ret);
44535
44536
  };
44536
44537
 
44537
44538
  module.exports.__wbindgen_object_drop_ref = function(arg0) {
44538
44539
  takeObject(arg0);
44539
44540
  };
44540
44541
 
44541
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
44542
- const ret = getStringFromWasm0(arg0, arg1);
44543
- return addHeapObject(ret);
44544
- };
44545
-
44546
44542
  module.exports.__wbindgen_throw = function(arg0, arg1) {
44547
44543
  throw new Error(getStringFromWasm0(arg0, arg1));
44548
44544
  };
@@ -44552,6 +44548,12 @@ module.exports.__wbindgen_memory = function() {
44552
44548
  return addHeapObject(ret);
44553
44549
  };
44554
44550
 
44551
+ module.exports.__wbindgen_is_object = function(arg0) {
44552
+ const val = getObject(arg0);
44553
+ const ret = typeof(val) === 'object' && val !== null;
44554
+ return ret;
44555
+ };
44556
+
44555
44557
  module.exports.__wbindgen_is_string = function(arg0) {
44556
44558
  const ret = typeof(getObject(arg0)) === 'string';
44557
44559
  return ret;
@@ -44562,11 +44564,6 @@ module.exports.__wbindgen_is_function = function(arg0) {
44562
44564
  return ret;
44563
44565
  };
44564
44566
 
44565
- module.exports.__wbindgen_object_clone_ref = function(arg0) {
44566
- const ret = getObject(arg0);
44567
- return addHeapObject(ret);
44568
- };
44569
-
44570
44567
  module.exports.__wbg_buffer_b7b08af79b0b0974 = function(arg0) {
44571
44568
  const ret = getObject(arg0).buffer;
44572
44569
  return addHeapObject(ret);
@@ -44665,6 +44662,11 @@ module.exports.__wbg_set_d1e79e2388520f18 = function(arg0, arg1, arg2) {
44665
44662
  getObject(arg0).set(getObject(arg1), arg2 >>> 0);
44666
44663
  };
44667
44664
 
44665
+ module.exports.__wbindgen_object_clone_ref = function(arg0) {
44666
+ const ret = getObject(arg0);
44667
+ return addHeapObject(ret);
44668
+ };
44669
+
44668
44670
  module.exports.__wbg_crypto_1d1f22824a6a080c = function(arg0) {
44669
44671
  const ret = getObject(arg0).crypto;
44670
44672
  return addHeapObject(ret);