@breeztech/breez-sdk-spark 0.12.2-dev2 → 0.12.2-dev4

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.
Files changed (32) hide show
  1. package/README.md +4 -4
  2. package/breez-sdk-spark.tgz +0 -0
  3. package/bundler/breez_sdk_spark_wasm.d.ts +601 -731
  4. package/bundler/breez_sdk_spark_wasm_bg.js +54 -151
  5. package/bundler/breez_sdk_spark_wasm_bg.wasm +0 -0
  6. package/bundler/breez_sdk_spark_wasm_bg.wasm.d.ts +5 -7
  7. package/bundler/storage/index.js +43 -65
  8. package/deno/breez_sdk_spark_wasm.d.ts +601 -731
  9. package/deno/breez_sdk_spark_wasm.js +54 -141
  10. package/deno/breez_sdk_spark_wasm_bg.wasm +0 -0
  11. package/deno/breez_sdk_spark_wasm_bg.wasm.d.ts +5 -7
  12. package/nodejs/breez_sdk_spark_wasm.d.ts +601 -731
  13. package/nodejs/breez_sdk_spark_wasm.js +54 -151
  14. package/nodejs/breez_sdk_spark_wasm_bg.wasm +0 -0
  15. package/nodejs/breez_sdk_spark_wasm_bg.wasm.d.ts +5 -7
  16. package/nodejs/index.js +2 -16
  17. package/nodejs/package.json +0 -1
  18. package/nodejs/postgres-storage/index.cjs +31 -42
  19. package/nodejs/postgres-storage/migrations.cjs +0 -24
  20. package/nodejs/postgres-tree-store/index.cjs +2 -12
  21. package/nodejs/storage/index.cjs +28 -19
  22. package/nodejs/storage/migrations.cjs +0 -18
  23. package/package.json +1 -1
  24. package/web/breez_sdk_spark_wasm.d.ts +606 -738
  25. package/web/breez_sdk_spark_wasm.js +54 -141
  26. package/web/breez_sdk_spark_wasm_bg.wasm +0 -0
  27. package/web/breez_sdk_spark_wasm_bg.wasm.d.ts +5 -7
  28. package/web/storage/index.js +43 -65
  29. package/nodejs/postgres-token-store/errors.cjs +0 -13
  30. package/nodejs/postgres-token-store/index.cjs +0 -857
  31. package/nodejs/postgres-token-store/migrations.cjs +0 -163
  32. package/nodejs/postgres-token-store/package.json +0 -9
@@ -245,6 +245,19 @@ module.exports.getSparkStatus = function() {
245
245
  return ret;
246
246
  };
247
247
 
248
+ /**
249
+ * @param {Config} config
250
+ * @param {ExternalSigner} signer
251
+ * @param {string} storage_dir
252
+ * @returns {Promise<BreezSdk>}
253
+ */
254
+ module.exports.connectWithSigner = function(config, signer, storage_dir) {
255
+ const ptr0 = passStringToWasm0(storage_dir, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
256
+ const len0 = WASM_VECTOR_LEN;
257
+ const ret = wasm.connectWithSigner(config, signer, ptr0, len0);
258
+ return ret;
259
+ };
260
+
248
261
  /**
249
262
  * @param {ConnectRequest} request
250
263
  * @returns {Promise<BreezSdk>}
@@ -254,6 +267,15 @@ module.exports.connect = function(request) {
254
267
  return ret;
255
268
  };
256
269
 
270
+ /**
271
+ * @param {Network} network
272
+ * @returns {Config}
273
+ */
274
+ module.exports.defaultConfig = function(network) {
275
+ const ret = wasm.defaultConfig(network);
276
+ return ret;
277
+ };
278
+
257
279
  /**
258
280
  * @param {Logger} logger
259
281
  * @param {string | null} [filter]
@@ -266,15 +288,6 @@ module.exports.initLogging = function(logger, filter) {
266
288
  return ret;
267
289
  };
268
290
 
269
- /**
270
- * @param {Network} network
271
- * @returns {Config}
272
- */
273
- module.exports.defaultConfig = function(network) {
274
- const ret = wasm.defaultConfig(network);
275
- return ret;
276
- };
277
-
278
291
  function takeFromExternrefTable0(idx) {
279
292
  const value = wasm.__wbindgen_export_5.get(idx);
280
293
  wasm.__externref_table_dealloc(idx);
@@ -299,19 +312,6 @@ module.exports.defaultExternalSigner = function(mnemonic, passphrase, network, k
299
312
  return DefaultSigner.__wrap(ret[0]);
300
313
  };
301
314
 
302
- /**
303
- * @param {Config} config
304
- * @param {ExternalSigner} signer
305
- * @param {string} storage_dir
306
- * @returns {Promise<BreezSdk>}
307
- */
308
- module.exports.connectWithSigner = function(config, signer, storage_dir) {
309
- const ptr0 = passStringToWasm0(storage_dir, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
310
- const len0 = WASM_VECTOR_LEN;
311
- const ret = wasm.connectWithSigner(config, signer, ptr0, len0);
312
- return ret;
313
- };
314
-
315
315
  function passArray8ToWasm0(arg, malloc) {
316
316
  const ptr = malloc(arg.length * 1, 1) >>> 0;
317
317
  getUint8ArrayMemory0().set(arg, ptr / 1);
@@ -330,15 +330,15 @@ module.exports.task_worker_entry_point = function(ptr) {
330
330
  };
331
331
 
332
332
  function __wbg_adapter_64(arg0, arg1, arg2) {
333
- wasm.closure456_externref_shim(arg0, arg1, arg2);
333
+ wasm.closure444_externref_shim(arg0, arg1, arg2);
334
334
  }
335
335
 
336
336
  function __wbg_adapter_69(arg0, arg1) {
337
337
  wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h1bbbe552b190da27(arg0, arg1);
338
338
  }
339
339
 
340
- function __wbg_adapter_395(arg0, arg1, arg2, arg3) {
341
- wasm.closure736_externref_shim(arg0, arg1, arg2, arg3);
340
+ function __wbg_adapter_373(arg0, arg1, arg2, arg3) {
341
+ wasm.closure711_externref_shim(arg0, arg1, arg2, arg3);
342
342
  }
343
343
 
344
344
  const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
@@ -475,13 +475,6 @@ class BreezSdk {
475
475
  const ret = wasm.breezsdk_listPayments(this.__wbg_ptr, request);
476
476
  return ret;
477
477
  }
478
- /**
479
- * @returns {Promise<Webhook[]>}
480
- */
481
- listWebhooks() {
482
- const ret = wasm.breezsdk_listWebhooks(this.__wbg_ptr);
483
- return ret;
484
- }
485
478
  /**
486
479
  * @param {string} id
487
480
  * @returns {Promise<void>}
@@ -545,14 +538,6 @@ class BreezSdk {
545
538
  const ret = wasm.breezsdk_recommendedFees(this.__wbg_ptr);
546
539
  return ret;
547
540
  }
548
- /**
549
- * @param {RegisterWebhookRequest} request
550
- * @returns {Promise<RegisterWebhookResponse>}
551
- */
552
- registerWebhook(request) {
553
- const ret = wasm.breezsdk_registerWebhook(this.__wbg_ptr, request);
554
- return ret;
555
- }
556
541
  /**
557
542
  * @returns {Promise<UserSettings>}
558
543
  */
@@ -584,14 +569,6 @@ class BreezSdk {
584
569
  const ret = wasm.breezsdk_claimHtlcPayment(this.__wbg_ptr, request);
585
570
  return ret;
586
571
  }
587
- /**
588
- * @param {UnregisterWebhookRequest} request
589
- * @returns {Promise<void>}
590
- */
591
- unregisterWebhook(request) {
592
- const ret = wasm.breezsdk_unregisterWebhook(this.__wbg_ptr, request);
593
- return ret;
594
- }
595
572
  /**
596
573
  * @param {GetTokensMetadataRequest} request
597
574
  * @returns {Promise<GetTokensMetadataResponse>}
@@ -656,12 +633,8 @@ class BreezSdk {
656
633
  const ret = wasm.breezsdk_listUnclaimedDeposits(this.__wbg_ptr, request);
657
634
  return ret;
658
635
  }
659
- /**
660
- * @returns {Promise<void>}
661
- */
662
636
  startLeafOptimization() {
663
- const ret = wasm.breezsdk_startLeafOptimization(this.__wbg_ptr);
664
- return ret;
637
+ wasm.breezsdk_startLeafOptimization(this.__wbg_ptr);
665
638
  }
666
639
  /**
667
640
  * @returns {Promise<void>}
@@ -1270,9 +1243,9 @@ class SdkBuilder {
1270
1243
  * @param {PostgresStorageConfig} config
1271
1244
  * @returns {SdkBuilder}
1272
1245
  */
1273
- withPostgresBackend(config) {
1246
+ withPostgresStorage(config) {
1274
1247
  const ptr = this.__destroy_into_raw();
1275
- const ret = wasm.sdkbuilder_withPostgresBackend(ptr, config);
1248
+ const ret = wasm.sdkbuilder_withPostgresStorage(ptr, config);
1276
1249
  return SdkBuilder.__wrap(ret);
1277
1250
  }
1278
1251
  /**
@@ -1288,6 +1261,15 @@ class SdkBuilder {
1288
1261
  const ret = wasm.sdkbuilder_withRestChainService(ptr, ptr0, len0, api_type, isLikeNone(credentials) ? 0 : addToExternrefTable0(credentials));
1289
1262
  return SdkBuilder.__wrap(ret);
1290
1263
  }
1264
+ /**
1265
+ * @param {PostgresStorageConfig} config
1266
+ * @returns {SdkBuilder}
1267
+ */
1268
+ withPostgresTreeStore(config) {
1269
+ const ptr = this.__destroy_into_raw();
1270
+ const ret = wasm.sdkbuilder_withPostgresTreeStore(ptr, config);
1271
+ return SdkBuilder.__wrap(ret);
1272
+ }
1291
1273
  /**
1292
1274
  * @param {Config} config
1293
1275
  * @param {Seed} seed
@@ -1406,13 +1388,13 @@ module.exports.__wbg_abort_775ef1d17fc65868 = function(arg0) {
1406
1388
  arg0.abort();
1407
1389
  };
1408
1390
 
1409
- module.exports.__wbg_addDeposit_42b1593db58de120 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
1391
+ module.exports.__wbg_addDeposit_5b1f93e7014f1e18 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
1410
1392
  let deferred0_0;
1411
1393
  let deferred0_1;
1412
1394
  try {
1413
1395
  deferred0_0 = arg1;
1414
1396
  deferred0_1 = arg2;
1415
- const ret = arg0.addDeposit(getStringFromWasm0(arg1, arg2), arg3 >>> 0, BigInt.asUintN(64, arg4), arg5 !== 0);
1397
+ const ret = arg0.addDeposit(getStringFromWasm0(arg1, arg2), arg3 >>> 0, BigInt.asUintN(64, arg4));
1416
1398
  return ret;
1417
1399
  } finally {
1418
1400
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
@@ -1516,19 +1498,6 @@ module.exports.__wbg_cancelReservation_d85a13db3e8e3c7b = function() { return ha
1516
1498
  }
1517
1499
  }, arguments) };
1518
1500
 
1519
- module.exports.__wbg_cancelReservation_fd3065607b457424 = function() { return handleError(function (arg0, arg1, arg2) {
1520
- let deferred0_0;
1521
- let deferred0_1;
1522
- try {
1523
- deferred0_0 = arg1;
1524
- deferred0_1 = arg2;
1525
- const ret = arg0.cancelReservation(getStringFromWasm0(arg1, arg2));
1526
- return ret;
1527
- } finally {
1528
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1529
- }
1530
- }, arguments) };
1531
-
1532
1501
  module.exports.__wbg_cancel_8a308660caa6cadf = function(arg0) {
1533
1502
  const ret = arg0.cancel();
1534
1503
  return ret;
@@ -1576,23 +1545,13 @@ module.exports.__wbg_createDefaultStorage_458aa01b5eaead27 = function() { return
1576
1545
  return ret;
1577
1546
  }, arguments) };
1578
1547
 
1579
- module.exports.__wbg_createPostgresPool_8b4003e9db8e9432 = function() { return handleError(function (arg0) {
1580
- const ret = createPostgresPool(arg0);
1548
+ module.exports.__wbg_createPostgresStorage_46770cbf8e947f9e = function() { return handleError(function (arg0, arg1) {
1549
+ const ret = createPostgresStorage(arg0, arg1);
1581
1550
  return ret;
1582
1551
  }, arguments) };
1583
1552
 
1584
- module.exports.__wbg_createPostgresStorageWithPool_77aa64bddd7440db = function() { return handleError(function (arg0, arg1) {
1585
- const ret = createPostgresStorageWithPool(arg0, arg1);
1586
- return ret;
1587
- }, arguments) };
1588
-
1589
- module.exports.__wbg_createPostgresTokenStoreWithPool_5e7b75f5975d8b94 = function() { return handleError(function (arg0, arg1) {
1590
- const ret = createPostgresTokenStoreWithPool(arg0, arg1);
1591
- return ret;
1592
- }, arguments) };
1593
-
1594
- module.exports.__wbg_createPostgresTreeStoreWithPool_55e19122e69fb9e3 = function() { return handleError(function (arg0, arg1) {
1595
- const ret = createPostgresTreeStoreWithPool(arg0, arg1);
1553
+ module.exports.__wbg_createPostgresTreeStore_7887b0b703c72f83 = function() { return handleError(function (arg0, arg1) {
1554
+ const ret = createPostgresTreeStore(arg0, arg1);
1596
1555
  return ret;
1597
1556
  }, arguments) };
1598
1557
 
@@ -1772,19 +1731,6 @@ module.exports.__wbg_fetch_f156d10be9a5c88a = function(arg0) {
1772
1731
  return ret;
1773
1732
  };
1774
1733
 
1775
- module.exports.__wbg_finalizeReservation_86ee8385c17e015b = function() { return handleError(function (arg0, arg1, arg2) {
1776
- let deferred0_0;
1777
- let deferred0_1;
1778
- try {
1779
- deferred0_0 = arg1;
1780
- deferred0_1 = arg2;
1781
- const ret = arg0.finalizeReservation(getStringFromWasm0(arg1, arg2));
1782
- return ret;
1783
- } finally {
1784
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1785
- }
1786
- }, arguments) };
1787
-
1788
1734
  module.exports.__wbg_finalizeReservation_a8fad570b7fe5185 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
1789
1735
  let deferred0_0;
1790
1736
  let deferred0_1;
@@ -1936,11 +1882,6 @@ module.exports.__wbg_getStaticDepositSecretSource_8e310c718339e400 = function()
1936
1882
  return ret;
1937
1883
  }, arguments) };
1938
1884
 
1939
- module.exports.__wbg_getTokenOutputs_f51d6f5d47330273 = function() { return handleError(function (arg0, arg1) {
1940
- const ret = arg0.getTokenOutputs(arg1);
1941
- return ret;
1942
- }, arguments) };
1943
-
1944
1885
  module.exports.__wbg_getTransactionHex_973b8d0555c60f99 = function() { return handleError(function (arg0, arg1, arg2) {
1945
1886
  let deferred0_0;
1946
1887
  let deferred0_1;
@@ -2045,11 +1986,6 @@ module.exports.__wbg_insertPayment_2afe3300c5f86ccf = function() { return handle
2045
1986
  return ret;
2046
1987
  }, arguments) };
2047
1988
 
2048
- module.exports.__wbg_insertTokenOutputs_043ceea065ff8f65 = function() { return handleError(function (arg0, arg1) {
2049
- const ret = arg0.insertTokenOutputs(arg1);
2050
- return ret;
2051
- }, arguments) };
2052
-
2053
1989
  module.exports.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function(arg0) {
2054
1990
  let result;
2055
1991
  try {
@@ -2183,11 +2119,6 @@ module.exports.__wbg_listPayments_d8c53ab09ffc756b = function() { return handleE
2183
2119
  return ret;
2184
2120
  }, arguments) };
2185
2121
 
2186
- module.exports.__wbg_listTokensOutputs_4b4500bd5aca2c88 = function() { return handleError(function (arg0) {
2187
- const ret = arg0.listTokensOutputs();
2188
- return ret;
2189
- }, arguments) };
2190
-
2191
2122
  module.exports.__wbg_log_62b3ddcc89229688 = function(arg0, arg1) {
2192
2123
  arg0.log(arg1);
2193
2124
  };
@@ -2235,7 +2166,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
2235
2166
  const a = state0.a;
2236
2167
  state0.a = 0;
2237
2168
  try {
2238
- return __wbg_adapter_395(a, state0.b, arg0, arg1);
2169
+ return __wbg_adapter_373(a, state0.b, arg0, arg1);
2239
2170
  } finally {
2240
2171
  state0.a = a;
2241
2172
  }
@@ -2332,11 +2263,6 @@ module.exports.__wbg_now_6af59e24f5a53ad4 = function() { return handleError(func
2332
2263
  return ret;
2333
2264
  }, arguments) };
2334
2265
 
2335
- module.exports.__wbg_now_79892f24f17d010a = function() { return handleError(function (arg0) {
2336
- const ret = arg0.now();
2337
- return ret;
2338
- }, arguments) };
2339
-
2340
2266
  module.exports.__wbg_now_807e54c39636c349 = function() {
2341
2267
  const ret = Date.now();
2342
2268
  return ret;
@@ -2423,24 +2349,6 @@ module.exports.__wbg_require_60cc747a6bc5215a = function() { return handleError(
2423
2349
  return ret;
2424
2350
  }, arguments) };
2425
2351
 
2426
- module.exports.__wbg_reserveTokenOutputs_6a190cf797e7d196 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
2427
- let deferred0_0;
2428
- let deferred0_1;
2429
- let deferred1_0;
2430
- let deferred1_1;
2431
- try {
2432
- deferred0_0 = arg1;
2433
- deferred0_1 = arg2;
2434
- deferred1_0 = arg4;
2435
- deferred1_1 = arg5;
2436
- const ret = arg0.reserveTokenOutputs(getStringFromWasm0(arg1, arg2), arg3, getStringFromWasm0(arg4, arg5), arg6, arg7);
2437
- return ret;
2438
- } finally {
2439
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2440
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2441
- }
2442
- }, arguments) };
2443
-
2444
2352
  module.exports.__wbg_resolve_4851785c9c5f573d = function(arg0) {
2445
2353
  const ret = Promise.resolve(arg0);
2446
2354
  return ret;
@@ -2507,11 +2415,6 @@ module.exports.__wbg_setTimeout_db2dbaeefb6f39c7 = function() { return handleErr
2507
2415
  return ret;
2508
2416
  }, arguments) };
2509
2417
 
2510
- module.exports.__wbg_setTokensOutputs_5b8449721027f347 = function() { return handleError(function (arg0, arg1, arg2) {
2511
- const ret = arg0.setTokensOutputs(arg1, arg2);
2512
- return ret;
2513
- }, arguments) };
2514
-
2515
2418
  module.exports.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
2516
2419
  arg0[arg1 >>> 0] = arg2;
2517
2420
  };
@@ -2888,28 +2791,28 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
2888
2791
  return ret;
2889
2792
  };
2890
2793
 
2891
- module.exports.__wbindgen_closure_wrapper10753 = function(arg0, arg1, arg2) {
2892
- const ret = makeMutClosure(arg0, arg1, 457, __wbg_adapter_69);
2794
+ module.exports.__wbindgen_closure_wrapper10366 = function(arg0, arg1, arg2) {
2795
+ const ret = makeMutClosure(arg0, arg1, 445, __wbg_adapter_69);
2893
2796
  return ret;
2894
2797
  };
2895
2798
 
2896
- module.exports.__wbindgen_closure_wrapper16125 = function(arg0, arg1, arg2) {
2897
- const ret = makeMutClosure(arg0, arg1, 457, __wbg_adapter_64);
2799
+ module.exports.__wbindgen_closure_wrapper15749 = function(arg0, arg1, arg2) {
2800
+ const ret = makeMutClosure(arg0, arg1, 445, __wbg_adapter_64);
2898
2801
  return ret;
2899
2802
  };
2900
2803
 
2901
- module.exports.__wbindgen_closure_wrapper6193 = function(arg0, arg1, arg2) {
2902
- const ret = makeMutClosure(arg0, arg1, 457, __wbg_adapter_64);
2804
+ module.exports.__wbindgen_closure_wrapper5888 = function(arg0, arg1, arg2) {
2805
+ const ret = makeMutClosure(arg0, arg1, 445, __wbg_adapter_64);
2903
2806
  return ret;
2904
2807
  };
2905
2808
 
2906
- module.exports.__wbindgen_closure_wrapper6201 = function(arg0, arg1, arg2) {
2907
- const ret = makeMutClosure(arg0, arg1, 457, __wbg_adapter_64);
2809
+ module.exports.__wbindgen_closure_wrapper5896 = function(arg0, arg1, arg2) {
2810
+ const ret = makeMutClosure(arg0, arg1, 445, __wbg_adapter_64);
2908
2811
  return ret;
2909
2812
  };
2910
2813
 
2911
- module.exports.__wbindgen_closure_wrapper7889 = function(arg0, arg1, arg2) {
2912
- const ret = makeMutClosure(arg0, arg1, 979, __wbg_adapter_69);
2814
+ module.exports.__wbindgen_closure_wrapper7593 = function(arg0, arg1, arg2) {
2815
+ const ret = makeMutClosure(arg0, arg1, 954, __wbg_adapter_69);
2913
2816
  return ret;
2914
2817
  };
2915
2818
 
Binary file
@@ -30,7 +30,6 @@ export const breezsdk_listFiatCurrencies: (a: number) => any;
30
30
  export const breezsdk_listFiatRates: (a: number) => any;
31
31
  export const breezsdk_listPayments: (a: number, b: any) => any;
32
32
  export const breezsdk_listUnclaimedDeposits: (a: number, b: any) => any;
33
- export const breezsdk_listWebhooks: (a: number) => any;
34
33
  export const breezsdk_lnurlAuth: (a: number, b: any) => any;
35
34
  export const breezsdk_lnurlPay: (a: number, b: any) => any;
36
35
  export const breezsdk_lnurlWithdraw: (a: number, b: any) => any;
@@ -41,13 +40,11 @@ export const breezsdk_receivePayment: (a: number, b: any) => any;
41
40
  export const breezsdk_recommendedFees: (a: number) => any;
42
41
  export const breezsdk_refundDeposit: (a: number, b: any) => any;
43
42
  export const breezsdk_registerLightningAddress: (a: number, b: any) => any;
44
- export const breezsdk_registerWebhook: (a: number, b: any) => any;
45
43
  export const breezsdk_removeEventListener: (a: number, b: number, c: number) => any;
46
44
  export const breezsdk_sendPayment: (a: number, b: any) => any;
47
45
  export const breezsdk_signMessage: (a: number, b: any) => any;
48
- export const breezsdk_startLeafOptimization: (a: number) => any;
46
+ export const breezsdk_startLeafOptimization: (a: number) => void;
49
47
  export const breezsdk_syncWallet: (a: number, b: any) => any;
50
- export const breezsdk_unregisterWebhook: (a: number, b: any) => any;
51
48
  export const breezsdk_updateContact: (a: number, b: any) => any;
52
49
  export const breezsdk_updateUserSettings: (a: number, b: any) => any;
53
50
  export const connect: (a: any) => any;
@@ -91,7 +88,8 @@ export const sdkbuilder_withFiatService: (a: number, b: any) => number;
91
88
  export const sdkbuilder_withKeySet: (a: number, b: any) => number;
92
89
  export const sdkbuilder_withLnurlClient: (a: number, b: any) => number;
93
90
  export const sdkbuilder_withPaymentObserver: (a: number, b: any) => number;
94
- export const sdkbuilder_withPostgresBackend: (a: number, b: any) => number;
91
+ export const sdkbuilder_withPostgresStorage: (a: number, b: any) => number;
92
+ export const sdkbuilder_withPostgresTreeStore: (a: number, b: any) => number;
95
93
  export const sdkbuilder_withRestChainService: (a: number, b: number, c: number, d: any, e: number) => number;
96
94
  export const sdkbuilder_withStorage: (a: number, b: any) => number;
97
95
  export const tokenissuer_burnIssuerToken: (a: number, b: any) => any;
@@ -128,7 +126,7 @@ export const __wbindgen_export_5: WebAssembly.Table;
128
126
  export const __externref_drop_slice: (a: number, b: number) => void;
129
127
  export const __wbindgen_export_7: WebAssembly.Table;
130
128
  export const __externref_table_dealloc: (a: number) => void;
131
- export const closure456_externref_shim: (a: number, b: number, c: any) => void;
129
+ export const closure444_externref_shim: (a: number, b: number, c: any) => void;
132
130
  export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h1bbbe552b190da27: (a: number, b: number) => void;
133
- export const closure736_externref_shim: (a: number, b: number, c: any, d: any) => void;
131
+ export const closure711_externref_shim: (a: number, b: number, c: any, d: any) => void;
134
132
  export const __wbindgen_start: () => void;
package/nodejs/index.js CHANGED
@@ -16,10 +16,8 @@ try {
16
16
 
17
17
  // Automatically import and set up the PostgreSQL storage for Node.js
18
18
  try {
19
- const { createPostgresStorage, createPostgresPool, createPostgresStorageWithPool } = require('./postgres-storage/index.cjs');
19
+ const { createPostgresStorage } = require('./postgres-storage/index.cjs');
20
20
  global.createPostgresStorage = createPostgresStorage;
21
- global.createPostgresPool = createPostgresPool;
22
- global.createPostgresStorageWithPool = createPostgresStorageWithPool;
23
21
  } catch (error) {
24
22
  if (error.code !== 'MODULE_NOT_FOUND') {
25
23
  console.warn('Breez SDK: Failed to load PostgreSQL storage:', error.message);
@@ -28,25 +26,13 @@ try {
28
26
 
29
27
  // Automatically import and set up the PostgreSQL tree store for Node.js
30
28
  try {
31
- const { createPostgresTreeStore, createPostgresTreeStoreWithPool } = require('./postgres-tree-store/index.cjs');
29
+ const { createPostgresTreeStore } = require('./postgres-tree-store/index.cjs');
32
30
  global.createPostgresTreeStore = createPostgresTreeStore;
33
- global.createPostgresTreeStoreWithPool = createPostgresTreeStoreWithPool;
34
31
  } catch (error) {
35
32
  if (error.code !== 'MODULE_NOT_FOUND') {
36
33
  console.warn('Breez SDK: Failed to load PostgreSQL tree store:', error.message);
37
34
  }
38
35
  }
39
36
 
40
- // Automatically import and set up the PostgreSQL token store for Node.js
41
- try {
42
- const { createPostgresTokenStore, createPostgresTokenStoreWithPool } = require('./postgres-token-store/index.cjs');
43
- global.createPostgresTokenStore = createPostgresTokenStore;
44
- global.createPostgresTokenStoreWithPool = createPostgresTokenStoreWithPool;
45
- } catch (error) {
46
- if (error.code !== 'MODULE_NOT_FOUND') {
47
- console.warn('Breez SDK: Failed to load PostgreSQL token store:', error.message);
48
- }
49
- }
50
-
51
37
  // Export all WASM functions
52
38
  module.exports = wasmModule;
@@ -6,7 +6,6 @@
6
6
  "storage/",
7
7
  "postgres-storage/",
8
8
  "postgres-tree-store/",
9
- "postgres-token-store/",
10
9
  "index.js"
11
10
  ],
12
11
  "main": "index.js",
@@ -50,7 +50,6 @@ const SELECT_PAYMENT_SQL = `
50
50
  pm.lnurl_pay_info,
51
51
  pm.lnurl_withdraw_info,
52
52
  pm.conversion_info,
53
- pm.conversion_status,
54
53
  t.metadata AS token_metadata,
55
54
  t.tx_hash AS token_tx_hash,
56
55
  t.tx_type AS token_tx_type,
@@ -282,6 +281,20 @@ class PostgresStorage {
282
281
  params.push(paymentDetailsFilter.txType);
283
282
  }
284
283
 
284
+ // Filter by LNURL preimage status
285
+ if (
286
+ paymentDetailsFilter.type === "lightning" &&
287
+ paymentDetailsFilter.hasLnurlPreimage !== undefined
288
+ ) {
289
+ if (paymentDetailsFilter.hasLnurlPreimage) {
290
+ paymentDetailsClauses.push("lrm.preimage IS NOT NULL");
291
+ } else {
292
+ paymentDetailsClauses.push(
293
+ "lrm.payment_hash IS NOT NULL AND l.preimage IS NOT NULL AND lrm.preimage IS NULL"
294
+ );
295
+ }
296
+ }
297
+
285
298
  if (paymentDetailsClauses.length > 0) {
286
299
  allPaymentDetailsClauses.push(
287
300
  `(${paymentDetailsClauses.join(" AND ")})`
@@ -551,15 +564,14 @@ class PostgresStorage {
551
564
  async insertPaymentMetadata(paymentId, metadata) {
552
565
  try {
553
566
  await this.pool.query(
554
- `INSERT INTO payment_metadata (payment_id, parent_payment_id, lnurl_pay_info, lnurl_withdraw_info, lnurl_description, conversion_info, conversion_status)
555
- VALUES ($1, $2, $3, $4, $5, $6, $7)
567
+ `INSERT INTO payment_metadata (payment_id, parent_payment_id, lnurl_pay_info, lnurl_withdraw_info, lnurl_description, conversion_info)
568
+ VALUES ($1, $2, $3, $4, $5, $6)
556
569
  ON CONFLICT(payment_id) DO UPDATE SET
557
570
  parent_payment_id = COALESCE(EXCLUDED.parent_payment_id, payment_metadata.parent_payment_id),
558
571
  lnurl_pay_info = COALESCE(EXCLUDED.lnurl_pay_info, payment_metadata.lnurl_pay_info),
559
572
  lnurl_withdraw_info = COALESCE(EXCLUDED.lnurl_withdraw_info, payment_metadata.lnurl_withdraw_info),
560
573
  lnurl_description = COALESCE(EXCLUDED.lnurl_description, payment_metadata.lnurl_description),
561
- conversion_info = COALESCE(EXCLUDED.conversion_info, payment_metadata.conversion_info),
562
- conversion_status = COALESCE(EXCLUDED.conversion_status, payment_metadata.conversion_status)`,
574
+ conversion_info = COALESCE(EXCLUDED.conversion_info, payment_metadata.conversion_info)`,
563
575
  [
564
576
  paymentId,
565
577
  metadata.parentPaymentId,
@@ -573,7 +585,6 @@ class PostgresStorage {
573
585
  metadata.conversionInfo
574
586
  ? JSON.stringify(metadata.conversionInfo)
575
587
  : null,
576
- metadata.conversionStatus ?? null,
577
588
  ]
578
589
  );
579
590
  } catch (error) {
@@ -586,13 +597,13 @@ class PostgresStorage {
586
597
 
587
598
  // ===== Deposit Operations =====
588
599
 
589
- async addDeposit(txid, vout, amountSats, isMature) {
600
+ async addDeposit(txid, vout, amountSats) {
590
601
  try {
591
602
  await this.pool.query(
592
- `INSERT INTO unclaimed_deposits (txid, vout, amount_sats, is_mature)
593
- VALUES ($1, $2, $3, $4)
594
- ON CONFLICT(txid, vout) DO UPDATE SET is_mature = EXCLUDED.is_mature, amount_sats = EXCLUDED.amount_sats`,
595
- [txid, vout, amountSats, isMature]
603
+ `INSERT INTO unclaimed_deposits (txid, vout, amount_sats)
604
+ VALUES ($1, $2, $3)
605
+ ON CONFLICT(txid, vout) DO NOTHING`,
606
+ [txid, vout, amountSats]
596
607
  );
597
608
  } catch (error) {
598
609
  throw new StorageError(
@@ -619,14 +630,13 @@ class PostgresStorage {
619
630
  async listDeposits() {
620
631
  try {
621
632
  const result = await this.pool.query(
622
- "SELECT txid, vout, amount_sats, is_mature, claim_error, refund_tx, refund_tx_id FROM unclaimed_deposits"
633
+ "SELECT txid, vout, amount_sats, claim_error, refund_tx, refund_tx_id FROM unclaimed_deposits"
623
634
  );
624
635
 
625
636
  return result.rows.map((row) => ({
626
637
  txid: row.txid,
627
638
  vout: row.vout,
628
639
  amountSats: row.amount_sats != null ? BigInt(row.amount_sats) : BigInt(0),
629
- isMature: row.is_mature ?? true,
630
640
  claimError: row.claim_error || null,
631
641
  refundTx: row.refund_tx,
632
642
  refundTxId: row.refund_tx_id,
@@ -672,17 +682,19 @@ class PostgresStorage {
672
682
  await this._withTransaction(async (client) => {
673
683
  for (const item of metadata) {
674
684
  await client.query(
675
- `INSERT INTO lnurl_receive_metadata (payment_hash, nostr_zap_request, nostr_zap_receipt, sender_comment)
676
- VALUES ($1, $2, $3, $4)
685
+ `INSERT INTO lnurl_receive_metadata (payment_hash, nostr_zap_request, nostr_zap_receipt, sender_comment, preimage)
686
+ VALUES ($1, $2, $3, $4, $5)
677
687
  ON CONFLICT(payment_hash) DO UPDATE SET
678
688
  nostr_zap_request = EXCLUDED.nostr_zap_request,
679
689
  nostr_zap_receipt = EXCLUDED.nostr_zap_receipt,
680
- sender_comment = EXCLUDED.sender_comment`,
690
+ sender_comment = EXCLUDED.sender_comment,
691
+ preimage = EXCLUDED.preimage`,
681
692
  [
682
693
  item.paymentHash,
683
694
  item.nostrZapRequest || null,
684
695
  item.nostrZapReceipt || null,
685
696
  item.senderComment || null,
697
+ item.preimage || null,
686
698
  ]
687
699
  );
688
700
  }
@@ -817,9 +829,7 @@ class PostgresStorage {
817
829
  timestamp: Number(row.timestamp),
818
830
  method,
819
831
  details,
820
- conversionDetails: row.conversion_status
821
- ? { status: row.conversion_status, from: null, to: null }
822
- : null,
832
+ conversionDetails: null,
823
833
  };
824
834
  }
825
835
 
@@ -1354,37 +1364,16 @@ function defaultPostgresStorageConfig(connectionString) {
1354
1364
  * @returns {Promise<PostgresStorage>}
1355
1365
  */
1356
1366
  async function createPostgresStorage(config, logger = null) {
1357
- const pool = createPostgresPool(config);
1358
- return createPostgresStorageWithPool(pool, logger);
1359
- }
1360
-
1361
- /**
1362
- * Create a pg.Pool from a config object.
1363
- * The returned pool can be shared across multiple store implementations.
1364
- *
1365
- * @param {object} config - PostgreSQL configuration (from defaultPostgresStorageConfig)
1366
- * @returns {pg.Pool}
1367
- */
1368
- function createPostgresPool(config) {
1369
- return new pg.Pool({
1367
+ const pool = new pg.Pool({
1370
1368
  connectionString: config.connectionString,
1371
1369
  max: config.maxPoolSize,
1372
1370
  connectionTimeoutMillis: config.createTimeoutSecs * 1000,
1373
1371
  idleTimeoutMillis: config.recycleTimeoutSecs * 1000,
1374
1372
  });
1375
- }
1376
1373
 
1377
- /**
1378
- * Create a PostgresStorage instance from an existing pg.Pool.
1379
- *
1380
- * @param {pg.Pool} pool - An existing connection pool
1381
- * @param {object} [logger] - Optional logger
1382
- * @returns {Promise<PostgresStorage>}
1383
- */
1384
- async function createPostgresStorageWithPool(pool, logger = null) {
1385
1374
  const storage = new PostgresStorage(pool, logger);
1386
1375
  await storage.initialize();
1387
1376
  return storage;
1388
1377
  }
1389
1378
 
1390
- module.exports = { PostgresStorage, createPostgresStorage, createPostgresPool, createPostgresStorageWithPool, defaultPostgresStorageConfig, StorageError };
1379
+ module.exports = { PostgresStorage, createPostgresStorage, defaultPostgresStorageConfig, StorageError };
@@ -234,30 +234,6 @@ class PostgresMigrationManager {
234
234
  )`,
235
235
  ],
236
236
  },
237
- {
238
- name: "Drop preimage column from lnurl_receive_metadata",
239
- sql: [
240
- `ALTER TABLE lnurl_receive_metadata DROP COLUMN IF EXISTS preimage`,
241
- ],
242
- },
243
- {
244
- name: "Clear cached lightning address for CachedLightningAddress format change",
245
- sql: [
246
- `DELETE FROM settings WHERE key = 'lightning_address'`,
247
- ],
248
- },
249
- {
250
- name: "Add is_mature to unclaimed_deposits",
251
- sql: [
252
- `ALTER TABLE unclaimed_deposits ADD COLUMN is_mature BOOLEAN NOT NULL DEFAULT TRUE`,
253
- ],
254
- },
255
- {
256
- name: "Add conversion_status to payment_metadata",
257
- sql: [
258
- `ALTER TABLE payment_metadata ADD COLUMN IF NOT EXISTS conversion_status TEXT`,
259
- ],
260
- },
261
237
  ];
262
238
  }
263
239
  }