@breeztech/breez-sdk-spark 0.27.2 → 0.28.0

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 (55) hide show
  1. package/README.md +9 -8
  2. package/bundler/breez_sdk_spark_wasm.d.ts +141 -16
  3. package/bundler/breez_sdk_spark_wasm.js +1 -1
  4. package/bundler/breez_sdk_spark_wasm_bg.js +190 -40
  5. package/bundler/breez_sdk_spark_wasm_bg.wasm +0 -0
  6. package/bundler/breez_sdk_spark_wasm_bg.wasm.d.ts +23 -11
  7. package/bundler/index.js +6 -13
  8. package/bundler/storage/index.js +89 -17
  9. package/deno/breez_sdk_spark_wasm.d.ts +141 -16
  10. package/deno/breez_sdk_spark_wasm.js +190 -40
  11. package/deno/breez_sdk_spark_wasm_bg.wasm +0 -0
  12. package/deno/breez_sdk_spark_wasm_bg.wasm.d.ts +23 -11
  13. package/nodejs/breez_sdk_spark_wasm.d.ts +141 -16
  14. package/nodejs/breez_sdk_spark_wasm.js +194 -40
  15. package/nodejs/breez_sdk_spark_wasm_bg.wasm +0 -0
  16. package/nodejs/breez_sdk_spark_wasm_bg.wasm.d.ts +23 -11
  17. package/nodejs/index.d.mts +3 -0
  18. package/nodejs/index.js +30 -120
  19. package/nodejs/index.mjs +4 -0
  20. package/nodejs/mysql-session-store/index.cjs +24 -7
  21. package/nodejs/mysql-session-store/migrations.cjs +6 -0
  22. package/nodejs/mysql-storage/index.cjs +36 -19
  23. package/nodejs/mysql-storage/migrations.cjs +24 -9
  24. package/nodejs/mysql-token-store/index.cjs +28 -18
  25. package/nodejs/postgres-session-store/index.cjs +25 -7
  26. package/nodejs/postgres-session-store/migrations.cjs +12 -9
  27. package/nodejs/postgres-storage/index.cjs +36 -19
  28. package/nodejs/postgres-storage/migrations.cjs +24 -9
  29. package/nodejs/postgres-token-store/index.cjs +32 -18
  30. package/nodejs/postgres-token-store/migrations.cjs +5 -9
  31. package/nodejs/postgres-tree-store/migrations.cjs +5 -9
  32. package/nodejs/storage/index.cjs +35 -14
  33. package/nodejs/storage/migrations.cjs +25 -15
  34. package/nodejs/tree-store/index.cjs +1 -1
  35. package/nodejs/tree-store/migrations.cjs +6 -13
  36. package/package.json +27 -6
  37. package/ssr/index.js +24 -0
  38. package/web/breez_sdk_spark_wasm.d.ts +164 -27
  39. package/web/breez_sdk_spark_wasm.js +190 -40
  40. package/web/breez_sdk_spark_wasm_bg.wasm +0 -0
  41. package/web/breez_sdk_spark_wasm_bg.wasm.d.ts +23 -11
  42. package/web/index.js +6 -13
  43. package/web/passkey-prf-provider/index.js +1 -0
  44. package/web/storage/index.js +89 -17
  45. package/breez-sdk-spark.tgz +0 -0
  46. package/itest/.gitignore +0 -2
  47. package/itest/database-drivers.test.js +0 -45
  48. package/itest/helpers/assert.test.js +0 -70
  49. package/itest/helpers/faucet.js +0 -68
  50. package/itest/helpers/lnurl-fixture.js +0 -229
  51. package/itest/helpers/scenario.js +0 -444
  52. package/itest/package-lock.json +0 -519
  53. package/itest/package.json +0 -18
  54. package/itest/scenarios.test.js +0 -47
  55. package/itest/smoke.test.js +0 -184
@@ -146,6 +146,7 @@ class BreezSdk {
146
146
  return ret;
147
147
  }
148
148
  /**
149
+ * @deprecated Use `bridgeFromCashApp` on the client from `getBridgingClient`.
149
150
  * @param {BridgeFromCashAppRequest} request
150
151
  * @returns {Promise<BridgeFromCashAppResponse>}
151
152
  */
@@ -154,6 +155,7 @@ class BreezSdk {
154
155
  return ret;
155
156
  }
156
157
  /**
158
+ * @deprecated Use `bridgeToCashApp` on the client from `getBridgingClient`.
157
159
  * @param {BridgeToCashAppRequest} request
158
160
  * @returns {Promise<BridgeToCashAppResponse>}
159
161
  */
@@ -304,6 +306,16 @@ class BreezSdk {
304
306
  const ret = wasm.breezsdk_fetchConversionLimits(this.__wbg_ptr, request);
305
307
  return ret;
306
308
  }
309
+ /**
310
+ * @returns {BridgingClient}
311
+ */
312
+ getBridgingClient() {
313
+ const ret = wasm.breezsdk_getBridgingClient(this.__wbg_ptr);
314
+ if (ret[2]) {
315
+ throw takeFromExternrefTable0(ret[1]);
316
+ }
317
+ return BridgingClient.__wrap(ret[0]);
318
+ }
307
319
  /**
308
320
  * @param {CrossChainRouteFilter} filter
309
321
  * @returns {Promise<CrossChainRoutePair[]>}
@@ -469,7 +481,7 @@ class BreezSdk {
469
481
  return ret;
470
482
  }
471
483
  /**
472
- * @deprecated Use `bridgeFromCashApp`.
484
+ * @deprecated Use `bridgeFromCashApp` on the client from `getBridgingClient`.
473
485
  * @param {PreparePaymentLinkRequest} request
474
486
  * @returns {Promise<PreparePaymentLinkResponse>}
475
487
  */
@@ -674,6 +686,102 @@ class BreezSdk {
674
686
  if (Symbol.dispose) BreezSdk.prototype[Symbol.dispose] = BreezSdk.prototype.free;
675
687
  exports.BreezSdk = BreezSdk;
676
688
 
689
+ /**
690
+ * Creates bridges: orders that pay a recipient from another chain or over
691
+ * Lightning, with no funds moving through the SDK. Only available on mainnet.
692
+ */
693
+ class BridgingClient {
694
+ static __wrap(ptr) {
695
+ const obj = Object.create(BridgingClient.prototype);
696
+ obj.__wbg_ptr = ptr;
697
+ BridgingClientFinalization.register(obj, obj.__wbg_ptr, obj);
698
+ return obj;
699
+ }
700
+ __destroy_into_raw() {
701
+ const ptr = this.__wbg_ptr;
702
+ this.__wbg_ptr = 0;
703
+ BridgingClientFinalization.unregister(this);
704
+ return ptr;
705
+ }
706
+ free() {
707
+ const ptr = this.__destroy_into_raw();
708
+ wasm.__wbg_bridgingclient_free(ptr, 0);
709
+ }
710
+ /**
711
+ * @param {CreateBridgeRequest} request
712
+ * @returns {Promise<CreateBridgeResponse>}
713
+ */
714
+ bridgeFromCashApp(request) {
715
+ const ret = wasm.bridgingclient_bridgeFromCashApp(this.__wbg_ptr, request);
716
+ return ret;
717
+ }
718
+ /**
719
+ * @param {CreateBridgeRequest} request
720
+ * @returns {Promise<CreateBridgeResponse>}
721
+ */
722
+ bridgeToCashApp(request) {
723
+ const ret = wasm.bridgingclient_bridgeToCashApp(this.__wbg_ptr, request);
724
+ return ret;
725
+ }
726
+ /**
727
+ * @param {CreateBridgeRequest} request
728
+ * @returns {Promise<CreateBridgeResponse>}
729
+ */
730
+ createBridge(request) {
731
+ const ret = wasm.bridgingclient_createBridge(this.__wbg_ptr, request);
732
+ return ret;
733
+ }
734
+ /**
735
+ * @param {GetBridgeStatusRequest} request
736
+ * @returns {Promise<GetBridgeStatusResponse>}
737
+ */
738
+ getBridgeStatus(request) {
739
+ const ret = wasm.bridgingclient_getBridgeStatus(this.__wbg_ptr, request);
740
+ return ret;
741
+ }
742
+ /**
743
+ * @param {GetBridgeRoutesRequest} request
744
+ * @returns {Promise<GetBridgeRoutesResponse>}
745
+ */
746
+ getRoutes(request) {
747
+ const ret = wasm.bridgingclient_getRoutes(this.__wbg_ptr, request);
748
+ return ret;
749
+ }
750
+ }
751
+ if (Symbol.dispose) BridgingClient.prototype[Symbol.dispose] = BridgingClient.prototype.free;
752
+ exports.BridgingClient = BridgingClient;
753
+
754
+ /**
755
+ * A logger that prints each log entry to the JavaScript console, with the console method that
756
+ * matches the entry's level.
757
+ */
758
+ class ConsoleLogger {
759
+ __destroy_into_raw() {
760
+ const ptr = this.__wbg_ptr;
761
+ this.__wbg_ptr = 0;
762
+ ConsoleLoggerFinalization.unregister(this);
763
+ return ptr;
764
+ }
765
+ free() {
766
+ const ptr = this.__destroy_into_raw();
767
+ wasm.__wbg_consolelogger_free(ptr, 0);
768
+ }
769
+ /**
770
+ * @param {LogEntry} entry
771
+ */
772
+ log(entry) {
773
+ wasm.consolelogger_log(this.__wbg_ptr, entry);
774
+ }
775
+ constructor() {
776
+ const ret = wasm.consolelogger_new();
777
+ this.__wbg_ptr = ret;
778
+ ConsoleLoggerFinalization.register(this, this.__wbg_ptr, this);
779
+ return this;
780
+ }
781
+ }
782
+ if (Symbol.dispose) ConsoleLogger.prototype[Symbol.dispose] = ConsoleLogger.prototype.free;
783
+ exports.ConsoleLogger = ConsoleLogger;
784
+
677
785
  /**
678
786
  * A CPFP signer matching the `CpfpSigner` TypeScript interface.
679
787
  */
@@ -1890,6 +1998,19 @@ function createTurnkeySigningOnlySigner(config) {
1890
1998
  }
1891
1999
  exports.createTurnkeySigningOnlySigner = createTurnkeySigningOnlySigner;
1892
2000
 
2001
+ /**
2002
+ * Settings for `newBridgingClient` with every optional field unset.
2003
+ * @param {string} api_key
2004
+ * @returns {BridgingConfig}
2005
+ */
2006
+ function defaultBridgingConfig(api_key) {
2007
+ const ptr0 = passStringToWasm0(api_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2008
+ const len0 = WASM_VECTOR_LEN;
2009
+ const ret = wasm.defaultBridgingConfig(ptr0, len0);
2010
+ return ret;
2011
+ }
2012
+ exports.defaultBridgingConfig = defaultBridgingConfig;
2013
+
1893
2014
  /**
1894
2015
  * @param {Network} network
1895
2016
  * @returns {Config}
@@ -2037,6 +2158,17 @@ function mysqlStorage(config) {
2037
2158
  }
2038
2159
  exports.mysqlStorage = mysqlStorage;
2039
2160
 
2161
+ /**
2162
+ * Builds a `BridgingClient` from an API key, with no seed or storage.
2163
+ * @param {BridgingConfig} config
2164
+ * @returns {Promise<BridgingClient>}
2165
+ */
2166
+ function newBridgingClient(config) {
2167
+ const ret = wasm.newBridgingClient(config);
2168
+ return ret;
2169
+ }
2170
+ exports.newBridgingClient = newBridgingClient;
2171
+
2040
2172
  /**
2041
2173
  * Constructs a shareable REST-based Bitcoin chain service.
2042
2174
  *
@@ -2299,6 +2431,10 @@ function __wbg_get_imports() {
2299
2431
  const ret = BreezSdk.__wrap(arg0);
2300
2432
  return ret;
2301
2433
  },
2434
+ __wbg_bridgingclient_new: function(arg0) {
2435
+ const ret = BridgingClient.__wrap(arg0);
2436
+ return ret;
2437
+ },
2302
2438
  __wbg_broadcastTransaction_f298d093a11def5e: function() { return handleError(function (arg0, arg1, arg2) {
2303
2439
  let deferred0_0;
2304
2440
  let deferred0_1;
@@ -2451,6 +2587,9 @@ function __wbg_get_imports() {
2451
2587
  const ret = arg0.data;
2452
2588
  return ret;
2453
2589
  },
2590
+ __wbg_debug_37240d2c1d0ce2bb: function(arg0) {
2591
+ console.debug(arg0);
2592
+ },
2454
2593
  __wbg_decryptEcies_ebe426814020926b: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2455
2594
  let deferred1_0;
2456
2595
  let deferred1_1;
@@ -2578,6 +2717,9 @@ function __wbg_get_imports() {
2578
2717
  __wbg_error_145dadf4216d70bc: function(arg0, arg1) {
2579
2718
  console.error(getStringFromWasm0(arg0, arg1));
2580
2719
  },
2720
+ __wbg_error_48655ee7e4756f8b: function(arg0) {
2721
+ console.error(arg0);
2722
+ },
2581
2723
  __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
2582
2724
  let deferred0_0;
2583
2725
  let deferred0_1;
@@ -2900,6 +3042,9 @@ function __wbg_get_imports() {
2900
3042
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2901
3043
  }
2902
3044
  }, arguments); },
3045
+ __wbg_info_092aeeab8cd06a0b: function(arg0) {
3046
+ console.info(arg0);
3047
+ },
2903
3048
  __wbg_insertContact_cc39397cb8e88ff8: function() { return handleError(function (arg0, arg1) {
2904
3049
  const ret = arg0.insertContact(arg1);
2905
3050
  return ret;
@@ -3798,63 +3943,66 @@ function __wbg_get_imports() {
3798
3943
  const ret = arg0.view;
3799
3944
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3800
3945
  },
3946
+ __wbg_warn_1f9b94806da61fbb: function(arg0) {
3947
+ console.warn(arg0);
3948
+ },
3801
3949
  __wbg_wasmsdkcontext_new: function(arg0) {
3802
3950
  const ret = WasmSdkContext.__wrap(arg0);
3803
3951
  return ret;
3804
3952
  },
3805
3953
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
3806
3954
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 26, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3807
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h6a948436da8c8a31);
3955
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h43ca79db2f165a92);
3808
3956
  return ret;
3809
3957
  },
3810
3958
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
3811
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 474, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3812
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h06397208c6d2b4ed);
3959
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 479, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3960
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h168b325370d2795a);
3813
3961
  return ret;
3814
3962
  },
3815
3963
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
3816
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 474, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3817
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h06397208c6d2b4ed_2);
3964
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 479, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3965
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h168b325370d2795a_2);
3818
3966
  return ret;
3819
3967
  },
3820
3968
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
3821
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 474, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3822
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h06397208c6d2b4ed_3);
3969
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 479, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3970
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h168b325370d2795a_3);
3823
3971
  return ret;
3824
3972
  },
3825
3973
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
3826
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 474, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3827
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h06397208c6d2b4ed_4);
3974
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 479, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3975
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h168b325370d2795a_4);
3828
3976
  return ret;
3829
3977
  },
3830
3978
  __wbindgen_cast_0000000000000006: function(arg0, arg1) {
3831
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 474, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3832
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h06397208c6d2b4ed_5);
3979
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 479, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3980
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h168b325370d2795a_5);
3833
3981
  return ret;
3834
3982
  },
3835
3983
  __wbindgen_cast_0000000000000007: function(arg0, arg1) {
3836
3984
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("SessionStore")], shim_idx: 26, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3837
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h6a948436da8c8a31_6);
3985
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h43ca79db2f165a92_6);
3838
3986
  return ret;
3839
3987
  },
3840
3988
  __wbindgen_cast_0000000000000008: function(arg0, arg1) {
3841
3989
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Storage")], shim_idx: 26, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3842
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h6a948436da8c8a31_7);
3990
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h43ca79db2f165a92_7);
3843
3991
  return ret;
3844
3992
  },
3845
3993
  __wbindgen_cast_0000000000000009: function(arg0, arg1) {
3846
3994
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("TokenStore")], shim_idx: 26, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3847
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h6a948436da8c8a31_8);
3995
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h43ca79db2f165a92_8);
3848
3996
  return ret;
3849
3997
  },
3850
3998
  __wbindgen_cast_000000000000000a: function(arg0, arg1) {
3851
3999
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("TreeStore")], shim_idx: 26, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3852
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h6a948436da8c8a31_9);
4000
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h43ca79db2f165a92_9);
3853
4001
  return ret;
3854
4002
  },
3855
4003
  __wbindgen_cast_000000000000000b: function(arg0, arg1) {
3856
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 864, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3857
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h02848814aa3937de);
4004
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 875, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
4005
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h8a05c61e16e49565);
3858
4006
  return ret;
3859
4007
  },
3860
4008
  __wbindgen_cast_000000000000000c: function(arg0) {
@@ -3945,60 +4093,60 @@ function __wbg_get_imports() {
3945
4093
  };
3946
4094
  }
3947
4095
 
3948
- function wasm_bindgen__convert__closures_____invoke__h02848814aa3937de(arg0, arg1) {
3949
- wasm.wasm_bindgen__convert__closures_____invoke__h02848814aa3937de(arg0, arg1);
4096
+ function wasm_bindgen__convert__closures_____invoke__h8a05c61e16e49565(arg0, arg1) {
4097
+ wasm.wasm_bindgen__convert__closures_____invoke__h8a05c61e16e49565(arg0, arg1);
3950
4098
  }
3951
4099
 
3952
- function wasm_bindgen__convert__closures_____invoke__h06397208c6d2b4ed(arg0, arg1, arg2) {
3953
- wasm.wasm_bindgen__convert__closures_____invoke__h06397208c6d2b4ed(arg0, arg1, arg2);
4100
+ function wasm_bindgen__convert__closures_____invoke__h168b325370d2795a(arg0, arg1, arg2) {
4101
+ wasm.wasm_bindgen__convert__closures_____invoke__h168b325370d2795a(arg0, arg1, arg2);
3954
4102
  }
3955
4103
 
3956
- function wasm_bindgen__convert__closures_____invoke__h06397208c6d2b4ed_2(arg0, arg1, arg2) {
3957
- wasm.wasm_bindgen__convert__closures_____invoke__h06397208c6d2b4ed_2(arg0, arg1, arg2);
4104
+ function wasm_bindgen__convert__closures_____invoke__h168b325370d2795a_2(arg0, arg1, arg2) {
4105
+ wasm.wasm_bindgen__convert__closures_____invoke__h168b325370d2795a_2(arg0, arg1, arg2);
3958
4106
  }
3959
4107
 
3960
- function wasm_bindgen__convert__closures_____invoke__h06397208c6d2b4ed_3(arg0, arg1, arg2) {
3961
- wasm.wasm_bindgen__convert__closures_____invoke__h06397208c6d2b4ed_3(arg0, arg1, arg2);
4108
+ function wasm_bindgen__convert__closures_____invoke__h168b325370d2795a_3(arg0, arg1, arg2) {
4109
+ wasm.wasm_bindgen__convert__closures_____invoke__h168b325370d2795a_3(arg0, arg1, arg2);
3962
4110
  }
3963
4111
 
3964
- function wasm_bindgen__convert__closures_____invoke__h06397208c6d2b4ed_4(arg0, arg1, arg2) {
3965
- wasm.wasm_bindgen__convert__closures_____invoke__h06397208c6d2b4ed_4(arg0, arg1, arg2);
4112
+ function wasm_bindgen__convert__closures_____invoke__h168b325370d2795a_4(arg0, arg1, arg2) {
4113
+ wasm.wasm_bindgen__convert__closures_____invoke__h168b325370d2795a_4(arg0, arg1, arg2);
3966
4114
  }
3967
4115
 
3968
- function wasm_bindgen__convert__closures_____invoke__h06397208c6d2b4ed_5(arg0, arg1, arg2) {
3969
- wasm.wasm_bindgen__convert__closures_____invoke__h06397208c6d2b4ed_5(arg0, arg1, arg2);
4116
+ function wasm_bindgen__convert__closures_____invoke__h168b325370d2795a_5(arg0, arg1, arg2) {
4117
+ wasm.wasm_bindgen__convert__closures_____invoke__h168b325370d2795a_5(arg0, arg1, arg2);
3970
4118
  }
3971
4119
 
3972
- function wasm_bindgen__convert__closures_____invoke__h6a948436da8c8a31(arg0, arg1, arg2) {
3973
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__h6a948436da8c8a31(arg0, arg1, arg2);
4120
+ function wasm_bindgen__convert__closures_____invoke__h43ca79db2f165a92(arg0, arg1, arg2) {
4121
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h43ca79db2f165a92(arg0, arg1, arg2);
3974
4122
  if (ret[1]) {
3975
4123
  throw takeFromExternrefTable0(ret[0]);
3976
4124
  }
3977
4125
  }
3978
4126
 
3979
- function wasm_bindgen__convert__closures_____invoke__h6a948436da8c8a31_6(arg0, arg1, arg2) {
3980
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__h6a948436da8c8a31_6(arg0, arg1, arg2);
4127
+ function wasm_bindgen__convert__closures_____invoke__h43ca79db2f165a92_6(arg0, arg1, arg2) {
4128
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h43ca79db2f165a92_6(arg0, arg1, arg2);
3981
4129
  if (ret[1]) {
3982
4130
  throw takeFromExternrefTable0(ret[0]);
3983
4131
  }
3984
4132
  }
3985
4133
 
3986
- function wasm_bindgen__convert__closures_____invoke__h6a948436da8c8a31_7(arg0, arg1, arg2) {
3987
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__h6a948436da8c8a31_7(arg0, arg1, arg2);
4134
+ function wasm_bindgen__convert__closures_____invoke__h43ca79db2f165a92_7(arg0, arg1, arg2) {
4135
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h43ca79db2f165a92_7(arg0, arg1, arg2);
3988
4136
  if (ret[1]) {
3989
4137
  throw takeFromExternrefTable0(ret[0]);
3990
4138
  }
3991
4139
  }
3992
4140
 
3993
- function wasm_bindgen__convert__closures_____invoke__h6a948436da8c8a31_8(arg0, arg1, arg2) {
3994
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__h6a948436da8c8a31_8(arg0, arg1, arg2);
4141
+ function wasm_bindgen__convert__closures_____invoke__h43ca79db2f165a92_8(arg0, arg1, arg2) {
4142
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h43ca79db2f165a92_8(arg0, arg1, arg2);
3995
4143
  if (ret[1]) {
3996
4144
  throw takeFromExternrefTable0(ret[0]);
3997
4145
  }
3998
4146
  }
3999
4147
 
4000
- function wasm_bindgen__convert__closures_____invoke__h6a948436da8c8a31_9(arg0, arg1, arg2) {
4001
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__h6a948436da8c8a31_9(arg0, arg1, arg2);
4148
+ function wasm_bindgen__convert__closures_____invoke__h43ca79db2f165a92_9(arg0, arg1, arg2) {
4149
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h43ca79db2f165a92_9(arg0, arg1, arg2);
4002
4150
  if (ret[1]) {
4003
4151
  throw takeFromExternrefTable0(ret[0]);
4004
4152
  }
@@ -4034,6 +4182,12 @@ const BitcoinChainServiceHandleFinalization = (typeof FinalizationRegistry === '
4034
4182
  const BreezSdkFinalization = (typeof FinalizationRegistry === 'undefined')
4035
4183
  ? { register: () => {}, unregister: () => {} }
4036
4184
  : new FinalizationRegistry(ptr => wasm.__wbg_breezsdk_free(ptr, 1));
4185
+ const BridgingClientFinalization = (typeof FinalizationRegistry === 'undefined')
4186
+ ? { register: () => {}, unregister: () => {} }
4187
+ : new FinalizationRegistry(ptr => wasm.__wbg_bridgingclient_free(ptr, 1));
4188
+ const ConsoleLoggerFinalization = (typeof FinalizationRegistry === 'undefined')
4189
+ ? { register: () => {}, unregister: () => {} }
4190
+ : new FinalizationRegistry(ptr => wasm.__wbg_consolelogger_free(ptr, 1));
4037
4191
  const DefaultCpfpSignerFinalization = (typeof FinalizationRegistry === 'undefined')
4038
4192
  ? { register: () => {}, unregister: () => {} }
4039
4193
  : new FinalizationRegistry(ptr => wasm.__wbg_defaultcpfpsigner_free(ptr, 1));
Binary file
@@ -3,6 +3,8 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const __wbg_bitcoinchainservicehandle_free: (a: number, b: number) => void;
5
5
  export const __wbg_breezsdk_free: (a: number, b: number) => void;
6
+ export const __wbg_bridgingclient_free: (a: number, b: number) => void;
7
+ export const __wbg_consolelogger_free: (a: number, b: number) => void;
6
8
  export const __wbg_defaultcpfpsigner_free: (a: number, b: number) => void;
7
9
  export const __wbg_externalsigners_free: (a: number, b: number) => void;
8
10
  export const __wbg_passkeyclient_free: (a: number, b: number) => void;
@@ -42,6 +44,7 @@ export const breezsdk_disconnect: (a: number) => any;
42
44
  export const breezsdk_exportUnilateralExitState: (a: number) => any;
43
45
  export const breezsdk_fetchClaimDepositQuote: (a: number, b: any) => any;
44
46
  export const breezsdk_fetchConversionLimits: (a: number, b: any) => any;
47
+ export const breezsdk_getBridgingClient: (a: number) => [number, number, number];
45
48
  export const breezsdk_getCrossChainRoutes: (a: number, b: any) => any;
46
49
  export const breezsdk_getInfo: (a: number, b: any) => any;
47
50
  export const breezsdk_getLightningAddress: (a: number) => any;
@@ -88,11 +91,19 @@ export const breezsdk_syncWallet: (a: number, b: any) => any;
88
91
  export const breezsdk_unregisterWebhook: (a: number, b: any) => any;
89
92
  export const breezsdk_updateContact: (a: number, b: any) => any;
90
93
  export const breezsdk_updateUserSettings: (a: number, b: any) => any;
94
+ export const bridgingclient_bridgeFromCashApp: (a: number, b: any) => any;
95
+ export const bridgingclient_bridgeToCashApp: (a: number, b: any) => any;
96
+ export const bridgingclient_createBridge: (a: number, b: any) => any;
97
+ export const bridgingclient_getBridgeStatus: (a: number, b: any) => any;
98
+ export const bridgingclient_getRoutes: (a: number, b: any) => any;
91
99
  export const connect: (a: any) => any;
92
100
  export const connectWithSigner: (a: any, b: any, c: any, d: number, e: number) => any;
93
101
  export const connectWithSigningOnlySigner: (a: any, b: any, c: any, d: number, e: number) => any;
102
+ export const consolelogger_log: (a: number, b: any) => void;
103
+ export const consolelogger_new: () => number;
94
104
  export const createTurnkeySigner: (a: any) => any;
95
105
  export const createTurnkeySigningOnlySigner: (a: any) => any;
106
+ export const defaultBridgingConfig: (a: number, b: number) => any;
96
107
  export const defaultConfig: (a: any) => any;
97
108
  export const defaultExternalSigners: (a: number, b: number, c: number, d: number, e: any, f: number) => [number, number, number];
98
109
  export const defaultMysqlStorageConfig: (a: number, b: number) => any;
@@ -138,6 +149,7 @@ export const externalsparksignerhandle_startWatchtowerExitRecovery: (a: number,
138
149
  export const getSparkStatus: () => any;
139
150
  export const initLogging: (a: any, b: number, c: number) => any;
140
151
  export const mysqlStorage: (a: any) => number;
152
+ export const newBridgingClient: (a: any) => any;
141
153
  export const newRestChainService: (a: number, b: number, c: any, d: any, e: number) => any;
142
154
  export const newSharedSdkContext: (a: any) => any;
143
155
  export const parseSparkConfig: (a: number, b: number) => [number, number, number];
@@ -202,18 +214,18 @@ export const __wbg_externalsigningsignerhandle_free: (a: number, b: number) => v
202
214
  export const __wbg_signingonlyexternalsigners_free: (a: number, b: number) => void;
203
215
  export const signingonlyexternalsigners_breezSigner: (a: number) => number;
204
216
  export const signingonlyexternalsigners_sparkSigner: (a: number) => number;
205
- export const wasm_bindgen__convert__closures_____invoke__h6a948436da8c8a31: (a: number, b: number, c: any) => [number, number];
206
- export const wasm_bindgen__convert__closures_____invoke__h6a948436da8c8a31_6: (a: number, b: number, c: any) => [number, number];
207
- export const wasm_bindgen__convert__closures_____invoke__h6a948436da8c8a31_7: (a: number, b: number, c: any) => [number, number];
208
- export const wasm_bindgen__convert__closures_____invoke__h6a948436da8c8a31_8: (a: number, b: number, c: any) => [number, number];
209
- export const wasm_bindgen__convert__closures_____invoke__h6a948436da8c8a31_9: (a: number, b: number, c: any) => [number, number];
217
+ export const wasm_bindgen__convert__closures_____invoke__h43ca79db2f165a92: (a: number, b: number, c: any) => [number, number];
218
+ export const wasm_bindgen__convert__closures_____invoke__h43ca79db2f165a92_6: (a: number, b: number, c: any) => [number, number];
219
+ export const wasm_bindgen__convert__closures_____invoke__h43ca79db2f165a92_7: (a: number, b: number, c: any) => [number, number];
220
+ export const wasm_bindgen__convert__closures_____invoke__h43ca79db2f165a92_8: (a: number, b: number, c: any) => [number, number];
221
+ export const wasm_bindgen__convert__closures_____invoke__h43ca79db2f165a92_9: (a: number, b: number, c: any) => [number, number];
210
222
  export const wasm_bindgen__convert__closures_____invoke__h118cfc65b353d9fd: (a: number, b: number, c: any, d: any) => void;
211
- export const wasm_bindgen__convert__closures_____invoke__h06397208c6d2b4ed: (a: number, b: number, c: any) => void;
212
- export const wasm_bindgen__convert__closures_____invoke__h06397208c6d2b4ed_2: (a: number, b: number, c: any) => void;
213
- export const wasm_bindgen__convert__closures_____invoke__h06397208c6d2b4ed_3: (a: number, b: number, c: any) => void;
214
- export const wasm_bindgen__convert__closures_____invoke__h06397208c6d2b4ed_4: (a: number, b: number, c: any) => void;
215
- export const wasm_bindgen__convert__closures_____invoke__h06397208c6d2b4ed_5: (a: number, b: number, c: any) => void;
216
- export const wasm_bindgen__convert__closures_____invoke__h02848814aa3937de: (a: number, b: number) => void;
223
+ export const wasm_bindgen__convert__closures_____invoke__h168b325370d2795a: (a: number, b: number, c: any) => void;
224
+ export const wasm_bindgen__convert__closures_____invoke__h168b325370d2795a_2: (a: number, b: number, c: any) => void;
225
+ export const wasm_bindgen__convert__closures_____invoke__h168b325370d2795a_3: (a: number, b: number, c: any) => void;
226
+ export const wasm_bindgen__convert__closures_____invoke__h168b325370d2795a_4: (a: number, b: number, c: any) => void;
227
+ export const wasm_bindgen__convert__closures_____invoke__h168b325370d2795a_5: (a: number, b: number, c: any) => void;
228
+ export const wasm_bindgen__convert__closures_____invoke__h8a05c61e16e49565: (a: number, b: number) => void;
217
229
  export const __wbindgen_malloc: (a: number, b: number) => number;
218
230
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
219
231
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
@@ -0,0 +1,3 @@
1
+ export * from "./breez_sdk_spark_wasm.js";
2
+ import * as pkg from "./breez_sdk_spark_wasm.js";
3
+ export default pkg;
package/nodejs/index.js CHANGED
@@ -1,125 +1,35 @@
1
1
  // Node.js entry point for Breez SDK with automatic storage support
2
2
  const wasmModule = require('./breez_sdk_spark_wasm.js');
3
3
 
4
- // Automatically import and set up the storage for Node.js
5
- try {
6
- const { createDefaultStorage } = require('./storage/index.cjs');
4
+ // The WASM bridge calls the storage factories as globals. When a storage module fails to
5
+ // load, for example because its optional database driver is not installed, its factories
6
+ // fail with the load error, so only an app that uses that storage gets it. The bridge
7
+ // awaits every factory except the pool factories.
8
+ function registerFactories(file, names, poolNames = []) {
9
+ try {
10
+ const factories = require(file);
11
+ for (const name of [...names, ...poolNames]) {
12
+ global[name] = factories[name];
13
+ }
14
+ } catch (error) {
15
+ for (const name of names) {
16
+ global[name] = () => Promise.reject(error);
17
+ }
18
+ for (const name of poolNames) {
19
+ global[name] = () => { throw error; };
20
+ }
21
+ }
22
+ }
23
+
24
+ registerFactories('./storage/index.cjs', ['createDefaultStorage']);
25
+ registerFactories('./tree-store/index.cjs', ['createDefaultTreeStore']);
26
+ registerFactories('./postgres-storage/index.cjs', ['createPostgresStorage', 'createPostgresStorageWithPool'], ['createPostgresPool']);
27
+ registerFactories('./postgres-tree-store/index.cjs', ['createPostgresTreeStore', 'createPostgresTreeStoreWithPool']);
28
+ registerFactories('./postgres-token-store/index.cjs', ['createPostgresTokenStore', 'createPostgresTokenStoreWithPool']);
29
+ registerFactories('./postgres-session-store/index.cjs', ['createPostgresSessionStore', 'createPostgresSessionStoreWithPool']);
30
+ registerFactories('./mysql-storage/index.cjs', ['createMysqlStorage', 'createMysqlStorageWithPool'], ['createMysqlPool']);
31
+ registerFactories('./mysql-tree-store/index.cjs', ['createMysqlTreeStore', 'createMysqlTreeStoreWithPool']);
32
+ registerFactories('./mysql-token-store/index.cjs', ['createMysqlTokenStore', 'createMysqlTokenStoreWithPool']);
33
+ registerFactories('./mysql-session-store/index.cjs', ['createMysqlSessionStore', 'createMysqlSessionStoreWithPool']);
7
34
 
8
- // Make createDefaultStorage available globally for WASM to find
9
- global.createDefaultStorage = createDefaultStorage;
10
-
11
- console.log('Breez SDK: Node.js storage automatically enabled');
12
- } catch (error) {
13
- console.warn('Breez SDK: Failed to load Node.js storage:', error.message);
14
- console.warn('Breez SDK: Storage operations may not work properly. Ignore this warning if you are not using the default storage.');
15
- }
16
-
17
- // Automatically import and set up the default tree store for Node.js
18
- try {
19
- const { createDefaultTreeStore } = require('./tree-store/index.cjs');
20
-
21
- // Make createDefaultTreeStore available globally for the WASM bridge to find.
22
- global.createDefaultTreeStore = createDefaultTreeStore;
23
- } catch (error) {
24
- console.warn('Breez SDK: Failed to load Node.js tree store:', error.message);
25
- console.warn('Breez SDK: Tree state will not be persisted. Ignore this warning if you are not using the default storage.');
26
- }
27
-
28
- // Automatically import and set up the PostgreSQL storage for Node.js
29
- try {
30
- const { createPostgresStorage, createPostgresPool, createPostgresStorageWithPool } = require('./postgres-storage/index.cjs');
31
- global.createPostgresStorage = createPostgresStorage;
32
- global.createPostgresPool = createPostgresPool;
33
- global.createPostgresStorageWithPool = createPostgresStorageWithPool;
34
- } catch (error) {
35
- if (error.code !== 'MODULE_NOT_FOUND') {
36
- console.warn('Breez SDK: Failed to load PostgreSQL storage:', error.message);
37
- }
38
- // The WASM bridge builds every PostgreSQL store from a pool, so a caller that asks
39
- // for PostgreSQL storage gets this load error.
40
- global.createPostgresPool = () => { throw error; };
41
- }
42
-
43
- // Automatically import and set up the PostgreSQL tree store for Node.js
44
- try {
45
- const { createPostgresTreeStore, createPostgresTreeStoreWithPool } = require('./postgres-tree-store/index.cjs');
46
- global.createPostgresTreeStore = createPostgresTreeStore;
47
- global.createPostgresTreeStoreWithPool = createPostgresTreeStoreWithPool;
48
- } catch (error) {
49
- if (error.code !== 'MODULE_NOT_FOUND') {
50
- console.warn('Breez SDK: Failed to load PostgreSQL tree store:', error.message);
51
- }
52
- }
53
-
54
- // Automatically import and set up the PostgreSQL token store for Node.js
55
- try {
56
- const { createPostgresTokenStore, createPostgresTokenStoreWithPool } = require('./postgres-token-store/index.cjs');
57
- global.createPostgresTokenStore = createPostgresTokenStore;
58
- global.createPostgresTokenStoreWithPool = createPostgresTokenStoreWithPool;
59
- } catch (error) {
60
- if (error.code !== 'MODULE_NOT_FOUND') {
61
- console.warn('Breez SDK: Failed to load PostgreSQL token store:', error.message);
62
- }
63
- }
64
-
65
- // Automatically import and set up the PostgreSQL session store for Node.js
66
- try {
67
- const { createPostgresSessionStore, createPostgresSessionStoreWithPool } = require('./postgres-session-store/index.cjs');
68
- global.createPostgresSessionStore = createPostgresSessionStore;
69
- global.createPostgresSessionStoreWithPool = createPostgresSessionStoreWithPool;
70
- } catch (error) {
71
- if (error.code !== 'MODULE_NOT_FOUND') {
72
- console.warn('Breez SDK: Failed to load PostgreSQL session store:', error.message);
73
- }
74
- }
75
-
76
- // Automatically import and set up the MySQL storage for Node.js
77
- try {
78
- const { createMysqlStorage, createMysqlPool, createMysqlStorageWithPool } = require('./mysql-storage/index.cjs');
79
- global.createMysqlStorage = createMysqlStorage;
80
- global.createMysqlPool = createMysqlPool;
81
- global.createMysqlStorageWithPool = createMysqlStorageWithPool;
82
- } catch (error) {
83
- if (error.code !== 'MODULE_NOT_FOUND') {
84
- console.warn('Breez SDK: Failed to load MySQL storage:', error.message);
85
- }
86
- // The WASM bridge builds every MySQL store from a pool, so a caller that asks
87
- // for MySQL storage gets this load error.
88
- global.createMysqlPool = () => { throw error; };
89
- }
90
-
91
- // Automatically import and set up the MySQL tree store for Node.js
92
- try {
93
- const { createMysqlTreeStore, createMysqlTreeStoreWithPool } = require('./mysql-tree-store/index.cjs');
94
- global.createMysqlTreeStore = createMysqlTreeStore;
95
- global.createMysqlTreeStoreWithPool = createMysqlTreeStoreWithPool;
96
- } catch (error) {
97
- if (error.code !== 'MODULE_NOT_FOUND') {
98
- console.warn('Breez SDK: Failed to load MySQL tree store:', error.message);
99
- }
100
- }
101
-
102
- // Automatically import and set up the MySQL token store for Node.js
103
- try {
104
- const { createMysqlTokenStore, createMysqlTokenStoreWithPool } = require('./mysql-token-store/index.cjs');
105
- global.createMysqlTokenStore = createMysqlTokenStore;
106
- global.createMysqlTokenStoreWithPool = createMysqlTokenStoreWithPool;
107
- } catch (error) {
108
- if (error.code !== 'MODULE_NOT_FOUND') {
109
- console.warn('Breez SDK: Failed to load MySQL token store:', error.message);
110
- }
111
- }
112
-
113
- // Automatically import and set up the MySQL session store for Node.js
114
- try {
115
- const { createMysqlSessionStore, createMysqlSessionStoreWithPool } = require('./mysql-session-store/index.cjs');
116
- global.createMysqlSessionStore = createMysqlSessionStore;
117
- global.createMysqlSessionStoreWithPool = createMysqlSessionStoreWithPool;
118
- } catch (error) {
119
- if (error.code !== 'MODULE_NOT_FOUND') {
120
- console.warn('Breez SDK: Failed to load MySQL session store:', error.message);
121
- }
122
- }
123
-
124
- // Export all WASM functions
125
35
  module.exports = wasmModule;