saito-wasm 0.2.4 → 0.2.6

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.4"
3
+ version = "0.2.6"
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.4",
3
+ "version": "0.2.6",
4
4
  "description": "js wrappings around saito-core using wasm",
5
5
  "scripts": {
6
6
  "test": "./node_modules/.bin/jest",
@@ -588,10 +588,9 @@ export class WasmTransaction {
588
588
  */
589
589
  is_to(key: string): boolean;
590
590
  /**
591
- * @param {string} private_key
592
591
  * @returns {Promise<void>}
593
592
  */
594
- sign(private_key: string): Promise<void>;
593
+ sign(): Promise<void>;
595
594
  /**
596
595
  * @returns {Uint8Array}
597
596
  */
package/pkg/node/index.js CHANGED
@@ -1,9 +1,29 @@
1
1
  let imports = {};
2
2
  imports['__wbindgen_placeholder__'] = module.exports;
3
3
  let wasm;
4
- const { MsgHandler } = require(String.raw`./snippets/saito-wasm-a07e1fafe917b5c6/js/msg_handler.js`);
4
+ const { MsgHandler } = require(String.raw`./snippets/saito-wasm-85a38d0d1511b673/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);
10
+
11
+ function getObject(idx) { return heap[idx]; }
12
+
13
+ let heap_next = heap.length;
14
+
15
+ function dropObject(idx) {
16
+ if (idx < 132) return;
17
+ heap[idx] = heap_next;
18
+ heap_next = idx;
19
+ }
20
+
21
+ function takeObject(idx) {
22
+ const ret = getObject(idx);
23
+ dropObject(idx);
24
+ return ret;
25
+ }
26
+
7
27
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
8
28
 
9
29
  cachedTextDecoder.decode();
@@ -22,12 +42,6 @@ function getStringFromWasm0(ptr, len) {
22
42
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
23
43
  }
24
44
 
25
- const heap = new Array(128).fill(undefined);
26
-
27
- heap.push(undefined, null, true, false);
28
-
29
- let heap_next = heap.length;
30
-
31
45
  function addHeapObject(obj) {
32
46
  if (heap_next === heap.length) heap.push(heap.length + 1);
33
47
  const idx = heap_next;
@@ -37,20 +51,6 @@ function addHeapObject(obj) {
37
51
  return idx;
38
52
  }
39
53
 
40
- function getObject(idx) { return heap[idx]; }
41
-
42
- function dropObject(idx) {
43
- if (idx < 132) return;
44
- heap[idx] = heap_next;
45
- heap_next = idx;
46
- }
47
-
48
- function takeObject(idx) {
49
- const ret = getObject(idx);
50
- dropObject(idx);
51
- return ret;
52
- }
53
-
54
54
  let WASM_VECTOR_LEN = 0;
55
55
 
56
56
  let cachedTextEncoder = new TextEncoder('utf-8');
@@ -582,7 +582,7 @@ function handleError(f, args) {
582
582
  wasm.__wbindgen_exn_store(addHeapObject(e));
583
583
  }
584
584
  }
585
- function __wbg_adapter_374(arg0, arg1, arg2, arg3) {
585
+ function __wbg_adapter_372(arg0, arg1, arg2, arg3) {
586
586
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h633d734e7d6d6514(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
587
587
  }
588
588
 
@@ -1856,11 +1856,10 @@ class WasmTransaction {
1856
1856
  wasm.wasmtransaction_set_timestamp(this.__wbg_ptr, timestamp);
1857
1857
  }
1858
1858
  /**
1859
- * @param {string} private_key
1860
1859
  * @returns {Promise<void>}
1861
1860
  */
1862
- sign(private_key) {
1863
- const ret = wasm.wasmtransaction_sign(this.__wbg_ptr, addHeapObject(private_key));
1861
+ sign() {
1862
+ const ret = wasm.wasmtransaction_sign(this.__wbg_ptr);
1864
1863
  return takeObject(ret);
1865
1864
  }
1866
1865
  /**
@@ -2068,7 +2067,7 @@ class WasmWalletSlip {
2068
2067
  * @returns {string}
2069
2068
  */
2070
2069
  get_utxokey() {
2071
- const ret = wasm.wasmslip_utxo_key(this.__wbg_ptr);
2070
+ const ret = wasm.wasmwalletslip_get_utxokey(this.__wbg_ptr);
2072
2071
  return takeObject(ret);
2073
2072
  }
2074
2073
  /**
@@ -2165,22 +2164,17 @@ class WasmWalletSlip {
2165
2164
  }
2166
2165
  module.exports.WasmWalletSlip = WasmWalletSlip;
2167
2166
 
2168
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
2169
- const ret = getStringFromWasm0(arg0, arg1);
2170
- return addHeapObject(ret);
2171
- };
2172
-
2173
2167
  module.exports.__wbindgen_object_drop_ref = function(arg0) {
2174
2168
  takeObject(arg0);
2175
2169
  };
2176
2170
 
2177
- module.exports.__wbg_wasmblock_new = function(arg0) {
2178
- const ret = WasmBlock.__wrap(arg0);
2171
+ module.exports.__wbg_wasmwallet_new = function(arg0) {
2172
+ const ret = WasmWallet.__wrap(arg0);
2179
2173
  return addHeapObject(ret);
2180
2174
  };
2181
2175
 
2182
- module.exports.__wbg_wasmtransaction_new = function(arg0) {
2183
- const ret = WasmTransaction.__wrap(arg0);
2176
+ module.exports.__wbindgen_string_new = function(arg0, arg1) {
2177
+ const ret = getStringFromWasm0(arg0, arg1);
2184
2178
  return addHeapObject(ret);
2185
2179
  };
2186
2180
 
@@ -2189,13 +2183,13 @@ module.exports.__wbindgen_bigint_from_u64 = function(arg0) {
2189
2183
  return addHeapObject(ret);
2190
2184
  };
2191
2185
 
2192
- module.exports.__wbg_wasmblockchain_new = function(arg0) {
2193
- const ret = WasmBlockchain.__wrap(arg0);
2186
+ module.exports.__wbg_wasmtransaction_new = function(arg0) {
2187
+ const ret = WasmTransaction.__wrap(arg0);
2194
2188
  return addHeapObject(ret);
2195
2189
  };
2196
2190
 
2197
- module.exports.__wbg_wasmpeer_new = function(arg0) {
2198
- const ret = WasmPeer.__wrap(arg0);
2191
+ module.exports.__wbg_wasmblock_new = function(arg0) {
2192
+ const ret = WasmBlock.__wrap(arg0);
2199
2193
  return addHeapObject(ret);
2200
2194
  };
2201
2195
 
@@ -2204,18 +2198,23 @@ module.exports.__wbg_wasmbalancesnapshot_new = function(arg0) {
2204
2198
  return addHeapObject(ret);
2205
2199
  };
2206
2200
 
2207
- module.exports.__wbg_wasmslip_new = function(arg0) {
2208
- const ret = WasmSlip.__wrap(arg0);
2201
+ module.exports.__wbg_wasmwalletslip_new = function(arg0) {
2202
+ const ret = WasmWalletSlip.__wrap(arg0);
2209
2203
  return addHeapObject(ret);
2210
2204
  };
2211
2205
 
2212
- module.exports.__wbg_wasmwalletslip_new = function(arg0) {
2213
- const ret = WasmWalletSlip.__wrap(arg0);
2206
+ module.exports.__wbg_wasmpeer_new = function(arg0) {
2207
+ const ret = WasmPeer.__wrap(arg0);
2214
2208
  return addHeapObject(ret);
2215
2209
  };
2216
2210
 
2217
- module.exports.__wbg_wasmwallet_new = function(arg0) {
2218
- const ret = WasmWallet.__wrap(arg0);
2211
+ module.exports.__wbg_wasmblockchain_new = function(arg0) {
2212
+ const ret = WasmBlockchain.__wrap(arg0);
2213
+ return addHeapObject(ret);
2214
+ };
2215
+
2216
+ module.exports.__wbg_wasmslip_new = function(arg0) {
2217
+ const ret = WasmSlip.__wrap(arg0);
2219
2218
  return addHeapObject(ret);
2220
2219
  };
2221
2220
 
@@ -2248,15 +2247,15 @@ module.exports.__wbg_wasmpeerservice_new = function(arg0) {
2248
2247
  return addHeapObject(ret);
2249
2248
  };
2250
2249
 
2251
- module.exports.__wbg_sendmessage_111cd294d0a1ba24 = function(arg0, arg1) {
2250
+ module.exports.__wbg_sendmessage_d26d631079e7972e = function(arg0, arg1) {
2252
2251
  MsgHandler.send_message(takeObject(arg0), getObject(arg1));
2253
2252
  };
2254
2253
 
2255
- module.exports.__wbg_sendmessagetoall_099731cb25195ffa = function(arg0, arg1) {
2254
+ module.exports.__wbg_sendmessagetoall_767fe6a653155589 = function(arg0, arg1) {
2256
2255
  MsgHandler.send_message_to_all(getObject(arg0), getObject(arg1));
2257
2256
  };
2258
2257
 
2259
- module.exports.__wbg_connecttopeer_34eab1844d61a5c0 = function() { return handleError(function (arg0, arg1, arg2) {
2258
+ module.exports.__wbg_connecttopeer_3e5a8d255a863186 = function() { return handleError(function (arg0, arg1, arg2) {
2260
2259
  let deferred0_0;
2261
2260
  let deferred0_1;
2262
2261
  try {
@@ -2269,12 +2268,12 @@ module.exports.__wbg_connecttopeer_34eab1844d61a5c0 = function() { return handle
2269
2268
  }
2270
2269
  }, arguments) };
2271
2270
 
2272
- module.exports.__wbg_disconnectfrompeer_08a68134af793703 = function() { return handleError(function (arg0) {
2271
+ module.exports.__wbg_disconnectfrompeer_c90b6ed7778a6070 = function() { return handleError(function (arg0) {
2273
2272
  const ret = MsgHandler.disconnect_from_peer(takeObject(arg0));
2274
2273
  return addHeapObject(ret);
2275
2274
  }, arguments) };
2276
2275
 
2277
- module.exports.__wbg_fetchblockfrompeer_7130e7753ae6e06c = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2276
+ module.exports.__wbg_fetchblockfrompeer_9ae8da796cdd9ccc = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2278
2277
  let deferred0_0;
2279
2278
  let deferred0_1;
2280
2279
  try {
@@ -2287,7 +2286,7 @@ module.exports.__wbg_fetchblockfrompeer_7130e7753ae6e06c = function() { return h
2287
2286
  }
2288
2287
  }, arguments) };
2289
2288
 
2290
- module.exports.__wbg_writevalue_911fb41ea9729264 = function(arg0, arg1, arg2) {
2289
+ module.exports.__wbg_writevalue_82bbfb598e61c29e = function(arg0, arg1, arg2) {
2291
2290
  let deferred0_0;
2292
2291
  let deferred0_1;
2293
2292
  try {
@@ -2299,7 +2298,7 @@ module.exports.__wbg_writevalue_911fb41ea9729264 = function(arg0, arg1, arg2) {
2299
2298
  }
2300
2299
  };
2301
2300
 
2302
- module.exports.__wbg_appendvalue_5c921467f4ba535e = function(arg0, arg1, arg2) {
2301
+ module.exports.__wbg_appendvalue_62f8251b6942f759 = function(arg0, arg1, arg2) {
2303
2302
  let deferred0_0;
2304
2303
  let deferred0_1;
2305
2304
  try {
@@ -2311,7 +2310,7 @@ module.exports.__wbg_appendvalue_5c921467f4ba535e = function(arg0, arg1, arg2) {
2311
2310
  }
2312
2311
  };
2313
2312
 
2314
- module.exports.__wbg_flushdata_69c2b56988946a06 = function(arg0, arg1) {
2313
+ module.exports.__wbg_flushdata_ddac78ca401e0844 = function(arg0, arg1) {
2315
2314
  let deferred0_0;
2316
2315
  let deferred0_1;
2317
2316
  try {
@@ -2323,7 +2322,7 @@ module.exports.__wbg_flushdata_69c2b56988946a06 = function(arg0, arg1) {
2323
2322
  }
2324
2323
  };
2325
2324
 
2326
- module.exports.__wbg_readvalue_a0ef58f234498dc1 = function() { return handleError(function (arg0, arg1) {
2325
+ module.exports.__wbg_readvalue_aae34bfe629835d9 = function() { return handleError(function (arg0, arg1) {
2327
2326
  let deferred0_0;
2328
2327
  let deferred0_1;
2329
2328
  try {
@@ -2336,12 +2335,12 @@ module.exports.__wbg_readvalue_a0ef58f234498dc1 = function() { return handleErro
2336
2335
  }
2337
2336
  }, arguments) };
2338
2337
 
2339
- module.exports.__wbg_loadblockfilelist_6deeaa1c5a65039b = function() { return handleError(function () {
2338
+ module.exports.__wbg_loadblockfilelist_800a58c25da71868 = function() { return handleError(function () {
2340
2339
  const ret = MsgHandler.load_block_file_list();
2341
2340
  return addHeapObject(ret);
2342
2341
  }, arguments) };
2343
2342
 
2344
- module.exports.__wbg_isexistingfile_dccfea43fa6c57a4 = function() { return handleError(function (arg0, arg1) {
2343
+ module.exports.__wbg_isexistingfile_23a3fb33acbbd80f = function() { return handleError(function (arg0, arg1) {
2345
2344
  let deferred0_0;
2346
2345
  let deferred0_1;
2347
2346
  try {
@@ -2354,7 +2353,7 @@ module.exports.__wbg_isexistingfile_dccfea43fa6c57a4 = function() { return handl
2354
2353
  }
2355
2354
  }, arguments) };
2356
2355
 
2357
- module.exports.__wbg_removevalue_8d74a068d1ccffa9 = function() { return handleError(function (arg0, arg1) {
2356
+ module.exports.__wbg_removevalue_46d840deac0c4803 = function() { return handleError(function (arg0, arg1) {
2358
2357
  let deferred0_0;
2359
2358
  let deferred0_1;
2360
2359
  try {
@@ -2367,7 +2366,7 @@ module.exports.__wbg_removevalue_8d74a068d1ccffa9 = function() { return handleEr
2367
2366
  }
2368
2367
  }, arguments) };
2369
2368
 
2370
- module.exports.__wbg_ensureblockdirectoryexists_79540c3dff4ee1cf = function() { return handleError(function (arg0, arg1) {
2369
+ module.exports.__wbg_ensureblockdirectoryexists_15554c117deaa3c6 = function() { return handleError(function (arg0, arg1) {
2371
2370
  let deferred0_0;
2372
2371
  let deferred0_1;
2373
2372
  try {
@@ -2379,19 +2378,19 @@ module.exports.__wbg_ensureblockdirectoryexists_79540c3dff4ee1cf = function() {
2379
2378
  }
2380
2379
  }, arguments) };
2381
2380
 
2382
- module.exports.__wbg_processapicall_5ad8351d24492723 = function(arg0, arg1, arg2) {
2381
+ module.exports.__wbg_processapicall_9af7fcc8479f7e5c = function(arg0, arg1, arg2) {
2383
2382
  MsgHandler.process_api_call(takeObject(arg0), arg1 >>> 0, BigInt.asUintN(64, arg2));
2384
2383
  };
2385
2384
 
2386
- module.exports.__wbg_processapisuccess_eaca7c1703abc148 = function(arg0, arg1, arg2) {
2385
+ module.exports.__wbg_processapisuccess_cef3d5002c643541 = function(arg0, arg1, arg2) {
2387
2386
  MsgHandler.process_api_success(takeObject(arg0), arg1 >>> 0, BigInt.asUintN(64, arg2));
2388
2387
  };
2389
2388
 
2390
- module.exports.__wbg_processapierror_148539df8cba6e1c = function(arg0, arg1, arg2) {
2389
+ module.exports.__wbg_processapierror_0fa072d72a578db8 = function(arg0, arg1, arg2) {
2391
2390
  MsgHandler.process_api_error(takeObject(arg0), arg1 >>> 0, BigInt.asUintN(64, arg2));
2392
2391
  };
2393
2392
 
2394
- module.exports.__wbg_sendinterfaceevent_c214ce9e2a672dd1 = function(arg0, arg1, arg2) {
2393
+ module.exports.__wbg_sendinterfaceevent_88b4d4a5728022b1 = function(arg0, arg1, arg2) {
2395
2394
  let deferred0_0;
2396
2395
  let deferred0_1;
2397
2396
  try {
@@ -2403,7 +2402,7 @@ module.exports.__wbg_sendinterfaceevent_c214ce9e2a672dd1 = function(arg0, arg1,
2403
2402
  }
2404
2403
  };
2405
2404
 
2406
- module.exports.__wbg_sendblocksuccess_9628c887be151962 = function(arg0, arg1, arg2) {
2405
+ module.exports.__wbg_sendblocksuccess_4728a163332d53c9 = function(arg0, arg1, arg2) {
2407
2406
  let deferred0_0;
2408
2407
  let deferred0_1;
2409
2408
  try {
@@ -2415,11 +2414,11 @@ module.exports.__wbg_sendblocksuccess_9628c887be151962 = function(arg0, arg1, ar
2415
2414
  }
2416
2415
  };
2417
2416
 
2418
- module.exports.__wbg_sendwalletupdate_8343add8492cdd78 = function() {
2417
+ module.exports.__wbg_sendwalletupdate_f931362359108be7 = function() {
2419
2418
  MsgHandler.send_wallet_update();
2420
2419
  };
2421
2420
 
2422
- module.exports.__wbg_sendnewversionalert_97d88b033f29573c = function(arg0, arg1, arg2) {
2421
+ module.exports.__wbg_sendnewversionalert_77bf6d74fe788061 = function(arg0, arg1, arg2) {
2423
2422
  let deferred0_0;
2424
2423
  let deferred0_1;
2425
2424
  try {
@@ -2431,15 +2430,15 @@ module.exports.__wbg_sendnewversionalert_97d88b033f29573c = function(arg0, arg1,
2431
2430
  }
2432
2431
  };
2433
2432
 
2434
- module.exports.__wbg_savewallet_cd7d81c6ba423855 = function() {
2433
+ module.exports.__wbg_savewallet_8e2925a27385680c = function() {
2435
2434
  MsgHandler.save_wallet();
2436
2435
  };
2437
2436
 
2438
- module.exports.__wbg_loadwallet_1df5c65c3397d11c = function() {
2437
+ module.exports.__wbg_loadwallet_85e9ee8adf8f8653 = function() {
2439
2438
  MsgHandler.load_wallet();
2440
2439
  };
2441
2440
 
2442
- module.exports.__wbg_getmyservices_f959eef99aa33bb1 = function() {
2441
+ module.exports.__wbg_getmyservices_08c9cff42d43cd20 = function() {
2443
2442
  const ret = MsgHandler.get_my_services();
2444
2443
  _assertClass(ret, WasmPeerServiceList);
2445
2444
  var ptr1 = ret.__destroy_into_raw();
@@ -2637,11 +2636,6 @@ module.exports.__wbg_call_27c0f87801dedf93 = function() { return handleError(fun
2637
2636
  return addHeapObject(ret);
2638
2637
  }, arguments) };
2639
2638
 
2640
- module.exports.__wbg_length_dee433d4c85c9387 = function(arg0) {
2641
- const ret = getObject(arg0).length;
2642
- return ret;
2643
- };
2644
-
2645
2639
  module.exports.__wbg_self_ce0dbfc45cf2f5be = function() { return handleError(function () {
2646
2640
  const ret = self.self;
2647
2641
  return addHeapObject(ret);
@@ -2714,7 +2708,7 @@ module.exports.__wbg_new_81740750da40724f = function(arg0, arg1) {
2714
2708
  const a = state0.a;
2715
2709
  state0.a = 0;
2716
2710
  try {
2717
- return __wbg_adapter_374(a, state0.b, arg0, arg1);
2711
+ return __wbg_adapter_372(a, state0.b, arg0, arg1);
2718
2712
  } finally {
2719
2713
  state0.a = a;
2720
2714
  }
@@ -2812,7 +2806,7 @@ module.exports.__wbindgen_memory = function() {
2812
2806
  return addHeapObject(ret);
2813
2807
  };
2814
2808
 
2815
- module.exports.__wbindgen_closure_wrapper1210 = function(arg0, arg1, arg2) {
2809
+ module.exports.__wbindgen_closure_wrapper1209 = function(arg0, arg1, arg2) {
2816
2810
  const ret = makeMutClosure(arg0, arg1, 456, __wbg_adapter_38);
2817
2811
  return addHeapObject(ret);
2818
2812
  };
Binary file
@@ -161,7 +161,7 @@ export function wasmtransaction_get_data(a: number): number;
161
161
  export function wasmtransaction_set_data(a: number, b: number): void;
162
162
  export function wasmtransaction_get_timestamp(a: number): number;
163
163
  export function wasmtransaction_set_timestamp(a: number, b: number): void;
164
- export function wasmtransaction_sign(a: number, b: number): number;
164
+ export function wasmtransaction_sign(a: number): number;
165
165
  export function wasmtransaction_get_type(a: number): number;
166
166
  export function wasmtransaction_set_type(a: number, b: number): void;
167
167
  export function wasmtransaction_total_fees(a: number): number;
@@ -182,6 +182,7 @@ export function wasmwallet_get_slips(a: number): number;
182
182
  export function wasmwallet_add_slip(a: number, b: number): number;
183
183
  export function wasmwallet_get_key_list(a: number): number;
184
184
  export function wasmwallet_set_key_list(a: number, b: number): number;
185
+ export function wasmwalletslip_get_utxokey(a: number): number;
185
186
  export function wasmwalletslip_set_utxokey(a: number, b: number): void;
186
187
  export function wasmwalletslip_get_slip_index(a: number): number;
187
188
  export function wasmwalletslip_set_slip_index(a: number, b: number): void;
@@ -196,7 +197,6 @@ export function wasmwalletslip_get_tx_ordinal(a: number): number;
196
197
  export function wasmwalletslip_set_amount(a: number, b: number): void;
197
198
  export function wasmwalletslip_set_block_id(a: number, b: number): void;
198
199
  export function wasmwalletslip_set_tx_ordinal(a: number, b: number): void;
199
- export function wasmwalletslip_get_utxokey(a: number): number;
200
200
  export function __wbg_wasmhop_free(a: number): void;
201
201
  export function wasmhop_from(a: number, b: number): void;
202
202
  export function wasmhop_sig(a: number, b: number): void;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saito-wasm",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "files": [
5
5
  "index_bg.wasm",
6
6
  "index.js",
@@ -588,10 +588,9 @@ export class WasmTransaction {
588
588
  */
589
589
  is_to(key: string): boolean;
590
590
  /**
591
- * @param {string} private_key
592
591
  * @returns {Promise<void>}
593
592
  */
594
- sign(private_key: string): Promise<void>;
593
+ sign(): Promise<void>;
595
594
  /**
596
595
  * @returns {Uint8Array}
597
596
  */
@@ -919,7 +918,7 @@ export interface InitOutput {
919
918
  readonly wasmtransaction_set_data: (a: number, b: number) => void;
920
919
  readonly wasmtransaction_get_timestamp: (a: number) => number;
921
920
  readonly wasmtransaction_set_timestamp: (a: number, b: number) => void;
922
- readonly wasmtransaction_sign: (a: number, b: number) => number;
921
+ readonly wasmtransaction_sign: (a: number) => number;
923
922
  readonly wasmtransaction_get_type: (a: number) => number;
924
923
  readonly wasmtransaction_set_type: (a: number, b: number) => void;
925
924
  readonly wasmtransaction_total_fees: (a: number) => number;
@@ -940,6 +939,7 @@ export interface InitOutput {
940
939
  readonly wasmwallet_add_slip: (a: number, b: number) => number;
941
940
  readonly wasmwallet_get_key_list: (a: number) => number;
942
941
  readonly wasmwallet_set_key_list: (a: number, b: number) => number;
942
+ readonly wasmwalletslip_get_utxokey: (a: number) => number;
943
943
  readonly wasmwalletslip_set_utxokey: (a: number, b: number) => void;
944
944
  readonly wasmwalletslip_get_slip_index: (a: number) => number;
945
945
  readonly wasmwalletslip_set_slip_index: (a: number, b: number) => void;
@@ -954,7 +954,6 @@ export interface InitOutput {
954
954
  readonly wasmwalletslip_set_amount: (a: number, b: number) => void;
955
955
  readonly wasmwalletslip_set_block_id: (a: number, b: number) => void;
956
956
  readonly wasmwalletslip_set_tx_ordinal: (a: number, b: number) => void;
957
- readonly wasmwalletslip_get_utxokey: (a: number) => number;
958
957
  readonly __wbg_wasmhop_free: (a: number) => void;
959
958
  readonly wasmhop_from: (a: number, b: number) => void;
960
959
  readonly wasmhop_sig: (a: number, b: number) => void;
package/pkg/web/index.js CHANGED
@@ -1,7 +1,27 @@
1
- import { MsgHandler } from './snippets/saito-wasm-a07e1fafe917b5c6/js/msg_handler.js';
1
+ import { MsgHandler } from './snippets/saito-wasm-85a38d0d1511b673/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);
8
+
9
+ function getObject(idx) { return heap[idx]; }
10
+
11
+ let heap_next = heap.length;
12
+
13
+ function dropObject(idx) {
14
+ if (idx < 132) return;
15
+ heap[idx] = heap_next;
16
+ heap_next = idx;
17
+ }
18
+
19
+ function takeObject(idx) {
20
+ const ret = getObject(idx);
21
+ dropObject(idx);
22
+ return ret;
23
+ }
24
+
5
25
  const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
6
26
 
7
27
  if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
@@ -20,12 +40,6 @@ function getStringFromWasm0(ptr, len) {
20
40
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
21
41
  }
22
42
 
23
- const heap = new Array(128).fill(undefined);
24
-
25
- heap.push(undefined, null, true, false);
26
-
27
- let heap_next = heap.length;
28
-
29
43
  function addHeapObject(obj) {
30
44
  if (heap_next === heap.length) heap.push(heap.length + 1);
31
45
  const idx = heap_next;
@@ -35,20 +49,6 @@ function addHeapObject(obj) {
35
49
  return idx;
36
50
  }
37
51
 
38
- function getObject(idx) { return heap[idx]; }
39
-
40
- function dropObject(idx) {
41
- if (idx < 132) return;
42
- heap[idx] = heap_next;
43
- heap_next = idx;
44
- }
45
-
46
- function takeObject(idx) {
47
- const ret = getObject(idx);
48
- dropObject(idx);
49
- return ret;
50
- }
51
-
52
52
  let WASM_VECTOR_LEN = 0;
53
53
 
54
54
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
@@ -580,7 +580,7 @@ function handleError(f, args) {
580
580
  wasm.__wbindgen_exn_store(addHeapObject(e));
581
581
  }
582
582
  }
583
- function __wbg_adapter_374(arg0, arg1, arg2, arg3) {
583
+ function __wbg_adapter_372(arg0, arg1, arg2, arg3) {
584
584
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h633d734e7d6d6514(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
585
585
  }
586
586
 
@@ -1843,11 +1843,10 @@ export class WasmTransaction {
1843
1843
  wasm.wasmtransaction_set_timestamp(this.__wbg_ptr, timestamp);
1844
1844
  }
1845
1845
  /**
1846
- * @param {string} private_key
1847
1846
  * @returns {Promise<void>}
1848
1847
  */
1849
- sign(private_key) {
1850
- const ret = wasm.wasmtransaction_sign(this.__wbg_ptr, addHeapObject(private_key));
1848
+ sign() {
1849
+ const ret = wasm.wasmtransaction_sign(this.__wbg_ptr);
1851
1850
  return takeObject(ret);
1852
1851
  }
1853
1852
  /**
@@ -2053,7 +2052,7 @@ export class WasmWalletSlip {
2053
2052
  * @returns {string}
2054
2053
  */
2055
2054
  get_utxokey() {
2056
- const ret = wasm.wasmslip_utxo_key(this.__wbg_ptr);
2055
+ const ret = wasm.wasmwalletslip_get_utxokey(this.__wbg_ptr);
2057
2056
  return takeObject(ret);
2058
2057
  }
2059
2058
  /**
@@ -2183,47 +2182,47 @@ async function __wbg_load(module, imports) {
2183
2182
  function __wbg_get_imports() {
2184
2183
  const imports = {};
2185
2184
  imports.wbg = {};
2186
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
2187
- const ret = getStringFromWasm0(arg0, arg1);
2188
- return addHeapObject(ret);
2189
- };
2190
2185
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
2191
2186
  takeObject(arg0);
2192
2187
  };
2193
- imports.wbg.__wbg_wasmblock_new = function(arg0) {
2194
- const ret = WasmBlock.__wrap(arg0);
2188
+ imports.wbg.__wbg_wasmwallet_new = function(arg0) {
2189
+ const ret = WasmWallet.__wrap(arg0);
2195
2190
  return addHeapObject(ret);
2196
2191
  };
2197
- imports.wbg.__wbg_wasmtransaction_new = function(arg0) {
2198
- const ret = WasmTransaction.__wrap(arg0);
2192
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
2193
+ const ret = getStringFromWasm0(arg0, arg1);
2199
2194
  return addHeapObject(ret);
2200
2195
  };
2201
2196
  imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
2202
2197
  const ret = BigInt.asUintN(64, arg0);
2203
2198
  return addHeapObject(ret);
2204
2199
  };
2205
- imports.wbg.__wbg_wasmblockchain_new = function(arg0) {
2206
- const ret = WasmBlockchain.__wrap(arg0);
2200
+ imports.wbg.__wbg_wasmtransaction_new = function(arg0) {
2201
+ const ret = WasmTransaction.__wrap(arg0);
2207
2202
  return addHeapObject(ret);
2208
2203
  };
2209
- imports.wbg.__wbg_wasmpeer_new = function(arg0) {
2210
- const ret = WasmPeer.__wrap(arg0);
2204
+ imports.wbg.__wbg_wasmblock_new = function(arg0) {
2205
+ const ret = WasmBlock.__wrap(arg0);
2211
2206
  return addHeapObject(ret);
2212
2207
  };
2213
2208
  imports.wbg.__wbg_wasmbalancesnapshot_new = function(arg0) {
2214
2209
  const ret = WasmBalanceSnapshot.__wrap(arg0);
2215
2210
  return addHeapObject(ret);
2216
2211
  };
2217
- imports.wbg.__wbg_wasmslip_new = function(arg0) {
2218
- const ret = WasmSlip.__wrap(arg0);
2219
- return addHeapObject(ret);
2220
- };
2221
2212
  imports.wbg.__wbg_wasmwalletslip_new = function(arg0) {
2222
2213
  const ret = WasmWalletSlip.__wrap(arg0);
2223
2214
  return addHeapObject(ret);
2224
2215
  };
2225
- imports.wbg.__wbg_wasmwallet_new = function(arg0) {
2226
- const ret = WasmWallet.__wrap(arg0);
2216
+ imports.wbg.__wbg_wasmpeer_new = function(arg0) {
2217
+ const ret = WasmPeer.__wrap(arg0);
2218
+ return addHeapObject(ret);
2219
+ };
2220
+ imports.wbg.__wbg_wasmblockchain_new = function(arg0) {
2221
+ const ret = WasmBlockchain.__wrap(arg0);
2222
+ return addHeapObject(ret);
2223
+ };
2224
+ imports.wbg.__wbg_wasmslip_new = function(arg0) {
2225
+ const ret = WasmSlip.__wrap(arg0);
2227
2226
  return addHeapObject(ret);
2228
2227
  };
2229
2228
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
@@ -2250,13 +2249,13 @@ function __wbg_get_imports() {
2250
2249
  const ret = WasmPeerService.__wrap(arg0);
2251
2250
  return addHeapObject(ret);
2252
2251
  };
2253
- imports.wbg.__wbg_sendmessage_111cd294d0a1ba24 = function(arg0, arg1) {
2252
+ imports.wbg.__wbg_sendmessage_d26d631079e7972e = function(arg0, arg1) {
2254
2253
  MsgHandler.send_message(takeObject(arg0), getObject(arg1));
2255
2254
  };
2256
- imports.wbg.__wbg_sendmessagetoall_099731cb25195ffa = function(arg0, arg1) {
2255
+ imports.wbg.__wbg_sendmessagetoall_767fe6a653155589 = function(arg0, arg1) {
2257
2256
  MsgHandler.send_message_to_all(getObject(arg0), getObject(arg1));
2258
2257
  };
2259
- imports.wbg.__wbg_connecttopeer_34eab1844d61a5c0 = function() { return handleError(function (arg0, arg1, arg2) {
2258
+ imports.wbg.__wbg_connecttopeer_3e5a8d255a863186 = function() { return handleError(function (arg0, arg1, arg2) {
2260
2259
  let deferred0_0;
2261
2260
  let deferred0_1;
2262
2261
  try {
@@ -2268,11 +2267,11 @@ function __wbg_get_imports() {
2268
2267
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2269
2268
  }
2270
2269
  }, arguments) };
2271
- imports.wbg.__wbg_disconnectfrompeer_08a68134af793703 = function() { return handleError(function (arg0) {
2270
+ imports.wbg.__wbg_disconnectfrompeer_c90b6ed7778a6070 = function() { return handleError(function (arg0) {
2272
2271
  const ret = MsgHandler.disconnect_from_peer(takeObject(arg0));
2273
2272
  return addHeapObject(ret);
2274
2273
  }, arguments) };
2275
- imports.wbg.__wbg_fetchblockfrompeer_7130e7753ae6e06c = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2274
+ imports.wbg.__wbg_fetchblockfrompeer_9ae8da796cdd9ccc = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2276
2275
  let deferred0_0;
2277
2276
  let deferred0_1;
2278
2277
  try {
@@ -2284,7 +2283,7 @@ function __wbg_get_imports() {
2284
2283
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2285
2284
  }
2286
2285
  }, arguments) };
2287
- imports.wbg.__wbg_writevalue_911fb41ea9729264 = function(arg0, arg1, arg2) {
2286
+ imports.wbg.__wbg_writevalue_82bbfb598e61c29e = function(arg0, arg1, arg2) {
2288
2287
  let deferred0_0;
2289
2288
  let deferred0_1;
2290
2289
  try {
@@ -2295,7 +2294,7 @@ function __wbg_get_imports() {
2295
2294
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2296
2295
  }
2297
2296
  };
2298
- imports.wbg.__wbg_appendvalue_5c921467f4ba535e = function(arg0, arg1, arg2) {
2297
+ imports.wbg.__wbg_appendvalue_62f8251b6942f759 = function(arg0, arg1, arg2) {
2299
2298
  let deferred0_0;
2300
2299
  let deferred0_1;
2301
2300
  try {
@@ -2306,7 +2305,7 @@ function __wbg_get_imports() {
2306
2305
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2307
2306
  }
2308
2307
  };
2309
- imports.wbg.__wbg_flushdata_69c2b56988946a06 = function(arg0, arg1) {
2308
+ imports.wbg.__wbg_flushdata_ddac78ca401e0844 = function(arg0, arg1) {
2310
2309
  let deferred0_0;
2311
2310
  let deferred0_1;
2312
2311
  try {
@@ -2317,7 +2316,7 @@ function __wbg_get_imports() {
2317
2316
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2318
2317
  }
2319
2318
  };
2320
- imports.wbg.__wbg_readvalue_a0ef58f234498dc1 = function() { return handleError(function (arg0, arg1) {
2319
+ imports.wbg.__wbg_readvalue_aae34bfe629835d9 = function() { return handleError(function (arg0, arg1) {
2321
2320
  let deferred0_0;
2322
2321
  let deferred0_1;
2323
2322
  try {
@@ -2329,11 +2328,11 @@ function __wbg_get_imports() {
2329
2328
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2330
2329
  }
2331
2330
  }, arguments) };
2332
- imports.wbg.__wbg_loadblockfilelist_6deeaa1c5a65039b = function() { return handleError(function () {
2331
+ imports.wbg.__wbg_loadblockfilelist_800a58c25da71868 = function() { return handleError(function () {
2333
2332
  const ret = MsgHandler.load_block_file_list();
2334
2333
  return addHeapObject(ret);
2335
2334
  }, arguments) };
2336
- imports.wbg.__wbg_isexistingfile_dccfea43fa6c57a4 = function() { return handleError(function (arg0, arg1) {
2335
+ imports.wbg.__wbg_isexistingfile_23a3fb33acbbd80f = function() { return handleError(function (arg0, arg1) {
2337
2336
  let deferred0_0;
2338
2337
  let deferred0_1;
2339
2338
  try {
@@ -2345,7 +2344,7 @@ function __wbg_get_imports() {
2345
2344
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2346
2345
  }
2347
2346
  }, arguments) };
2348
- imports.wbg.__wbg_removevalue_8d74a068d1ccffa9 = function() { return handleError(function (arg0, arg1) {
2347
+ imports.wbg.__wbg_removevalue_46d840deac0c4803 = function() { return handleError(function (arg0, arg1) {
2349
2348
  let deferred0_0;
2350
2349
  let deferred0_1;
2351
2350
  try {
@@ -2357,7 +2356,7 @@ function __wbg_get_imports() {
2357
2356
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2358
2357
  }
2359
2358
  }, arguments) };
2360
- imports.wbg.__wbg_ensureblockdirectoryexists_79540c3dff4ee1cf = function() { return handleError(function (arg0, arg1) {
2359
+ imports.wbg.__wbg_ensureblockdirectoryexists_15554c117deaa3c6 = function() { return handleError(function (arg0, arg1) {
2361
2360
  let deferred0_0;
2362
2361
  let deferred0_1;
2363
2362
  try {
@@ -2368,16 +2367,16 @@ function __wbg_get_imports() {
2368
2367
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2369
2368
  }
2370
2369
  }, arguments) };
2371
- imports.wbg.__wbg_processapicall_5ad8351d24492723 = function(arg0, arg1, arg2) {
2370
+ imports.wbg.__wbg_processapicall_9af7fcc8479f7e5c = function(arg0, arg1, arg2) {
2372
2371
  MsgHandler.process_api_call(takeObject(arg0), arg1 >>> 0, BigInt.asUintN(64, arg2));
2373
2372
  };
2374
- imports.wbg.__wbg_processapisuccess_eaca7c1703abc148 = function(arg0, arg1, arg2) {
2373
+ imports.wbg.__wbg_processapisuccess_cef3d5002c643541 = function(arg0, arg1, arg2) {
2375
2374
  MsgHandler.process_api_success(takeObject(arg0), arg1 >>> 0, BigInt.asUintN(64, arg2));
2376
2375
  };
2377
- imports.wbg.__wbg_processapierror_148539df8cba6e1c = function(arg0, arg1, arg2) {
2376
+ imports.wbg.__wbg_processapierror_0fa072d72a578db8 = function(arg0, arg1, arg2) {
2378
2377
  MsgHandler.process_api_error(takeObject(arg0), arg1 >>> 0, BigInt.asUintN(64, arg2));
2379
2378
  };
2380
- imports.wbg.__wbg_sendinterfaceevent_c214ce9e2a672dd1 = function(arg0, arg1, arg2) {
2379
+ imports.wbg.__wbg_sendinterfaceevent_88b4d4a5728022b1 = function(arg0, arg1, arg2) {
2381
2380
  let deferred0_0;
2382
2381
  let deferred0_1;
2383
2382
  try {
@@ -2388,7 +2387,7 @@ function __wbg_get_imports() {
2388
2387
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2389
2388
  }
2390
2389
  };
2391
- imports.wbg.__wbg_sendblocksuccess_9628c887be151962 = function(arg0, arg1, arg2) {
2390
+ imports.wbg.__wbg_sendblocksuccess_4728a163332d53c9 = function(arg0, arg1, arg2) {
2392
2391
  let deferred0_0;
2393
2392
  let deferred0_1;
2394
2393
  try {
@@ -2399,10 +2398,10 @@ function __wbg_get_imports() {
2399
2398
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2400
2399
  }
2401
2400
  };
2402
- imports.wbg.__wbg_sendwalletupdate_8343add8492cdd78 = function() {
2401
+ imports.wbg.__wbg_sendwalletupdate_f931362359108be7 = function() {
2403
2402
  MsgHandler.send_wallet_update();
2404
2403
  };
2405
- imports.wbg.__wbg_sendnewversionalert_97d88b033f29573c = function(arg0, arg1, arg2) {
2404
+ imports.wbg.__wbg_sendnewversionalert_77bf6d74fe788061 = function(arg0, arg1, arg2) {
2406
2405
  let deferred0_0;
2407
2406
  let deferred0_1;
2408
2407
  try {
@@ -2413,13 +2412,13 @@ function __wbg_get_imports() {
2413
2412
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2414
2413
  }
2415
2414
  };
2416
- imports.wbg.__wbg_savewallet_cd7d81c6ba423855 = function() {
2415
+ imports.wbg.__wbg_savewallet_8e2925a27385680c = function() {
2417
2416
  MsgHandler.save_wallet();
2418
2417
  };
2419
- imports.wbg.__wbg_loadwallet_1df5c65c3397d11c = function() {
2418
+ imports.wbg.__wbg_loadwallet_85e9ee8adf8f8653 = function() {
2420
2419
  MsgHandler.load_wallet();
2421
2420
  };
2422
- imports.wbg.__wbg_getmyservices_f959eef99aa33bb1 = function() {
2421
+ imports.wbg.__wbg_getmyservices_08c9cff42d43cd20 = function() {
2423
2422
  const ret = MsgHandler.get_my_services();
2424
2423
  _assertClass(ret, WasmPeerServiceList);
2425
2424
  var ptr1 = ret.__destroy_into_raw();
@@ -2578,10 +2577,6 @@ function __wbg_get_imports() {
2578
2577
  const ret = getObject(arg0).call(getObject(arg1));
2579
2578
  return addHeapObject(ret);
2580
2579
  }, arguments) };
2581
- imports.wbg.__wbg_length_dee433d4c85c9387 = function(arg0) {
2582
- const ret = getObject(arg0).length;
2583
- return ret;
2584
- };
2585
2580
  imports.wbg.__wbg_self_ce0dbfc45cf2f5be = function() { return handleError(function () {
2586
2581
  const ret = self.self;
2587
2582
  return addHeapObject(ret);
@@ -2642,7 +2637,7 @@ function __wbg_get_imports() {
2642
2637
  const a = state0.a;
2643
2638
  state0.a = 0;
2644
2639
  try {
2645
- return __wbg_adapter_374(a, state0.b, arg0, arg1);
2640
+ return __wbg_adapter_372(a, state0.b, arg0, arg1);
2646
2641
  } finally {
2647
2642
  state0.a = a;
2648
2643
  }
@@ -2723,7 +2718,7 @@ function __wbg_get_imports() {
2723
2718
  const ret = wasm.memory;
2724
2719
  return addHeapObject(ret);
2725
2720
  };
2726
- imports.wbg.__wbindgen_closure_wrapper1210 = function(arg0, arg1, arg2) {
2721
+ imports.wbg.__wbindgen_closure_wrapper1209 = function(arg0, arg1, arg2) {
2727
2722
  const ret = makeMutClosure(arg0, arg1, 456, __wbg_adapter_38);
2728
2723
  return addHeapObject(ret);
2729
2724
  };
Binary file
@@ -161,7 +161,7 @@ export function wasmtransaction_get_data(a: number): number;
161
161
  export function wasmtransaction_set_data(a: number, b: number): void;
162
162
  export function wasmtransaction_get_timestamp(a: number): number;
163
163
  export function wasmtransaction_set_timestamp(a: number, b: number): void;
164
- export function wasmtransaction_sign(a: number, b: number): number;
164
+ export function wasmtransaction_sign(a: number): number;
165
165
  export function wasmtransaction_get_type(a: number): number;
166
166
  export function wasmtransaction_set_type(a: number, b: number): void;
167
167
  export function wasmtransaction_total_fees(a: number): number;
@@ -182,6 +182,7 @@ export function wasmwallet_get_slips(a: number): number;
182
182
  export function wasmwallet_add_slip(a: number, b: number): number;
183
183
  export function wasmwallet_get_key_list(a: number): number;
184
184
  export function wasmwallet_set_key_list(a: number, b: number): number;
185
+ export function wasmwalletslip_get_utxokey(a: number): number;
185
186
  export function wasmwalletslip_set_utxokey(a: number, b: number): void;
186
187
  export function wasmwalletslip_get_slip_index(a: number): number;
187
188
  export function wasmwalletslip_set_slip_index(a: number, b: number): void;
@@ -196,7 +197,6 @@ export function wasmwalletslip_get_tx_ordinal(a: number): number;
196
197
  export function wasmwalletslip_set_amount(a: number, b: number): void;
197
198
  export function wasmwalletslip_set_block_id(a: number, b: number): void;
198
199
  export function wasmwalletslip_set_tx_ordinal(a: number, b: number): void;
199
- export function wasmwalletslip_get_utxokey(a: number): number;
200
200
  export function __wbg_wasmhop_free(a: number): void;
201
201
  export function wasmhop_from(a: number, b: number): void;
202
202
  export function wasmhop_sig(a: number, b: number): void;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saito-wasm",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
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
- "cross-env": "^7.0.3",
16
- "node-fetch": "^3.3.0"
15
+ "node-fetch": "^3.3.0",
16
+ "cross-env": "^7.0.3"
17
17
  }
18
18
  }