saito-wasm 0.2.93 → 0.2.95

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/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "saito-wasm"
3
- version = "0.2.93"
3
+ version = "0.2.95"
4
4
  edition = "2021"
5
5
 
6
6
  # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saito-wasm",
3
- "version": "0.2.93",
3
+ "version": "0.2.95",
4
4
  "description": "js wrappings around saito-core using wasm",
5
5
  "scripts": {
6
6
  "test": "./node_modules/.bin/jest",
@@ -243,6 +243,10 @@ export function produce_block_without_gt(): Promise<boolean>;
243
243
  */
244
244
  export function get_stats(): Promise<string>;
245
245
  /**
246
+ * @returns {Promise<string>}
247
+ */
248
+ export function get_peer_stats(): Promise<string>;
249
+ /**
246
250
  */
247
251
  export class SaitoWasm {
248
252
  free(): void;
package/pkg/node/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  let imports = {};
2
2
  imports['__wbindgen_placeholder__'] = module.exports;
3
3
  let wasm;
4
- const { MsgHandler } = require(String.raw`./snippets/saito-wasm-1508f323aa70efc2/js/msg_handler.js`);
5
- const { TextDecoder, TextEncoder } = require(`util`);
4
+ const { MsgHandler } = require(String.raw`./snippets/saito-wasm-54beba3cbd6d7df7/js/msg_handler.js`);
5
+ const { TextEncoder, TextDecoder } = require(`util`);
6
6
 
7
7
  const heap = new Array(128).fill(undefined);
8
8
 
@@ -33,9 +33,7 @@ function addHeapObject(obj) {
33
33
  return idx;
34
34
  }
35
35
 
36
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
37
-
38
- cachedTextDecoder.decode();
36
+ let WASM_VECTOR_LEN = 0;
39
37
 
40
38
  let cachedUint8Memory0 = null;
41
39
 
@@ -46,13 +44,6 @@ function getUint8Memory0() {
46
44
  return cachedUint8Memory0;
47
45
  }
48
46
 
49
- function getStringFromWasm0(ptr, len) {
50
- ptr = ptr >>> 0;
51
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
52
- }
53
-
54
- let WASM_VECTOR_LEN = 0;
55
-
56
47
  let cachedTextEncoder = new TextEncoder('utf-8');
57
48
 
58
49
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -120,6 +111,15 @@ function getInt32Memory0() {
120
111
  return cachedInt32Memory0;
121
112
  }
122
113
 
114
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
115
+
116
+ cachedTextDecoder.decode();
117
+
118
+ function getStringFromWasm0(ptr, len) {
119
+ ptr = ptr >>> 0;
120
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
121
+ }
122
+
123
123
  let cachedFloat64Memory0 = null;
124
124
 
125
125
  function getFloat64Memory0() {
@@ -228,13 +228,6 @@ function __wbg_adapter_38(arg0, arg1, arg2) {
228
228
  wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h575b308e3e106cb6(arg0, arg1, addHeapObject(arg2));
229
229
  }
230
230
 
231
- function _assertClass(instance, klass) {
232
- if (!(instance instanceof klass)) {
233
- throw new Error(`expected instance of ${klass.name}`);
234
- }
235
- return instance.ptr;
236
- }
237
-
238
231
  function handleError(f, args) {
239
232
  try {
240
233
  return f.apply(this, args);
@@ -243,6 +236,13 @@ function handleError(f, args) {
243
236
  }
244
237
  }
245
238
 
239
+ function _assertClass(instance, klass) {
240
+ if (!(instance instanceof klass)) {
241
+ throw new Error(`expected instance of ${klass.name}`);
242
+ }
243
+ return instance.ptr;
244
+ }
245
+
246
246
  let stack_pointer = 128;
247
247
 
248
248
  function addBorrowedObject(obj) {
@@ -689,7 +689,15 @@ module.exports.get_stats = function() {
689
689
  return takeObject(ret);
690
690
  };
691
691
 
692
- function __wbg_adapter_419(arg0, arg1, arg2, arg3) {
692
+ /**
693
+ * @returns {Promise<string>}
694
+ */
695
+ module.exports.get_peer_stats = function() {
696
+ const ret = wasm.get_peer_stats();
697
+ return takeObject(ret);
698
+ };
699
+
700
+ function __wbg_adapter_420(arg0, arg1, arg2, arg3) {
693
701
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h1d2fe914d97897fe(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
694
702
  }
695
703
 
@@ -2206,7 +2214,7 @@ class WasmTransaction {
2206
2214
  * @returns {bigint}
2207
2215
  */
2208
2216
  get timestamp() {
2209
- const ret = wasm.wasmtransaction_get_timestamp(this.__wbg_ptr);
2217
+ const ret = wasm.wasmpeer_get_peer_index(this.__wbg_ptr);
2210
2218
  return BigInt.asUintN(64, ret);
2211
2219
  }
2212
2220
  /**
@@ -2551,8 +2559,8 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
2551
2559
  takeObject(arg0);
2552
2560
  };
2553
2561
 
2554
- module.exports.__wbg_wasmwallet_new = function(arg0) {
2555
- const ret = WasmWallet.__wrap(arg0);
2562
+ module.exports.__wbg_wasmtransaction_new = function(arg0) {
2563
+ const ret = WasmTransaction.__wrap(arg0);
2556
2564
  return addHeapObject(ret);
2557
2565
  };
2558
2566
 
@@ -2561,16 +2569,6 @@ module.exports.__wbindgen_bigint_from_u64 = function(arg0) {
2561
2569
  return addHeapObject(ret);
2562
2570
  };
2563
2571
 
2564
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
2565
- const ret = getStringFromWasm0(arg0, arg1);
2566
- return addHeapObject(ret);
2567
- };
2568
-
2569
- module.exports.__wbg_wasmwalletslip_new = function(arg0) {
2570
- const ret = WasmWalletSlip.__wrap(arg0);
2571
- return addHeapObject(ret);
2572
- };
2573
-
2574
2572
  module.exports.__wbindgen_string_get = function(arg0, arg1) {
2575
2573
  const obj = getObject(arg1);
2576
2574
  const ret = typeof(obj) === 'string' ? obj : undefined;
@@ -2580,8 +2578,8 @@ module.exports.__wbindgen_string_get = function(arg0, arg1) {
2580
2578
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2581
2579
  };
2582
2580
 
2583
- module.exports.__wbg_wasmtransaction_new = function(arg0) {
2584
- const ret = WasmTransaction.__wrap(arg0);
2581
+ module.exports.__wbindgen_string_new = function(arg0, arg1) {
2582
+ const ret = getStringFromWasm0(arg0, arg1);
2585
2583
  return addHeapObject(ret);
2586
2584
  };
2587
2585
 
@@ -2590,13 +2588,8 @@ module.exports.__wbg_wasmpeer_new = function(arg0) {
2590
2588
  return addHeapObject(ret);
2591
2589
  };
2592
2590
 
2593
- module.exports.__wbg_wasmslip_new = function(arg0) {
2594
- const ret = WasmSlip.__wrap(arg0);
2595
- return addHeapObject(ret);
2596
- };
2597
-
2598
- module.exports.__wbg_wasmnft_new = function(arg0) {
2599
- const ret = WasmNFT.__wrap(arg0);
2591
+ module.exports.__wbg_wasmblockchain_new = function(arg0) {
2592
+ const ret = WasmBlockchain.__wrap(arg0);
2600
2593
  return addHeapObject(ret);
2601
2594
  };
2602
2595
 
@@ -2605,8 +2598,8 @@ module.exports.__wbg_wasmblock_new = function(arg0) {
2605
2598
  return addHeapObject(ret);
2606
2599
  };
2607
2600
 
2608
- module.exports.__wbg_wasmblockchain_new = function(arg0) {
2609
- const ret = WasmBlockchain.__wrap(arg0);
2601
+ module.exports.__wbg_wasmwallet_new = function(arg0) {
2602
+ const ret = WasmWallet.__wrap(arg0);
2610
2603
  return addHeapObject(ret);
2611
2604
  };
2612
2605
 
@@ -2615,8 +2608,23 @@ module.exports.__wbg_wasmbalancesnapshot_new = function(arg0) {
2615
2608
  return addHeapObject(ret);
2616
2609
  };
2617
2610
 
2618
- module.exports.__wbg_wasmhop_new = function(arg0) {
2619
- const ret = WasmHop.__wrap(arg0);
2611
+ module.exports.__wbg_wasmnft_new = function(arg0) {
2612
+ const ret = WasmNFT.__wrap(arg0);
2613
+ return addHeapObject(ret);
2614
+ };
2615
+
2616
+ module.exports.__wbg_wasmslip_new = function(arg0) {
2617
+ const ret = WasmSlip.__wrap(arg0);
2618
+ return addHeapObject(ret);
2619
+ };
2620
+
2621
+ module.exports.__wbg_wasmwalletslip_new = function(arg0) {
2622
+ const ret = WasmWalletSlip.__wrap(arg0);
2623
+ return addHeapObject(ret);
2624
+ };
2625
+
2626
+ module.exports.__wbindgen_error_new = function(arg0, arg1) {
2627
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
2620
2628
  return addHeapObject(ret);
2621
2629
  };
2622
2630
 
@@ -2636,15 +2644,15 @@ module.exports.__wbindgen_in = function(arg0, arg1) {
2636
2644
  return ret;
2637
2645
  };
2638
2646
 
2639
- module.exports.__wbg_sendmessage_7da6b536e60629d8 = function(arg0, arg1) {
2647
+ module.exports.__wbg_sendmessage_902e21902c5e262d = function(arg0, arg1) {
2640
2648
  MsgHandler.send_message(takeObject(arg0), getObject(arg1));
2641
2649
  };
2642
2650
 
2643
- module.exports.__wbg_sendmessagetoall_9746becda496e1a8 = function(arg0, arg1) {
2651
+ module.exports.__wbg_sendmessagetoall_603e52dae7959572 = function(arg0, arg1) {
2644
2652
  MsgHandler.send_message_to_all(getObject(arg0), getObject(arg1));
2645
2653
  };
2646
2654
 
2647
- module.exports.__wbg_connecttopeer_38a6c0f7ca69b030 = function() { return handleError(function (arg0, arg1, arg2) {
2655
+ module.exports.__wbg_connecttopeer_50264b7f7d8f3348 = function() { return handleError(function (arg0, arg1, arg2) {
2648
2656
  let deferred0_0;
2649
2657
  let deferred0_1;
2650
2658
  try {
@@ -2657,12 +2665,12 @@ module.exports.__wbg_connecttopeer_38a6c0f7ca69b030 = function() { return handle
2657
2665
  }
2658
2666
  }, arguments) };
2659
2667
 
2660
- module.exports.__wbg_disconnectfrompeer_f764615b16ce87db = function() { return handleError(function (arg0) {
2668
+ module.exports.__wbg_disconnectfrompeer_0e096206b76116af = function() { return handleError(function (arg0) {
2661
2669
  const ret = MsgHandler.disconnect_from_peer(takeObject(arg0));
2662
2670
  return addHeapObject(ret);
2663
2671
  }, arguments) };
2664
2672
 
2665
- module.exports.__wbg_fetchblockfrompeer_05f4accffdcb4e73 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2673
+ module.exports.__wbg_fetchblockfrompeer_d9e340951116fd5e = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2666
2674
  let deferred0_0;
2667
2675
  let deferred0_1;
2668
2676
  try {
@@ -2675,7 +2683,7 @@ module.exports.__wbg_fetchblockfrompeer_05f4accffdcb4e73 = function() { return h
2675
2683
  }
2676
2684
  }, arguments) };
2677
2685
 
2678
- module.exports.__wbg_writevalue_52c350b098d8ba6d = function(arg0, arg1, arg2) {
2686
+ module.exports.__wbg_writevalue_ea54b07da8d73841 = function(arg0, arg1, arg2) {
2679
2687
  let deferred0_0;
2680
2688
  let deferred0_1;
2681
2689
  try {
@@ -2687,7 +2695,7 @@ module.exports.__wbg_writevalue_52c350b098d8ba6d = function(arg0, arg1, arg2) {
2687
2695
  }
2688
2696
  };
2689
2697
 
2690
- module.exports.__wbg_appendvalue_d52b5112f880c2bd = function(arg0, arg1, arg2) {
2698
+ module.exports.__wbg_appendvalue_93d3921c67970198 = function(arg0, arg1, arg2) {
2691
2699
  let deferred0_0;
2692
2700
  let deferred0_1;
2693
2701
  try {
@@ -2699,7 +2707,7 @@ module.exports.__wbg_appendvalue_d52b5112f880c2bd = function(arg0, arg1, arg2) {
2699
2707
  }
2700
2708
  };
2701
2709
 
2702
- module.exports.__wbg_flushdata_7eae5dacc6aa6fd6 = function(arg0, arg1) {
2710
+ module.exports.__wbg_flushdata_f28f633aed082e26 = function(arg0, arg1) {
2703
2711
  let deferred0_0;
2704
2712
  let deferred0_1;
2705
2713
  try {
@@ -2711,7 +2719,7 @@ module.exports.__wbg_flushdata_7eae5dacc6aa6fd6 = function(arg0, arg1) {
2711
2719
  }
2712
2720
  };
2713
2721
 
2714
- module.exports.__wbg_readvalue_2ab41e8d220d2dea = function() { return handleError(function (arg0, arg1) {
2722
+ module.exports.__wbg_readvalue_2931aceaeb438aff = function() { return handleError(function (arg0, arg1) {
2715
2723
  let deferred0_0;
2716
2724
  let deferred0_1;
2717
2725
  try {
@@ -2724,12 +2732,12 @@ module.exports.__wbg_readvalue_2ab41e8d220d2dea = function() { return handleErro
2724
2732
  }
2725
2733
  }, arguments) };
2726
2734
 
2727
- module.exports.__wbg_loadblockfilelist_abd183222cb57c66 = function() { return handleError(function () {
2735
+ module.exports.__wbg_loadblockfilelist_b380ec35971a08ff = function() { return handleError(function () {
2728
2736
  const ret = MsgHandler.load_block_file_list();
2729
2737
  return addHeapObject(ret);
2730
2738
  }, arguments) };
2731
2739
 
2732
- module.exports.__wbg_isexistingfile_7adfeb51601d9a39 = function() { return handleError(function (arg0, arg1) {
2740
+ module.exports.__wbg_isexistingfile_9fbf96fdc0412096 = function() { return handleError(function (arg0, arg1) {
2733
2741
  let deferred0_0;
2734
2742
  let deferred0_1;
2735
2743
  try {
@@ -2742,7 +2750,7 @@ module.exports.__wbg_isexistingfile_7adfeb51601d9a39 = function() { return handl
2742
2750
  }
2743
2751
  }, arguments) };
2744
2752
 
2745
- module.exports.__wbg_removevalue_023a9b789c850581 = function() { return handleError(function (arg0, arg1) {
2753
+ module.exports.__wbg_removevalue_0c4b6b558e89215f = function() { return handleError(function (arg0, arg1) {
2746
2754
  let deferred0_0;
2747
2755
  let deferred0_1;
2748
2756
  try {
@@ -2755,7 +2763,7 @@ module.exports.__wbg_removevalue_023a9b789c850581 = function() { return handleEr
2755
2763
  }
2756
2764
  }, arguments) };
2757
2765
 
2758
- module.exports.__wbg_ensureblockdirectoryexists_18f639bed1c973ea = function() { return handleError(function (arg0, arg1) {
2766
+ module.exports.__wbg_ensureblockdirectoryexists_24dd763a83b0b2b0 = function() { return handleError(function (arg0, arg1) {
2759
2767
  let deferred0_0;
2760
2768
  let deferred0_1;
2761
2769
  try {
@@ -2767,19 +2775,19 @@ module.exports.__wbg_ensureblockdirectoryexists_18f639bed1c973ea = function() {
2767
2775
  }
2768
2776
  }, arguments) };
2769
2777
 
2770
- module.exports.__wbg_processapicall_d4420f96292edf10 = function(arg0, arg1, arg2) {
2778
+ module.exports.__wbg_processapicall_6f760a4144c8aee4 = function(arg0, arg1, arg2) {
2771
2779
  MsgHandler.process_api_call(takeObject(arg0), arg1 >>> 0, takeObject(arg2));
2772
2780
  };
2773
2781
 
2774
- module.exports.__wbg_processapisuccess_22b999c5e9efd7b3 = function(arg0, arg1, arg2) {
2782
+ module.exports.__wbg_processapisuccess_54c5ada448ed6240 = function(arg0, arg1, arg2) {
2775
2783
  MsgHandler.process_api_success(takeObject(arg0), arg1 >>> 0, takeObject(arg2));
2776
2784
  };
2777
2785
 
2778
- module.exports.__wbg_processapierror_426f26232b72bec2 = function(arg0, arg1, arg2) {
2786
+ module.exports.__wbg_processapierror_f5aa5f808992e8c7 = function(arg0, arg1, arg2) {
2779
2787
  MsgHandler.process_api_error(takeObject(arg0), arg1 >>> 0, takeObject(arg2));
2780
2788
  };
2781
2789
 
2782
- module.exports.__wbg_sendinterfaceevent_62edd715d62b856b = function(arg0, arg1, arg2, arg3, arg4) {
2790
+ module.exports.__wbg_sendinterfaceevent_71da58d10523e1c2 = function(arg0, arg1, arg2, arg3, arg4) {
2783
2791
  let deferred0_0;
2784
2792
  let deferred0_1;
2785
2793
  let deferred1_0;
@@ -2796,7 +2804,7 @@ module.exports.__wbg_sendinterfaceevent_62edd715d62b856b = function(arg0, arg1,
2796
2804
  }
2797
2805
  };
2798
2806
 
2799
- module.exports.__wbg_sendblocksuccess_ca14df574b2164de = function(arg0, arg1, arg2) {
2807
+ module.exports.__wbg_sendblocksuccess_7db37b555c014b46 = function(arg0, arg1, arg2) {
2800
2808
  let deferred0_0;
2801
2809
  let deferred0_1;
2802
2810
  try {
@@ -2808,11 +2816,11 @@ module.exports.__wbg_sendblocksuccess_ca14df574b2164de = function(arg0, arg1, ar
2808
2816
  }
2809
2817
  };
2810
2818
 
2811
- module.exports.__wbg_sendwalletupdate_8da949e7c02a50a9 = function() {
2819
+ module.exports.__wbg_sendwalletupdate_45462f5f064b6068 = function() {
2812
2820
  MsgHandler.send_wallet_update();
2813
2821
  };
2814
2822
 
2815
- module.exports.__wbg_sendnewversionalert_75337b4f4d4963bc = function(arg0, arg1, arg2) {
2823
+ module.exports.__wbg_sendnewversionalert_632ad4258760c5ea = function(arg0, arg1, arg2) {
2816
2824
  let deferred0_0;
2817
2825
  let deferred0_1;
2818
2826
  try {
@@ -2824,32 +2832,32 @@ module.exports.__wbg_sendnewversionalert_75337b4f4d4963bc = function(arg0, arg1,
2824
2832
  }
2825
2833
  };
2826
2834
 
2827
- module.exports.__wbg_sendblockfetchstatusevent_88042b60d97e121b = function(arg0) {
2835
+ module.exports.__wbg_sendblockfetchstatusevent_c4501c23877de83e = function(arg0) {
2828
2836
  MsgHandler.send_block_fetch_status_event(BigInt.asUintN(64, arg0));
2829
2837
  };
2830
2838
 
2831
- module.exports.__wbg_savewallet_03c1a613203972ea = function() {
2839
+ module.exports.__wbg_savewallet_74dbf7500d189f85 = function() {
2832
2840
  MsgHandler.save_wallet();
2833
2841
  };
2834
2842
 
2835
- module.exports.__wbg_loadwallet_7fa67f74fb8ed52d = function() {
2843
+ module.exports.__wbg_loadwallet_233127d53a5cfb10 = function() {
2836
2844
  MsgHandler.load_wallet();
2837
2845
  };
2838
2846
 
2839
- module.exports.__wbg_getmyservices_07a6e1837cf0723a = function() {
2847
+ module.exports.__wbg_getmyservices_1e26bd90a0f96aa9 = function() {
2840
2848
  const ret = MsgHandler.get_my_services();
2841
2849
  _assertClass(ret, WasmPeerServiceList);
2842
2850
  var ptr1 = ret.__destroy_into_raw();
2843
2851
  return ptr1;
2844
2852
  };
2845
2853
 
2846
- module.exports.__wbg_wasmpeerservice_new = function(arg0) {
2847
- const ret = WasmPeerService.__wrap(arg0);
2854
+ module.exports.__wbg_wasmhop_new = function(arg0) {
2855
+ const ret = WasmHop.__wrap(arg0);
2848
2856
  return addHeapObject(ret);
2849
2857
  };
2850
2858
 
2851
- module.exports.__wbindgen_error_new = function(arg0, arg1) {
2852
- const ret = new Error(getStringFromWasm0(arg0, arg1));
2859
+ module.exports.__wbg_wasmpeerservice_new = function(arg0) {
2860
+ const ret = WasmPeerService.__wrap(arg0);
2853
2861
  return addHeapObject(ret);
2854
2862
  };
2855
2863
 
@@ -3121,7 +3129,7 @@ module.exports.__wbg_new_81740750da40724f = function(arg0, arg1) {
3121
3129
  const a = state0.a;
3122
3130
  state0.a = 0;
3123
3131
  try {
3124
- return __wbg_adapter_419(a, state0.b, arg0, arg1);
3132
+ return __wbg_adapter_420(a, state0.b, arg0, arg1);
3125
3133
  } finally {
3126
3134
  state0.a = a;
3127
3135
  }
@@ -3220,7 +3228,7 @@ module.exports.__wbindgen_memory = function() {
3220
3228
  };
3221
3229
 
3222
3230
  module.exports.__wbindgen_closure_wrapper1367 = function(arg0, arg1, arg2) {
3223
- const ret = makeMutClosure(arg0, arg1, 486, __wbg_adapter_38);
3231
+ const ret = makeMutClosure(arg0, arg1, 489, __wbg_adapter_38);
3224
3232
  return addHeapObject(ret);
3225
3233
  };
3226
3234
 
Binary file