saito-wasm 0.2.109 → 0.2.111

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/pkg/web/index.js CHANGED
@@ -1,7 +1,27 @@
1
- import { MsgHandler } from './snippets/saito-wasm-e43d5d0d0dc6b2eb/js/msg_handler.js';
1
+ import { MsgHandler } from './snippets/saito-wasm-4593348001ae2b5f/js/msg_handler.js';
2
2
 
3
3
  let wasm;
4
4
 
5
+ const heap = new Array(128).fill(undefined);
6
+
7
+ heap.push(undefined, null, true, false);
8
+
9
+ function getObject(idx) { return heap[idx]; }
10
+
11
+ let heap_next = heap.length;
12
+
13
+ function dropObject(idx) {
14
+ if (idx < 132) return;
15
+ heap[idx] = heap_next;
16
+ heap_next = idx;
17
+ }
18
+
19
+ function takeObject(idx) {
20
+ const ret = getObject(idx);
21
+ dropObject(idx);
22
+ return ret;
23
+ }
24
+
5
25
  const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
6
26
 
7
27
  if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
@@ -20,12 +40,6 @@ function getStringFromWasm0(ptr, len) {
20
40
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
21
41
  }
22
42
 
23
- const heap = new Array(128).fill(undefined);
24
-
25
- heap.push(undefined, null, true, false);
26
-
27
- let heap_next = heap.length;
28
-
29
43
  function addHeapObject(obj) {
30
44
  if (heap_next === heap.length) heap.push(heap.length + 1);
31
45
  const idx = heap_next;
@@ -35,20 +49,6 @@ function addHeapObject(obj) {
35
49
  return idx;
36
50
  }
37
51
 
38
- function getObject(idx) { return heap[idx]; }
39
-
40
- function dropObject(idx) {
41
- if (idx < 132) return;
42
- heap[idx] = heap_next;
43
- heap_next = idx;
44
- }
45
-
46
- function takeObject(idx) {
47
- const ret = getObject(idx);
48
- dropObject(idx);
49
- return ret;
50
- }
51
-
52
52
  let WASM_VECTOR_LEN = 0;
53
53
 
54
54
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
@@ -223,23 +223,9 @@ function makeMutClosure(arg0, arg1, dtor, f) {
223
223
  return real;
224
224
  }
225
225
  function __wbg_adapter_38(arg0, arg1, arg2) {
226
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h575b308e3e106cb6(arg0, arg1, addHeapObject(arg2));
227
- }
228
-
229
- function handleError(f, args) {
230
- try {
231
- return f.apply(this, args);
232
- } catch (e) {
233
- wasm.__wbindgen_exn_store(addHeapObject(e));
234
- }
226
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h5b81f38714849c11(arg0, arg1, addHeapObject(arg2));
235
227
  }
236
228
 
237
- function _assertClass(instance, klass) {
238
- if (!(instance instanceof klass)) {
239
- throw new Error(`expected instance of ${klass.name}`);
240
- }
241
- return instance.ptr;
242
- }
243
229
  /**
244
230
  * @param {string} config_json
245
231
  * @param {string} private_key
@@ -531,6 +517,12 @@ export function get_balance_snapshot(keys) {
531
517
  return takeObject(ret);
532
518
  }
533
519
 
520
+ function _assertClass(instance, klass) {
521
+ if (!(instance instanceof klass)) {
522
+ throw new Error(`expected instance of ${klass.name}`);
523
+ }
524
+ return instance.ptr;
525
+ }
534
526
  /**
535
527
  * @param {WasmBalanceSnapshot} snapshot
536
528
  * @returns {Promise<void>}
@@ -714,6 +706,14 @@ export function get_congestion_stats() {
714
706
  return takeObject(ret);
715
707
  }
716
708
 
709
+ function handleError(f, args) {
710
+ try {
711
+ return f.apply(this, args);
712
+ } catch (e) {
713
+ wasm.__wbindgen_exn_store(addHeapObject(e));
714
+ }
715
+ }
716
+
717
717
  let stack_pointer = 128;
718
718
 
719
719
  function addBorrowedObject(obj) {
@@ -722,7 +722,7 @@ function addBorrowedObject(obj) {
722
722
  return stack_pointer;
723
723
  }
724
724
  function __wbg_adapter_424(arg0, arg1, arg2, arg3) {
725
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h1d2fe914d97897fe(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
725
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h181ffbb7749dfc48(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
726
726
  }
727
727
 
728
728
  const SaitoWasmFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -2619,29 +2619,17 @@ async function __wbg_load(module, imports) {
2619
2619
  function __wbg_get_imports() {
2620
2620
  const imports = {};
2621
2621
  imports.wbg = {};
2622
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
2623
- const ret = getStringFromWasm0(arg0, arg1);
2624
- return addHeapObject(ret);
2625
- };
2626
2622
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
2627
2623
  takeObject(arg0);
2628
2624
  };
2629
- imports.wbg.__wbg_wasmblock_new = function(arg0) {
2630
- const ret = WasmBlock.__wrap(arg0);
2625
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
2626
+ const ret = getStringFromWasm0(arg0, arg1);
2631
2627
  return addHeapObject(ret);
2632
2628
  };
2633
2629
  imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
2634
2630
  const ret = BigInt.asUintN(64, arg0);
2635
2631
  return addHeapObject(ret);
2636
2632
  };
2637
- imports.wbg.__wbg_wasmblockchain_new = function(arg0) {
2638
- const ret = WasmBlockchain.__wrap(arg0);
2639
- return addHeapObject(ret);
2640
- };
2641
- imports.wbg.__wbg_wasmtransaction_new = function(arg0) {
2642
- const ret = WasmTransaction.__wrap(arg0);
2643
- return addHeapObject(ret);
2644
- };
2645
2633
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
2646
2634
  const obj = getObject(arg1);
2647
2635
  const ret = typeof(obj) === 'string' ? obj : undefined;
@@ -2650,8 +2638,20 @@ function __wbg_get_imports() {
2650
2638
  getInt32Memory0()[arg0 / 4 + 1] = len1;
2651
2639
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2652
2640
  };
2653
- imports.wbg.__wbg_wasmnft_new = function(arg0) {
2654
- const ret = WasmNFT.__wrap(arg0);
2641
+ imports.wbg.__wbg_wasmtransaction_new = function(arg0) {
2642
+ const ret = WasmTransaction.__wrap(arg0);
2643
+ return addHeapObject(ret);
2644
+ };
2645
+ imports.wbg.__wbg_wasmbalancesnapshot_new = function(arg0) {
2646
+ const ret = WasmBalanceSnapshot.__wrap(arg0);
2647
+ return addHeapObject(ret);
2648
+ };
2649
+ imports.wbg.__wbg_wasmwalletslip_new = function(arg0) {
2650
+ const ret = WasmWalletSlip.__wrap(arg0);
2651
+ return addHeapObject(ret);
2652
+ };
2653
+ imports.wbg.__wbg_wasmwallet_new = function(arg0) {
2654
+ const ret = WasmWallet.__wrap(arg0);
2655
2655
  return addHeapObject(ret);
2656
2656
  };
2657
2657
  imports.wbg.__wbg_wasmpeer_new = function(arg0) {
@@ -2662,16 +2662,24 @@ function __wbg_get_imports() {
2662
2662
  const ret = WasmSlip.__wrap(arg0);
2663
2663
  return addHeapObject(ret);
2664
2664
  };
2665
- imports.wbg.__wbg_wasmwallet_new = function(arg0) {
2666
- const ret = WasmWallet.__wrap(arg0);
2665
+ imports.wbg.__wbg_wasmblockchain_new = function(arg0) {
2666
+ const ret = WasmBlockchain.__wrap(arg0);
2667
2667
  return addHeapObject(ret);
2668
2668
  };
2669
- imports.wbg.__wbg_wasmwalletslip_new = function(arg0) {
2670
- const ret = WasmWalletSlip.__wrap(arg0);
2669
+ imports.wbg.__wbg_wasmnft_new = function(arg0) {
2670
+ const ret = WasmNFT.__wrap(arg0);
2671
2671
  return addHeapObject(ret);
2672
2672
  };
2673
- imports.wbg.__wbg_wasmbalancesnapshot_new = function(arg0) {
2674
- const ret = WasmBalanceSnapshot.__wrap(arg0);
2673
+ imports.wbg.__wbg_wasmblock_new = function(arg0) {
2674
+ const ret = WasmBlock.__wrap(arg0);
2675
+ return addHeapObject(ret);
2676
+ };
2677
+ imports.wbg.__wbg_wasmhop_new = function(arg0) {
2678
+ const ret = WasmHop.__wrap(arg0);
2679
+ return addHeapObject(ret);
2680
+ };
2681
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
2682
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
2675
2683
  return addHeapObject(ret);
2676
2684
  };
2677
2685
  imports.wbg.__wbindgen_is_object = function(arg0) {
@@ -2687,13 +2695,13 @@ function __wbg_get_imports() {
2687
2695
  const ret = getObject(arg0) in getObject(arg1);
2688
2696
  return ret;
2689
2697
  };
2690
- imports.wbg.__wbg_sendmessage_e5d866d7abe1b030 = function(arg0, arg1) {
2698
+ imports.wbg.__wbg_sendmessage_60ac34929e01f90a = function(arg0, arg1) {
2691
2699
  MsgHandler.send_message(takeObject(arg0), getObject(arg1));
2692
2700
  };
2693
- imports.wbg.__wbg_sendmessagetoall_9a9b2118177d1524 = function(arg0, arg1) {
2701
+ imports.wbg.__wbg_sendmessagetoall_dd37c4e3d81cfb02 = function(arg0, arg1) {
2694
2702
  MsgHandler.send_message_to_all(getObject(arg0), getObject(arg1));
2695
2703
  };
2696
- imports.wbg.__wbg_connecttopeer_7300e81c8fee01df = function() { return handleError(function (arg0, arg1, arg2) {
2704
+ imports.wbg.__wbg_connecttopeer_520fb19cb8efb4cc = function() { return handleError(function (arg0, arg1, arg2) {
2697
2705
  let deferred0_0;
2698
2706
  let deferred0_1;
2699
2707
  try {
@@ -2705,11 +2713,11 @@ function __wbg_get_imports() {
2705
2713
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2706
2714
  }
2707
2715
  }, arguments) };
2708
- imports.wbg.__wbg_disconnectfrompeer_3f36a0c1c6001d6e = function() { return handleError(function (arg0) {
2716
+ imports.wbg.__wbg_disconnectfrompeer_9cf3c916c0f496c3 = function() { return handleError(function (arg0) {
2709
2717
  const ret = MsgHandler.disconnect_from_peer(takeObject(arg0));
2710
2718
  return addHeapObject(ret);
2711
2719
  }, arguments) };
2712
- imports.wbg.__wbg_fetchblockfrompeer_bb8350ce7f0eea14 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2720
+ imports.wbg.__wbg_fetchblockfrompeer_4e645b26c9c6cffd = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2713
2721
  let deferred0_0;
2714
2722
  let deferred0_1;
2715
2723
  try {
@@ -2721,7 +2729,7 @@ function __wbg_get_imports() {
2721
2729
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2722
2730
  }
2723
2731
  }, arguments) };
2724
- imports.wbg.__wbg_writevalue_3c10a5b0d9e5f39f = function(arg0, arg1, arg2) {
2732
+ imports.wbg.__wbg_writevalue_d7ff80b45cb179e7 = function(arg0, arg1, arg2) {
2725
2733
  let deferred0_0;
2726
2734
  let deferred0_1;
2727
2735
  try {
@@ -2732,7 +2740,7 @@ function __wbg_get_imports() {
2732
2740
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2733
2741
  }
2734
2742
  };
2735
- imports.wbg.__wbg_appendvalue_618ceb860a8aa480 = function(arg0, arg1, arg2) {
2743
+ imports.wbg.__wbg_appendvalue_4136cb2ada1e605b = function(arg0, arg1, arg2) {
2736
2744
  let deferred0_0;
2737
2745
  let deferred0_1;
2738
2746
  try {
@@ -2743,7 +2751,7 @@ function __wbg_get_imports() {
2743
2751
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2744
2752
  }
2745
2753
  };
2746
- imports.wbg.__wbg_flushdata_bb08ed37bc709dfa = function(arg0, arg1) {
2754
+ imports.wbg.__wbg_flushdata_e4eba82d50af4d68 = function(arg0, arg1) {
2747
2755
  let deferred0_0;
2748
2756
  let deferred0_1;
2749
2757
  try {
@@ -2754,7 +2762,7 @@ function __wbg_get_imports() {
2754
2762
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2755
2763
  }
2756
2764
  };
2757
- imports.wbg.__wbg_readvalue_f0f3db2b62e66acc = function() { return handleError(function (arg0, arg1) {
2765
+ imports.wbg.__wbg_readvalue_d4fcdcdd2ef48a37 = function() { return handleError(function (arg0, arg1) {
2758
2766
  let deferred0_0;
2759
2767
  let deferred0_1;
2760
2768
  try {
@@ -2766,11 +2774,11 @@ function __wbg_get_imports() {
2766
2774
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2767
2775
  }
2768
2776
  }, arguments) };
2769
- imports.wbg.__wbg_loadblockfilelist_e14276bf67f56a8e = function() { return handleError(function () {
2777
+ imports.wbg.__wbg_loadblockfilelist_d8a247e53a690a9b = function() { return handleError(function () {
2770
2778
  const ret = MsgHandler.load_block_file_list();
2771
2779
  return addHeapObject(ret);
2772
2780
  }, arguments) };
2773
- imports.wbg.__wbg_isexistingfile_ff2ecc1da664ac46 = function() { return handleError(function (arg0, arg1) {
2781
+ imports.wbg.__wbg_isexistingfile_3411fb80788f03c9 = function() { return handleError(function (arg0, arg1) {
2774
2782
  let deferred0_0;
2775
2783
  let deferred0_1;
2776
2784
  try {
@@ -2782,7 +2790,7 @@ function __wbg_get_imports() {
2782
2790
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2783
2791
  }
2784
2792
  }, arguments) };
2785
- imports.wbg.__wbg_removevalue_8332354fed8f3594 = function() { return handleError(function (arg0, arg1) {
2793
+ imports.wbg.__wbg_removevalue_36f6c4478bb1e22a = function() { return handleError(function (arg0, arg1) {
2786
2794
  let deferred0_0;
2787
2795
  let deferred0_1;
2788
2796
  try {
@@ -2794,7 +2802,7 @@ function __wbg_get_imports() {
2794
2802
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2795
2803
  }
2796
2804
  }, arguments) };
2797
- imports.wbg.__wbg_ensureblockdirectoryexists_17d7c0013891066f = function() { return handleError(function (arg0, arg1) {
2805
+ imports.wbg.__wbg_ensureblockdirectoryexists_ca37897fcf6db834 = function() { return handleError(function (arg0, arg1) {
2798
2806
  let deferred0_0;
2799
2807
  let deferred0_1;
2800
2808
  try {
@@ -2805,16 +2813,16 @@ function __wbg_get_imports() {
2805
2813
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2806
2814
  }
2807
2815
  }, arguments) };
2808
- imports.wbg.__wbg_processapicall_8c355a6886c86358 = function(arg0, arg1, arg2) {
2816
+ imports.wbg.__wbg_processapicall_5a54f4c0e96bebca = function(arg0, arg1, arg2) {
2809
2817
  MsgHandler.process_api_call(takeObject(arg0), arg1 >>> 0, takeObject(arg2));
2810
2818
  };
2811
- imports.wbg.__wbg_processapisuccess_13c76662220a0e3b = function(arg0, arg1, arg2) {
2819
+ imports.wbg.__wbg_processapisuccess_74ad4c725c55cab9 = function(arg0, arg1, arg2) {
2812
2820
  MsgHandler.process_api_success(takeObject(arg0), arg1 >>> 0, takeObject(arg2));
2813
2821
  };
2814
- imports.wbg.__wbg_processapierror_a9371fc6877ae5cd = function(arg0, arg1, arg2) {
2822
+ imports.wbg.__wbg_processapierror_1d41c81af9ffdd2d = function(arg0, arg1, arg2) {
2815
2823
  MsgHandler.process_api_error(takeObject(arg0), arg1 >>> 0, takeObject(arg2));
2816
2824
  };
2817
- imports.wbg.__wbg_sendinterfaceevent_e9b4837d36fbf9ff = function(arg0, arg1, arg2, arg3, arg4) {
2825
+ imports.wbg.__wbg_sendinterfaceevent_0495938273bd3ecb = function(arg0, arg1, arg2, arg3, arg4) {
2818
2826
  let deferred0_0;
2819
2827
  let deferred0_1;
2820
2828
  let deferred1_0;
@@ -2830,7 +2838,7 @@ function __wbg_get_imports() {
2830
2838
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2831
2839
  }
2832
2840
  };
2833
- imports.wbg.__wbg_sendblocksuccess_7e75116641308a16 = function(arg0, arg1, arg2) {
2841
+ imports.wbg.__wbg_sendblocksuccess_d6f269bebdc169ed = function(arg0, arg1, arg2) {
2834
2842
  let deferred0_0;
2835
2843
  let deferred0_1;
2836
2844
  try {
@@ -2841,10 +2849,10 @@ function __wbg_get_imports() {
2841
2849
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2842
2850
  }
2843
2851
  };
2844
- imports.wbg.__wbg_sendwalletupdate_3812361372d6f0fd = function() {
2852
+ imports.wbg.__wbg_sendwalletupdate_6123dd2c03aa38d3 = function() {
2845
2853
  MsgHandler.send_wallet_update();
2846
2854
  };
2847
- imports.wbg.__wbg_sendnewversionalert_1aa1233c519b08d2 = function(arg0, arg1, arg2) {
2855
+ imports.wbg.__wbg_sendnewversionalert_7b36214ed7aed727 = function(arg0, arg1, arg2) {
2848
2856
  let deferred0_0;
2849
2857
  let deferred0_1;
2850
2858
  try {
@@ -2855,16 +2863,16 @@ function __wbg_get_imports() {
2855
2863
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2856
2864
  }
2857
2865
  };
2858
- imports.wbg.__wbg_sendblockfetchstatusevent_71c28df423448b21 = function(arg0) {
2866
+ imports.wbg.__wbg_sendblockfetchstatusevent_d2e9c212d0a90815 = function(arg0) {
2859
2867
  MsgHandler.send_block_fetch_status_event(BigInt.asUintN(64, arg0));
2860
2868
  };
2861
- imports.wbg.__wbg_savewallet_b15d05f5e71c91db = function() {
2869
+ imports.wbg.__wbg_savewallet_81da255abc39c4f8 = function() {
2862
2870
  MsgHandler.save_wallet();
2863
2871
  };
2864
- imports.wbg.__wbg_loadwallet_4aec7279515ce27d = function() {
2872
+ imports.wbg.__wbg_loadwallet_e2baef2eccdab5b4 = function() {
2865
2873
  MsgHandler.load_wallet();
2866
2874
  };
2867
- imports.wbg.__wbg_getmyservices_ad240e9ee0f04555 = function() {
2875
+ imports.wbg.__wbg_getmyservices_46381ac777db876e = function() {
2868
2876
  const ret = MsgHandler.get_my_services();
2869
2877
  _assertClass(ret, WasmPeerServiceList);
2870
2878
  var ptr1 = ret.__destroy_into_raw();
@@ -2874,14 +2882,6 @@ function __wbg_get_imports() {
2874
2882
  const ret = WasmPeerService.__wrap(arg0);
2875
2883
  return addHeapObject(ret);
2876
2884
  };
2877
- imports.wbg.__wbg_wasmhop_new = function(arg0) {
2878
- const ret = WasmHop.__wrap(arg0);
2879
- return addHeapObject(ret);
2880
- };
2881
- imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
2882
- const ret = new Error(getStringFromWasm0(arg0, arg1));
2883
- return addHeapObject(ret);
2884
- };
2885
2885
  imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
2886
2886
  const ret = getObject(arg0) == getObject(arg1);
2887
2887
  return ret;
@@ -3182,7 +3182,7 @@ function __wbg_get_imports() {
3182
3182
  const ret = wasm.memory;
3183
3183
  return addHeapObject(ret);
3184
3184
  };
3185
- imports.wbg.__wbindgen_closure_wrapper1509 = function(arg0, arg1, arg2) {
3185
+ imports.wbg.__wbindgen_closure_wrapper1510 = function(arg0, arg1, arg2) {
3186
3186
  const ret = makeMutClosure(arg0, arg1, 541, __wbg_adapter_38);
3187
3187
  return addHeapObject(ret);
3188
3188
  };
Binary file