saito-wasm 0.2.37 → 0.2.38

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.37"
3
+ version = "0.2.38"
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.37",
3
+ "version": "0.2.38",
4
4
  "description": "js wrappings around saito-core using wasm",
5
5
  "scripts": {
6
6
  "test": "./node_modules/.bin/jest",
@@ -35,9 +35,10 @@ export function get_latest_block_hash(): Promise<string>;
35
35
  export function get_block(block_hash: string): Promise<WasmBlock>;
36
36
  /**
37
37
  * @param {bigint} peer_index
38
+ * @param {string} ip
38
39
  * @returns {Promise<void>}
39
40
  */
40
- export function process_new_peer(peer_index: bigint): Promise<void>;
41
+ export function process_new_peer(peer_index: bigint, ip: string): Promise<void>;
41
42
  /**
42
43
  * @param {bigint} peer_index
43
44
  * @param {string} public_key
package/pkg/node/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  let imports = {};
2
2
  imports['__wbindgen_placeholder__'] = module.exports;
3
3
  let wasm;
4
- const { MsgHandler } = require(String.raw`./snippets/saito-wasm-bfaae508e27fc0a7/js/msg_handler.js`);
4
+ const { MsgHandler } = require(String.raw`./snippets/saito-wasm-3bafae0815ebbf59/js/msg_handler.js`);
5
5
  const { TextDecoder, TextEncoder } = require(`util`);
6
6
 
7
7
  const heap = new Array(128).fill(undefined);
@@ -24,6 +24,15 @@ function takeObject(idx) {
24
24
  return ret;
25
25
  }
26
26
 
27
+ function addHeapObject(obj) {
28
+ if (heap_next === heap.length) heap.push(heap.length + 1);
29
+ const idx = heap_next;
30
+ heap_next = heap[idx];
31
+
32
+ heap[idx] = obj;
33
+ return idx;
34
+ }
35
+
27
36
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
28
37
 
29
38
  cachedTextDecoder.decode();
@@ -42,15 +51,6 @@ function getStringFromWasm0(ptr, len) {
42
51
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
43
52
  }
44
53
 
45
- function addHeapObject(obj) {
46
- if (heap_next === heap.length) heap.push(heap.length + 1);
47
- const idx = heap_next;
48
- heap_next = heap[idx];
49
-
50
- heap[idx] = obj;
51
- return idx;
52
- }
53
-
54
54
  let WASM_VECTOR_LEN = 0;
55
55
 
56
56
  let cachedTextEncoder = new TextEncoder('utf-8');
@@ -225,15 +225,9 @@ function makeMutClosure(arg0, arg1, dtor, f) {
225
225
  return real;
226
226
  }
227
227
  function __wbg_adapter_38(arg0, arg1, arg2) {
228
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha18c4469c8531320(arg0, arg1, addHeapObject(arg2));
228
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hff8f949cfc01b93d(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
231
  /**
238
232
  * @param {string} json
239
233
  * @param {string} private_key
@@ -289,10 +283,11 @@ module.exports.get_block = function(block_hash) {
289
283
 
290
284
  /**
291
285
  * @param {bigint} peer_index
286
+ * @param {string} ip
292
287
  * @returns {Promise<void>}
293
288
  */
294
- module.exports.process_new_peer = function(peer_index) {
295
- const ret = wasm.process_new_peer(peer_index);
289
+ module.exports.process_new_peer = function(peer_index, ip) {
290
+ const ret = wasm.process_new_peer(peer_index, addHeapObject(ip));
296
291
  return takeObject(ret);
297
292
  };
298
293
 
@@ -459,6 +454,12 @@ module.exports.get_balance_snapshot = function(keys) {
459
454
  return takeObject(ret);
460
455
  };
461
456
 
457
+ function _assertClass(instance, klass) {
458
+ if (!(instance instanceof klass)) {
459
+ throw new Error(`expected instance of ${klass.name}`);
460
+ }
461
+ return instance.ptr;
462
+ }
462
463
  /**
463
464
  * @param {WasmBalanceSnapshot} snapshot
464
465
  * @returns {Promise<void>}
@@ -626,7 +627,7 @@ function handleError(f, args) {
626
627
  }
627
628
  }
628
629
  function __wbg_adapter_413(arg0, arg1, arg2, arg3) {
629
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h2c2d2984a3f304e5(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
630
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__hb9084490229a77bd(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
630
631
  }
631
632
 
632
633
  const SaitoWasmFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -2407,33 +2408,37 @@ class WasmWalletSlip {
2407
2408
  }
2408
2409
  module.exports.WasmWalletSlip = WasmWalletSlip;
2409
2410
 
2410
- module.exports.__wbindgen_object_drop_ref = function(arg0) {
2411
- takeObject(arg0);
2411
+ module.exports.__wbg_wasmtransaction_new = function(arg0) {
2412
+ const ret = WasmTransaction.__wrap(arg0);
2413
+ return addHeapObject(ret);
2412
2414
  };
2413
2415
 
2414
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
2415
- const ret = getStringFromWasm0(arg0, arg1);
2416
- return addHeapObject(ret);
2416
+ module.exports.__wbindgen_object_drop_ref = function(arg0) {
2417
+ takeObject(arg0);
2417
2418
  };
2418
2419
 
2419
- module.exports.__wbg_wasmblock_new = function(arg0) {
2420
- const ret = WasmBlock.__wrap(arg0);
2420
+ module.exports.__wbindgen_bigint_from_u64 = function(arg0) {
2421
+ const ret = BigInt.asUintN(64, arg0);
2421
2422
  return addHeapObject(ret);
2422
2423
  };
2423
2424
 
2424
- module.exports.__wbg_wasmpeer_new = function(arg0) {
2425
- const ret = WasmPeer.__wrap(arg0);
2425
+ module.exports.__wbg_wasmwalletslip_new = function(arg0) {
2426
+ const ret = WasmWalletSlip.__wrap(arg0);
2426
2427
  return addHeapObject(ret);
2427
2428
  };
2428
2429
 
2429
- module.exports.__wbg_wasmtransaction_new = function(arg0) {
2430
- const ret = WasmTransaction.__wrap(arg0);
2430
+ module.exports.__wbindgen_string_new = function(arg0, arg1) {
2431
+ const ret = getStringFromWasm0(arg0, arg1);
2431
2432
  return addHeapObject(ret);
2432
2433
  };
2433
2434
 
2434
- module.exports.__wbg_wasmwalletslip_new = function(arg0) {
2435
- const ret = WasmWalletSlip.__wrap(arg0);
2436
- return addHeapObject(ret);
2435
+ module.exports.__wbindgen_string_get = function(arg0, arg1) {
2436
+ const obj = getObject(arg1);
2437
+ const ret = typeof(obj) === 'string' ? obj : undefined;
2438
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2439
+ var len1 = WASM_VECTOR_LEN;
2440
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
2441
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2437
2442
  };
2438
2443
 
2439
2444
  module.exports.__wbg_wasmwallet_new = function(arg0) {
@@ -2441,13 +2446,13 @@ module.exports.__wbg_wasmwallet_new = function(arg0) {
2441
2446
  return addHeapObject(ret);
2442
2447
  };
2443
2448
 
2444
- module.exports.__wbg_wasmslip_new = function(arg0) {
2445
- const ret = WasmSlip.__wrap(arg0);
2449
+ module.exports.__wbg_wasmbalancesnapshot_new = function(arg0) {
2450
+ const ret = WasmBalanceSnapshot.__wrap(arg0);
2446
2451
  return addHeapObject(ret);
2447
2452
  };
2448
2453
 
2449
- module.exports.__wbindgen_bigint_from_u64 = function(arg0) {
2450
- const ret = BigInt.asUintN(64, arg0);
2454
+ module.exports.__wbg_wasmpeer_new = function(arg0) {
2455
+ const ret = WasmPeer.__wrap(arg0);
2451
2456
  return addHeapObject(ret);
2452
2457
  };
2453
2458
 
@@ -2456,27 +2461,13 @@ module.exports.__wbg_wasmblockchain_new = function(arg0) {
2456
2461
  return addHeapObject(ret);
2457
2462
  };
2458
2463
 
2459
- module.exports.__wbg_wasmbalancesnapshot_new = function(arg0) {
2460
- const ret = WasmBalanceSnapshot.__wrap(arg0);
2461
- return addHeapObject(ret);
2462
- };
2463
-
2464
- module.exports.__wbg_wasmhop_new = function(arg0) {
2465
- const ret = WasmHop.__wrap(arg0);
2464
+ module.exports.__wbg_wasmblock_new = function(arg0) {
2465
+ const ret = WasmBlock.__wrap(arg0);
2466
2466
  return addHeapObject(ret);
2467
2467
  };
2468
2468
 
2469
- module.exports.__wbindgen_string_get = function(arg0, arg1) {
2470
- const obj = getObject(arg1);
2471
- const ret = typeof(obj) === 'string' ? obj : undefined;
2472
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2473
- var len1 = WASM_VECTOR_LEN;
2474
- getInt32Memory0()[arg0 / 4 + 1] = len1;
2475
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2476
- };
2477
-
2478
- module.exports.__wbg_wasmconsensusvalues_new = function(arg0) {
2479
- const ret = WasmConsensusValues.__wrap(arg0);
2469
+ module.exports.__wbg_wasmslip_new = function(arg0) {
2470
+ const ret = WasmSlip.__wrap(arg0);
2480
2471
  return addHeapObject(ret);
2481
2472
  };
2482
2473
 
@@ -2485,8 +2476,8 @@ module.exports.__wbindgen_error_new = function(arg0, arg1) {
2485
2476
  return addHeapObject(ret);
2486
2477
  };
2487
2478
 
2488
- module.exports.__wbg_wasmpeerservice_new = function(arg0) {
2489
- const ret = WasmPeerService.__wrap(arg0);
2479
+ module.exports.__wbg_wasmhop_new = function(arg0) {
2480
+ const ret = WasmHop.__wrap(arg0);
2490
2481
  return addHeapObject(ret);
2491
2482
  };
2492
2483
 
@@ -2506,15 +2497,25 @@ module.exports.__wbindgen_in = function(arg0, arg1) {
2506
2497
  return ret;
2507
2498
  };
2508
2499
 
2509
- module.exports.__wbg_sendmessage_f2603c9d4ea2253e = function(arg0, arg1) {
2500
+ module.exports.__wbg_wasmconsensusvalues_new = function(arg0) {
2501
+ const ret = WasmConsensusValues.__wrap(arg0);
2502
+ return addHeapObject(ret);
2503
+ };
2504
+
2505
+ module.exports.__wbg_wasmpeerservice_new = function(arg0) {
2506
+ const ret = WasmPeerService.__wrap(arg0);
2507
+ return addHeapObject(ret);
2508
+ };
2509
+
2510
+ module.exports.__wbg_sendmessage_01a0fb29ee4e0fdf = function(arg0, arg1) {
2510
2511
  MsgHandler.send_message(takeObject(arg0), getObject(arg1));
2511
2512
  };
2512
2513
 
2513
- module.exports.__wbg_sendmessagetoall_4571eed8e09a1bbf = function(arg0, arg1) {
2514
+ module.exports.__wbg_sendmessagetoall_2d909ce06d9b5627 = function(arg0, arg1) {
2514
2515
  MsgHandler.send_message_to_all(getObject(arg0), getObject(arg1));
2515
2516
  };
2516
2517
 
2517
- module.exports.__wbg_connecttopeer_9933a840535386f6 = function() { return handleError(function (arg0, arg1, arg2) {
2518
+ module.exports.__wbg_connecttopeer_3d068449af276244 = function() { return handleError(function (arg0, arg1, arg2) {
2518
2519
  let deferred0_0;
2519
2520
  let deferred0_1;
2520
2521
  try {
@@ -2527,12 +2528,12 @@ module.exports.__wbg_connecttopeer_9933a840535386f6 = function() { return handle
2527
2528
  }
2528
2529
  }, arguments) };
2529
2530
 
2530
- module.exports.__wbg_disconnectfrompeer_54dfa860f91b8589 = function() { return handleError(function (arg0) {
2531
+ module.exports.__wbg_disconnectfrompeer_e14fc04db54b4e1b = function() { return handleError(function (arg0) {
2531
2532
  const ret = MsgHandler.disconnect_from_peer(takeObject(arg0));
2532
2533
  return addHeapObject(ret);
2533
2534
  }, arguments) };
2534
2535
 
2535
- module.exports.__wbg_fetchblockfrompeer_29e028e229b841d2 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2536
+ module.exports.__wbg_fetchblockfrompeer_85d6a96cb0019bff = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2536
2537
  let deferred0_0;
2537
2538
  let deferred0_1;
2538
2539
  try {
@@ -2545,7 +2546,7 @@ module.exports.__wbg_fetchblockfrompeer_29e028e229b841d2 = function() { return h
2545
2546
  }
2546
2547
  }, arguments) };
2547
2548
 
2548
- module.exports.__wbg_writevalue_342ce4ac6bdcd855 = function(arg0, arg1, arg2) {
2549
+ module.exports.__wbg_writevalue_e089e6144beb0065 = function(arg0, arg1, arg2) {
2549
2550
  let deferred0_0;
2550
2551
  let deferred0_1;
2551
2552
  try {
@@ -2557,7 +2558,7 @@ module.exports.__wbg_writevalue_342ce4ac6bdcd855 = function(arg0, arg1, arg2) {
2557
2558
  }
2558
2559
  };
2559
2560
 
2560
- module.exports.__wbg_appendvalue_c5fe88bac9d1b3db = function(arg0, arg1, arg2) {
2561
+ module.exports.__wbg_appendvalue_cc4381d5777004cd = function(arg0, arg1, arg2) {
2561
2562
  let deferred0_0;
2562
2563
  let deferred0_1;
2563
2564
  try {
@@ -2569,7 +2570,7 @@ module.exports.__wbg_appendvalue_c5fe88bac9d1b3db = function(arg0, arg1, arg2) {
2569
2570
  }
2570
2571
  };
2571
2572
 
2572
- module.exports.__wbg_flushdata_cd03f17297474ffa = function(arg0, arg1) {
2573
+ module.exports.__wbg_flushdata_10f27e0477ecf68c = function(arg0, arg1) {
2573
2574
  let deferred0_0;
2574
2575
  let deferred0_1;
2575
2576
  try {
@@ -2581,7 +2582,7 @@ module.exports.__wbg_flushdata_cd03f17297474ffa = function(arg0, arg1) {
2581
2582
  }
2582
2583
  };
2583
2584
 
2584
- module.exports.__wbg_readvalue_00f341229dd21a6b = function() { return handleError(function (arg0, arg1) {
2585
+ module.exports.__wbg_readvalue_fe1ec638259055e9 = function() { return handleError(function (arg0, arg1) {
2585
2586
  let deferred0_0;
2586
2587
  let deferred0_1;
2587
2588
  try {
@@ -2594,12 +2595,12 @@ module.exports.__wbg_readvalue_00f341229dd21a6b = function() { return handleErro
2594
2595
  }
2595
2596
  }, arguments) };
2596
2597
 
2597
- module.exports.__wbg_loadblockfilelist_3474c36914debf2d = function() { return handleError(function () {
2598
+ module.exports.__wbg_loadblockfilelist_d4763cedb8ae3717 = function() { return handleError(function () {
2598
2599
  const ret = MsgHandler.load_block_file_list();
2599
2600
  return addHeapObject(ret);
2600
2601
  }, arguments) };
2601
2602
 
2602
- module.exports.__wbg_isexistingfile_ec4947f2b3ed5ba4 = function() { return handleError(function (arg0, arg1) {
2603
+ module.exports.__wbg_isexistingfile_b131ec06042caad5 = function() { return handleError(function (arg0, arg1) {
2603
2604
  let deferred0_0;
2604
2605
  let deferred0_1;
2605
2606
  try {
@@ -2612,7 +2613,7 @@ module.exports.__wbg_isexistingfile_ec4947f2b3ed5ba4 = function() { return handl
2612
2613
  }
2613
2614
  }, arguments) };
2614
2615
 
2615
- module.exports.__wbg_removevalue_65a3ec050b0de31a = function() { return handleError(function (arg0, arg1) {
2616
+ module.exports.__wbg_removevalue_fb2922ec60aa1d40 = function() { return handleError(function (arg0, arg1) {
2616
2617
  let deferred0_0;
2617
2618
  let deferred0_1;
2618
2619
  try {
@@ -2625,7 +2626,7 @@ module.exports.__wbg_removevalue_65a3ec050b0de31a = function() { return handleEr
2625
2626
  }
2626
2627
  }, arguments) };
2627
2628
 
2628
- module.exports.__wbg_ensureblockdirectoryexists_8f88dda39ce680e9 = function() { return handleError(function (arg0, arg1) {
2629
+ module.exports.__wbg_ensureblockdirectoryexists_38597ad2222d7055 = function() { return handleError(function (arg0, arg1) {
2629
2630
  let deferred0_0;
2630
2631
  let deferred0_1;
2631
2632
  try {
@@ -2637,19 +2638,19 @@ module.exports.__wbg_ensureblockdirectoryexists_8f88dda39ce680e9 = function() {
2637
2638
  }
2638
2639
  }, arguments) };
2639
2640
 
2640
- module.exports.__wbg_processapicall_e7027967095af57b = function(arg0, arg1, arg2) {
2641
+ module.exports.__wbg_processapicall_82ace9a385ba4205 = function(arg0, arg1, arg2) {
2641
2642
  MsgHandler.process_api_call(takeObject(arg0), arg1 >>> 0, takeObject(arg2));
2642
2643
  };
2643
2644
 
2644
- module.exports.__wbg_processapisuccess_d8ff9f709ac66cac = function(arg0, arg1, arg2) {
2645
+ module.exports.__wbg_processapisuccess_cc91e58b52af8dae = function(arg0, arg1, arg2) {
2645
2646
  MsgHandler.process_api_success(takeObject(arg0), arg1 >>> 0, takeObject(arg2));
2646
2647
  };
2647
2648
 
2648
- module.exports.__wbg_processapierror_f9b8174f2c0e36d1 = function(arg0, arg1, arg2) {
2649
+ module.exports.__wbg_processapierror_d90d19eb5da8f53e = function(arg0, arg1, arg2) {
2649
2650
  MsgHandler.process_api_error(takeObject(arg0), arg1 >>> 0, takeObject(arg2));
2650
2651
  };
2651
2652
 
2652
- module.exports.__wbg_sendinterfaceevent_00984e6a741c6508 = function(arg0, arg1, arg2, arg3, arg4) {
2653
+ module.exports.__wbg_sendinterfaceevent_4009ebbb39823d19 = function(arg0, arg1, arg2, arg3, arg4) {
2653
2654
  let deferred0_0;
2654
2655
  let deferred0_1;
2655
2656
  let deferred1_0;
@@ -2666,7 +2667,7 @@ module.exports.__wbg_sendinterfaceevent_00984e6a741c6508 = function(arg0, arg1,
2666
2667
  }
2667
2668
  };
2668
2669
 
2669
- module.exports.__wbg_sendblocksuccess_78b0ae88e349e9bd = function(arg0, arg1, arg2) {
2670
+ module.exports.__wbg_sendblocksuccess_117da218011c62ae = function(arg0, arg1, arg2) {
2670
2671
  let deferred0_0;
2671
2672
  let deferred0_1;
2672
2673
  try {
@@ -2678,11 +2679,11 @@ module.exports.__wbg_sendblocksuccess_78b0ae88e349e9bd = function(arg0, arg1, ar
2678
2679
  }
2679
2680
  };
2680
2681
 
2681
- module.exports.__wbg_sendwalletupdate_00c66cede0ee906c = function() {
2682
+ module.exports.__wbg_sendwalletupdate_c1921b99a69a0b7a = function() {
2682
2683
  MsgHandler.send_wallet_update();
2683
2684
  };
2684
2685
 
2685
- module.exports.__wbg_sendnewversionalert_e0bc5ea9d42468f9 = function(arg0, arg1, arg2) {
2686
+ module.exports.__wbg_sendnewversionalert_ab631524d6663883 = function(arg0, arg1, arg2) {
2686
2687
  let deferred0_0;
2687
2688
  let deferred0_1;
2688
2689
  try {
@@ -2694,19 +2695,19 @@ module.exports.__wbg_sendnewversionalert_e0bc5ea9d42468f9 = function(arg0, arg1,
2694
2695
  }
2695
2696
  };
2696
2697
 
2697
- module.exports.__wbg_sendblockfetchstatusevent_d53e7ad666287006 = function(arg0) {
2698
+ module.exports.__wbg_sendblockfetchstatusevent_31d6fbc902ded423 = function(arg0) {
2698
2699
  MsgHandler.send_block_fetch_status_event(BigInt.asUintN(64, arg0));
2699
2700
  };
2700
2701
 
2701
- module.exports.__wbg_savewallet_e2871acf59b663e0 = function() {
2702
+ module.exports.__wbg_savewallet_34f4e0b94b979d2d = function() {
2702
2703
  MsgHandler.save_wallet();
2703
2704
  };
2704
2705
 
2705
- module.exports.__wbg_loadwallet_cb5f9cb8049efd42 = function() {
2706
+ module.exports.__wbg_loadwallet_19b3646f649b28ee = function() {
2706
2707
  MsgHandler.load_wallet();
2707
2708
  };
2708
2709
 
2709
- module.exports.__wbg_getmyservices_1fa819c247e35990 = function() {
2710
+ module.exports.__wbg_getmyservices_bebad1b483c4a0d6 = function() {
2710
2711
  const ret = MsgHandler.get_my_services();
2711
2712
  _assertClass(ret, WasmPeerServiceList);
2712
2713
  var ptr1 = ret.__destroy_into_raw();
@@ -3083,8 +3084,8 @@ module.exports.__wbindgen_memory = function() {
3083
3084
  return addHeapObject(ret);
3084
3085
  };
3085
3086
 
3086
- module.exports.__wbindgen_closure_wrapper1371 = function(arg0, arg1, arg2) {
3087
- const ret = makeMutClosure(arg0, arg1, 489, __wbg_adapter_38);
3087
+ module.exports.__wbindgen_closure_wrapper1400 = function(arg0, arg1, arg2) {
3088
+ const ret = makeMutClosure(arg0, arg1, 491, __wbg_adapter_38);
3088
3089
  return addHeapObject(ret);
3089
3090
  };
3090
3091
 
Binary file