saito-wasm 0.2.97 → 0.2.99

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,4 +1,4 @@
1
- import { MsgHandler } from './snippets/saito-wasm-b45c8a6dcd9ce9de/js/msg_handler.js';
1
+ import { MsgHandler } from './snippets/saito-wasm-4375448d2b4dc1d8/js/msg_handler.js';
2
2
 
3
3
  let wasm;
4
4
 
@@ -6,19 +6,10 @@ const heap = new Array(128).fill(undefined);
6
6
 
7
7
  heap.push(undefined, null, true, false);
8
8
 
9
- let heap_next = heap.length;
10
-
11
- function addHeapObject(obj) {
12
- if (heap_next === heap.length) heap.push(heap.length + 1);
13
- const idx = heap_next;
14
- heap_next = heap[idx];
15
-
16
- heap[idx] = obj;
17
- return idx;
18
- }
19
-
20
9
  function getObject(idx) { return heap[idx]; }
21
10
 
11
+ let heap_next = heap.length;
12
+
22
13
  function dropObject(idx) {
23
14
  if (idx < 132) return;
24
15
  heap[idx] = heap_next;
@@ -49,6 +40,15 @@ function getStringFromWasm0(ptr, len) {
49
40
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
50
41
  }
51
42
 
43
+ function addHeapObject(obj) {
44
+ if (heap_next === heap.length) heap.push(heap.length + 1);
45
+ const idx = heap_next;
46
+ heap_next = heap[idx];
47
+
48
+ heap[idx] = obj;
49
+ return idx;
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') } } );
@@ -226,38 +226,22 @@ function __wbg_adapter_38(arg0, arg1, arg2) {
226
226
  wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h575b308e3e106cb6(arg0, arg1, addHeapObject(arg2));
227
227
  }
228
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
- }
235
- }
236
-
237
229
  function _assertClass(instance, klass) {
238
230
  if (!(instance instanceof klass)) {
239
231
  throw new Error(`expected instance of ${klass.name}`);
240
232
  }
241
233
  return instance.ptr;
242
234
  }
243
-
244
- let stack_pointer = 128;
245
-
246
- function addBorrowedObject(obj) {
247
- if (stack_pointer == 1) throw new Error('out of js stack');
248
- heap[--stack_pointer] = obj;
249
- return stack_pointer;
250
- }
251
235
  /**
252
- * @param {string} json
236
+ * @param {string} config_json
253
237
  * @param {string} private_key
254
238
  * @param {number} log_level_num
255
239
  * @param {bigint} hasten_multiplier
256
240
  * @param {boolean} delete_old_blocks
257
241
  * @returns {Promise<any>}
258
242
  */
259
- export function initialize(json, private_key, log_level_num, hasten_multiplier, delete_old_blocks) {
260
- const ret = wasm.initialize(addHeapObject(json), addHeapObject(private_key), log_level_num, hasten_multiplier, delete_old_blocks);
243
+ export function initialize(config_json, private_key, log_level_num, hasten_multiplier, delete_old_blocks) {
244
+ const ret = wasm.initialize(addHeapObject(config_json), addHeapObject(private_key), log_level_num, hasten_multiplier, delete_old_blocks);
261
245
  return takeObject(ret);
262
246
  }
263
247
 
@@ -695,7 +679,30 @@ export function get_peer_stats() {
695
679
  return takeObject(ret);
696
680
  }
697
681
 
698
- function __wbg_adapter_420(arg0, arg1, arg2, arg3) {
682
+ /**
683
+ * @returns {Promise<string>}
684
+ */
685
+ export function get_congestion_stats() {
686
+ const ret = wasm.get_congestion_stats();
687
+ return takeObject(ret);
688
+ }
689
+
690
+ let stack_pointer = 128;
691
+
692
+ function addBorrowedObject(obj) {
693
+ if (stack_pointer == 1) throw new Error('out of js stack');
694
+ heap[--stack_pointer] = obj;
695
+ return stack_pointer;
696
+ }
697
+
698
+ function handleError(f, args) {
699
+ try {
700
+ return f.apply(this, args);
701
+ } catch (e) {
702
+ wasm.__wbindgen_exn_store(addHeapObject(e));
703
+ }
704
+ }
705
+ function __wbg_adapter_421(arg0, arg1, arg2, arg3) {
699
706
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h1d2fe914d97897fe(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
700
707
  }
701
708
 
@@ -2571,10 +2578,6 @@ async function __wbg_load(module, imports) {
2571
2578
  function __wbg_get_imports() {
2572
2579
  const imports = {};
2573
2580
  imports.wbg = {};
2574
- imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
2575
- const ret = BigInt.asUintN(64, arg0);
2576
- return addHeapObject(ret);
2577
- };
2578
2581
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
2579
2582
  takeObject(arg0);
2580
2583
  };
@@ -2582,28 +2585,16 @@ function __wbg_get_imports() {
2582
2585
  const ret = getStringFromWasm0(arg0, arg1);
2583
2586
  return addHeapObject(ret);
2584
2587
  };
2585
- imports.wbg.__wbg_wasmblockchain_new = function(arg0) {
2586
- const ret = WasmBlockchain.__wrap(arg0);
2587
- return addHeapObject(ret);
2588
- };
2589
- imports.wbg.__wbg_wasmblock_new = function(arg0) {
2590
- const ret = WasmBlock.__wrap(arg0);
2591
- return addHeapObject(ret);
2592
- };
2593
- imports.wbg.__wbg_wasmpeer_new = function(arg0) {
2594
- const ret = WasmPeer.__wrap(arg0);
2595
- return addHeapObject(ret);
2596
- };
2597
- imports.wbg.__wbg_wasmnft_new = function(arg0) {
2598
- const ret = WasmNFT.__wrap(arg0);
2588
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
2589
+ const ret = BigInt.asUintN(64, arg0);
2599
2590
  return addHeapObject(ret);
2600
2591
  };
2601
- imports.wbg.__wbg_wasmwallet_new = function(arg0) {
2602
- const ret = WasmWallet.__wrap(arg0);
2592
+ imports.wbg.__wbg_wasmslip_new = function(arg0) {
2593
+ const ret = WasmSlip.__wrap(arg0);
2603
2594
  return addHeapObject(ret);
2604
2595
  };
2605
- imports.wbg.__wbg_wasmbalancesnapshot_new = function(arg0) {
2606
- const ret = WasmBalanceSnapshot.__wrap(arg0);
2596
+ imports.wbg.__wbg_wasmtransaction_new = function(arg0) {
2597
+ const ret = WasmTransaction.__wrap(arg0);
2607
2598
  return addHeapObject(ret);
2608
2599
  };
2609
2600
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
@@ -2618,18 +2609,42 @@ function __wbg_get_imports() {
2618
2609
  const ret = WasmWalletSlip.__wrap(arg0);
2619
2610
  return addHeapObject(ret);
2620
2611
  };
2621
- imports.wbg.__wbg_wasmtransaction_new = function(arg0) {
2622
- const ret = WasmTransaction.__wrap(arg0);
2612
+ imports.wbg.__wbg_wasmpeer_new = function(arg0) {
2613
+ const ret = WasmPeer.__wrap(arg0);
2623
2614
  return addHeapObject(ret);
2624
2615
  };
2625
- imports.wbg.__wbg_wasmslip_new = function(arg0) {
2626
- const ret = WasmSlip.__wrap(arg0);
2616
+ imports.wbg.__wbg_wasmnft_new = function(arg0) {
2617
+ const ret = WasmNFT.__wrap(arg0);
2618
+ return addHeapObject(ret);
2619
+ };
2620
+ imports.wbg.__wbg_wasmblock_new = function(arg0) {
2621
+ const ret = WasmBlock.__wrap(arg0);
2622
+ return addHeapObject(ret);
2623
+ };
2624
+ imports.wbg.__wbg_wasmblockchain_new = function(arg0) {
2625
+ const ret = WasmBlockchain.__wrap(arg0);
2626
+ return addHeapObject(ret);
2627
+ };
2628
+ imports.wbg.__wbg_wasmwallet_new = function(arg0) {
2629
+ const ret = WasmWallet.__wrap(arg0);
2630
+ return addHeapObject(ret);
2631
+ };
2632
+ imports.wbg.__wbg_wasmbalancesnapshot_new = function(arg0) {
2633
+ const ret = WasmBalanceSnapshot.__wrap(arg0);
2634
+ return addHeapObject(ret);
2635
+ };
2636
+ imports.wbg.__wbg_wasmhop_new = function(arg0) {
2637
+ const ret = WasmHop.__wrap(arg0);
2627
2638
  return addHeapObject(ret);
2628
2639
  };
2629
2640
  imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
2630
2641
  const ret = new Error(getStringFromWasm0(arg0, arg1));
2631
2642
  return addHeapObject(ret);
2632
2643
  };
2644
+ imports.wbg.__wbg_wasmpeerservice_new = function(arg0) {
2645
+ const ret = WasmPeerService.__wrap(arg0);
2646
+ return addHeapObject(ret);
2647
+ };
2633
2648
  imports.wbg.__wbindgen_is_object = function(arg0) {
2634
2649
  const val = getObject(arg0);
2635
2650
  const ret = typeof(val) === 'object' && val !== null;
@@ -2643,13 +2658,13 @@ function __wbg_get_imports() {
2643
2658
  const ret = getObject(arg0) in getObject(arg1);
2644
2659
  return ret;
2645
2660
  };
2646
- imports.wbg.__wbg_sendmessage_2b354f191bbba65f = function(arg0, arg1) {
2661
+ imports.wbg.__wbg_sendmessage_97d7f022a877467e = function(arg0, arg1) {
2647
2662
  MsgHandler.send_message(takeObject(arg0), getObject(arg1));
2648
2663
  };
2649
- imports.wbg.__wbg_sendmessagetoall_a02b856abefbfe14 = function(arg0, arg1) {
2664
+ imports.wbg.__wbg_sendmessagetoall_ba211b96dfa65fe5 = function(arg0, arg1) {
2650
2665
  MsgHandler.send_message_to_all(getObject(arg0), getObject(arg1));
2651
2666
  };
2652
- imports.wbg.__wbg_connecttopeer_f6a3e45a0ac78200 = function() { return handleError(function (arg0, arg1, arg2) {
2667
+ imports.wbg.__wbg_connecttopeer_2ab190f6ca71f5f7 = function() { return handleError(function (arg0, arg1, arg2) {
2653
2668
  let deferred0_0;
2654
2669
  let deferred0_1;
2655
2670
  try {
@@ -2661,11 +2676,11 @@ function __wbg_get_imports() {
2661
2676
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2662
2677
  }
2663
2678
  }, arguments) };
2664
- imports.wbg.__wbg_disconnectfrompeer_2f8dae828632793c = function() { return handleError(function (arg0) {
2679
+ imports.wbg.__wbg_disconnectfrompeer_fa7180862666085b = function() { return handleError(function (arg0) {
2665
2680
  const ret = MsgHandler.disconnect_from_peer(takeObject(arg0));
2666
2681
  return addHeapObject(ret);
2667
2682
  }, arguments) };
2668
- imports.wbg.__wbg_fetchblockfrompeer_3e78b4611fb74141 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2683
+ imports.wbg.__wbg_fetchblockfrompeer_ebaf495142809113 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2669
2684
  let deferred0_0;
2670
2685
  let deferred0_1;
2671
2686
  try {
@@ -2677,7 +2692,7 @@ function __wbg_get_imports() {
2677
2692
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2678
2693
  }
2679
2694
  }, arguments) };
2680
- imports.wbg.__wbg_writevalue_c19f047c2edbf7e6 = function(arg0, arg1, arg2) {
2695
+ imports.wbg.__wbg_writevalue_db033c89e3cc6ce1 = function(arg0, arg1, arg2) {
2681
2696
  let deferred0_0;
2682
2697
  let deferred0_1;
2683
2698
  try {
@@ -2688,7 +2703,7 @@ function __wbg_get_imports() {
2688
2703
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2689
2704
  }
2690
2705
  };
2691
- imports.wbg.__wbg_appendvalue_190f0b64fdd1118f = function(arg0, arg1, arg2) {
2706
+ imports.wbg.__wbg_appendvalue_b71488e99c0b2acc = function(arg0, arg1, arg2) {
2692
2707
  let deferred0_0;
2693
2708
  let deferred0_1;
2694
2709
  try {
@@ -2699,7 +2714,7 @@ function __wbg_get_imports() {
2699
2714
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2700
2715
  }
2701
2716
  };
2702
- imports.wbg.__wbg_flushdata_d81471c52acf9534 = function(arg0, arg1) {
2717
+ imports.wbg.__wbg_flushdata_9472c01596035377 = function(arg0, arg1) {
2703
2718
  let deferred0_0;
2704
2719
  let deferred0_1;
2705
2720
  try {
@@ -2710,7 +2725,7 @@ function __wbg_get_imports() {
2710
2725
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2711
2726
  }
2712
2727
  };
2713
- imports.wbg.__wbg_readvalue_21a901db2b03aa6e = function() { return handleError(function (arg0, arg1) {
2728
+ imports.wbg.__wbg_readvalue_52aaffc6b45c3221 = function() { return handleError(function (arg0, arg1) {
2714
2729
  let deferred0_0;
2715
2730
  let deferred0_1;
2716
2731
  try {
@@ -2722,11 +2737,11 @@ function __wbg_get_imports() {
2722
2737
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2723
2738
  }
2724
2739
  }, arguments) };
2725
- imports.wbg.__wbg_loadblockfilelist_75fb9bfa84a987db = function() { return handleError(function () {
2740
+ imports.wbg.__wbg_loadblockfilelist_a4e2a6d9d03ee691 = function() { return handleError(function () {
2726
2741
  const ret = MsgHandler.load_block_file_list();
2727
2742
  return addHeapObject(ret);
2728
2743
  }, arguments) };
2729
- imports.wbg.__wbg_isexistingfile_5ff330a31fbe4ab8 = function() { return handleError(function (arg0, arg1) {
2744
+ imports.wbg.__wbg_isexistingfile_961bc3427edd9588 = function() { return handleError(function (arg0, arg1) {
2730
2745
  let deferred0_0;
2731
2746
  let deferred0_1;
2732
2747
  try {
@@ -2738,7 +2753,7 @@ function __wbg_get_imports() {
2738
2753
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2739
2754
  }
2740
2755
  }, arguments) };
2741
- imports.wbg.__wbg_removevalue_5aad14b432fc5e3b = function() { return handleError(function (arg0, arg1) {
2756
+ imports.wbg.__wbg_removevalue_04f5e8da4126f5ff = function() { return handleError(function (arg0, arg1) {
2742
2757
  let deferred0_0;
2743
2758
  let deferred0_1;
2744
2759
  try {
@@ -2750,7 +2765,7 @@ function __wbg_get_imports() {
2750
2765
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2751
2766
  }
2752
2767
  }, arguments) };
2753
- imports.wbg.__wbg_ensureblockdirectoryexists_6acb3dcab334e54f = function() { return handleError(function (arg0, arg1) {
2768
+ imports.wbg.__wbg_ensureblockdirectoryexists_a66636c752771723 = function() { return handleError(function (arg0, arg1) {
2754
2769
  let deferred0_0;
2755
2770
  let deferred0_1;
2756
2771
  try {
@@ -2761,16 +2776,16 @@ function __wbg_get_imports() {
2761
2776
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2762
2777
  }
2763
2778
  }, arguments) };
2764
- imports.wbg.__wbg_processapicall_348f8802466464f8 = function(arg0, arg1, arg2) {
2779
+ imports.wbg.__wbg_processapicall_58ba2d9ccb130e31 = function(arg0, arg1, arg2) {
2765
2780
  MsgHandler.process_api_call(takeObject(arg0), arg1 >>> 0, takeObject(arg2));
2766
2781
  };
2767
- imports.wbg.__wbg_processapisuccess_2548ab1b4cbf4550 = function(arg0, arg1, arg2) {
2782
+ imports.wbg.__wbg_processapisuccess_9ead7dfd1f7243b6 = function(arg0, arg1, arg2) {
2768
2783
  MsgHandler.process_api_success(takeObject(arg0), arg1 >>> 0, takeObject(arg2));
2769
2784
  };
2770
- imports.wbg.__wbg_processapierror_50719fffa83242ac = function(arg0, arg1, arg2) {
2785
+ imports.wbg.__wbg_processapierror_5edd170759073625 = function(arg0, arg1, arg2) {
2771
2786
  MsgHandler.process_api_error(takeObject(arg0), arg1 >>> 0, takeObject(arg2));
2772
2787
  };
2773
- imports.wbg.__wbg_sendinterfaceevent_624c75814d5c701f = function(arg0, arg1, arg2, arg3, arg4) {
2788
+ imports.wbg.__wbg_sendinterfaceevent_d7add55de27c21bc = function(arg0, arg1, arg2, arg3, arg4) {
2774
2789
  let deferred0_0;
2775
2790
  let deferred0_1;
2776
2791
  let deferred1_0;
@@ -2786,7 +2801,7 @@ function __wbg_get_imports() {
2786
2801
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2787
2802
  }
2788
2803
  };
2789
- imports.wbg.__wbg_sendblocksuccess_3d2a8a7f0565ba5a = function(arg0, arg1, arg2) {
2804
+ imports.wbg.__wbg_sendblocksuccess_35d6fef02f71245a = function(arg0, arg1, arg2) {
2790
2805
  let deferred0_0;
2791
2806
  let deferred0_1;
2792
2807
  try {
@@ -2797,10 +2812,10 @@ function __wbg_get_imports() {
2797
2812
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2798
2813
  }
2799
2814
  };
2800
- imports.wbg.__wbg_sendwalletupdate_495f6f7559a64ef4 = function() {
2815
+ imports.wbg.__wbg_sendwalletupdate_7943305ec88b0155 = function() {
2801
2816
  MsgHandler.send_wallet_update();
2802
2817
  };
2803
- imports.wbg.__wbg_sendnewversionalert_0fd3ce9054611c4f = function(arg0, arg1, arg2) {
2818
+ imports.wbg.__wbg_sendnewversionalert_7edac17a51748e05 = function(arg0, arg1, arg2) {
2804
2819
  let deferred0_0;
2805
2820
  let deferred0_1;
2806
2821
  try {
@@ -2811,29 +2826,21 @@ function __wbg_get_imports() {
2811
2826
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2812
2827
  }
2813
2828
  };
2814
- imports.wbg.__wbg_sendblockfetchstatusevent_e0d10082e9d3260d = function(arg0) {
2829
+ imports.wbg.__wbg_sendblockfetchstatusevent_87def7f265f52508 = function(arg0) {
2815
2830
  MsgHandler.send_block_fetch_status_event(BigInt.asUintN(64, arg0));
2816
2831
  };
2817
- imports.wbg.__wbg_savewallet_85ace855f615ea4e = function() {
2832
+ imports.wbg.__wbg_savewallet_36ef14fa90357832 = function() {
2818
2833
  MsgHandler.save_wallet();
2819
2834
  };
2820
- imports.wbg.__wbg_loadwallet_7c3aa7326ed80060 = function() {
2835
+ imports.wbg.__wbg_loadwallet_c140164674179902 = function() {
2821
2836
  MsgHandler.load_wallet();
2822
2837
  };
2823
- imports.wbg.__wbg_getmyservices_45b0fe08ed80e525 = function() {
2838
+ imports.wbg.__wbg_getmyservices_3277a77e136f5719 = function() {
2824
2839
  const ret = MsgHandler.get_my_services();
2825
2840
  _assertClass(ret, WasmPeerServiceList);
2826
2841
  var ptr1 = ret.__destroy_into_raw();
2827
2842
  return ptr1;
2828
2843
  };
2829
- imports.wbg.__wbg_wasmpeerservice_new = function(arg0) {
2830
- const ret = WasmPeerService.__wrap(arg0);
2831
- return addHeapObject(ret);
2832
- };
2833
- imports.wbg.__wbg_wasmhop_new = function(arg0) {
2834
- const ret = WasmHop.__wrap(arg0);
2835
- return addHeapObject(ret);
2836
- };
2837
2844
  imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
2838
2845
  const ret = getObject(arg0) == getObject(arg1);
2839
2846
  return ret;
@@ -3053,7 +3060,7 @@ function __wbg_get_imports() {
3053
3060
  const a = state0.a;
3054
3061
  state0.a = 0;
3055
3062
  try {
3056
- return __wbg_adapter_420(a, state0.b, arg0, arg1);
3063
+ return __wbg_adapter_421(a, state0.b, arg0, arg1);
3057
3064
  } finally {
3058
3065
  state0.a = a;
3059
3066
  }
@@ -3134,8 +3141,8 @@ function __wbg_get_imports() {
3134
3141
  const ret = wasm.memory;
3135
3142
  return addHeapObject(ret);
3136
3143
  };
3137
- imports.wbg.__wbindgen_closure_wrapper1374 = function(arg0, arg1, arg2) {
3138
- const ret = makeMutClosure(arg0, arg1, 489, __wbg_adapter_38);
3144
+ imports.wbg.__wbindgen_closure_wrapper1475 = function(arg0, arg1, arg2) {
3145
+ const ret = makeMutClosure(arg0, arg1, 519, __wbg_adapter_38);
3139
3146
  return addHeapObject(ret);
3140
3147
  };
3141
3148
 
Binary file