saito-wasm 0.2.75 → 0.2.77

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.75"
3
+ version = "0.2.77"
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.75",
3
+ "version": "0.2.77",
4
4
  "description": "js wrappings around saito-core using wasm",
5
5
  "scripts": {
6
6
  "test": "./node_modules/.bin/jest",
@@ -5,9 +5,10 @@
5
5
  * @param {string} private_key
6
6
  * @param {number} log_level_num
7
7
  * @param {bigint} hasten_multiplier
8
+ * @param {boolean} delete_old_blocks
8
9
  * @returns {Promise<any>}
9
10
  */
10
- export function initialize(json: string, private_key: string, log_level_num: number, hasten_multiplier: bigint): Promise<any>;
11
+ export function initialize(json: string, private_key: string, log_level_num: number, hasten_multiplier: bigint, delete_old_blocks: boolean): Promise<any>;
11
12
  /**
12
13
  * @param {string} public_key
13
14
  * @param {bigint} amount
package/pkg/node/index.js CHANGED
@@ -1,32 +1,28 @@
1
1
  let imports = {};
2
2
  imports['__wbindgen_placeholder__'] = module.exports;
3
3
  let wasm;
4
- const { MsgHandler } = require(String.raw`./snippets/saito-wasm-0e723ae7610f53a0/js/msg_handler.js`);
4
+ const { MsgHandler } = require(String.raw`./snippets/saito-wasm-546a99cbdca04c57/js/msg_handler.js`);
5
5
  const { TextDecoder, TextEncoder } = require(`util`);
6
6
 
7
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
7
+ const heap = new Array(128).fill(undefined);
8
8
 
9
- cachedTextDecoder.decode();
9
+ heap.push(undefined, null, true, false);
10
10
 
11
- let cachedUint8Memory0 = null;
11
+ function getObject(idx) { return heap[idx]; }
12
12
 
13
- function getUint8Memory0() {
14
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
15
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
16
- }
17
- return cachedUint8Memory0;
18
- }
13
+ let heap_next = heap.length;
19
14
 
20
- function getStringFromWasm0(ptr, len) {
21
- ptr = ptr >>> 0;
22
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
15
+ function dropObject(idx) {
16
+ if (idx < 132) return;
17
+ heap[idx] = heap_next;
18
+ heap_next = idx;
23
19
  }
24
20
 
25
- const heap = new Array(128).fill(undefined);
26
-
27
- heap.push(undefined, null, true, false);
28
-
29
- let heap_next = heap.length;
21
+ function takeObject(idx) {
22
+ const ret = getObject(idx);
23
+ dropObject(idx);
24
+ return ret;
25
+ }
30
26
 
31
27
  function addHeapObject(obj) {
32
28
  if (heap_next === heap.length) heap.push(heap.length + 1);
@@ -37,18 +33,22 @@ function addHeapObject(obj) {
37
33
  return idx;
38
34
  }
39
35
 
40
- function getObject(idx) { return heap[idx]; }
36
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
41
37
 
42
- function dropObject(idx) {
43
- if (idx < 132) return;
44
- heap[idx] = heap_next;
45
- heap_next = idx;
38
+ cachedTextDecoder.decode();
39
+
40
+ let cachedUint8Memory0 = null;
41
+
42
+ function getUint8Memory0() {
43
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
44
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
45
+ }
46
+ return cachedUint8Memory0;
46
47
  }
47
48
 
48
- function takeObject(idx) {
49
- const ret = getObject(idx);
50
- dropObject(idx);
51
- return ret;
49
+ function getStringFromWasm0(ptr, len) {
50
+ ptr = ptr >>> 0;
51
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
52
52
  }
53
53
 
54
54
  let WASM_VECTOR_LEN = 0;
@@ -247,10 +247,11 @@ function handleError(f, args) {
247
247
  * @param {string} private_key
248
248
  * @param {number} log_level_num
249
249
  * @param {bigint} hasten_multiplier
250
+ * @param {boolean} delete_old_blocks
250
251
  * @returns {Promise<any>}
251
252
  */
252
- module.exports.initialize = function(json, private_key, log_level_num, hasten_multiplier) {
253
- const ret = wasm.initialize(addHeapObject(json), addHeapObject(private_key), log_level_num, hasten_multiplier);
253
+ module.exports.initialize = function(json, private_key, log_level_num, hasten_multiplier, delete_old_blocks) {
254
+ const ret = wasm.initialize(addHeapObject(json), addHeapObject(private_key), log_level_num, hasten_multiplier, delete_old_blocks);
254
255
  return takeObject(ret);
255
256
  };
256
257
 
@@ -2352,22 +2353,12 @@ class WasmWalletSlip {
2352
2353
  }
2353
2354
  module.exports.WasmWalletSlip = WasmWalletSlip;
2354
2355
 
2355
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
2356
- const ret = getStringFromWasm0(arg0, arg1);
2357
- return addHeapObject(ret);
2358
- };
2359
-
2360
2356
  module.exports.__wbindgen_object_drop_ref = function(arg0) {
2361
2357
  takeObject(arg0);
2362
2358
  };
2363
2359
 
2364
- module.exports.__wbindgen_bigint_from_u64 = function(arg0) {
2365
- const ret = BigInt.asUintN(64, arg0);
2366
- return addHeapObject(ret);
2367
- };
2368
-
2369
- module.exports.__wbg_wasmtransaction_new = function(arg0) {
2370
- const ret = WasmTransaction.__wrap(arg0);
2360
+ module.exports.__wbg_wasmblockchain_new = function(arg0) {
2361
+ const ret = WasmBlockchain.__wrap(arg0);
2371
2362
  return addHeapObject(ret);
2372
2363
  };
2373
2364
 
@@ -2376,13 +2367,13 @@ module.exports.__wbg_wasmwallet_new = function(arg0) {
2376
2367
  return addHeapObject(ret);
2377
2368
  };
2378
2369
 
2379
- module.exports.__wbg_wasmpeer_new = function(arg0) {
2380
- const ret = WasmPeer.__wrap(arg0);
2370
+ module.exports.__wbindgen_bigint_from_u64 = function(arg0) {
2371
+ const ret = BigInt.asUintN(64, arg0);
2381
2372
  return addHeapObject(ret);
2382
2373
  };
2383
2374
 
2384
- module.exports.__wbg_wasmslip_new = function(arg0) {
2385
- const ret = WasmSlip.__wrap(arg0);
2375
+ module.exports.__wbindgen_string_new = function(arg0, arg1) {
2376
+ const ret = getStringFromWasm0(arg0, arg1);
2386
2377
  return addHeapObject(ret);
2387
2378
  };
2388
2379
 
@@ -2391,13 +2382,13 @@ module.exports.__wbg_wasmblock_new = function(arg0) {
2391
2382
  return addHeapObject(ret);
2392
2383
  };
2393
2384
 
2394
- module.exports.__wbg_wasmblockchain_new = function(arg0) {
2395
- const ret = WasmBlockchain.__wrap(arg0);
2385
+ module.exports.__wbg_wasmwalletslip_new = function(arg0) {
2386
+ const ret = WasmWalletSlip.__wrap(arg0);
2396
2387
  return addHeapObject(ret);
2397
2388
  };
2398
2389
 
2399
- module.exports.__wbg_wasmwalletslip_new = function(arg0) {
2400
- const ret = WasmWalletSlip.__wrap(arg0);
2390
+ module.exports.__wbg_wasmpeer_new = function(arg0) {
2391
+ const ret = WasmPeer.__wrap(arg0);
2401
2392
  return addHeapObject(ret);
2402
2393
  };
2403
2394
 
@@ -2410,23 +2401,23 @@ module.exports.__wbindgen_string_get = function(arg0, arg1) {
2410
2401
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2411
2402
  };
2412
2403
 
2413
- module.exports.__wbg_wasmbalancesnapshot_new = function(arg0) {
2414
- const ret = WasmBalanceSnapshot.__wrap(arg0);
2404
+ module.exports.__wbg_wasmtransaction_new = function(arg0) {
2405
+ const ret = WasmTransaction.__wrap(arg0);
2415
2406
  return addHeapObject(ret);
2416
2407
  };
2417
2408
 
2418
- module.exports.__wbindgen_error_new = function(arg0, arg1) {
2419
- const ret = new Error(getStringFromWasm0(arg0, arg1));
2409
+ module.exports.__wbg_wasmslip_new = function(arg0) {
2410
+ const ret = WasmSlip.__wrap(arg0);
2420
2411
  return addHeapObject(ret);
2421
2412
  };
2422
2413
 
2423
- module.exports.__wbg_wasmhop_new = function(arg0) {
2424
- const ret = WasmHop.__wrap(arg0);
2414
+ module.exports.__wbg_wasmbalancesnapshot_new = function(arg0) {
2415
+ const ret = WasmBalanceSnapshot.__wrap(arg0);
2425
2416
  return addHeapObject(ret);
2426
2417
  };
2427
2418
 
2428
- module.exports.__wbg_wasmpeerservice_new = function(arg0) {
2429
- const ret = WasmPeerService.__wrap(arg0);
2419
+ module.exports.__wbindgen_error_new = function(arg0, arg1) {
2420
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
2430
2421
  return addHeapObject(ret);
2431
2422
  };
2432
2423
 
@@ -2446,15 +2437,15 @@ module.exports.__wbindgen_in = function(arg0, arg1) {
2446
2437
  return ret;
2447
2438
  };
2448
2439
 
2449
- module.exports.__wbg_sendmessage_12f10ca4a606a37d = function(arg0, arg1) {
2440
+ module.exports.__wbg_sendmessage_91e78cbd21582eab = function(arg0, arg1) {
2450
2441
  MsgHandler.send_message(takeObject(arg0), getObject(arg1));
2451
2442
  };
2452
2443
 
2453
- module.exports.__wbg_sendmessagetoall_7be952f451cfb1af = function(arg0, arg1) {
2444
+ module.exports.__wbg_sendmessagetoall_8aa797c88b23b10f = function(arg0, arg1) {
2454
2445
  MsgHandler.send_message_to_all(getObject(arg0), getObject(arg1));
2455
2446
  };
2456
2447
 
2457
- module.exports.__wbg_connecttopeer_9ae92a6e46a9795d = function() { return handleError(function (arg0, arg1, arg2) {
2448
+ module.exports.__wbg_connecttopeer_c6f6e9cf91ca7c9f = function() { return handleError(function (arg0, arg1, arg2) {
2458
2449
  let deferred0_0;
2459
2450
  let deferred0_1;
2460
2451
  try {
@@ -2467,12 +2458,12 @@ module.exports.__wbg_connecttopeer_9ae92a6e46a9795d = function() { return handle
2467
2458
  }
2468
2459
  }, arguments) };
2469
2460
 
2470
- module.exports.__wbg_disconnectfrompeer_6ab6e62455c78090 = function() { return handleError(function (arg0) {
2461
+ module.exports.__wbg_disconnectfrompeer_1646cf039dd307fc = function() { return handleError(function (arg0) {
2471
2462
  const ret = MsgHandler.disconnect_from_peer(takeObject(arg0));
2472
2463
  return addHeapObject(ret);
2473
2464
  }, arguments) };
2474
2465
 
2475
- module.exports.__wbg_fetchblockfrompeer_78dea779fd556bfc = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2466
+ module.exports.__wbg_fetchblockfrompeer_fc057440cab45649 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2476
2467
  let deferred0_0;
2477
2468
  let deferred0_1;
2478
2469
  try {
@@ -2485,7 +2476,7 @@ module.exports.__wbg_fetchblockfrompeer_78dea779fd556bfc = function() { return h
2485
2476
  }
2486
2477
  }, arguments) };
2487
2478
 
2488
- module.exports.__wbg_writevalue_9b909fd9eaeb97fb = function(arg0, arg1, arg2) {
2479
+ module.exports.__wbg_writevalue_6df3c67b4b8b7b9b = function(arg0, arg1, arg2) {
2489
2480
  let deferred0_0;
2490
2481
  let deferred0_1;
2491
2482
  try {
@@ -2497,7 +2488,7 @@ module.exports.__wbg_writevalue_9b909fd9eaeb97fb = function(arg0, arg1, arg2) {
2497
2488
  }
2498
2489
  };
2499
2490
 
2500
- module.exports.__wbg_appendvalue_4ab3f1860013a348 = function(arg0, arg1, arg2) {
2491
+ module.exports.__wbg_appendvalue_ce52a3290c71a50c = function(arg0, arg1, arg2) {
2501
2492
  let deferred0_0;
2502
2493
  let deferred0_1;
2503
2494
  try {
@@ -2509,7 +2500,7 @@ module.exports.__wbg_appendvalue_4ab3f1860013a348 = function(arg0, arg1, arg2) {
2509
2500
  }
2510
2501
  };
2511
2502
 
2512
- module.exports.__wbg_flushdata_e44f38756cc00016 = function(arg0, arg1) {
2503
+ module.exports.__wbg_flushdata_12d393e978a999ce = function(arg0, arg1) {
2513
2504
  let deferred0_0;
2514
2505
  let deferred0_1;
2515
2506
  try {
@@ -2521,7 +2512,7 @@ module.exports.__wbg_flushdata_e44f38756cc00016 = function(arg0, arg1) {
2521
2512
  }
2522
2513
  };
2523
2514
 
2524
- module.exports.__wbg_readvalue_a4abab67b3aff364 = function() { return handleError(function (arg0, arg1) {
2515
+ module.exports.__wbg_readvalue_e65553927937cdc5 = function() { return handleError(function (arg0, arg1) {
2525
2516
  let deferred0_0;
2526
2517
  let deferred0_1;
2527
2518
  try {
@@ -2534,12 +2525,12 @@ module.exports.__wbg_readvalue_a4abab67b3aff364 = function() { return handleErro
2534
2525
  }
2535
2526
  }, arguments) };
2536
2527
 
2537
- module.exports.__wbg_loadblockfilelist_85d9f088c9503a58 = function() { return handleError(function () {
2528
+ module.exports.__wbg_loadblockfilelist_9a1ce1435bb39160 = function() { return handleError(function () {
2538
2529
  const ret = MsgHandler.load_block_file_list();
2539
2530
  return addHeapObject(ret);
2540
2531
  }, arguments) };
2541
2532
 
2542
- module.exports.__wbg_isexistingfile_0b7d14902e6cde70 = function() { return handleError(function (arg0, arg1) {
2533
+ module.exports.__wbg_isexistingfile_478430505161a1b2 = function() { return handleError(function (arg0, arg1) {
2543
2534
  let deferred0_0;
2544
2535
  let deferred0_1;
2545
2536
  try {
@@ -2552,7 +2543,7 @@ module.exports.__wbg_isexistingfile_0b7d14902e6cde70 = function() { return handl
2552
2543
  }
2553
2544
  }, arguments) };
2554
2545
 
2555
- module.exports.__wbg_removevalue_802864b894af2e66 = function() { return handleError(function (arg0, arg1) {
2546
+ module.exports.__wbg_removevalue_024bf56f6b701113 = function() { return handleError(function (arg0, arg1) {
2556
2547
  let deferred0_0;
2557
2548
  let deferred0_1;
2558
2549
  try {
@@ -2565,7 +2556,7 @@ module.exports.__wbg_removevalue_802864b894af2e66 = function() { return handleEr
2565
2556
  }
2566
2557
  }, arguments) };
2567
2558
 
2568
- module.exports.__wbg_ensureblockdirectoryexists_0889d13d515ac1a1 = function() { return handleError(function (arg0, arg1) {
2559
+ module.exports.__wbg_ensureblockdirectoryexists_1818ca71b5c5d81a = function() { return handleError(function (arg0, arg1) {
2569
2560
  let deferred0_0;
2570
2561
  let deferred0_1;
2571
2562
  try {
@@ -2577,19 +2568,19 @@ module.exports.__wbg_ensureblockdirectoryexists_0889d13d515ac1a1 = function() {
2577
2568
  }
2578
2569
  }, arguments) };
2579
2570
 
2580
- module.exports.__wbg_processapicall_f2ec3ebc3e316354 = function(arg0, arg1, arg2) {
2571
+ module.exports.__wbg_processapicall_444766484e38805d = function(arg0, arg1, arg2) {
2581
2572
  MsgHandler.process_api_call(takeObject(arg0), arg1 >>> 0, takeObject(arg2));
2582
2573
  };
2583
2574
 
2584
- module.exports.__wbg_processapisuccess_345fc163487c70d0 = function(arg0, arg1, arg2) {
2575
+ module.exports.__wbg_processapisuccess_256ee2ce023f2b28 = function(arg0, arg1, arg2) {
2585
2576
  MsgHandler.process_api_success(takeObject(arg0), arg1 >>> 0, takeObject(arg2));
2586
2577
  };
2587
2578
 
2588
- module.exports.__wbg_processapierror_318fa93fcfd48fb3 = function(arg0, arg1, arg2) {
2579
+ module.exports.__wbg_processapierror_3747b226a46841cb = function(arg0, arg1, arg2) {
2589
2580
  MsgHandler.process_api_error(takeObject(arg0), arg1 >>> 0, takeObject(arg2));
2590
2581
  };
2591
2582
 
2592
- module.exports.__wbg_sendinterfaceevent_78bb5e94f955662c = function(arg0, arg1, arg2, arg3, arg4) {
2583
+ module.exports.__wbg_sendinterfaceevent_37ad2589b2da3da2 = function(arg0, arg1, arg2, arg3, arg4) {
2593
2584
  let deferred0_0;
2594
2585
  let deferred0_1;
2595
2586
  let deferred1_0;
@@ -2606,7 +2597,7 @@ module.exports.__wbg_sendinterfaceevent_78bb5e94f955662c = function(arg0, arg1,
2606
2597
  }
2607
2598
  };
2608
2599
 
2609
- module.exports.__wbg_sendblocksuccess_b1042c2a8caac1c9 = function(arg0, arg1, arg2) {
2600
+ module.exports.__wbg_sendblocksuccess_dce1654fe9a36478 = function(arg0, arg1, arg2) {
2610
2601
  let deferred0_0;
2611
2602
  let deferred0_1;
2612
2603
  try {
@@ -2618,11 +2609,11 @@ module.exports.__wbg_sendblocksuccess_b1042c2a8caac1c9 = function(arg0, arg1, ar
2618
2609
  }
2619
2610
  };
2620
2611
 
2621
- module.exports.__wbg_sendwalletupdate_26662b816e940308 = function() {
2612
+ module.exports.__wbg_sendwalletupdate_c946a444c7138a37 = function() {
2622
2613
  MsgHandler.send_wallet_update();
2623
2614
  };
2624
2615
 
2625
- module.exports.__wbg_sendnewversionalert_c143fff2854867f1 = function(arg0, arg1, arg2) {
2616
+ module.exports.__wbg_sendnewversionalert_212fb237295adacc = function(arg0, arg1, arg2) {
2626
2617
  let deferred0_0;
2627
2618
  let deferred0_1;
2628
2619
  try {
@@ -2634,25 +2625,35 @@ module.exports.__wbg_sendnewversionalert_c143fff2854867f1 = function(arg0, arg1,
2634
2625
  }
2635
2626
  };
2636
2627
 
2637
- module.exports.__wbg_sendblockfetchstatusevent_765e3302676fc940 = function(arg0) {
2628
+ module.exports.__wbg_sendblockfetchstatusevent_d62cf3d03f0c1ed4 = function(arg0) {
2638
2629
  MsgHandler.send_block_fetch_status_event(BigInt.asUintN(64, arg0));
2639
2630
  };
2640
2631
 
2641
- module.exports.__wbg_savewallet_87e13a98198194d4 = function() {
2632
+ module.exports.__wbg_savewallet_3b3747702486c95d = function() {
2642
2633
  MsgHandler.save_wallet();
2643
2634
  };
2644
2635
 
2645
- module.exports.__wbg_loadwallet_158b846d8bfe8793 = function() {
2636
+ module.exports.__wbg_loadwallet_682313adc62cb15d = function() {
2646
2637
  MsgHandler.load_wallet();
2647
2638
  };
2648
2639
 
2649
- module.exports.__wbg_getmyservices_56d63a37a6afbd50 = function() {
2640
+ module.exports.__wbg_getmyservices_9b8694fd15197e81 = function() {
2650
2641
  const ret = MsgHandler.get_my_services();
2651
2642
  _assertClass(ret, WasmPeerServiceList);
2652
2643
  var ptr1 = ret.__destroy_into_raw();
2653
2644
  return ptr1;
2654
2645
  };
2655
2646
 
2647
+ module.exports.__wbg_wasmpeerservice_new = function(arg0) {
2648
+ const ret = WasmPeerService.__wrap(arg0);
2649
+ return addHeapObject(ret);
2650
+ };
2651
+
2652
+ module.exports.__wbg_wasmhop_new = function(arg0) {
2653
+ const ret = WasmHop.__wrap(arg0);
2654
+ return addHeapObject(ret);
2655
+ };
2656
+
2656
2657
  module.exports.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
2657
2658
  const ret = getObject(arg0) == getObject(arg1);
2658
2659
  return ret;
@@ -3023,7 +3024,7 @@ module.exports.__wbindgen_memory = function() {
3023
3024
  return addHeapObject(ret);
3024
3025
  };
3025
3026
 
3026
- module.exports.__wbindgen_closure_wrapper1300 = function(arg0, arg1, arg2) {
3027
+ module.exports.__wbindgen_closure_wrapper1299 = function(arg0, arg1, arg2) {
3027
3028
  const ret = makeMutClosure(arg0, arg1, 460, __wbg_adapter_38);
3028
3029
  return addHeapObject(ret);
3029
3030
  };
Binary file
@@ -101,7 +101,7 @@ export function wasmpeerservice_get_domain(a: number): number;
101
101
  export function wasmpeerservicelist_push(a: number, b: number): void;
102
102
  export function wasmpeerservicelist_new(): number;
103
103
  export function __wbg_saitowasm_free(a: number): void;
104
- export function initialize(a: number, b: number, c: number, d: number): number;
104
+ export function initialize(a: number, b: number, c: number, d: number, e: number): number;
105
105
  export function create_transaction(a: number, b: number, c: number, d: number): number;
106
106
  export function create_transaction_with_multiple_payments(a: number, b: number, c: number, d: number): number;
107
107
  export function get_latest_block_hash(): number;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saito-wasm",
3
- "version": "0.2.75",
3
+ "version": "0.2.77",
4
4
  "files": [
5
5
  "index_bg.wasm",
6
6
  "index.js",
@@ -9,7 +9,7 @@
9
9
  "main": "index.js",
10
10
  "types": "index.d.ts",
11
11
  "dependencies": {
12
- "cross-env": "^7.0.3",
13
- "node-fetch": "^3.3.0"
12
+ "node-fetch": "^3.3.0",
13
+ "cross-env": "^7.0.3"
14
14
  }
15
15
  }
@@ -5,9 +5,10 @@
5
5
  * @param {string} private_key
6
6
  * @param {number} log_level_num
7
7
  * @param {bigint} hasten_multiplier
8
+ * @param {boolean} delete_old_blocks
8
9
  * @returns {Promise<any>}
9
10
  */
10
- export function initialize(json: string, private_key: string, log_level_num: number, hasten_multiplier: bigint): Promise<any>;
11
+ export function initialize(json: string, private_key: string, log_level_num: number, hasten_multiplier: bigint, delete_old_blocks: boolean): Promise<any>;
11
12
  /**
12
13
  * @param {string} public_key
13
14
  * @param {bigint} amount
@@ -954,7 +955,7 @@ export interface InitOutput {
954
955
  readonly wasmpeerservicelist_push: (a: number, b: number) => void;
955
956
  readonly wasmpeerservicelist_new: () => number;
956
957
  readonly __wbg_saitowasm_free: (a: number) => void;
957
- readonly initialize: (a: number, b: number, c: number, d: number) => number;
958
+ readonly initialize: (a: number, b: number, c: number, d: number, e: number) => number;
958
959
  readonly create_transaction: (a: number, b: number, c: number, d: number) => number;
959
960
  readonly create_transaction_with_multiple_payments: (a: number, b: number, c: number, d: number) => number;
960
961
  readonly get_latest_block_hash: () => number;
package/pkg/web/index.js CHANGED
@@ -1,30 +1,26 @@
1
- import { MsgHandler } from './snippets/saito-wasm-0e723ae7610f53a0/js/msg_handler.js';
1
+ import { MsgHandler } from './snippets/saito-wasm-546a99cbdca04c57/js/msg_handler.js';
2
2
 
3
3
  let wasm;
4
4
 
5
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
5
+ const heap = new Array(128).fill(undefined);
6
6
 
7
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
7
+ heap.push(undefined, null, true, false);
8
8
 
9
- let cachedUint8Memory0 = null;
9
+ function getObject(idx) { return heap[idx]; }
10
10
 
11
- function getUint8Memory0() {
12
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
13
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
14
- }
15
- return cachedUint8Memory0;
16
- }
11
+ let heap_next = heap.length;
17
12
 
18
- function getStringFromWasm0(ptr, len) {
19
- ptr = ptr >>> 0;
20
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
13
+ function dropObject(idx) {
14
+ if (idx < 132) return;
15
+ heap[idx] = heap_next;
16
+ heap_next = idx;
21
17
  }
22
18
 
23
- const heap = new Array(128).fill(undefined);
24
-
25
- heap.push(undefined, null, true, false);
26
-
27
- let heap_next = heap.length;
19
+ function takeObject(idx) {
20
+ const ret = getObject(idx);
21
+ dropObject(idx);
22
+ return ret;
23
+ }
28
24
 
29
25
  function addHeapObject(obj) {
30
26
  if (heap_next === heap.length) heap.push(heap.length + 1);
@@ -35,18 +31,22 @@ function addHeapObject(obj) {
35
31
  return idx;
36
32
  }
37
33
 
38
- function getObject(idx) { return heap[idx]; }
34
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
39
35
 
40
- function dropObject(idx) {
41
- if (idx < 132) return;
42
- heap[idx] = heap_next;
43
- heap_next = idx;
36
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
37
+
38
+ let cachedUint8Memory0 = null;
39
+
40
+ function getUint8Memory0() {
41
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
42
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
43
+ }
44
+ return cachedUint8Memory0;
44
45
  }
45
46
 
46
- function takeObject(idx) {
47
- const ret = getObject(idx);
48
- dropObject(idx);
49
- return ret;
47
+ function getStringFromWasm0(ptr, len) {
48
+ ptr = ptr >>> 0;
49
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
50
50
  }
51
51
 
52
52
  let WASM_VECTOR_LEN = 0;
@@ -245,10 +245,11 @@ function handleError(f, args) {
245
245
  * @param {string} private_key
246
246
  * @param {number} log_level_num
247
247
  * @param {bigint} hasten_multiplier
248
+ * @param {boolean} delete_old_blocks
248
249
  * @returns {Promise<any>}
249
250
  */
250
- export function initialize(json, private_key, log_level_num, hasten_multiplier) {
251
- const ret = wasm.initialize(addHeapObject(json), addHeapObject(private_key), log_level_num, hasten_multiplier);
251
+ export function initialize(json, private_key, log_level_num, hasten_multiplier, delete_old_blocks) {
252
+ const ret = wasm.initialize(addHeapObject(json), addHeapObject(private_key), log_level_num, hasten_multiplier, delete_old_blocks);
252
253
  return takeObject(ret);
253
254
  }
254
255
 
@@ -2370,45 +2371,37 @@ async function __wbg_load(module, imports) {
2370
2371
  function __wbg_get_imports() {
2371
2372
  const imports = {};
2372
2373
  imports.wbg = {};
2373
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
2374
- const ret = getStringFromWasm0(arg0, arg1);
2375
- return addHeapObject(ret);
2376
- };
2377
2374
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
2378
2375
  takeObject(arg0);
2379
2376
  };
2380
- imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
2381
- const ret = BigInt.asUintN(64, arg0);
2382
- return addHeapObject(ret);
2383
- };
2384
- imports.wbg.__wbg_wasmtransaction_new = function(arg0) {
2385
- const ret = WasmTransaction.__wrap(arg0);
2377
+ imports.wbg.__wbg_wasmblockchain_new = function(arg0) {
2378
+ const ret = WasmBlockchain.__wrap(arg0);
2386
2379
  return addHeapObject(ret);
2387
2380
  };
2388
2381
  imports.wbg.__wbg_wasmwallet_new = function(arg0) {
2389
2382
  const ret = WasmWallet.__wrap(arg0);
2390
2383
  return addHeapObject(ret);
2391
2384
  };
2392
- imports.wbg.__wbg_wasmpeer_new = function(arg0) {
2393
- const ret = WasmPeer.__wrap(arg0);
2385
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
2386
+ const ret = BigInt.asUintN(64, arg0);
2394
2387
  return addHeapObject(ret);
2395
2388
  };
2396
- imports.wbg.__wbg_wasmslip_new = function(arg0) {
2397
- const ret = WasmSlip.__wrap(arg0);
2389
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
2390
+ const ret = getStringFromWasm0(arg0, arg1);
2398
2391
  return addHeapObject(ret);
2399
2392
  };
2400
2393
  imports.wbg.__wbg_wasmblock_new = function(arg0) {
2401
2394
  const ret = WasmBlock.__wrap(arg0);
2402
2395
  return addHeapObject(ret);
2403
2396
  };
2404
- imports.wbg.__wbg_wasmblockchain_new = function(arg0) {
2405
- const ret = WasmBlockchain.__wrap(arg0);
2406
- return addHeapObject(ret);
2407
- };
2408
2397
  imports.wbg.__wbg_wasmwalletslip_new = function(arg0) {
2409
2398
  const ret = WasmWalletSlip.__wrap(arg0);
2410
2399
  return addHeapObject(ret);
2411
2400
  };
2401
+ imports.wbg.__wbg_wasmpeer_new = function(arg0) {
2402
+ const ret = WasmPeer.__wrap(arg0);
2403
+ return addHeapObject(ret);
2404
+ };
2412
2405
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
2413
2406
  const obj = getObject(arg1);
2414
2407
  const ret = typeof(obj) === 'string' ? obj : undefined;
@@ -2417,20 +2410,20 @@ function __wbg_get_imports() {
2417
2410
  getInt32Memory0()[arg0 / 4 + 1] = len1;
2418
2411
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
2419
2412
  };
2420
- imports.wbg.__wbg_wasmbalancesnapshot_new = function(arg0) {
2421
- const ret = WasmBalanceSnapshot.__wrap(arg0);
2413
+ imports.wbg.__wbg_wasmtransaction_new = function(arg0) {
2414
+ const ret = WasmTransaction.__wrap(arg0);
2422
2415
  return addHeapObject(ret);
2423
2416
  };
2424
- imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
2425
- const ret = new Error(getStringFromWasm0(arg0, arg1));
2417
+ imports.wbg.__wbg_wasmslip_new = function(arg0) {
2418
+ const ret = WasmSlip.__wrap(arg0);
2426
2419
  return addHeapObject(ret);
2427
2420
  };
2428
- imports.wbg.__wbg_wasmhop_new = function(arg0) {
2429
- const ret = WasmHop.__wrap(arg0);
2421
+ imports.wbg.__wbg_wasmbalancesnapshot_new = function(arg0) {
2422
+ const ret = WasmBalanceSnapshot.__wrap(arg0);
2430
2423
  return addHeapObject(ret);
2431
2424
  };
2432
- imports.wbg.__wbg_wasmpeerservice_new = function(arg0) {
2433
- const ret = WasmPeerService.__wrap(arg0);
2425
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
2426
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
2434
2427
  return addHeapObject(ret);
2435
2428
  };
2436
2429
  imports.wbg.__wbindgen_is_object = function(arg0) {
@@ -2446,13 +2439,13 @@ function __wbg_get_imports() {
2446
2439
  const ret = getObject(arg0) in getObject(arg1);
2447
2440
  return ret;
2448
2441
  };
2449
- imports.wbg.__wbg_sendmessage_12f10ca4a606a37d = function(arg0, arg1) {
2442
+ imports.wbg.__wbg_sendmessage_91e78cbd21582eab = function(arg0, arg1) {
2450
2443
  MsgHandler.send_message(takeObject(arg0), getObject(arg1));
2451
2444
  };
2452
- imports.wbg.__wbg_sendmessagetoall_7be952f451cfb1af = function(arg0, arg1) {
2445
+ imports.wbg.__wbg_sendmessagetoall_8aa797c88b23b10f = function(arg0, arg1) {
2453
2446
  MsgHandler.send_message_to_all(getObject(arg0), getObject(arg1));
2454
2447
  };
2455
- imports.wbg.__wbg_connecttopeer_9ae92a6e46a9795d = function() { return handleError(function (arg0, arg1, arg2) {
2448
+ imports.wbg.__wbg_connecttopeer_c6f6e9cf91ca7c9f = function() { return handleError(function (arg0, arg1, arg2) {
2456
2449
  let deferred0_0;
2457
2450
  let deferred0_1;
2458
2451
  try {
@@ -2464,11 +2457,11 @@ function __wbg_get_imports() {
2464
2457
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2465
2458
  }
2466
2459
  }, arguments) };
2467
- imports.wbg.__wbg_disconnectfrompeer_6ab6e62455c78090 = function() { return handleError(function (arg0) {
2460
+ imports.wbg.__wbg_disconnectfrompeer_1646cf039dd307fc = function() { return handleError(function (arg0) {
2468
2461
  const ret = MsgHandler.disconnect_from_peer(takeObject(arg0));
2469
2462
  return addHeapObject(ret);
2470
2463
  }, arguments) };
2471
- imports.wbg.__wbg_fetchblockfrompeer_78dea779fd556bfc = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2464
+ imports.wbg.__wbg_fetchblockfrompeer_fc057440cab45649 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2472
2465
  let deferred0_0;
2473
2466
  let deferred0_1;
2474
2467
  try {
@@ -2480,7 +2473,7 @@ function __wbg_get_imports() {
2480
2473
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2481
2474
  }
2482
2475
  }, arguments) };
2483
- imports.wbg.__wbg_writevalue_9b909fd9eaeb97fb = function(arg0, arg1, arg2) {
2476
+ imports.wbg.__wbg_writevalue_6df3c67b4b8b7b9b = function(arg0, arg1, arg2) {
2484
2477
  let deferred0_0;
2485
2478
  let deferred0_1;
2486
2479
  try {
@@ -2491,7 +2484,7 @@ function __wbg_get_imports() {
2491
2484
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2492
2485
  }
2493
2486
  };
2494
- imports.wbg.__wbg_appendvalue_4ab3f1860013a348 = function(arg0, arg1, arg2) {
2487
+ imports.wbg.__wbg_appendvalue_ce52a3290c71a50c = function(arg0, arg1, arg2) {
2495
2488
  let deferred0_0;
2496
2489
  let deferred0_1;
2497
2490
  try {
@@ -2502,7 +2495,7 @@ function __wbg_get_imports() {
2502
2495
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2503
2496
  }
2504
2497
  };
2505
- imports.wbg.__wbg_flushdata_e44f38756cc00016 = function(arg0, arg1) {
2498
+ imports.wbg.__wbg_flushdata_12d393e978a999ce = function(arg0, arg1) {
2506
2499
  let deferred0_0;
2507
2500
  let deferred0_1;
2508
2501
  try {
@@ -2513,7 +2506,7 @@ function __wbg_get_imports() {
2513
2506
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2514
2507
  }
2515
2508
  };
2516
- imports.wbg.__wbg_readvalue_a4abab67b3aff364 = function() { return handleError(function (arg0, arg1) {
2509
+ imports.wbg.__wbg_readvalue_e65553927937cdc5 = function() { return handleError(function (arg0, arg1) {
2517
2510
  let deferred0_0;
2518
2511
  let deferred0_1;
2519
2512
  try {
@@ -2525,11 +2518,11 @@ function __wbg_get_imports() {
2525
2518
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2526
2519
  }
2527
2520
  }, arguments) };
2528
- imports.wbg.__wbg_loadblockfilelist_85d9f088c9503a58 = function() { return handleError(function () {
2521
+ imports.wbg.__wbg_loadblockfilelist_9a1ce1435bb39160 = function() { return handleError(function () {
2529
2522
  const ret = MsgHandler.load_block_file_list();
2530
2523
  return addHeapObject(ret);
2531
2524
  }, arguments) };
2532
- imports.wbg.__wbg_isexistingfile_0b7d14902e6cde70 = function() { return handleError(function (arg0, arg1) {
2525
+ imports.wbg.__wbg_isexistingfile_478430505161a1b2 = function() { return handleError(function (arg0, arg1) {
2533
2526
  let deferred0_0;
2534
2527
  let deferred0_1;
2535
2528
  try {
@@ -2541,7 +2534,7 @@ function __wbg_get_imports() {
2541
2534
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2542
2535
  }
2543
2536
  }, arguments) };
2544
- imports.wbg.__wbg_removevalue_802864b894af2e66 = function() { return handleError(function (arg0, arg1) {
2537
+ imports.wbg.__wbg_removevalue_024bf56f6b701113 = function() { return handleError(function (arg0, arg1) {
2545
2538
  let deferred0_0;
2546
2539
  let deferred0_1;
2547
2540
  try {
@@ -2553,7 +2546,7 @@ function __wbg_get_imports() {
2553
2546
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2554
2547
  }
2555
2548
  }, arguments) };
2556
- imports.wbg.__wbg_ensureblockdirectoryexists_0889d13d515ac1a1 = function() { return handleError(function (arg0, arg1) {
2549
+ imports.wbg.__wbg_ensureblockdirectoryexists_1818ca71b5c5d81a = function() { return handleError(function (arg0, arg1) {
2557
2550
  let deferred0_0;
2558
2551
  let deferred0_1;
2559
2552
  try {
@@ -2564,16 +2557,16 @@ function __wbg_get_imports() {
2564
2557
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2565
2558
  }
2566
2559
  }, arguments) };
2567
- imports.wbg.__wbg_processapicall_f2ec3ebc3e316354 = function(arg0, arg1, arg2) {
2560
+ imports.wbg.__wbg_processapicall_444766484e38805d = function(arg0, arg1, arg2) {
2568
2561
  MsgHandler.process_api_call(takeObject(arg0), arg1 >>> 0, takeObject(arg2));
2569
2562
  };
2570
- imports.wbg.__wbg_processapisuccess_345fc163487c70d0 = function(arg0, arg1, arg2) {
2563
+ imports.wbg.__wbg_processapisuccess_256ee2ce023f2b28 = function(arg0, arg1, arg2) {
2571
2564
  MsgHandler.process_api_success(takeObject(arg0), arg1 >>> 0, takeObject(arg2));
2572
2565
  };
2573
- imports.wbg.__wbg_processapierror_318fa93fcfd48fb3 = function(arg0, arg1, arg2) {
2566
+ imports.wbg.__wbg_processapierror_3747b226a46841cb = function(arg0, arg1, arg2) {
2574
2567
  MsgHandler.process_api_error(takeObject(arg0), arg1 >>> 0, takeObject(arg2));
2575
2568
  };
2576
- imports.wbg.__wbg_sendinterfaceevent_78bb5e94f955662c = function(arg0, arg1, arg2, arg3, arg4) {
2569
+ imports.wbg.__wbg_sendinterfaceevent_37ad2589b2da3da2 = function(arg0, arg1, arg2, arg3, arg4) {
2577
2570
  let deferred0_0;
2578
2571
  let deferred0_1;
2579
2572
  let deferred1_0;
@@ -2589,7 +2582,7 @@ function __wbg_get_imports() {
2589
2582
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2590
2583
  }
2591
2584
  };
2592
- imports.wbg.__wbg_sendblocksuccess_b1042c2a8caac1c9 = function(arg0, arg1, arg2) {
2585
+ imports.wbg.__wbg_sendblocksuccess_dce1654fe9a36478 = function(arg0, arg1, arg2) {
2593
2586
  let deferred0_0;
2594
2587
  let deferred0_1;
2595
2588
  try {
@@ -2600,10 +2593,10 @@ function __wbg_get_imports() {
2600
2593
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2601
2594
  }
2602
2595
  };
2603
- imports.wbg.__wbg_sendwalletupdate_26662b816e940308 = function() {
2596
+ imports.wbg.__wbg_sendwalletupdate_c946a444c7138a37 = function() {
2604
2597
  MsgHandler.send_wallet_update();
2605
2598
  };
2606
- imports.wbg.__wbg_sendnewversionalert_c143fff2854867f1 = function(arg0, arg1, arg2) {
2599
+ imports.wbg.__wbg_sendnewversionalert_212fb237295adacc = function(arg0, arg1, arg2) {
2607
2600
  let deferred0_0;
2608
2601
  let deferred0_1;
2609
2602
  try {
@@ -2614,21 +2607,29 @@ function __wbg_get_imports() {
2614
2607
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2615
2608
  }
2616
2609
  };
2617
- imports.wbg.__wbg_sendblockfetchstatusevent_765e3302676fc940 = function(arg0) {
2610
+ imports.wbg.__wbg_sendblockfetchstatusevent_d62cf3d03f0c1ed4 = function(arg0) {
2618
2611
  MsgHandler.send_block_fetch_status_event(BigInt.asUintN(64, arg0));
2619
2612
  };
2620
- imports.wbg.__wbg_savewallet_87e13a98198194d4 = function() {
2613
+ imports.wbg.__wbg_savewallet_3b3747702486c95d = function() {
2621
2614
  MsgHandler.save_wallet();
2622
2615
  };
2623
- imports.wbg.__wbg_loadwallet_158b846d8bfe8793 = function() {
2616
+ imports.wbg.__wbg_loadwallet_682313adc62cb15d = function() {
2624
2617
  MsgHandler.load_wallet();
2625
2618
  };
2626
- imports.wbg.__wbg_getmyservices_56d63a37a6afbd50 = function() {
2619
+ imports.wbg.__wbg_getmyservices_9b8694fd15197e81 = function() {
2627
2620
  const ret = MsgHandler.get_my_services();
2628
2621
  _assertClass(ret, WasmPeerServiceList);
2629
2622
  var ptr1 = ret.__destroy_into_raw();
2630
2623
  return ptr1;
2631
2624
  };
2625
+ imports.wbg.__wbg_wasmpeerservice_new = function(arg0) {
2626
+ const ret = WasmPeerService.__wrap(arg0);
2627
+ return addHeapObject(ret);
2628
+ };
2629
+ imports.wbg.__wbg_wasmhop_new = function(arg0) {
2630
+ const ret = WasmHop.__wrap(arg0);
2631
+ return addHeapObject(ret);
2632
+ };
2632
2633
  imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
2633
2634
  const ret = getObject(arg0) == getObject(arg1);
2634
2635
  return ret;
@@ -2932,7 +2933,7 @@ function __wbg_get_imports() {
2932
2933
  const ret = wasm.memory;
2933
2934
  return addHeapObject(ret);
2934
2935
  };
2935
- imports.wbg.__wbindgen_closure_wrapper1300 = function(arg0, arg1, arg2) {
2936
+ imports.wbg.__wbindgen_closure_wrapper1299 = function(arg0, arg1, arg2) {
2936
2937
  const ret = makeMutClosure(arg0, arg1, 460, __wbg_adapter_38);
2937
2938
  return addHeapObject(ret);
2938
2939
  };
Binary file
@@ -101,7 +101,7 @@ export function wasmpeerservice_get_domain(a: number): number;
101
101
  export function wasmpeerservicelist_push(a: number, b: number): void;
102
102
  export function wasmpeerservicelist_new(): number;
103
103
  export function __wbg_saitowasm_free(a: number): void;
104
- export function initialize(a: number, b: number, c: number, d: number): number;
104
+ export function initialize(a: number, b: number, c: number, d: number, e: number): number;
105
105
  export function create_transaction(a: number, b: number, c: number, d: number): number;
106
106
  export function create_transaction_with_multiple_payments(a: number, b: number, c: number, d: number): number;
107
107
  export function get_latest_block_hash(): number;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saito-wasm",
3
- "version": "0.2.75",
3
+ "version": "0.2.77",
4
4
  "files": [
5
5
  "index_bg.wasm",
6
6
  "index.js",
@@ -12,7 +12,7 @@
12
12
  "./snippets/*"
13
13
  ],
14
14
  "dependencies": {
15
- "node-fetch": "^3.3.0",
16
- "cross-env": "^7.0.3"
15
+ "cross-env": "^7.0.3",
16
+ "node-fetch": "^3.3.0"
17
17
  }
18
18
  }