saito-wasm 0.0.16 → 0.0.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saito-wasm",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
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
@@ -4,26 +4,30 @@ let wasm;
4
4
  const { MsgHandler } = require(String.raw`./snippets/saito-wasm-ab5a63a608170761/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);
@@ -1616,6 +1619,11 @@ module.exports.__wbg_getmyservices_07cd9026693aca08 = function() {
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;
@@ -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
@@ -2,26 +2,30 @@ import { MsgHandler } from './snippets/saito-wasm-ab5a63a608170761/js/msg_handle
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);
@@ -1627,6 +1631,10 @@ function __wbg_get_imports() {
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;