saito-wasm 0.0.16 → 0.0.18

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.0.12"
3
+ version = "0.0.18"
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.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "js wrappings around saito-core using wasm",
5
5
  "scripts": {
6
6
  "test": "./node_modules/.bin/jest",
@@ -124,17 +124,9 @@ export function get_wallet(): Promise<WasmWallet>;
124
124
  */
125
125
  export function get_blockchain(): Promise<WasmBlockchain>;
126
126
  /**
127
- * @param {Uint8Array} buffer
128
- */
129
- export function test_buffer_in(buffer: Uint8Array): void;
130
- /**
131
- * @returns {Uint8Array}
132
- */
133
- export function test_buffer_out(): Uint8Array;
134
- /**
135
- * @returns {Promise<Uint8Array>}
127
+ * @returns {Promise<Array<any>>}
136
128
  */
137
- export function test_buffer_out_async(): Promise<Uint8Array>;
129
+ export function get_mempool_txs(): Promise<Array<any>>;
138
130
  /**
139
131
  */
140
132
  export class SaitoWasm {
@@ -246,6 +238,20 @@ export class WasmBlockchain {
246
238
  * @returns {Promise<bigint>}
247
239
  */
248
240
  get_lowest_acceptable_block_id(): Promise<bigint>;
241
+ /**
242
+ * @returns {Promise<bigint>}
243
+ */
244
+ get_latest_block_id(): Promise<bigint>;
245
+ /**
246
+ * @param {bigint} block_id
247
+ * @returns {Promise<string>}
248
+ */
249
+ get_longest_chain_hash_at_id(block_id: bigint): Promise<string>;
250
+ /**
251
+ * @param {bigint} block_id
252
+ * @returns {Promise<Array<any>>}
253
+ */
254
+ get_hashes_at_id(block_id: bigint): Promise<Array<any>>;
249
255
  }
250
256
  /**
251
257
  */
package/pkg/node/index.js CHANGED
@@ -1,29 +1,33 @@
1
1
  let imports = {};
2
2
  imports['__wbindgen_placeholder__'] = module.exports;
3
3
  let wasm;
4
- const { MsgHandler } = require(String.raw`./snippets/saito-wasm-ab5a63a608170761/js/msg_handler.js`);
4
+ const { MsgHandler } = require(String.raw`./snippets/saito-wasm-e4fc46f5034ac0a9/js/msg_handler.js`);
5
5
  const { TextDecoder, TextEncoder } = require(`util`);
6
6
 
7
- const heap = new Array(128).fill(undefined);
8
-
9
- heap.push(undefined, null, true, false);
7
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
10
8
 
11
- function getObject(idx) { return heap[idx]; }
9
+ cachedTextDecoder.decode();
12
10
 
13
- let heap_next = heap.length;
11
+ let cachedUint8Memory0 = null;
14
12
 
15
- function dropObject(idx) {
16
- if (idx < 132) return;
17
- heap[idx] = heap_next;
18
- heap_next = idx;
13
+ function getUint8Memory0() {
14
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
15
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
16
+ }
17
+ return cachedUint8Memory0;
19
18
  }
20
19
 
21
- function takeObject(idx) {
22
- const ret = getObject(idx);
23
- dropObject(idx);
24
- return ret;
20
+ function getStringFromWasm0(ptr, len) {
21
+ ptr = ptr >>> 0;
22
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
25
23
  }
26
24
 
25
+ const heap = new Array(128).fill(undefined);
26
+
27
+ heap.push(undefined, null, true, false);
28
+
29
+ let heap_next = heap.length;
30
+
27
31
  function addHeapObject(obj) {
28
32
  if (heap_next === heap.length) heap.push(heap.length + 1);
29
33
  const idx = heap_next;
@@ -33,22 +37,18 @@ function addHeapObject(obj) {
33
37
  return idx;
34
38
  }
35
39
 
36
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
37
-
38
- cachedTextDecoder.decode();
39
-
40
- let cachedUint8Memory0 = null;
40
+ function getObject(idx) { return heap[idx]; }
41
41
 
42
- function getUint8Memory0() {
43
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
44
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
45
- }
46
- return cachedUint8Memory0;
42
+ function dropObject(idx) {
43
+ if (idx < 132) return;
44
+ heap[idx] = heap_next;
45
+ heap_next = idx;
47
46
  }
48
47
 
49
- function getStringFromWasm0(ptr, len) {
50
- ptr = ptr >>> 0;
51
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
48
+ function takeObject(idx) {
49
+ const ret = getObject(idx);
50
+ dropObject(idx);
51
+ return ret;
52
52
  }
53
53
 
54
54
  let WASM_VECTOR_LEN = 0;
@@ -448,25 +448,10 @@ module.exports.get_blockchain = function() {
448
448
  };
449
449
 
450
450
  /**
451
- * @param {Uint8Array} buffer
452
- */
453
- module.exports.test_buffer_in = function(buffer) {
454
- wasm.test_buffer_in(addHeapObject(buffer));
455
- };
456
-
457
- /**
458
- * @returns {Uint8Array}
459
- */
460
- module.exports.test_buffer_out = function() {
461
- const ret = wasm.test_buffer_out();
462
- return takeObject(ret);
463
- };
464
-
465
- /**
466
- * @returns {Promise<Uint8Array>}
451
+ * @returns {Promise<Array<any>>}
467
452
  */
468
- module.exports.test_buffer_out_async = function() {
469
- const ret = wasm.test_buffer_out_async();
453
+ module.exports.get_mempool_txs = function() {
454
+ const ret = wasm.get_mempool_txs();
470
455
  return takeObject(ret);
471
456
  };
472
457
 
@@ -474,7 +459,7 @@ function getArrayU8FromWasm0(ptr, len) {
474
459
  ptr = ptr >>> 0;
475
460
  return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
476
461
  }
477
- function __wbg_adapter_273(arg0, arg1, arg2, arg3) {
462
+ function __wbg_adapter_274(arg0, arg1, arg2, arg3) {
478
463
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h5cc70648b3a77aa5(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
479
464
  }
480
465
 
@@ -769,6 +754,29 @@ class WasmBlockchain {
769
754
  const ret = wasm.wasmblockchain_get_lowest_acceptable_block_id(this.__wbg_ptr);
770
755
  return takeObject(ret);
771
756
  }
757
+ /**
758
+ * @returns {Promise<bigint>}
759
+ */
760
+ get_latest_block_id() {
761
+ const ret = wasm.wasmblockchain_get_latest_block_id(this.__wbg_ptr);
762
+ return takeObject(ret);
763
+ }
764
+ /**
765
+ * @param {bigint} block_id
766
+ * @returns {Promise<string>}
767
+ */
768
+ get_longest_chain_hash_at_id(block_id) {
769
+ const ret = wasm.wasmblockchain_get_longest_chain_hash_at_id(this.__wbg_ptr, block_id);
770
+ return takeObject(ret);
771
+ }
772
+ /**
773
+ * @param {bigint} block_id
774
+ * @returns {Promise<Array<any>>}
775
+ */
776
+ get_hashes_at_id(block_id) {
777
+ const ret = wasm.wasmblockchain_get_hashes_at_id(this.__wbg_ptr, block_id);
778
+ return takeObject(ret);
779
+ }
772
780
  }
773
781
  module.exports.WasmBlockchain = WasmBlockchain;
774
782
  /**
@@ -1394,6 +1402,26 @@ class WasmWallet {
1394
1402
  }
1395
1403
  module.exports.WasmWallet = WasmWallet;
1396
1404
 
1405
+ module.exports.__wbg_wasmwallet_new = function(arg0) {
1406
+ const ret = WasmWallet.__wrap(arg0);
1407
+ return addHeapObject(ret);
1408
+ };
1409
+
1410
+ module.exports.__wbindgen_error_new = function(arg0, arg1) {
1411
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
1412
+ return addHeapObject(ret);
1413
+ };
1414
+
1415
+ module.exports.__wbg_wasmblock_new = function(arg0) {
1416
+ const ret = WasmBlock.__wrap(arg0);
1417
+ return addHeapObject(ret);
1418
+ };
1419
+
1420
+ module.exports.__wbg_wasmtransaction_new = function(arg0) {
1421
+ const ret = WasmTransaction.__wrap(arg0);
1422
+ return addHeapObject(ret);
1423
+ };
1424
+
1397
1425
  module.exports.__wbindgen_object_drop_ref = function(arg0) {
1398
1426
  takeObject(arg0);
1399
1427
  };
@@ -1413,16 +1441,11 @@ module.exports.__wbindgen_string_new = function(arg0, arg1) {
1413
1441
  return addHeapObject(ret);
1414
1442
  };
1415
1443
 
1416
- module.exports.__wbg_wasmtransaction_new = function(arg0) {
1417
- const ret = WasmTransaction.__wrap(arg0);
1444
+ module.exports.__wbg_wasmpeerservice_new = function(arg0) {
1445
+ const ret = WasmPeerService.__wrap(arg0);
1418
1446
  return addHeapObject(ret);
1419
1447
  };
1420
1448
 
1421
- module.exports.__wbindgen_is_falsy = function(arg0) {
1422
- const ret = !getObject(arg0);
1423
- return ret;
1424
- };
1425
-
1426
1449
  module.exports.__wbindgen_string_get = function(arg0, arg1) {
1427
1450
  const obj = getObject(arg1);
1428
1451
  const ret = typeof(obj) === 'string' ? obj : undefined;
@@ -1432,31 +1455,11 @@ module.exports.__wbindgen_string_get = function(arg0, arg1) {
1432
1455
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
1433
1456
  };
1434
1457
 
1435
- module.exports.__wbg_wasmwallet_new = function(arg0) {
1436
- const ret = WasmWallet.__wrap(arg0);
1437
- return addHeapObject(ret);
1438
- };
1439
-
1440
- module.exports.__wbg_wasmblock_new = function(arg0) {
1441
- const ret = WasmBlock.__wrap(arg0);
1442
- return addHeapObject(ret);
1443
- };
1444
-
1445
1458
  module.exports.__wbg_wasmblockchain_new = function(arg0) {
1446
1459
  const ret = WasmBlockchain.__wrap(arg0);
1447
1460
  return addHeapObject(ret);
1448
1461
  };
1449
1462
 
1450
- module.exports.__wbindgen_error_new = function(arg0, arg1) {
1451
- const ret = new Error(getStringFromWasm0(arg0, arg1));
1452
- return addHeapObject(ret);
1453
- };
1454
-
1455
- module.exports.__wbg_wasmpeerservice_new = function(arg0) {
1456
- const ret = WasmPeerService.__wrap(arg0);
1457
- return addHeapObject(ret);
1458
- };
1459
-
1460
1463
  module.exports.__wbg_wasmslip_new = function(arg0) {
1461
1464
  const ret = WasmSlip.__wrap(arg0);
1462
1465
  return addHeapObject(ret);
@@ -1478,25 +1481,25 @@ module.exports.__wbindgen_in = function(arg0, arg1) {
1478
1481
  return ret;
1479
1482
  };
1480
1483
 
1481
- module.exports.__wbg_sendmessage_2a7cb3960340003f = function(arg0, arg1) {
1484
+ module.exports.__wbg_sendmessage_bc28ea49c82675ac = function(arg0, arg1) {
1482
1485
  MsgHandler.send_message(takeObject(arg0), getObject(arg1));
1483
1486
  };
1484
1487
 
1485
- module.exports.__wbg_sendmessagetoall_8e1963596d87a6c9 = function(arg0, arg1) {
1488
+ module.exports.__wbg_sendmessagetoall_5128186d0c6f7c44 = function(arg0, arg1) {
1486
1489
  MsgHandler.send_message_to_all(getObject(arg0), getObject(arg1));
1487
1490
  };
1488
1491
 
1489
- module.exports.__wbg_connecttopeer_5f7b55d0b33d8945 = function() { return handleError(function (arg0) {
1492
+ module.exports.__wbg_connecttopeer_a5b7c0c1f322b314 = function() { return handleError(function (arg0) {
1490
1493
  const ret = MsgHandler.connect_to_peer(takeObject(arg0));
1491
1494
  return addHeapObject(ret);
1492
1495
  }, arguments) };
1493
1496
 
1494
- module.exports.__wbg_disconnectfrompeer_c4b18addc554f556 = function() { return handleError(function (arg0) {
1497
+ module.exports.__wbg_disconnectfrompeer_39f334f2d1f5df45 = function() { return handleError(function (arg0) {
1495
1498
  const ret = MsgHandler.disconnect_from_peer(takeObject(arg0));
1496
1499
  return addHeapObject(ret);
1497
1500
  }, arguments) };
1498
1501
 
1499
- module.exports.__wbg_fetchblockfrompeer_8c17ad7ddc49409a = function() { return handleError(function (arg0, arg1, arg2, arg3) {
1502
+ module.exports.__wbg_fetchblockfrompeer_5f8e079c86059e52 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
1500
1503
  let deferred0_0;
1501
1504
  let deferred0_1;
1502
1505
  try {
@@ -1509,7 +1512,7 @@ module.exports.__wbg_fetchblockfrompeer_8c17ad7ddc49409a = function() { return h
1509
1512
  }
1510
1513
  }, arguments) };
1511
1514
 
1512
- module.exports.__wbg_writevalue_9e55c94b97509b8e = function(arg0, arg1, arg2) {
1515
+ module.exports.__wbg_writevalue_e5fefa0841689686 = function(arg0, arg1, arg2) {
1513
1516
  let deferred0_0;
1514
1517
  let deferred0_1;
1515
1518
  try {
@@ -1521,7 +1524,7 @@ module.exports.__wbg_writevalue_9e55c94b97509b8e = function(arg0, arg1, arg2) {
1521
1524
  }
1522
1525
  };
1523
1526
 
1524
- module.exports.__wbg_readvalue_0c81f78742bebea0 = function() { return handleError(function (arg0, arg1) {
1527
+ module.exports.__wbg_readvalue_cb7c63f12e2fcfc1 = function() { return handleError(function (arg0, arg1) {
1525
1528
  let deferred0_0;
1526
1529
  let deferred0_1;
1527
1530
  try {
@@ -1534,12 +1537,12 @@ module.exports.__wbg_readvalue_0c81f78742bebea0 = function() { return handleErro
1534
1537
  }
1535
1538
  }, arguments) };
1536
1539
 
1537
- module.exports.__wbg_loadblockfilelist_9accca826df805e3 = function() { return handleError(function () {
1540
+ module.exports.__wbg_loadblockfilelist_08aaeaaa82b17463 = function() { return handleError(function () {
1538
1541
  const ret = MsgHandler.load_block_file_list();
1539
1542
  return addHeapObject(ret);
1540
1543
  }, arguments) };
1541
1544
 
1542
- module.exports.__wbg_isexistingfile_60346c5e9a043ff5 = function() { return handleError(function (arg0, arg1) {
1545
+ module.exports.__wbg_isexistingfile_f833bbf4f449c4e7 = function() { return handleError(function (arg0, arg1) {
1543
1546
  let deferred0_0;
1544
1547
  let deferred0_1;
1545
1548
  try {
@@ -1552,7 +1555,7 @@ module.exports.__wbg_isexistingfile_60346c5e9a043ff5 = function() { return handl
1552
1555
  }
1553
1556
  }, arguments) };
1554
1557
 
1555
- module.exports.__wbg_removevalue_cc0b7e61fa1e8819 = function() { return handleError(function (arg0, arg1) {
1558
+ module.exports.__wbg_removevalue_c4ab7b83f813a171 = function() { return handleError(function (arg0, arg1) {
1556
1559
  let deferred0_0;
1557
1560
  let deferred0_1;
1558
1561
  try {
@@ -1565,19 +1568,19 @@ module.exports.__wbg_removevalue_cc0b7e61fa1e8819 = function() { return handleEr
1565
1568
  }
1566
1569
  }, arguments) };
1567
1570
 
1568
- module.exports.__wbg_processapicall_5feead2a6c49333c = function(arg0, arg1, arg2) {
1571
+ module.exports.__wbg_processapicall_1ae12e2f6bc1b845 = function(arg0, arg1, arg2) {
1569
1572
  MsgHandler.process_api_call(takeObject(arg0), arg1 >>> 0, BigInt.asUintN(64, arg2));
1570
1573
  };
1571
1574
 
1572
- module.exports.__wbg_processapisuccess_2294422cdc32f937 = function(arg0, arg1, arg2) {
1575
+ module.exports.__wbg_processapisuccess_597da43ed8731c2f = function(arg0, arg1, arg2) {
1573
1576
  MsgHandler.process_api_success(takeObject(arg0), arg1 >>> 0, BigInt.asUintN(64, arg2));
1574
1577
  };
1575
1578
 
1576
- module.exports.__wbg_processapierror_49e99c8b78279760 = function(arg0, arg1, arg2) {
1579
+ module.exports.__wbg_processapierror_a71aba96980c82ce = function(arg0, arg1, arg2) {
1577
1580
  MsgHandler.process_api_error(takeObject(arg0), arg1 >>> 0, BigInt.asUintN(64, arg2));
1578
1581
  };
1579
1582
 
1580
- module.exports.__wbg_sendinterfaceevent_99ba5a26d98773f2 = function(arg0, arg1, arg2) {
1583
+ module.exports.__wbg_sendinterfaceevent_cd7f8de0e2907421 = function(arg0, arg1, arg2) {
1581
1584
  let deferred0_0;
1582
1585
  let deferred0_1;
1583
1586
  try {
@@ -1589,7 +1592,7 @@ module.exports.__wbg_sendinterfaceevent_99ba5a26d98773f2 = function(arg0, arg1,
1589
1592
  }
1590
1593
  };
1591
1594
 
1592
- module.exports.__wbg_sendblocksuccess_a6b946b45c44c52e = function(arg0, arg1, arg2) {
1595
+ module.exports.__wbg_sendblocksuccess_405274aa2f9747b3 = function(arg0, arg1, arg2) {
1593
1596
  let deferred0_0;
1594
1597
  let deferred0_1;
1595
1598
  try {
@@ -1601,21 +1604,26 @@ module.exports.__wbg_sendblocksuccess_a6b946b45c44c52e = function(arg0, arg1, ar
1601
1604
  }
1602
1605
  };
1603
1606
 
1604
- module.exports.__wbg_savewallet_43d0b07b379bb519 = function() {
1607
+ module.exports.__wbg_savewallet_7387f03066474245 = function() {
1605
1608
  MsgHandler.save_wallet();
1606
1609
  };
1607
1610
 
1608
- module.exports.__wbg_loadwallet_46802d85c0a99c4d = function() {
1611
+ module.exports.__wbg_loadwallet_0d0b6e72f2e2d24d = function() {
1609
1612
  MsgHandler.load_wallet();
1610
1613
  };
1611
1614
 
1612
- module.exports.__wbg_getmyservices_07cd9026693aca08 = function() {
1615
+ module.exports.__wbg_getmyservices_5cdd70799e488036 = function() {
1613
1616
  const ret = MsgHandler.get_my_services();
1614
1617
  _assertClass(ret, WasmPeerServiceList);
1615
1618
  var ptr1 = ret.__destroy_into_raw();
1616
1619
  return ptr1;
1617
1620
  };
1618
1621
 
1622
+ module.exports.__wbindgen_is_falsy = function(arg0) {
1623
+ const ret = !getObject(arg0);
1624
+ return ret;
1625
+ };
1626
+
1619
1627
  module.exports.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
1620
1628
  const ret = getObject(arg0) == getObject(arg1);
1621
1629
  return ret;
@@ -1844,7 +1852,7 @@ module.exports.__wbg_new_2b55e405e4af4986 = function(arg0, arg1) {
1844
1852
  const a = state0.a;
1845
1853
  state0.a = 0;
1846
1854
  try {
1847
- return __wbg_adapter_273(a, state0.b, arg0, arg1);
1855
+ return __wbg_adapter_274(a, state0.b, arg0, arg1);
1848
1856
  } finally {
1849
1857
  state0.a = a;
1850
1858
  }
@@ -1938,8 +1946,8 @@ module.exports.__wbindgen_memory = function() {
1938
1946
  return addHeapObject(ret);
1939
1947
  };
1940
1948
 
1941
- module.exports.__wbindgen_closure_wrapper937 = function(arg0, arg1, arg2) {
1942
- const ret = makeMutClosure(arg0, arg1, 312, __wbg_adapter_40);
1949
+ module.exports.__wbindgen_closure_wrapper952 = function(arg0, arg1, arg2) {
1950
+ const ret = makeMutClosure(arg0, arg1, 318, __wbg_adapter_40);
1943
1951
  return addHeapObject(ret);
1944
1952
  };
1945
1953
 
Binary file
@@ -1,18 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function __wbg_wasmblockchain_free(a: number): void;
5
- export function wasmblockchain_reset(a: number): number;
6
- export function wasmblockchain_get_last_block_id(a: number): number;
7
- export function wasmblockchain_get_last_timestamp(a: number): number;
8
- export function wasmblockchain_get_longest_chain_hash_at(a: number, b: number): number;
9
- export function wasmblockchain_get_last_block_hash(a: number): number;
10
- export function wasmblockchain_get_last_burnfee(a: number): number;
11
- export function wasmblockchain_get_genesis_block_id(a: number): number;
12
- export function wasmblockchain_get_genesis_timestamp(a: number): number;
13
- export function wasmblockchain_get_lowest_acceptable_timestamp(a: number): number;
14
- export function wasmblockchain_get_lowest_acceptable_block_hash(a: number): number;
15
- export function wasmblockchain_get_lowest_acceptable_block_id(a: number): number;
16
4
  export function __wbg_wasmwallet_free(a: number): void;
17
5
  export function wasmwallet_save(a: number): number;
18
6
  export function wasmwallet_reset(a: number): number;
@@ -103,6 +91,21 @@ export function wasmblock_serialize(a: number): number;
103
91
  export function wasmblock_deserialize(a: number, b: number, c: number): void;
104
92
  export function wasmblock_has_keylist_txs(a: number, b: number): number;
105
93
  export function wasmblock_generate_lite_block(a: number, b: number): number;
94
+ export function __wbg_wasmblockchain_free(a: number): void;
95
+ export function wasmblockchain_reset(a: number): number;
96
+ export function wasmblockchain_get_last_block_id(a: number): number;
97
+ export function wasmblockchain_get_last_timestamp(a: number): number;
98
+ export function wasmblockchain_get_longest_chain_hash_at(a: number, b: number): number;
99
+ export function wasmblockchain_get_last_block_hash(a: number): number;
100
+ export function wasmblockchain_get_last_burnfee(a: number): number;
101
+ export function wasmblockchain_get_genesis_block_id(a: number): number;
102
+ export function wasmblockchain_get_genesis_timestamp(a: number): number;
103
+ export function wasmblockchain_get_lowest_acceptable_timestamp(a: number): number;
104
+ export function wasmblockchain_get_lowest_acceptable_block_hash(a: number): number;
105
+ export function wasmblockchain_get_lowest_acceptable_block_id(a: number): number;
106
+ export function wasmblockchain_get_latest_block_id(a: number): number;
107
+ export function wasmblockchain_get_longest_chain_hash_at_id(a: number, b: number): number;
108
+ export function wasmblockchain_get_hashes_at_id(a: number, b: number): number;
106
109
  export function __wbg_wasmconfiguration_free(a: number): void;
107
110
  export function wasmconfiguration_new(): number;
108
111
  export function __wbg_saitowasm_free(a: number): void;
@@ -128,9 +131,7 @@ export function send_api_success(a: number, b: number, c: number): number;
128
131
  export function send_api_error(a: number, b: number, c: number): number;
129
132
  export function get_wallet(): number;
130
133
  export function get_blockchain(): number;
131
- export function test_buffer_in(a: number): void;
132
- export function test_buffer_out(): number;
133
- export function test_buffer_out_async(): number;
134
+ export function get_mempool_txs(): number;
134
135
  export function rustsecp256k1_v0_8_1_context_create(a: number): number;
135
136
  export function rustsecp256k1_v0_8_1_context_destroy(a: number): void;
136
137
  export function rustsecp256k1_v0_8_1_default_illegal_callback_fn(a: number, b: number): void;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saito-wasm",
3
- "version": "0.0.12",
3
+ "version": "0.0.18",
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
  }
@@ -1,11 +1,9 @@
1
1
  class MsgHandler {
2
2
  static send_message(peer_index, buffer) {
3
- console.debug("MsgHandler::send_message : " + peer_index);
4
3
  return global.shared_methods.send_message(peer_index, buffer);
5
4
  }
6
5
 
7
6
  static send_message_to_all(buffer, exceptions) {
8
- console.debug("MsgHandler::send_message_to_all");
9
7
  return global.shared_methods.send_message_to_all(buffer, exceptions);
10
8
  }
11
9
 
@@ -124,17 +124,9 @@ export function get_wallet(): Promise<WasmWallet>;
124
124
  */
125
125
  export function get_blockchain(): Promise<WasmBlockchain>;
126
126
  /**
127
- * @param {Uint8Array} buffer
128
- */
129
- export function test_buffer_in(buffer: Uint8Array): void;
130
- /**
131
- * @returns {Uint8Array}
132
- */
133
- export function test_buffer_out(): Uint8Array;
134
- /**
135
- * @returns {Promise<Uint8Array>}
127
+ * @returns {Promise<Array<any>>}
136
128
  */
137
- export function test_buffer_out_async(): Promise<Uint8Array>;
129
+ export function get_mempool_txs(): Promise<Array<any>>;
138
130
  /**
139
131
  */
140
132
  export class SaitoWasm {
@@ -246,6 +238,20 @@ export class WasmBlockchain {
246
238
  * @returns {Promise<bigint>}
247
239
  */
248
240
  get_lowest_acceptable_block_id(): Promise<bigint>;
241
+ /**
242
+ * @returns {Promise<bigint>}
243
+ */
244
+ get_latest_block_id(): Promise<bigint>;
245
+ /**
246
+ * @param {bigint} block_id
247
+ * @returns {Promise<string>}
248
+ */
249
+ get_longest_chain_hash_at_id(block_id: bigint): Promise<string>;
250
+ /**
251
+ * @param {bigint} block_id
252
+ * @returns {Promise<Array<any>>}
253
+ */
254
+ get_hashes_at_id(block_id: bigint): Promise<Array<any>>;
249
255
  }
250
256
  /**
251
257
  */
@@ -457,18 +463,6 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
457
463
 
458
464
  export interface InitOutput {
459
465
  readonly memory: WebAssembly.Memory;
460
- readonly __wbg_wasmblockchain_free: (a: number) => void;
461
- readonly wasmblockchain_reset: (a: number) => number;
462
- readonly wasmblockchain_get_last_block_id: (a: number) => number;
463
- readonly wasmblockchain_get_last_timestamp: (a: number) => number;
464
- readonly wasmblockchain_get_longest_chain_hash_at: (a: number, b: number) => number;
465
- readonly wasmblockchain_get_last_block_hash: (a: number) => number;
466
- readonly wasmblockchain_get_last_burnfee: (a: number) => number;
467
- readonly wasmblockchain_get_genesis_block_id: (a: number) => number;
468
- readonly wasmblockchain_get_genesis_timestamp: (a: number) => number;
469
- readonly wasmblockchain_get_lowest_acceptable_timestamp: (a: number) => number;
470
- readonly wasmblockchain_get_lowest_acceptable_block_hash: (a: number) => number;
471
- readonly wasmblockchain_get_lowest_acceptable_block_id: (a: number) => number;
472
466
  readonly __wbg_wasmwallet_free: (a: number) => void;
473
467
  readonly wasmwallet_save: (a: number) => number;
474
468
  readonly wasmwallet_reset: (a: number) => number;
@@ -559,6 +553,21 @@ export interface InitOutput {
559
553
  readonly wasmblock_deserialize: (a: number, b: number, c: number) => void;
560
554
  readonly wasmblock_has_keylist_txs: (a: number, b: number) => number;
561
555
  readonly wasmblock_generate_lite_block: (a: number, b: number) => number;
556
+ readonly __wbg_wasmblockchain_free: (a: number) => void;
557
+ readonly wasmblockchain_reset: (a: number) => number;
558
+ readonly wasmblockchain_get_last_block_id: (a: number) => number;
559
+ readonly wasmblockchain_get_last_timestamp: (a: number) => number;
560
+ readonly wasmblockchain_get_longest_chain_hash_at: (a: number, b: number) => number;
561
+ readonly wasmblockchain_get_last_block_hash: (a: number) => number;
562
+ readonly wasmblockchain_get_last_burnfee: (a: number) => number;
563
+ readonly wasmblockchain_get_genesis_block_id: (a: number) => number;
564
+ readonly wasmblockchain_get_genesis_timestamp: (a: number) => number;
565
+ readonly wasmblockchain_get_lowest_acceptable_timestamp: (a: number) => number;
566
+ readonly wasmblockchain_get_lowest_acceptable_block_hash: (a: number) => number;
567
+ readonly wasmblockchain_get_lowest_acceptable_block_id: (a: number) => number;
568
+ readonly wasmblockchain_get_latest_block_id: (a: number) => number;
569
+ readonly wasmblockchain_get_longest_chain_hash_at_id: (a: number, b: number) => number;
570
+ readonly wasmblockchain_get_hashes_at_id: (a: number, b: number) => number;
562
571
  readonly __wbg_wasmconfiguration_free: (a: number) => void;
563
572
  readonly wasmconfiguration_new: () => number;
564
573
  readonly __wbg_saitowasm_free: (a: number) => void;
@@ -584,9 +593,7 @@ export interface InitOutput {
584
593
  readonly send_api_error: (a: number, b: number, c: number) => number;
585
594
  readonly get_wallet: () => number;
586
595
  readonly get_blockchain: () => number;
587
- readonly test_buffer_in: (a: number) => void;
588
- readonly test_buffer_out: () => number;
589
- readonly test_buffer_out_async: () => number;
596
+ readonly get_mempool_txs: () => number;
590
597
  readonly rustsecp256k1_v0_8_1_context_create: (a: number) => number;
591
598
  readonly rustsecp256k1_v0_8_1_context_destroy: (a: number) => void;
592
599
  readonly rustsecp256k1_v0_8_1_default_illegal_callback_fn: (a: number, b: number) => void;
package/pkg/web/index.js CHANGED
@@ -1,27 +1,31 @@
1
- import { MsgHandler } from './snippets/saito-wasm-ab5a63a608170761/js/msg_handler.js';
1
+ import { MsgHandler } from './snippets/saito-wasm-e4fc46f5034ac0a9/js/msg_handler.js';
2
2
 
3
3
  let wasm;
4
4
 
5
- const heap = new Array(128).fill(undefined);
6
-
7
- heap.push(undefined, null, true, false);
5
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
8
6
 
9
- function getObject(idx) { return heap[idx]; }
7
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
10
8
 
11
- let heap_next = heap.length;
9
+ let cachedUint8Memory0 = null;
12
10
 
13
- function dropObject(idx) {
14
- if (idx < 132) return;
15
- heap[idx] = heap_next;
16
- heap_next = idx;
11
+ function getUint8Memory0() {
12
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
13
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
14
+ }
15
+ return cachedUint8Memory0;
17
16
  }
18
17
 
19
- function takeObject(idx) {
20
- const ret = getObject(idx);
21
- dropObject(idx);
22
- return ret;
18
+ function getStringFromWasm0(ptr, len) {
19
+ ptr = ptr >>> 0;
20
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
23
21
  }
24
22
 
23
+ const heap = new Array(128).fill(undefined);
24
+
25
+ heap.push(undefined, null, true, false);
26
+
27
+ let heap_next = heap.length;
28
+
25
29
  function addHeapObject(obj) {
26
30
  if (heap_next === heap.length) heap.push(heap.length + 1);
27
31
  const idx = heap_next;
@@ -31,22 +35,18 @@ function addHeapObject(obj) {
31
35
  return idx;
32
36
  }
33
37
 
34
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
35
-
36
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
37
-
38
- let cachedUint8Memory0 = null;
38
+ function getObject(idx) { return heap[idx]; }
39
39
 
40
- function getUint8Memory0() {
41
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
42
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
43
- }
44
- return cachedUint8Memory0;
40
+ function dropObject(idx) {
41
+ if (idx < 132) return;
42
+ heap[idx] = heap_next;
43
+ heap_next = idx;
45
44
  }
46
45
 
47
- function getStringFromWasm0(ptr, len) {
48
- ptr = ptr >>> 0;
49
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
46
+ function takeObject(idx) {
47
+ const ret = getObject(idx);
48
+ dropObject(idx);
49
+ return ret;
50
50
  }
51
51
 
52
52
  let WASM_VECTOR_LEN = 0;
@@ -450,25 +450,10 @@ export function get_blockchain() {
450
450
  }
451
451
 
452
452
  /**
453
- * @param {Uint8Array} buffer
454
- */
455
- export function test_buffer_in(buffer) {
456
- wasm.test_buffer_in(addHeapObject(buffer));
457
- }
458
-
459
- /**
460
- * @returns {Uint8Array}
461
- */
462
- export function test_buffer_out() {
463
- const ret = wasm.test_buffer_out();
464
- return takeObject(ret);
465
- }
466
-
467
- /**
468
- * @returns {Promise<Uint8Array>}
453
+ * @returns {Promise<Array<any>>}
469
454
  */
470
- export function test_buffer_out_async() {
471
- const ret = wasm.test_buffer_out_async();
455
+ export function get_mempool_txs() {
456
+ const ret = wasm.get_mempool_txs();
472
457
  return takeObject(ret);
473
458
  }
474
459
 
@@ -476,7 +461,7 @@ function getArrayU8FromWasm0(ptr, len) {
476
461
  ptr = ptr >>> 0;
477
462
  return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
478
463
  }
479
- function __wbg_adapter_273(arg0, arg1, arg2, arg3) {
464
+ function __wbg_adapter_274(arg0, arg1, arg2, arg3) {
480
465
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h5cc70648b3a77aa5(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
481
466
  }
482
467
 
@@ -774,6 +759,29 @@ export class WasmBlockchain {
774
759
  const ret = wasm.wasmblockchain_get_lowest_acceptable_block_id(this.__wbg_ptr);
775
760
  return takeObject(ret);
776
761
  }
762
+ /**
763
+ * @returns {Promise<bigint>}
764
+ */
765
+ get_latest_block_id() {
766
+ const ret = wasm.wasmblockchain_get_latest_block_id(this.__wbg_ptr);
767
+ return takeObject(ret);
768
+ }
769
+ /**
770
+ * @param {bigint} block_id
771
+ * @returns {Promise<string>}
772
+ */
773
+ get_longest_chain_hash_at_id(block_id) {
774
+ const ret = wasm.wasmblockchain_get_longest_chain_hash_at_id(this.__wbg_ptr, block_id);
775
+ return takeObject(ret);
776
+ }
777
+ /**
778
+ * @param {bigint} block_id
779
+ * @returns {Promise<Array<any>>}
780
+ */
781
+ get_hashes_at_id(block_id) {
782
+ const ret = wasm.wasmblockchain_get_hashes_at_id(this.__wbg_ptr, block_id);
783
+ return takeObject(ret);
784
+ }
777
785
  }
778
786
 
779
787
  const WasmConfigurationFinalization = new FinalizationRegistry(ptr => wasm.__wbg_wasmconfiguration_free(ptr >>> 0));
@@ -1439,6 +1447,22 @@ async function __wbg_load(module, imports) {
1439
1447
  function __wbg_get_imports() {
1440
1448
  const imports = {};
1441
1449
  imports.wbg = {};
1450
+ imports.wbg.__wbg_wasmwallet_new = function(arg0) {
1451
+ const ret = WasmWallet.__wrap(arg0);
1452
+ return addHeapObject(ret);
1453
+ };
1454
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
1455
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
1456
+ return addHeapObject(ret);
1457
+ };
1458
+ imports.wbg.__wbg_wasmblock_new = function(arg0) {
1459
+ const ret = WasmBlock.__wrap(arg0);
1460
+ return addHeapObject(ret);
1461
+ };
1462
+ imports.wbg.__wbg_wasmtransaction_new = function(arg0) {
1463
+ const ret = WasmTransaction.__wrap(arg0);
1464
+ return addHeapObject(ret);
1465
+ };
1442
1466
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
1443
1467
  takeObject(arg0);
1444
1468
  };
@@ -1454,14 +1478,10 @@ function __wbg_get_imports() {
1454
1478
  const ret = getStringFromWasm0(arg0, arg1);
1455
1479
  return addHeapObject(ret);
1456
1480
  };
1457
- imports.wbg.__wbg_wasmtransaction_new = function(arg0) {
1458
- const ret = WasmTransaction.__wrap(arg0);
1481
+ imports.wbg.__wbg_wasmpeerservice_new = function(arg0) {
1482
+ const ret = WasmPeerService.__wrap(arg0);
1459
1483
  return addHeapObject(ret);
1460
1484
  };
1461
- imports.wbg.__wbindgen_is_falsy = function(arg0) {
1462
- const ret = !getObject(arg0);
1463
- return ret;
1464
- };
1465
1485
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
1466
1486
  const obj = getObject(arg1);
1467
1487
  const ret = typeof(obj) === 'string' ? obj : undefined;
@@ -1470,26 +1490,10 @@ function __wbg_get_imports() {
1470
1490
  getInt32Memory0()[arg0 / 4 + 1] = len1;
1471
1491
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
1472
1492
  };
1473
- imports.wbg.__wbg_wasmwallet_new = function(arg0) {
1474
- const ret = WasmWallet.__wrap(arg0);
1475
- return addHeapObject(ret);
1476
- };
1477
- imports.wbg.__wbg_wasmblock_new = function(arg0) {
1478
- const ret = WasmBlock.__wrap(arg0);
1479
- return addHeapObject(ret);
1480
- };
1481
1493
  imports.wbg.__wbg_wasmblockchain_new = function(arg0) {
1482
1494
  const ret = WasmBlockchain.__wrap(arg0);
1483
1495
  return addHeapObject(ret);
1484
1496
  };
1485
- imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
1486
- const ret = new Error(getStringFromWasm0(arg0, arg1));
1487
- return addHeapObject(ret);
1488
- };
1489
- imports.wbg.__wbg_wasmpeerservice_new = function(arg0) {
1490
- const ret = WasmPeerService.__wrap(arg0);
1491
- return addHeapObject(ret);
1492
- };
1493
1497
  imports.wbg.__wbg_wasmslip_new = function(arg0) {
1494
1498
  const ret = WasmSlip.__wrap(arg0);
1495
1499
  return addHeapObject(ret);
@@ -1507,21 +1511,21 @@ function __wbg_get_imports() {
1507
1511
  const ret = getObject(arg0) in getObject(arg1);
1508
1512
  return ret;
1509
1513
  };
1510
- imports.wbg.__wbg_sendmessage_2a7cb3960340003f = function(arg0, arg1) {
1514
+ imports.wbg.__wbg_sendmessage_bc28ea49c82675ac = function(arg0, arg1) {
1511
1515
  MsgHandler.send_message(takeObject(arg0), getObject(arg1));
1512
1516
  };
1513
- imports.wbg.__wbg_sendmessagetoall_8e1963596d87a6c9 = function(arg0, arg1) {
1517
+ imports.wbg.__wbg_sendmessagetoall_5128186d0c6f7c44 = function(arg0, arg1) {
1514
1518
  MsgHandler.send_message_to_all(getObject(arg0), getObject(arg1));
1515
1519
  };
1516
- imports.wbg.__wbg_connecttopeer_5f7b55d0b33d8945 = function() { return handleError(function (arg0) {
1520
+ imports.wbg.__wbg_connecttopeer_a5b7c0c1f322b314 = function() { return handleError(function (arg0) {
1517
1521
  const ret = MsgHandler.connect_to_peer(takeObject(arg0));
1518
1522
  return addHeapObject(ret);
1519
1523
  }, arguments) };
1520
- imports.wbg.__wbg_disconnectfrompeer_c4b18addc554f556 = function() { return handleError(function (arg0) {
1524
+ imports.wbg.__wbg_disconnectfrompeer_39f334f2d1f5df45 = function() { return handleError(function (arg0) {
1521
1525
  const ret = MsgHandler.disconnect_from_peer(takeObject(arg0));
1522
1526
  return addHeapObject(ret);
1523
1527
  }, arguments) };
1524
- imports.wbg.__wbg_fetchblockfrompeer_8c17ad7ddc49409a = function() { return handleError(function (arg0, arg1, arg2, arg3) {
1528
+ imports.wbg.__wbg_fetchblockfrompeer_5f8e079c86059e52 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
1525
1529
  let deferred0_0;
1526
1530
  let deferred0_1;
1527
1531
  try {
@@ -1533,7 +1537,7 @@ function __wbg_get_imports() {
1533
1537
  wasm.__wbindgen_free(deferred0_0, deferred0_1);
1534
1538
  }
1535
1539
  }, arguments) };
1536
- imports.wbg.__wbg_writevalue_9e55c94b97509b8e = function(arg0, arg1, arg2) {
1540
+ imports.wbg.__wbg_writevalue_e5fefa0841689686 = function(arg0, arg1, arg2) {
1537
1541
  let deferred0_0;
1538
1542
  let deferred0_1;
1539
1543
  try {
@@ -1544,7 +1548,7 @@ function __wbg_get_imports() {
1544
1548
  wasm.__wbindgen_free(deferred0_0, deferred0_1);
1545
1549
  }
1546
1550
  };
1547
- imports.wbg.__wbg_readvalue_0c81f78742bebea0 = function() { return handleError(function (arg0, arg1) {
1551
+ imports.wbg.__wbg_readvalue_cb7c63f12e2fcfc1 = function() { return handleError(function (arg0, arg1) {
1548
1552
  let deferred0_0;
1549
1553
  let deferred0_1;
1550
1554
  try {
@@ -1556,11 +1560,11 @@ function __wbg_get_imports() {
1556
1560
  wasm.__wbindgen_free(deferred0_0, deferred0_1);
1557
1561
  }
1558
1562
  }, arguments) };
1559
- imports.wbg.__wbg_loadblockfilelist_9accca826df805e3 = function() { return handleError(function () {
1563
+ imports.wbg.__wbg_loadblockfilelist_08aaeaaa82b17463 = function() { return handleError(function () {
1560
1564
  const ret = MsgHandler.load_block_file_list();
1561
1565
  return addHeapObject(ret);
1562
1566
  }, arguments) };
1563
- imports.wbg.__wbg_isexistingfile_60346c5e9a043ff5 = function() { return handleError(function (arg0, arg1) {
1567
+ imports.wbg.__wbg_isexistingfile_f833bbf4f449c4e7 = function() { return handleError(function (arg0, arg1) {
1564
1568
  let deferred0_0;
1565
1569
  let deferred0_1;
1566
1570
  try {
@@ -1572,7 +1576,7 @@ function __wbg_get_imports() {
1572
1576
  wasm.__wbindgen_free(deferred0_0, deferred0_1);
1573
1577
  }
1574
1578
  }, arguments) };
1575
- imports.wbg.__wbg_removevalue_cc0b7e61fa1e8819 = function() { return handleError(function (arg0, arg1) {
1579
+ imports.wbg.__wbg_removevalue_c4ab7b83f813a171 = function() { return handleError(function (arg0, arg1) {
1576
1580
  let deferred0_0;
1577
1581
  let deferred0_1;
1578
1582
  try {
@@ -1584,16 +1588,16 @@ function __wbg_get_imports() {
1584
1588
  wasm.__wbindgen_free(deferred0_0, deferred0_1);
1585
1589
  }
1586
1590
  }, arguments) };
1587
- imports.wbg.__wbg_processapicall_5feead2a6c49333c = function(arg0, arg1, arg2) {
1591
+ imports.wbg.__wbg_processapicall_1ae12e2f6bc1b845 = function(arg0, arg1, arg2) {
1588
1592
  MsgHandler.process_api_call(takeObject(arg0), arg1 >>> 0, BigInt.asUintN(64, arg2));
1589
1593
  };
1590
- imports.wbg.__wbg_processapisuccess_2294422cdc32f937 = function(arg0, arg1, arg2) {
1594
+ imports.wbg.__wbg_processapisuccess_597da43ed8731c2f = function(arg0, arg1, arg2) {
1591
1595
  MsgHandler.process_api_success(takeObject(arg0), arg1 >>> 0, BigInt.asUintN(64, arg2));
1592
1596
  };
1593
- imports.wbg.__wbg_processapierror_49e99c8b78279760 = function(arg0, arg1, arg2) {
1597
+ imports.wbg.__wbg_processapierror_a71aba96980c82ce = function(arg0, arg1, arg2) {
1594
1598
  MsgHandler.process_api_error(takeObject(arg0), arg1 >>> 0, BigInt.asUintN(64, arg2));
1595
1599
  };
1596
- imports.wbg.__wbg_sendinterfaceevent_99ba5a26d98773f2 = function(arg0, arg1, arg2) {
1600
+ imports.wbg.__wbg_sendinterfaceevent_cd7f8de0e2907421 = function(arg0, arg1, arg2) {
1597
1601
  let deferred0_0;
1598
1602
  let deferred0_1;
1599
1603
  try {
@@ -1604,7 +1608,7 @@ function __wbg_get_imports() {
1604
1608
  wasm.__wbindgen_free(deferred0_0, deferred0_1);
1605
1609
  }
1606
1610
  };
1607
- imports.wbg.__wbg_sendblocksuccess_a6b946b45c44c52e = function(arg0, arg1, arg2) {
1611
+ imports.wbg.__wbg_sendblocksuccess_405274aa2f9747b3 = function(arg0, arg1, arg2) {
1608
1612
  let deferred0_0;
1609
1613
  let deferred0_1;
1610
1614
  try {
@@ -1615,18 +1619,22 @@ function __wbg_get_imports() {
1615
1619
  wasm.__wbindgen_free(deferred0_0, deferred0_1);
1616
1620
  }
1617
1621
  };
1618
- imports.wbg.__wbg_savewallet_43d0b07b379bb519 = function() {
1622
+ imports.wbg.__wbg_savewallet_7387f03066474245 = function() {
1619
1623
  MsgHandler.save_wallet();
1620
1624
  };
1621
- imports.wbg.__wbg_loadwallet_46802d85c0a99c4d = function() {
1625
+ imports.wbg.__wbg_loadwallet_0d0b6e72f2e2d24d = function() {
1622
1626
  MsgHandler.load_wallet();
1623
1627
  };
1624
- imports.wbg.__wbg_getmyservices_07cd9026693aca08 = function() {
1628
+ imports.wbg.__wbg_getmyservices_5cdd70799e488036 = function() {
1625
1629
  const ret = MsgHandler.get_my_services();
1626
1630
  _assertClass(ret, WasmPeerServiceList);
1627
1631
  var ptr1 = ret.__destroy_into_raw();
1628
1632
  return ptr1;
1629
1633
  };
1634
+ imports.wbg.__wbindgen_is_falsy = function(arg0) {
1635
+ const ret = !getObject(arg0);
1636
+ return ret;
1637
+ };
1630
1638
  imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
1631
1639
  const ret = getObject(arg0) == getObject(arg1);
1632
1640
  return ret;
@@ -1812,7 +1820,7 @@ function __wbg_get_imports() {
1812
1820
  const a = state0.a;
1813
1821
  state0.a = 0;
1814
1822
  try {
1815
- return __wbg_adapter_273(a, state0.b, arg0, arg1);
1823
+ return __wbg_adapter_274(a, state0.b, arg0, arg1);
1816
1824
  } finally {
1817
1825
  state0.a = a;
1818
1826
  }
@@ -1890,8 +1898,8 @@ function __wbg_get_imports() {
1890
1898
  const ret = wasm.memory;
1891
1899
  return addHeapObject(ret);
1892
1900
  };
1893
- imports.wbg.__wbindgen_closure_wrapper937 = function(arg0, arg1, arg2) {
1894
- const ret = makeMutClosure(arg0, arg1, 312, __wbg_adapter_40);
1901
+ imports.wbg.__wbindgen_closure_wrapper952 = function(arg0, arg1, arg2) {
1902
+ const ret = makeMutClosure(arg0, arg1, 318, __wbg_adapter_40);
1895
1903
  return addHeapObject(ret);
1896
1904
  };
1897
1905
 
Binary file
@@ -1,18 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function __wbg_wasmblockchain_free(a: number): void;
5
- export function wasmblockchain_reset(a: number): number;
6
- export function wasmblockchain_get_last_block_id(a: number): number;
7
- export function wasmblockchain_get_last_timestamp(a: number): number;
8
- export function wasmblockchain_get_longest_chain_hash_at(a: number, b: number): number;
9
- export function wasmblockchain_get_last_block_hash(a: number): number;
10
- export function wasmblockchain_get_last_burnfee(a: number): number;
11
- export function wasmblockchain_get_genesis_block_id(a: number): number;
12
- export function wasmblockchain_get_genesis_timestamp(a: number): number;
13
- export function wasmblockchain_get_lowest_acceptable_timestamp(a: number): number;
14
- export function wasmblockchain_get_lowest_acceptable_block_hash(a: number): number;
15
- export function wasmblockchain_get_lowest_acceptable_block_id(a: number): number;
16
4
  export function __wbg_wasmwallet_free(a: number): void;
17
5
  export function wasmwallet_save(a: number): number;
18
6
  export function wasmwallet_reset(a: number): number;
@@ -103,6 +91,21 @@ export function wasmblock_serialize(a: number): number;
103
91
  export function wasmblock_deserialize(a: number, b: number, c: number): void;
104
92
  export function wasmblock_has_keylist_txs(a: number, b: number): number;
105
93
  export function wasmblock_generate_lite_block(a: number, b: number): number;
94
+ export function __wbg_wasmblockchain_free(a: number): void;
95
+ export function wasmblockchain_reset(a: number): number;
96
+ export function wasmblockchain_get_last_block_id(a: number): number;
97
+ export function wasmblockchain_get_last_timestamp(a: number): number;
98
+ export function wasmblockchain_get_longest_chain_hash_at(a: number, b: number): number;
99
+ export function wasmblockchain_get_last_block_hash(a: number): number;
100
+ export function wasmblockchain_get_last_burnfee(a: number): number;
101
+ export function wasmblockchain_get_genesis_block_id(a: number): number;
102
+ export function wasmblockchain_get_genesis_timestamp(a: number): number;
103
+ export function wasmblockchain_get_lowest_acceptable_timestamp(a: number): number;
104
+ export function wasmblockchain_get_lowest_acceptable_block_hash(a: number): number;
105
+ export function wasmblockchain_get_lowest_acceptable_block_id(a: number): number;
106
+ export function wasmblockchain_get_latest_block_id(a: number): number;
107
+ export function wasmblockchain_get_longest_chain_hash_at_id(a: number, b: number): number;
108
+ export function wasmblockchain_get_hashes_at_id(a: number, b: number): number;
106
109
  export function __wbg_wasmconfiguration_free(a: number): void;
107
110
  export function wasmconfiguration_new(): number;
108
111
  export function __wbg_saitowasm_free(a: number): void;
@@ -128,9 +131,7 @@ export function send_api_success(a: number, b: number, c: number): number;
128
131
  export function send_api_error(a: number, b: number, c: number): number;
129
132
  export function get_wallet(): number;
130
133
  export function get_blockchain(): number;
131
- export function test_buffer_in(a: number): void;
132
- export function test_buffer_out(): number;
133
- export function test_buffer_out_async(): number;
134
+ export function get_mempool_txs(): number;
134
135
  export function rustsecp256k1_v0_8_1_context_create(a: number): number;
135
136
  export function rustsecp256k1_v0_8_1_context_destroy(a: number): void;
136
137
  export function rustsecp256k1_v0_8_1_default_illegal_callback_fn(a: number, b: number): void;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saito-wasm",
3
- "version": "0.0.12",
3
+ "version": "0.0.18",
4
4
  "files": [
5
5
  "index_bg.wasm",
6
6
  "index.js",
@@ -1,11 +1,9 @@
1
1
  class MsgHandler {
2
2
  static send_message(peer_index, buffer) {
3
- console.debug("MsgHandler::send_message : " + peer_index);
4
3
  return global.shared_methods.send_message(peer_index, buffer);
5
4
  }
6
5
 
7
6
  static send_message_to_all(buffer, exceptions) {
8
- console.debug("MsgHandler::send_message_to_all");
9
7
  return global.shared_methods.send_message_to_all(buffer, exceptions);
10
8
  }
11
9