saito-wasm 0.2.6 → 0.2.8

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.6"
3
+ version = "0.2.8"
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.6",
3
+ "version": "0.2.8",
4
4
  "description": "js wrappings around saito-core using wasm",
5
5
  "scripts": {
6
6
  "test": "./node_modules/.bin/jest",
@@ -680,6 +680,11 @@ export class WasmWallet {
680
680
  */
681
681
  add_slip(slip: WasmWalletSlip): Promise<void>;
682
682
  /**
683
+ * @param {WasmTransaction} tx
684
+ * @returns {Promise<void>}
685
+ */
686
+ add_to_pending(tx: WasmTransaction): Promise<void>;
687
+ /**
683
688
  * @returns {Promise<Array<any>>}
684
689
  */
685
690
  get_key_list(): Promise<Array<any>>;
package/pkg/node/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  let imports = {};
2
2
  imports['__wbindgen_placeholder__'] = module.exports;
3
3
  let wasm;
4
- const { MsgHandler } = require(String.raw`./snippets/saito-wasm-85a38d0d1511b673/js/msg_handler.js`);
4
+ const { MsgHandler } = require(String.raw`./snippets/saito-wasm-c1e3c28a4083d654/js/msg_handler.js`);
5
5
  const { TextDecoder, TextEncoder } = require(`util`);
6
6
 
7
7
  const heap = new Array(128).fill(undefined);
@@ -24,6 +24,15 @@ function takeObject(idx) {
24
24
  return ret;
25
25
  }
26
26
 
27
+ function addHeapObject(obj) {
28
+ if (heap_next === heap.length) heap.push(heap.length + 1);
29
+ const idx = heap_next;
30
+ heap_next = heap[idx];
31
+
32
+ heap[idx] = obj;
33
+ return idx;
34
+ }
35
+
27
36
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
28
37
 
29
38
  cachedTextDecoder.decode();
@@ -42,15 +51,6 @@ function getStringFromWasm0(ptr, len) {
42
51
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
43
52
  }
44
53
 
45
- function addHeapObject(obj) {
46
- if (heap_next === heap.length) heap.push(heap.length + 1);
47
- const idx = heap_next;
48
- heap_next = heap[idx];
49
-
50
- heap[idx] = obj;
51
- return idx;
52
- }
53
-
54
54
  let WASM_VECTOR_LEN = 0;
55
55
 
56
56
  let cachedTextEncoder = new TextEncoder('utf-8');
@@ -582,7 +582,7 @@ function handleError(f, args) {
582
582
  wasm.__wbindgen_exn_store(addHeapObject(e));
583
583
  }
584
584
  }
585
- function __wbg_adapter_372(arg0, arg1, arg2, arg3) {
585
+ function __wbg_adapter_373(arg0, arg1, arg2, arg3) {
586
586
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h633d734e7d6d6514(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
587
587
  }
588
588
 
@@ -2020,6 +2020,15 @@ class WasmWallet {
2020
2020
  return takeObject(ret);
2021
2021
  }
2022
2022
  /**
2023
+ * @param {WasmTransaction} tx
2024
+ * @returns {Promise<void>}
2025
+ */
2026
+ add_to_pending(tx) {
2027
+ _assertClass(tx, WasmTransaction);
2028
+ const ret = wasm.wasmwallet_add_to_pending(this.__wbg_ptr, tx.__wbg_ptr);
2029
+ return takeObject(ret);
2030
+ }
2031
+ /**
2023
2032
  * @returns {Promise<Array<any>>}
2024
2033
  */
2025
2034
  get_key_list() {
@@ -2173,13 +2182,13 @@ module.exports.__wbg_wasmwallet_new = function(arg0) {
2173
2182
  return addHeapObject(ret);
2174
2183
  };
2175
2184
 
2176
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
2177
- const ret = getStringFromWasm0(arg0, arg1);
2185
+ module.exports.__wbindgen_bigint_from_u64 = function(arg0) {
2186
+ const ret = BigInt.asUintN(64, arg0);
2178
2187
  return addHeapObject(ret);
2179
2188
  };
2180
2189
 
2181
- module.exports.__wbindgen_bigint_from_u64 = function(arg0) {
2182
- const ret = BigInt.asUintN(64, arg0);
2190
+ module.exports.__wbindgen_string_new = function(arg0, arg1) {
2191
+ const ret = getStringFromWasm0(arg0, arg1);
2183
2192
  return addHeapObject(ret);
2184
2193
  };
2185
2194
 
@@ -2188,8 +2197,8 @@ module.exports.__wbg_wasmtransaction_new = function(arg0) {
2188
2197
  return addHeapObject(ret);
2189
2198
  };
2190
2199
 
2191
- module.exports.__wbg_wasmblock_new = function(arg0) {
2192
- const ret = WasmBlock.__wrap(arg0);
2200
+ module.exports.__wbg_wasmslip_new = function(arg0) {
2201
+ const ret = WasmSlip.__wrap(arg0);
2193
2202
  return addHeapObject(ret);
2194
2203
  };
2195
2204
 
@@ -2198,13 +2207,13 @@ module.exports.__wbg_wasmbalancesnapshot_new = function(arg0) {
2198
2207
  return addHeapObject(ret);
2199
2208
  };
2200
2209
 
2201
- module.exports.__wbg_wasmwalletslip_new = function(arg0) {
2202
- const ret = WasmWalletSlip.__wrap(arg0);
2210
+ module.exports.__wbg_wasmpeer_new = function(arg0) {
2211
+ const ret = WasmPeer.__wrap(arg0);
2203
2212
  return addHeapObject(ret);
2204
2213
  };
2205
2214
 
2206
- module.exports.__wbg_wasmpeer_new = function(arg0) {
2207
- const ret = WasmPeer.__wrap(arg0);
2215
+ module.exports.__wbg_wasmblock_new = function(arg0) {
2216
+ const ret = WasmBlock.__wrap(arg0);
2208
2217
  return addHeapObject(ret);
2209
2218
  };
2210
2219
 
@@ -2213,8 +2222,8 @@ module.exports.__wbg_wasmblockchain_new = function(arg0) {
2213
2222
  return addHeapObject(ret);
2214
2223
  };
2215
2224
 
2216
- module.exports.__wbg_wasmslip_new = function(arg0) {
2217
- const ret = WasmSlip.__wrap(arg0);
2225
+ module.exports.__wbg_wasmwalletslip_new = function(arg0) {
2226
+ const ret = WasmWalletSlip.__wrap(arg0);
2218
2227
  return addHeapObject(ret);
2219
2228
  };
2220
2229
 
@@ -2247,15 +2256,31 @@ module.exports.__wbg_wasmpeerservice_new = function(arg0) {
2247
2256
  return addHeapObject(ret);
2248
2257
  };
2249
2258
 
2250
- module.exports.__wbg_sendmessage_d26d631079e7972e = function(arg0, arg1) {
2259
+ module.exports.__wbindgen_is_object = function(arg0) {
2260
+ const val = getObject(arg0);
2261
+ const ret = typeof(val) === 'object' && val !== null;
2262
+ return ret;
2263
+ };
2264
+
2265
+ module.exports.__wbindgen_is_undefined = function(arg0) {
2266
+ const ret = getObject(arg0) === undefined;
2267
+ return ret;
2268
+ };
2269
+
2270
+ module.exports.__wbindgen_in = function(arg0, arg1) {
2271
+ const ret = getObject(arg0) in getObject(arg1);
2272
+ return ret;
2273
+ };
2274
+
2275
+ module.exports.__wbg_sendmessage_3f2ca1799ebc7997 = function(arg0, arg1) {
2251
2276
  MsgHandler.send_message(takeObject(arg0), getObject(arg1));
2252
2277
  };
2253
2278
 
2254
- module.exports.__wbg_sendmessagetoall_767fe6a653155589 = function(arg0, arg1) {
2279
+ module.exports.__wbg_sendmessagetoall_753a523ae8d60207 = function(arg0, arg1) {
2255
2280
  MsgHandler.send_message_to_all(getObject(arg0), getObject(arg1));
2256
2281
  };
2257
2282
 
2258
- module.exports.__wbg_connecttopeer_3e5a8d255a863186 = function() { return handleError(function (arg0, arg1, arg2) {
2283
+ module.exports.__wbg_connecttopeer_eeca26fd21ccf031 = function() { return handleError(function (arg0, arg1, arg2) {
2259
2284
  let deferred0_0;
2260
2285
  let deferred0_1;
2261
2286
  try {
@@ -2268,12 +2293,12 @@ module.exports.__wbg_connecttopeer_3e5a8d255a863186 = function() { return handle
2268
2293
  }
2269
2294
  }, arguments) };
2270
2295
 
2271
- module.exports.__wbg_disconnectfrompeer_c90b6ed7778a6070 = function() { return handleError(function (arg0) {
2296
+ module.exports.__wbg_disconnectfrompeer_5ffa6a2a137fadf7 = function() { return handleError(function (arg0) {
2272
2297
  const ret = MsgHandler.disconnect_from_peer(takeObject(arg0));
2273
2298
  return addHeapObject(ret);
2274
2299
  }, arguments) };
2275
2300
 
2276
- module.exports.__wbg_fetchblockfrompeer_9ae8da796cdd9ccc = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2301
+ module.exports.__wbg_fetchblockfrompeer_3f18dddd45d38db5 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2277
2302
  let deferred0_0;
2278
2303
  let deferred0_1;
2279
2304
  try {
@@ -2286,7 +2311,7 @@ module.exports.__wbg_fetchblockfrompeer_9ae8da796cdd9ccc = function() { return h
2286
2311
  }
2287
2312
  }, arguments) };
2288
2313
 
2289
- module.exports.__wbg_writevalue_82bbfb598e61c29e = function(arg0, arg1, arg2) {
2314
+ module.exports.__wbg_writevalue_40bbfe117c14a5e5 = function(arg0, arg1, arg2) {
2290
2315
  let deferred0_0;
2291
2316
  let deferred0_1;
2292
2317
  try {
@@ -2298,7 +2323,7 @@ module.exports.__wbg_writevalue_82bbfb598e61c29e = function(arg0, arg1, arg2) {
2298
2323
  }
2299
2324
  };
2300
2325
 
2301
- module.exports.__wbg_appendvalue_62f8251b6942f759 = function(arg0, arg1, arg2) {
2326
+ module.exports.__wbg_appendvalue_a43ce50944928ce8 = function(arg0, arg1, arg2) {
2302
2327
  let deferred0_0;
2303
2328
  let deferred0_1;
2304
2329
  try {
@@ -2310,7 +2335,7 @@ module.exports.__wbg_appendvalue_62f8251b6942f759 = function(arg0, arg1, arg2) {
2310
2335
  }
2311
2336
  };
2312
2337
 
2313
- module.exports.__wbg_flushdata_ddac78ca401e0844 = function(arg0, arg1) {
2338
+ module.exports.__wbg_flushdata_a7560bfbea376e83 = function(arg0, arg1) {
2314
2339
  let deferred0_0;
2315
2340
  let deferred0_1;
2316
2341
  try {
@@ -2322,7 +2347,7 @@ module.exports.__wbg_flushdata_ddac78ca401e0844 = function(arg0, arg1) {
2322
2347
  }
2323
2348
  };
2324
2349
 
2325
- module.exports.__wbg_readvalue_aae34bfe629835d9 = function() { return handleError(function (arg0, arg1) {
2350
+ module.exports.__wbg_readvalue_6684d5a5802b8109 = function() { return handleError(function (arg0, arg1) {
2326
2351
  let deferred0_0;
2327
2352
  let deferred0_1;
2328
2353
  try {
@@ -2335,12 +2360,12 @@ module.exports.__wbg_readvalue_aae34bfe629835d9 = function() { return handleErro
2335
2360
  }
2336
2361
  }, arguments) };
2337
2362
 
2338
- module.exports.__wbg_loadblockfilelist_800a58c25da71868 = function() { return handleError(function () {
2363
+ module.exports.__wbg_loadblockfilelist_9a6dc3de54d7fc8e = function() { return handleError(function () {
2339
2364
  const ret = MsgHandler.load_block_file_list();
2340
2365
  return addHeapObject(ret);
2341
2366
  }, arguments) };
2342
2367
 
2343
- module.exports.__wbg_isexistingfile_23a3fb33acbbd80f = function() { return handleError(function (arg0, arg1) {
2368
+ module.exports.__wbg_isexistingfile_080ea828bbb10fdd = function() { return handleError(function (arg0, arg1) {
2344
2369
  let deferred0_0;
2345
2370
  let deferred0_1;
2346
2371
  try {
@@ -2353,7 +2378,7 @@ module.exports.__wbg_isexistingfile_23a3fb33acbbd80f = function() { return handl
2353
2378
  }
2354
2379
  }, arguments) };
2355
2380
 
2356
- module.exports.__wbg_removevalue_46d840deac0c4803 = function() { return handleError(function (arg0, arg1) {
2381
+ module.exports.__wbg_removevalue_f7cd2ea6ea5d02b0 = function() { return handleError(function (arg0, arg1) {
2357
2382
  let deferred0_0;
2358
2383
  let deferred0_1;
2359
2384
  try {
@@ -2366,7 +2391,7 @@ module.exports.__wbg_removevalue_46d840deac0c4803 = function() { return handleEr
2366
2391
  }
2367
2392
  }, arguments) };
2368
2393
 
2369
- module.exports.__wbg_ensureblockdirectoryexists_15554c117deaa3c6 = function() { return handleError(function (arg0, arg1) {
2394
+ module.exports.__wbg_ensureblockdirectoryexists_f8ee4f97e7a0daf4 = function() { return handleError(function (arg0, arg1) {
2370
2395
  let deferred0_0;
2371
2396
  let deferred0_1;
2372
2397
  try {
@@ -2378,19 +2403,19 @@ module.exports.__wbg_ensureblockdirectoryexists_15554c117deaa3c6 = function() {
2378
2403
  }
2379
2404
  }, arguments) };
2380
2405
 
2381
- module.exports.__wbg_processapicall_9af7fcc8479f7e5c = function(arg0, arg1, arg2) {
2406
+ module.exports.__wbg_processapicall_d4d9d5cd684c05b9 = function(arg0, arg1, arg2) {
2382
2407
  MsgHandler.process_api_call(takeObject(arg0), arg1 >>> 0, BigInt.asUintN(64, arg2));
2383
2408
  };
2384
2409
 
2385
- module.exports.__wbg_processapisuccess_cef3d5002c643541 = function(arg0, arg1, arg2) {
2410
+ module.exports.__wbg_processapisuccess_e6a7a4ba733a0974 = function(arg0, arg1, arg2) {
2386
2411
  MsgHandler.process_api_success(takeObject(arg0), arg1 >>> 0, BigInt.asUintN(64, arg2));
2387
2412
  };
2388
2413
 
2389
- module.exports.__wbg_processapierror_0fa072d72a578db8 = function(arg0, arg1, arg2) {
2414
+ module.exports.__wbg_processapierror_1074003fb4ab84ef = function(arg0, arg1, arg2) {
2390
2415
  MsgHandler.process_api_error(takeObject(arg0), arg1 >>> 0, BigInt.asUintN(64, arg2));
2391
2416
  };
2392
2417
 
2393
- module.exports.__wbg_sendinterfaceevent_88b4d4a5728022b1 = function(arg0, arg1, arg2) {
2418
+ module.exports.__wbg_sendinterfaceevent_21c3aedfadc73439 = function(arg0, arg1, arg2) {
2394
2419
  let deferred0_0;
2395
2420
  let deferred0_1;
2396
2421
  try {
@@ -2402,7 +2427,7 @@ module.exports.__wbg_sendinterfaceevent_88b4d4a5728022b1 = function(arg0, arg1,
2402
2427
  }
2403
2428
  };
2404
2429
 
2405
- module.exports.__wbg_sendblocksuccess_4728a163332d53c9 = function(arg0, arg1, arg2) {
2430
+ module.exports.__wbg_sendblocksuccess_d84c638f3866f3ae = function(arg0, arg1, arg2) {
2406
2431
  let deferred0_0;
2407
2432
  let deferred0_1;
2408
2433
  try {
@@ -2414,11 +2439,11 @@ module.exports.__wbg_sendblocksuccess_4728a163332d53c9 = function(arg0, arg1, ar
2414
2439
  }
2415
2440
  };
2416
2441
 
2417
- module.exports.__wbg_sendwalletupdate_f931362359108be7 = function() {
2442
+ module.exports.__wbg_sendwalletupdate_b0c4504aaf55b748 = function() {
2418
2443
  MsgHandler.send_wallet_update();
2419
2444
  };
2420
2445
 
2421
- module.exports.__wbg_sendnewversionalert_77bf6d74fe788061 = function(arg0, arg1, arg2) {
2446
+ module.exports.__wbg_sendnewversionalert_9ac0ae298a4a3777 = function(arg0, arg1, arg2) {
2422
2447
  let deferred0_0;
2423
2448
  let deferred0_1;
2424
2449
  try {
@@ -2430,37 +2455,21 @@ module.exports.__wbg_sendnewversionalert_77bf6d74fe788061 = function(arg0, arg1,
2430
2455
  }
2431
2456
  };
2432
2457
 
2433
- module.exports.__wbg_savewallet_8e2925a27385680c = function() {
2458
+ module.exports.__wbg_savewallet_c0002e54eb474649 = function() {
2434
2459
  MsgHandler.save_wallet();
2435
2460
  };
2436
2461
 
2437
- module.exports.__wbg_loadwallet_85e9ee8adf8f8653 = function() {
2462
+ module.exports.__wbg_loadwallet_81518c79e419f3b4 = function() {
2438
2463
  MsgHandler.load_wallet();
2439
2464
  };
2440
2465
 
2441
- module.exports.__wbg_getmyservices_08c9cff42d43cd20 = function() {
2466
+ module.exports.__wbg_getmyservices_740cd1aa23b2ab28 = function() {
2442
2467
  const ret = MsgHandler.get_my_services();
2443
2468
  _assertClass(ret, WasmPeerServiceList);
2444
2469
  var ptr1 = ret.__destroy_into_raw();
2445
2470
  return ptr1;
2446
2471
  };
2447
2472
 
2448
- module.exports.__wbindgen_is_object = function(arg0) {
2449
- const val = getObject(arg0);
2450
- const ret = typeof(val) === 'object' && val !== null;
2451
- return ret;
2452
- };
2453
-
2454
- module.exports.__wbindgen_is_undefined = function(arg0) {
2455
- const ret = getObject(arg0) === undefined;
2456
- return ret;
2457
- };
2458
-
2459
- module.exports.__wbindgen_in = function(arg0, arg1) {
2460
- const ret = getObject(arg0) in getObject(arg1);
2461
- return ret;
2462
- };
2463
-
2464
2473
  module.exports.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
2465
2474
  const ret = getObject(arg0) == getObject(arg1);
2466
2475
  return ret;
@@ -2708,7 +2717,7 @@ module.exports.__wbg_new_81740750da40724f = function(arg0, arg1) {
2708
2717
  const a = state0.a;
2709
2718
  state0.a = 0;
2710
2719
  try {
2711
- return __wbg_adapter_372(a, state0.b, arg0, arg1);
2720
+ return __wbg_adapter_373(a, state0.b, arg0, arg1);
2712
2721
  } finally {
2713
2722
  state0.a = a;
2714
2723
  }
@@ -2806,8 +2815,8 @@ module.exports.__wbindgen_memory = function() {
2806
2815
  return addHeapObject(ret);
2807
2816
  };
2808
2817
 
2809
- module.exports.__wbindgen_closure_wrapper1209 = function(arg0, arg1, arg2) {
2810
- const ret = makeMutClosure(arg0, arg1, 456, __wbg_adapter_38);
2818
+ module.exports.__wbindgen_closure_wrapper1216 = function(arg0, arg1, arg2) {
2819
+ const ret = makeMutClosure(arg0, arg1, 460, __wbg_adapter_38);
2811
2820
  return addHeapObject(ret);
2812
2821
  };
2813
2822
 
Binary file
@@ -83,8 +83,6 @@ export function wasmpeerservice_set_domain(a: number, b: number): void;
83
83
  export function wasmpeerservice_get_domain(a: number): number;
84
84
  export function wasmpeerservicelist_push(a: number, b: number): void;
85
85
  export function wasmpeerservicelist_new(): number;
86
- export function __wbg_wasmconfiguration_free(a: number): void;
87
- export function wasmconfiguration_new(): number;
88
86
  export function __wbg_wasmblock_free(a: number): void;
89
87
  export function wasmblock_new(): number;
90
88
  export function wasmblock_get_transactions(a: number): number;
@@ -180,6 +178,7 @@ export function wasmwallet_get_balance(a: number): number;
180
178
  export function wasmwallet_get_pending_txs(a: number): number;
181
179
  export function wasmwallet_get_slips(a: number): number;
182
180
  export function wasmwallet_add_slip(a: number, b: number): number;
181
+ export function wasmwallet_add_to_pending(a: number, b: number): number;
183
182
  export function wasmwallet_get_key_list(a: number): number;
184
183
  export function wasmwallet_set_key_list(a: number, b: number): number;
185
184
  export function wasmwalletslip_get_utxokey(a: number): number;
@@ -210,6 +209,8 @@ export function wasmpeer_get_sync_type(a: number): number;
210
209
  export function wasmpeer_get_services(a: number): number;
211
210
  export function wasmpeer_set_services(a: number, b: number): void;
212
211
  export function wasmpeer_has_service(a: number, b: number): number;
212
+ export function __wbg_wasmconfiguration_free(a: number): void;
213
+ export function wasmconfiguration_new(): number;
213
214
  export function rustsecp256k1_v0_10_0_context_create(a: number): number;
214
215
  export function rustsecp256k1_v0_10_0_context_destroy(a: number): void;
215
216
  export function rustsecp256k1_v0_10_0_default_illegal_callback_fn(a: number, b: number): void;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saito-wasm",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
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
- "node-fetch": "^3.3.0",
13
- "cross-env": "^7.0.3"
12
+ "cross-env": "^7.0.3",
13
+ "node-fetch": "^3.3.0"
14
14
  }
15
15
  }
@@ -680,6 +680,11 @@ export class WasmWallet {
680
680
  */
681
681
  add_slip(slip: WasmWalletSlip): Promise<void>;
682
682
  /**
683
+ * @param {WasmTransaction} tx
684
+ * @returns {Promise<void>}
685
+ */
686
+ add_to_pending(tx: WasmTransaction): Promise<void>;
687
+ /**
683
688
  * @returns {Promise<Array<any>>}
684
689
  */
685
690
  get_key_list(): Promise<Array<any>>;
@@ -840,8 +845,6 @@ export interface InitOutput {
840
845
  readonly wasmpeerservice_get_domain: (a: number) => number;
841
846
  readonly wasmpeerservicelist_push: (a: number, b: number) => void;
842
847
  readonly wasmpeerservicelist_new: () => number;
843
- readonly __wbg_wasmconfiguration_free: (a: number) => void;
844
- readonly wasmconfiguration_new: () => number;
845
848
  readonly __wbg_wasmblock_free: (a: number) => void;
846
849
  readonly wasmblock_new: () => number;
847
850
  readonly wasmblock_get_transactions: (a: number) => number;
@@ -937,6 +940,7 @@ export interface InitOutput {
937
940
  readonly wasmwallet_get_pending_txs: (a: number) => number;
938
941
  readonly wasmwallet_get_slips: (a: number) => number;
939
942
  readonly wasmwallet_add_slip: (a: number, b: number) => number;
943
+ readonly wasmwallet_add_to_pending: (a: number, b: number) => number;
940
944
  readonly wasmwallet_get_key_list: (a: number) => number;
941
945
  readonly wasmwallet_set_key_list: (a: number, b: number) => number;
942
946
  readonly wasmwalletslip_get_utxokey: (a: number) => number;
@@ -967,6 +971,8 @@ export interface InitOutput {
967
971
  readonly wasmpeer_get_services: (a: number) => number;
968
972
  readonly wasmpeer_set_services: (a: number, b: number) => void;
969
973
  readonly wasmpeer_has_service: (a: number, b: number) => number;
974
+ readonly __wbg_wasmconfiguration_free: (a: number) => void;
975
+ readonly wasmconfiguration_new: () => number;
970
976
  readonly rustsecp256k1_v0_10_0_context_create: (a: number) => number;
971
977
  readonly rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
972
978
  readonly rustsecp256k1_v0_10_0_default_illegal_callback_fn: (a: number, b: number) => void;
package/pkg/web/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { MsgHandler } from './snippets/saito-wasm-85a38d0d1511b673/js/msg_handler.js';
1
+ import { MsgHandler } from './snippets/saito-wasm-c1e3c28a4083d654/js/msg_handler.js';
2
2
 
3
3
  let wasm;
4
4
 
@@ -22,6 +22,15 @@ function takeObject(idx) {
22
22
  return ret;
23
23
  }
24
24
 
25
+ function addHeapObject(obj) {
26
+ if (heap_next === heap.length) heap.push(heap.length + 1);
27
+ const idx = heap_next;
28
+ heap_next = heap[idx];
29
+
30
+ heap[idx] = obj;
31
+ return idx;
32
+ }
33
+
25
34
  const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
26
35
 
27
36
  if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
@@ -40,15 +49,6 @@ function getStringFromWasm0(ptr, len) {
40
49
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
41
50
  }
42
51
 
43
- function addHeapObject(obj) {
44
- if (heap_next === heap.length) heap.push(heap.length + 1);
45
- const idx = heap_next;
46
- heap_next = heap[idx];
47
-
48
- heap[idx] = obj;
49
- return idx;
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_372(arg0, arg1, arg2, arg3) {
583
+ function __wbg_adapter_373(arg0, arg1, arg2, arg3) {
584
584
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h633d734e7d6d6514(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
585
585
  }
586
586
 
@@ -2006,6 +2006,15 @@ export class WasmWallet {
2006
2006
  return takeObject(ret);
2007
2007
  }
2008
2008
  /**
2009
+ * @param {WasmTransaction} tx
2010
+ * @returns {Promise<void>}
2011
+ */
2012
+ add_to_pending(tx) {
2013
+ _assertClass(tx, WasmTransaction);
2014
+ const ret = wasm.wasmwallet_add_to_pending(this.__wbg_ptr, tx.__wbg_ptr);
2015
+ return takeObject(ret);
2016
+ }
2017
+ /**
2009
2018
  * @returns {Promise<Array<any>>}
2010
2019
  */
2011
2020
  get_key_list() {
@@ -2189,40 +2198,40 @@ function __wbg_get_imports() {
2189
2198
  const ret = WasmWallet.__wrap(arg0);
2190
2199
  return addHeapObject(ret);
2191
2200
  };
2192
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
2193
- const ret = getStringFromWasm0(arg0, arg1);
2194
- return addHeapObject(ret);
2195
- };
2196
2201
  imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
2197
2202
  const ret = BigInt.asUintN(64, arg0);
2198
2203
  return addHeapObject(ret);
2199
2204
  };
2205
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
2206
+ const ret = getStringFromWasm0(arg0, arg1);
2207
+ return addHeapObject(ret);
2208
+ };
2200
2209
  imports.wbg.__wbg_wasmtransaction_new = function(arg0) {
2201
2210
  const ret = WasmTransaction.__wrap(arg0);
2202
2211
  return addHeapObject(ret);
2203
2212
  };
2204
- imports.wbg.__wbg_wasmblock_new = function(arg0) {
2205
- const ret = WasmBlock.__wrap(arg0);
2213
+ imports.wbg.__wbg_wasmslip_new = function(arg0) {
2214
+ const ret = WasmSlip.__wrap(arg0);
2206
2215
  return addHeapObject(ret);
2207
2216
  };
2208
2217
  imports.wbg.__wbg_wasmbalancesnapshot_new = function(arg0) {
2209
2218
  const ret = WasmBalanceSnapshot.__wrap(arg0);
2210
2219
  return addHeapObject(ret);
2211
2220
  };
2212
- imports.wbg.__wbg_wasmwalletslip_new = function(arg0) {
2213
- const ret = WasmWalletSlip.__wrap(arg0);
2214
- return addHeapObject(ret);
2215
- };
2216
2221
  imports.wbg.__wbg_wasmpeer_new = function(arg0) {
2217
2222
  const ret = WasmPeer.__wrap(arg0);
2218
2223
  return addHeapObject(ret);
2219
2224
  };
2225
+ imports.wbg.__wbg_wasmblock_new = function(arg0) {
2226
+ const ret = WasmBlock.__wrap(arg0);
2227
+ return addHeapObject(ret);
2228
+ };
2220
2229
  imports.wbg.__wbg_wasmblockchain_new = function(arg0) {
2221
2230
  const ret = WasmBlockchain.__wrap(arg0);
2222
2231
  return addHeapObject(ret);
2223
2232
  };
2224
- imports.wbg.__wbg_wasmslip_new = function(arg0) {
2225
- const ret = WasmSlip.__wrap(arg0);
2233
+ imports.wbg.__wbg_wasmwalletslip_new = function(arg0) {
2234
+ const ret = WasmWalletSlip.__wrap(arg0);
2226
2235
  return addHeapObject(ret);
2227
2236
  };
2228
2237
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
@@ -2249,13 +2258,26 @@ function __wbg_get_imports() {
2249
2258
  const ret = WasmPeerService.__wrap(arg0);
2250
2259
  return addHeapObject(ret);
2251
2260
  };
2252
- imports.wbg.__wbg_sendmessage_d26d631079e7972e = function(arg0, arg1) {
2261
+ imports.wbg.__wbindgen_is_object = function(arg0) {
2262
+ const val = getObject(arg0);
2263
+ const ret = typeof(val) === 'object' && val !== null;
2264
+ return ret;
2265
+ };
2266
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
2267
+ const ret = getObject(arg0) === undefined;
2268
+ return ret;
2269
+ };
2270
+ imports.wbg.__wbindgen_in = function(arg0, arg1) {
2271
+ const ret = getObject(arg0) in getObject(arg1);
2272
+ return ret;
2273
+ };
2274
+ imports.wbg.__wbg_sendmessage_3f2ca1799ebc7997 = function(arg0, arg1) {
2253
2275
  MsgHandler.send_message(takeObject(arg0), getObject(arg1));
2254
2276
  };
2255
- imports.wbg.__wbg_sendmessagetoall_767fe6a653155589 = function(arg0, arg1) {
2277
+ imports.wbg.__wbg_sendmessagetoall_753a523ae8d60207 = function(arg0, arg1) {
2256
2278
  MsgHandler.send_message_to_all(getObject(arg0), getObject(arg1));
2257
2279
  };
2258
- imports.wbg.__wbg_connecttopeer_3e5a8d255a863186 = function() { return handleError(function (arg0, arg1, arg2) {
2280
+ imports.wbg.__wbg_connecttopeer_eeca26fd21ccf031 = function() { return handleError(function (arg0, arg1, arg2) {
2259
2281
  let deferred0_0;
2260
2282
  let deferred0_1;
2261
2283
  try {
@@ -2267,11 +2289,11 @@ function __wbg_get_imports() {
2267
2289
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2268
2290
  }
2269
2291
  }, arguments) };
2270
- imports.wbg.__wbg_disconnectfrompeer_c90b6ed7778a6070 = function() { return handleError(function (arg0) {
2292
+ imports.wbg.__wbg_disconnectfrompeer_5ffa6a2a137fadf7 = function() { return handleError(function (arg0) {
2271
2293
  const ret = MsgHandler.disconnect_from_peer(takeObject(arg0));
2272
2294
  return addHeapObject(ret);
2273
2295
  }, arguments) };
2274
- imports.wbg.__wbg_fetchblockfrompeer_9ae8da796cdd9ccc = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2296
+ imports.wbg.__wbg_fetchblockfrompeer_3f18dddd45d38db5 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2275
2297
  let deferred0_0;
2276
2298
  let deferred0_1;
2277
2299
  try {
@@ -2283,7 +2305,7 @@ function __wbg_get_imports() {
2283
2305
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2284
2306
  }
2285
2307
  }, arguments) };
2286
- imports.wbg.__wbg_writevalue_82bbfb598e61c29e = function(arg0, arg1, arg2) {
2308
+ imports.wbg.__wbg_writevalue_40bbfe117c14a5e5 = function(arg0, arg1, arg2) {
2287
2309
  let deferred0_0;
2288
2310
  let deferred0_1;
2289
2311
  try {
@@ -2294,7 +2316,7 @@ function __wbg_get_imports() {
2294
2316
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2295
2317
  }
2296
2318
  };
2297
- imports.wbg.__wbg_appendvalue_62f8251b6942f759 = function(arg0, arg1, arg2) {
2319
+ imports.wbg.__wbg_appendvalue_a43ce50944928ce8 = function(arg0, arg1, arg2) {
2298
2320
  let deferred0_0;
2299
2321
  let deferred0_1;
2300
2322
  try {
@@ -2305,7 +2327,7 @@ function __wbg_get_imports() {
2305
2327
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2306
2328
  }
2307
2329
  };
2308
- imports.wbg.__wbg_flushdata_ddac78ca401e0844 = function(arg0, arg1) {
2330
+ imports.wbg.__wbg_flushdata_a7560bfbea376e83 = function(arg0, arg1) {
2309
2331
  let deferred0_0;
2310
2332
  let deferred0_1;
2311
2333
  try {
@@ -2316,7 +2338,7 @@ function __wbg_get_imports() {
2316
2338
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2317
2339
  }
2318
2340
  };
2319
- imports.wbg.__wbg_readvalue_aae34bfe629835d9 = function() { return handleError(function (arg0, arg1) {
2341
+ imports.wbg.__wbg_readvalue_6684d5a5802b8109 = function() { return handleError(function (arg0, arg1) {
2320
2342
  let deferred0_0;
2321
2343
  let deferred0_1;
2322
2344
  try {
@@ -2328,11 +2350,11 @@ function __wbg_get_imports() {
2328
2350
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2329
2351
  }
2330
2352
  }, arguments) };
2331
- imports.wbg.__wbg_loadblockfilelist_800a58c25da71868 = function() { return handleError(function () {
2353
+ imports.wbg.__wbg_loadblockfilelist_9a6dc3de54d7fc8e = function() { return handleError(function () {
2332
2354
  const ret = MsgHandler.load_block_file_list();
2333
2355
  return addHeapObject(ret);
2334
2356
  }, arguments) };
2335
- imports.wbg.__wbg_isexistingfile_23a3fb33acbbd80f = function() { return handleError(function (arg0, arg1) {
2357
+ imports.wbg.__wbg_isexistingfile_080ea828bbb10fdd = function() { return handleError(function (arg0, arg1) {
2336
2358
  let deferred0_0;
2337
2359
  let deferred0_1;
2338
2360
  try {
@@ -2344,7 +2366,7 @@ function __wbg_get_imports() {
2344
2366
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2345
2367
  }
2346
2368
  }, arguments) };
2347
- imports.wbg.__wbg_removevalue_46d840deac0c4803 = function() { return handleError(function (arg0, arg1) {
2369
+ imports.wbg.__wbg_removevalue_f7cd2ea6ea5d02b0 = function() { return handleError(function (arg0, arg1) {
2348
2370
  let deferred0_0;
2349
2371
  let deferred0_1;
2350
2372
  try {
@@ -2356,7 +2378,7 @@ function __wbg_get_imports() {
2356
2378
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2357
2379
  }
2358
2380
  }, arguments) };
2359
- imports.wbg.__wbg_ensureblockdirectoryexists_15554c117deaa3c6 = function() { return handleError(function (arg0, arg1) {
2381
+ imports.wbg.__wbg_ensureblockdirectoryexists_f8ee4f97e7a0daf4 = function() { return handleError(function (arg0, arg1) {
2360
2382
  let deferred0_0;
2361
2383
  let deferred0_1;
2362
2384
  try {
@@ -2367,16 +2389,16 @@ function __wbg_get_imports() {
2367
2389
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2368
2390
  }
2369
2391
  }, arguments) };
2370
- imports.wbg.__wbg_processapicall_9af7fcc8479f7e5c = function(arg0, arg1, arg2) {
2392
+ imports.wbg.__wbg_processapicall_d4d9d5cd684c05b9 = function(arg0, arg1, arg2) {
2371
2393
  MsgHandler.process_api_call(takeObject(arg0), arg1 >>> 0, BigInt.asUintN(64, arg2));
2372
2394
  };
2373
- imports.wbg.__wbg_processapisuccess_cef3d5002c643541 = function(arg0, arg1, arg2) {
2395
+ imports.wbg.__wbg_processapisuccess_e6a7a4ba733a0974 = function(arg0, arg1, arg2) {
2374
2396
  MsgHandler.process_api_success(takeObject(arg0), arg1 >>> 0, BigInt.asUintN(64, arg2));
2375
2397
  };
2376
- imports.wbg.__wbg_processapierror_0fa072d72a578db8 = function(arg0, arg1, arg2) {
2398
+ imports.wbg.__wbg_processapierror_1074003fb4ab84ef = function(arg0, arg1, arg2) {
2377
2399
  MsgHandler.process_api_error(takeObject(arg0), arg1 >>> 0, BigInt.asUintN(64, arg2));
2378
2400
  };
2379
- imports.wbg.__wbg_sendinterfaceevent_88b4d4a5728022b1 = function(arg0, arg1, arg2) {
2401
+ imports.wbg.__wbg_sendinterfaceevent_21c3aedfadc73439 = function(arg0, arg1, arg2) {
2380
2402
  let deferred0_0;
2381
2403
  let deferred0_1;
2382
2404
  try {
@@ -2387,7 +2409,7 @@ function __wbg_get_imports() {
2387
2409
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2388
2410
  }
2389
2411
  };
2390
- imports.wbg.__wbg_sendblocksuccess_4728a163332d53c9 = function(arg0, arg1, arg2) {
2412
+ imports.wbg.__wbg_sendblocksuccess_d84c638f3866f3ae = function(arg0, arg1, arg2) {
2391
2413
  let deferred0_0;
2392
2414
  let deferred0_1;
2393
2415
  try {
@@ -2398,10 +2420,10 @@ function __wbg_get_imports() {
2398
2420
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2399
2421
  }
2400
2422
  };
2401
- imports.wbg.__wbg_sendwalletupdate_f931362359108be7 = function() {
2423
+ imports.wbg.__wbg_sendwalletupdate_b0c4504aaf55b748 = function() {
2402
2424
  MsgHandler.send_wallet_update();
2403
2425
  };
2404
- imports.wbg.__wbg_sendnewversionalert_77bf6d74fe788061 = function(arg0, arg1, arg2) {
2426
+ imports.wbg.__wbg_sendnewversionalert_9ac0ae298a4a3777 = function(arg0, arg1, arg2) {
2405
2427
  let deferred0_0;
2406
2428
  let deferred0_1;
2407
2429
  try {
@@ -2412,31 +2434,18 @@ function __wbg_get_imports() {
2412
2434
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2413
2435
  }
2414
2436
  };
2415
- imports.wbg.__wbg_savewallet_8e2925a27385680c = function() {
2437
+ imports.wbg.__wbg_savewallet_c0002e54eb474649 = function() {
2416
2438
  MsgHandler.save_wallet();
2417
2439
  };
2418
- imports.wbg.__wbg_loadwallet_85e9ee8adf8f8653 = function() {
2440
+ imports.wbg.__wbg_loadwallet_81518c79e419f3b4 = function() {
2419
2441
  MsgHandler.load_wallet();
2420
2442
  };
2421
- imports.wbg.__wbg_getmyservices_08c9cff42d43cd20 = function() {
2443
+ imports.wbg.__wbg_getmyservices_740cd1aa23b2ab28 = function() {
2422
2444
  const ret = MsgHandler.get_my_services();
2423
2445
  _assertClass(ret, WasmPeerServiceList);
2424
2446
  var ptr1 = ret.__destroy_into_raw();
2425
2447
  return ptr1;
2426
2448
  };
2427
- imports.wbg.__wbindgen_is_object = function(arg0) {
2428
- const val = getObject(arg0);
2429
- const ret = typeof(val) === 'object' && val !== null;
2430
- return ret;
2431
- };
2432
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
2433
- const ret = getObject(arg0) === undefined;
2434
- return ret;
2435
- };
2436
- imports.wbg.__wbindgen_in = function(arg0, arg1) {
2437
- const ret = getObject(arg0) in getObject(arg1);
2438
- return ret;
2439
- };
2440
2449
  imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
2441
2450
  const ret = getObject(arg0) == getObject(arg1);
2442
2451
  return ret;
@@ -2637,7 +2646,7 @@ function __wbg_get_imports() {
2637
2646
  const a = state0.a;
2638
2647
  state0.a = 0;
2639
2648
  try {
2640
- return __wbg_adapter_372(a, state0.b, arg0, arg1);
2649
+ return __wbg_adapter_373(a, state0.b, arg0, arg1);
2641
2650
  } finally {
2642
2651
  state0.a = a;
2643
2652
  }
@@ -2718,8 +2727,8 @@ function __wbg_get_imports() {
2718
2727
  const ret = wasm.memory;
2719
2728
  return addHeapObject(ret);
2720
2729
  };
2721
- imports.wbg.__wbindgen_closure_wrapper1209 = function(arg0, arg1, arg2) {
2722
- const ret = makeMutClosure(arg0, arg1, 456, __wbg_adapter_38);
2730
+ imports.wbg.__wbindgen_closure_wrapper1216 = function(arg0, arg1, arg2) {
2731
+ const ret = makeMutClosure(arg0, arg1, 460, __wbg_adapter_38);
2723
2732
  return addHeapObject(ret);
2724
2733
  };
2725
2734
 
Binary file
@@ -83,8 +83,6 @@ export function wasmpeerservice_set_domain(a: number, b: number): void;
83
83
  export function wasmpeerservice_get_domain(a: number): number;
84
84
  export function wasmpeerservicelist_push(a: number, b: number): void;
85
85
  export function wasmpeerservicelist_new(): number;
86
- export function __wbg_wasmconfiguration_free(a: number): void;
87
- export function wasmconfiguration_new(): number;
88
86
  export function __wbg_wasmblock_free(a: number): void;
89
87
  export function wasmblock_new(): number;
90
88
  export function wasmblock_get_transactions(a: number): number;
@@ -180,6 +178,7 @@ export function wasmwallet_get_balance(a: number): number;
180
178
  export function wasmwallet_get_pending_txs(a: number): number;
181
179
  export function wasmwallet_get_slips(a: number): number;
182
180
  export function wasmwallet_add_slip(a: number, b: number): number;
181
+ export function wasmwallet_add_to_pending(a: number, b: number): number;
183
182
  export function wasmwallet_get_key_list(a: number): number;
184
183
  export function wasmwallet_set_key_list(a: number, b: number): number;
185
184
  export function wasmwalletslip_get_utxokey(a: number): number;
@@ -210,6 +209,8 @@ export function wasmpeer_get_sync_type(a: number): number;
210
209
  export function wasmpeer_get_services(a: number): number;
211
210
  export function wasmpeer_set_services(a: number, b: number): void;
212
211
  export function wasmpeer_has_service(a: number, b: number): number;
212
+ export function __wbg_wasmconfiguration_free(a: number): void;
213
+ export function wasmconfiguration_new(): number;
213
214
  export function rustsecp256k1_v0_10_0_context_create(a: number): number;
214
215
  export function rustsecp256k1_v0_10_0_context_destroy(a: number): void;
215
216
  export function rustsecp256k1_v0_10_0_default_illegal_callback_fn(a: number, b: number): void;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saito-wasm",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "files": [
5
5
  "index_bg.wasm",
6
6
  "index.js",