@breeztech/breez-sdk-spark-react-native 0.13.10-dev → 0.13.12-dev1

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.
@@ -240,6 +240,14 @@ typedef void (*UniffiCallbackInterfaceRestClientMethod2)(
240
240
  uint64_t uniffi_handle, RustBuffer url, RustBuffer headers, RustBuffer body,
241
241
  UniffiForeignFutureCompleteRustBuffer uniffi_future_callback,
242
242
  uint64_t uniffi_callback_data, UniffiForeignFuture *uniffi_out_return);
243
+ typedef void (*UniffiCallbackInterfaceSessionManagerMethod0)(
244
+ uint64_t uniffi_handle, RustBuffer service_identity_key,
245
+ UniffiForeignFutureCompleteRustBuffer uniffi_future_callback,
246
+ uint64_t uniffi_callback_data, UniffiForeignFuture *uniffi_out_return);
247
+ typedef void (*UniffiCallbackInterfaceSessionManagerMethod1)(
248
+ uint64_t uniffi_handle, RustBuffer service_identity_key, RustBuffer session,
249
+ UniffiForeignFutureCompleteVoid uniffi_future_callback,
250
+ uint64_t uniffi_callback_data, UniffiForeignFuture *uniffi_out_return);
243
251
  typedef void (*UniffiCallbackInterfaceStorageMethod0)(
244
252
  uint64_t uniffi_handle, RustBuffer key,
245
253
  UniffiForeignFutureCompleteVoid uniffi_future_callback,
@@ -409,6 +417,11 @@ typedef struct UniffiVTableCallbackInterfaceRestClient {
409
417
  UniffiCallbackInterfaceRestClientMethod2 delete_request;
410
418
  UniffiCallbackInterfaceFree uniffi_free;
411
419
  } UniffiVTableCallbackInterfaceRestClient;
420
+ typedef struct UniffiVTableCallbackInterfaceSessionManager {
421
+ UniffiCallbackInterfaceSessionManagerMethod0 get_session;
422
+ UniffiCallbackInterfaceSessionManagerMethod1 set_session;
423
+ UniffiCallbackInterfaceFree uniffi_free;
424
+ } UniffiVTableCallbackInterfaceSessionManager;
412
425
  typedef struct UniffiVTableCallbackInterfaceStorage {
413
426
  UniffiCallbackInterfaceStorageMethod0 delete_cached_item;
414
427
  UniffiCallbackInterfaceStorageMethod1 get_cached_item;
@@ -584,6 +597,10 @@ uniffi_breez_sdk_spark_fn_method_breezsdk_update_contact(void *ptr,
584
597
  /*handle*/ uint64_t
585
598
  uniffi_breez_sdk_spark_fn_method_breezsdk_update_user_settings(
586
599
  void *ptr, RustBuffer request);
600
+ void *uniffi_breez_sdk_spark_fn_clone_connectionmanager(
601
+ void *ptr, RustCallStatus *uniffi_out_err);
602
+ void uniffi_breez_sdk_spark_fn_free_connectionmanager(
603
+ void *ptr, RustCallStatus *uniffi_out_err);
587
604
  void *
588
605
  uniffi_breez_sdk_spark_fn_clone_externalsigner(void *ptr,
589
606
  RustCallStatus *uniffi_out_err);
@@ -723,6 +740,9 @@ uniffi_breez_sdk_spark_fn_method_sdkbuilder_build(void *ptr);
723
740
  uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_chain_service(
724
741
  void *ptr, void *chain_service);
725
742
  /*handle*/ uint64_t
743
+ uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_connection_manager(
744
+ void *ptr, void *connection_manager);
745
+ /*handle*/ uint64_t
726
746
  uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_default_storage(
727
747
  void *ptr, RustBuffer storage_dir);
728
748
  /*handle*/ uint64_t
@@ -741,8 +761,29 @@ uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_payment_observer(
741
761
  uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_rest_chain_service(
742
762
  void *ptr, RustBuffer url, RustBuffer api_type, RustBuffer credentials);
743
763
  /*handle*/ uint64_t
764
+ uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_session_manager(
765
+ void *ptr, void *session_manager);
766
+ /*handle*/ uint64_t
767
+ uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_ssp_connection_manager(
768
+ void *ptr, void *manager);
769
+ /*handle*/ uint64_t
744
770
  uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_storage(void *ptr,
745
771
  void *storage);
772
+ void *
773
+ uniffi_breez_sdk_spark_fn_clone_sessionmanager(void *ptr,
774
+ RustCallStatus *uniffi_out_err);
775
+ void uniffi_breez_sdk_spark_fn_free_sessionmanager(
776
+ void *ptr, RustCallStatus *uniffi_out_err);
777
+ void uniffi_breez_sdk_spark_fn_init_callback_vtable_sessionmanager(
778
+ UniffiVTableCallbackInterfaceSessionManager *vtable);
779
+ /*handle*/ uint64_t uniffi_breez_sdk_spark_fn_method_sessionmanager_get_session(
780
+ void *ptr, RustBuffer service_identity_key);
781
+ /*handle*/ uint64_t uniffi_breez_sdk_spark_fn_method_sessionmanager_set_session(
782
+ void *ptr, RustBuffer service_identity_key, RustBuffer session);
783
+ void *uniffi_breez_sdk_spark_fn_clone_sspconnectionmanager(
784
+ void *ptr, RustCallStatus *uniffi_out_err);
785
+ void uniffi_breez_sdk_spark_fn_free_sspconnectionmanager(
786
+ void *ptr, RustCallStatus *uniffi_out_err);
746
787
  void *uniffi_breez_sdk_spark_fn_clone_storage(void *ptr,
747
788
  RustCallStatus *uniffi_out_err);
748
789
  void uniffi_breez_sdk_spark_fn_free_storage(void *ptr,
@@ -865,6 +906,13 @@ void *uniffi_breez_sdk_spark_fn_func_default_external_signer(
865
906
  void uniffi_breez_sdk_spark_fn_func_init_logging(
866
907
  RustBuffer log_dir, RustBuffer app_logger, RustBuffer log_filter,
867
908
  RustCallStatus *uniffi_out_err);
909
+ void *uniffi_breez_sdk_spark_fn_func_new_connection_manager(
910
+ RustBuffer connections_per_operator, RustCallStatus *uniffi_out_err);
911
+ void *uniffi_breez_sdk_spark_fn_func_new_rest_chain_service(
912
+ RustBuffer url, RustBuffer network, RustBuffer api_type,
913
+ RustBuffer credentials, RustCallStatus *uniffi_out_err);
914
+ void *uniffi_breez_sdk_spark_fn_func_new_ssp_connection_manager(
915
+ RustBuffer user_agent, RustCallStatus *uniffi_out_err);
868
916
  RustBuffer ffi_breez_sdk_spark_rustbuffer_alloc(uint64_t size,
869
917
  RustCallStatus *uniffi_out_err);
870
918
  RustBuffer
@@ -998,6 +1046,9 @@ uint16_t uniffi_breez_sdk_spark_checksum_func_default_config();
998
1046
  uint16_t uniffi_breez_sdk_spark_checksum_func_default_external_signer();
999
1047
  uint16_t uniffi_breez_sdk_spark_checksum_func_get_spark_status();
1000
1048
  uint16_t uniffi_breez_sdk_spark_checksum_func_init_logging();
1049
+ uint16_t uniffi_breez_sdk_spark_checksum_func_new_connection_manager();
1050
+ uint16_t uniffi_breez_sdk_spark_checksum_func_new_rest_chain_service();
1051
+ uint16_t uniffi_breez_sdk_spark_checksum_func_new_ssp_connection_manager();
1001
1052
  uint16_t
1002
1053
  uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_get_address_utxos();
1003
1054
  uint16_t
@@ -1115,6 +1166,8 @@ uint16_t uniffi_breez_sdk_spark_checksum_method_restclient_delete_request();
1115
1166
  uint16_t uniffi_breez_sdk_spark_checksum_method_sdkbuilder_build();
1116
1167
  uint16_t uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_chain_service();
1117
1168
  uint16_t
1169
+ uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_connection_manager();
1170
+ uint16_t
1118
1171
  uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_default_storage();
1119
1172
  uint16_t uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_fiat_service();
1120
1173
  uint16_t uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_key_set();
@@ -1123,7 +1176,13 @@ uint16_t
1123
1176
  uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_payment_observer();
1124
1177
  uint16_t
1125
1178
  uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_rest_chain_service();
1179
+ uint16_t
1180
+ uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_session_manager();
1181
+ uint16_t
1182
+ uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_ssp_connection_manager();
1126
1183
  uint16_t uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_storage();
1184
+ uint16_t uniffi_breez_sdk_spark_checksum_method_sessionmanager_get_session();
1185
+ uint16_t uniffi_breez_sdk_spark_checksum_method_sessionmanager_set_session();
1127
1186
  uint16_t uniffi_breez_sdk_spark_checksum_method_storage_delete_cached_item();
1128
1187
  uint16_t uniffi_breez_sdk_spark_checksum_method_storage_get_cached_item();
1129
1188
  uint16_t uniffi_breez_sdk_spark_checksum_method_storage_set_cached_item();
@@ -2542,6 +2601,118 @@ static void cleanup() {
2542
2601
  } // namespace
2543
2602
  // uniffi::breez_sdk_spark::st::vtablecallbackinterfacerestclient::vtablecallbackinterfacerestclient::free
2544
2603
 
2604
+ // Callback function:
2605
+ // uniffi::breez_sdk_spark::st::vtablecallbackinterfacesessionmanager::vtablecallbackinterfacesessionmanager::free::UniffiCallbackInterfaceFree
2606
+ //
2607
+ // We have the following constraints:
2608
+ // - we need to pass a function pointer to Rust.
2609
+ // - we need a jsi::Runtime and jsi::Function to call into JS.
2610
+ // - function pointers can't store state, so we can't use a lamda.
2611
+ //
2612
+ // For this, we store a lambda as a global, as `rsLambda`. The `callback`
2613
+ // function calls the lambda, which itself calls the `body` which then calls
2614
+ // into JS.
2615
+ //
2616
+ // We then give the `callback` function pointer to Rust which will call the
2617
+ // lambda sometime in the future.
2618
+ namespace uniffi::breez_sdk_spark::st::vtablecallbackinterfacesessionmanager::
2619
+ vtablecallbackinterfacesessionmanager::free {
2620
+ using namespace facebook;
2621
+
2622
+ // We need to store a lambda in a global so we can call it from
2623
+ // a function pointer. The function pointer is passed to Rust.
2624
+ static std::function<void(uint64_t)> rsLambda = nullptr;
2625
+
2626
+ // This is the main body of the callback. It's called from the lambda,
2627
+ // which itself is called from the callback function which is passed to Rust.
2628
+ static void body(jsi::Runtime &rt,
2629
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
2630
+ std::shared_ptr<jsi::Value> callbackValue,
2631
+ uint64_t rs_handle) {
2632
+
2633
+ // Convert the arguments from Rust, into jsi::Values.
2634
+ // We'll use the Bridging class to do this…
2635
+ auto js_handle =
2636
+ uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_handle);
2637
+
2638
+ // Now we are ready to call the callback.
2639
+ // We are already on the JS thread, because this `body` function was
2640
+ // invoked from the CallInvoker.
2641
+ try {
2642
+ // Getting the callback function
2643
+ auto cb = callbackValue->asObject(rt).asFunction(rt);
2644
+ auto uniffiResult = cb.call(rt, js_handle);
2645
+
2646
+ } catch (const jsi::JSError &error) {
2647
+ std::cout << "Error in callback UniffiCallbackInterfaceFree: "
2648
+ << error.what() << std::endl;
2649
+ throw error;
2650
+ }
2651
+ }
2652
+
2653
+ static void callback(uint64_t rs_handle) {
2654
+ // If the runtime has shutdown, then there is no point in trying to
2655
+ // call into Javascript. BUT how do we tell if the runtime has shutdown?
2656
+ //
2657
+ // Answer: the module destructor calls into callback `cleanup` method,
2658
+ // which nulls out the rsLamda.
2659
+ //
2660
+ // If rsLamda is null, then there is no runtime to call into.
2661
+ if (rsLambda == nullptr) {
2662
+ // This only occurs when destructors are calling into Rust free/drop,
2663
+ // which causes the JS callback to be dropped.
2664
+ return;
2665
+ }
2666
+
2667
+ // The runtime, the actual callback jsi::funtion, and the callInvoker
2668
+ // are all in the lambda.
2669
+ rsLambda(rs_handle);
2670
+ }
2671
+
2672
+ static UniffiCallbackInterfaceFree
2673
+ makeCallbackFunction( // uniffi::breez_sdk_spark::st::vtablecallbackinterfacesessionmanager::vtablecallbackinterfacesessionmanager::free
2674
+ jsi::Runtime &rt,
2675
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
2676
+ const jsi::Value &value) {
2677
+ if (rsLambda != nullptr) {
2678
+ // `makeCallbackFunction` is called in two circumstances:
2679
+ //
2680
+ // 1. at startup, when initializing callback interface vtables.
2681
+ // 2. when polling futures. This happens at least once per future that is
2682
+ // exposed to Javascript. We know that this is always the same function,
2683
+ // `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
2684
+ //
2685
+ // We can therefore return the callback function without making anything
2686
+ // new if we've been initialized already.
2687
+ return callback;
2688
+ }
2689
+ auto callbackFunction = value.asObject(rt).asFunction(rt);
2690
+ auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
2691
+ rsLambda = [&rt, callInvoker, callbackValue](uint64_t rs_handle) {
2692
+ // We immediately make a lambda which will do the work of transforming the
2693
+ // arguments into JSI values and calling the callback.
2694
+ uniffi_runtime::UniffiCallFunc jsLambda =
2695
+ [callInvoker, callbackValue, rs_handle](jsi::Runtime &rt) mutable {
2696
+ body(rt, callInvoker, callbackValue, rs_handle);
2697
+ };
2698
+ // We'll then call that lambda from the callInvoker which will
2699
+ // look after calling it on the correct thread.
2700
+
2701
+ callInvoker->invokeNonBlocking(rt, jsLambda);
2702
+ };
2703
+ return callback;
2704
+ }
2705
+
2706
+ // This method is called from the destructor of NativeBreezSdkSpark, which only
2707
+ // happens when the jsi::Runtime is being destroyed.
2708
+ static void cleanup() {
2709
+ // The lambda holds a reference to the the Runtime, so when this is nulled
2710
+ // out, then the pointer will no longer be left dangling.
2711
+ rsLambda = nullptr;
2712
+ }
2713
+ } // namespace
2714
+ // uniffi::breez_sdk_spark::st::vtablecallbackinterfacesessionmanager::vtablecallbackinterfacesessionmanager::free
2715
+
2545
2716
  // Callback function:
2546
2717
  // uniffi::breez_sdk_spark::st::vtablecallbackinterfacestorage::vtablecallbackinterfacestorage::free::UniffiCallbackInterfaceFree
2547
2718
  //
@@ -8648,10 +8819,10 @@ static void cleanup() {
8648
8819
  }
8649
8820
  } // namespace uniffi::breez_sdk_spark::cb::callbackinterfacerestclientmethod2
8650
8821
  // Implementation of callback function calling from Rust to JS
8651
- // CallbackInterfaceStorageMethod0
8822
+ // CallbackInterfaceSessionManagerMethod0
8652
8823
 
8653
8824
  // Callback function:
8654
- // uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod0::UniffiCallbackInterfaceStorageMethod0
8825
+ // uniffi::breez_sdk_spark::cb::callbackinterfacesessionmanagermethod0::UniffiCallbackInterfaceSessionManagerMethod0
8655
8826
  //
8656
8827
  // We have the following constraints:
8657
8828
  // - we need to pass a function pointer to Rust.
@@ -8664,13 +8835,14 @@ static void cleanup() {
8664
8835
  //
8665
8836
  // We then give the `callback` function pointer to Rust which will call the
8666
8837
  // lambda sometime in the future.
8667
- namespace uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod0 {
8838
+ namespace uniffi::breez_sdk_spark::cb::callbackinterfacesessionmanagermethod0 {
8668
8839
  using namespace facebook;
8669
8840
 
8670
8841
  // We need to store a lambda in a global so we can call it from
8671
8842
  // a function pointer. The function pointer is passed to Rust.
8672
- static std::function<void(uint64_t, RustBuffer, UniffiForeignFutureCompleteVoid,
8673
- uint64_t, UniffiForeignFuture *)>
8843
+ static std::function<void(uint64_t, RustBuffer,
8844
+ UniffiForeignFutureCompleteRustBuffer, uint64_t,
8845
+ UniffiForeignFuture *)>
8674
8846
  rsLambda = nullptr;
8675
8847
 
8676
8848
  // This is the main body of the callback. It's called from the lambda,
@@ -8678,8 +8850,8 @@ static std::function<void(uint64_t, RustBuffer, UniffiForeignFutureCompleteVoid,
8678
8850
  static void body(jsi::Runtime &rt,
8679
8851
  std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
8680
8852
  std::shared_ptr<jsi::Value> callbackValue,
8681
- uint64_t rs_uniffiHandle, RustBuffer rs_key,
8682
- UniffiForeignFutureCompleteVoid rs_uniffiFutureCallback,
8853
+ uint64_t rs_uniffiHandle, RustBuffer rs_serviceIdentityKey,
8854
+ UniffiForeignFutureCompleteRustBuffer rs_uniffiFutureCallback,
8683
8855
  uint64_t rs_uniffiCallbackData,
8684
8856
  UniffiForeignFuture *rs_uniffiOutReturn) {
8685
8857
 
@@ -8687,11 +8859,12 @@ static void body(jsi::Runtime &rt,
8687
8859
  // We'll use the Bridging class to do this…
8688
8860
  auto js_uniffiHandle =
8689
8861
  uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_uniffiHandle);
8690
- auto js_key = uniffi::breez_sdk_spark::Bridging<RustBuffer>::toJs(
8691
- rt, callInvoker, rs_key);
8692
- auto js_uniffiFutureCallback =
8693
- uniffi::breez_sdk_spark::Bridging<UniffiForeignFutureCompleteVoid>::toJs(
8694
- rt, callInvoker, rs_uniffiFutureCallback);
8862
+ auto js_serviceIdentityKey =
8863
+ uniffi::breez_sdk_spark::Bridging<RustBuffer>::toJs(
8864
+ rt, callInvoker, rs_serviceIdentityKey);
8865
+ auto js_uniffiFutureCallback = uniffi::breez_sdk_spark::Bridging<
8866
+ UniffiForeignFutureCompleteRustBuffer>::toJs(rt, callInvoker,
8867
+ rs_uniffiFutureCallback);
8695
8868
  auto js_uniffiCallbackData = uniffi_jsi::Bridging<uint64_t>::toJs(
8696
8869
  rt, callInvoker, rs_uniffiCallbackData);
8697
8870
 
@@ -8701,7 +8874,7 @@ static void body(jsi::Runtime &rt,
8701
8874
  try {
8702
8875
  // Getting the callback function
8703
8876
  auto cb = callbackValue->asObject(rt).asFunction(rt);
8704
- auto uniffiResult = cb.call(rt, js_uniffiHandle, js_key,
8877
+ auto uniffiResult = cb.call(rt, js_uniffiHandle, js_serviceIdentityKey,
8705
8878
  js_uniffiFutureCallback, js_uniffiCallbackData);
8706
8879
 
8707
8880
  // return type is MutReference(Struct("ForeignFuture"))
@@ -8710,16 +8883,18 @@ static void body(jsi::Runtime &rt,
8710
8883
  uniffi::breez_sdk_spark::Bridging<UniffiForeignFuture>::fromJs(
8711
8884
  rt, callInvoker, uniffiResult);
8712
8885
  } catch (const jsi::JSError &error) {
8713
- std::cout << "Error in callback UniffiCallbackInterfaceStorageMethod0: "
8714
- << error.what() << std::endl;
8886
+ std::cout
8887
+ << "Error in callback UniffiCallbackInterfaceSessionManagerMethod0: "
8888
+ << error.what() << std::endl;
8715
8889
  throw error;
8716
8890
  }
8717
8891
  }
8718
8892
 
8719
- static void callback(uint64_t rs_uniffiHandle, RustBuffer rs_key,
8720
- UniffiForeignFutureCompleteVoid rs_uniffiFutureCallback,
8721
- uint64_t rs_uniffiCallbackData,
8722
- UniffiForeignFuture *rs_uniffiOutReturn) {
8893
+ static void
8894
+ callback(uint64_t rs_uniffiHandle, RustBuffer rs_serviceIdentityKey,
8895
+ UniffiForeignFutureCompleteRustBuffer rs_uniffiFutureCallback,
8896
+ uint64_t rs_uniffiCallbackData,
8897
+ UniffiForeignFuture *rs_uniffiOutReturn) {
8723
8898
  // If the runtime has shutdown, then there is no point in trying to
8724
8899
  // call into Javascript. BUT how do we tell if the runtime has shutdown?
8725
8900
  //
@@ -8735,12 +8910,12 @@ static void callback(uint64_t rs_uniffiHandle, RustBuffer rs_key,
8735
8910
 
8736
8911
  // The runtime, the actual callback jsi::funtion, and the callInvoker
8737
8912
  // are all in the lambda.
8738
- rsLambda(rs_uniffiHandle, rs_key, rs_uniffiFutureCallback,
8913
+ rsLambda(rs_uniffiHandle, rs_serviceIdentityKey, rs_uniffiFutureCallback,
8739
8914
  rs_uniffiCallbackData, rs_uniffiOutReturn);
8740
8915
  }
8741
8916
 
8742
- static UniffiCallbackInterfaceStorageMethod0
8743
- makeCallbackFunction( // uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod0
8917
+ static UniffiCallbackInterfaceSessionManagerMethod0
8918
+ makeCallbackFunction( // uniffi::breez_sdk_spark::cb::callbackinterfacesessionmanagermethod0
8744
8919
  jsi::Runtime &rt,
8745
8920
  std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
8746
8921
  const jsi::Value &value) {
@@ -8759,19 +8934,19 @@ makeCallbackFunction( // uniffi::breez_sdk_spark::cb::callbackinterfacestorageme
8759
8934
  auto callbackFunction = value.asObject(rt).asFunction(rt);
8760
8935
  auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
8761
8936
  rsLambda = [&rt, callInvoker, callbackValue](
8762
- uint64_t rs_uniffiHandle, RustBuffer rs_key,
8763
- UniffiForeignFutureCompleteVoid rs_uniffiFutureCallback,
8937
+ uint64_t rs_uniffiHandle, RustBuffer rs_serviceIdentityKey,
8938
+ UniffiForeignFutureCompleteRustBuffer rs_uniffiFutureCallback,
8764
8939
  uint64_t rs_uniffiCallbackData,
8765
8940
  UniffiForeignFuture *rs_uniffiOutReturn) {
8766
8941
  // We immediately make a lambda which will do the work of transforming the
8767
8942
  // arguments into JSI values and calling the callback.
8768
8943
  uniffi_runtime::UniffiCallFunc jsLambda =
8769
- [callInvoker, callbackValue, rs_uniffiHandle, rs_key,
8944
+ [callInvoker, callbackValue, rs_uniffiHandle, rs_serviceIdentityKey,
8770
8945
  rs_uniffiFutureCallback, rs_uniffiCallbackData,
8771
8946
  rs_uniffiOutReturn](jsi::Runtime &rt) mutable {
8772
- body(rt, callInvoker, callbackValue, rs_uniffiHandle, rs_key,
8773
- rs_uniffiFutureCallback, rs_uniffiCallbackData,
8774
- rs_uniffiOutReturn);
8947
+ body(rt, callInvoker, callbackValue, rs_uniffiHandle,
8948
+ rs_serviceIdentityKey, rs_uniffiFutureCallback,
8949
+ rs_uniffiCallbackData, rs_uniffiOutReturn);
8775
8950
  };
8776
8951
  // We'll then call that lambda from the callInvoker which will
8777
8952
  // look after calling it on the correct thread.
@@ -8787,12 +8962,13 @@ static void cleanup() {
8787
8962
  // out, then the pointer will no longer be left dangling.
8788
8963
  rsLambda = nullptr;
8789
8964
  }
8790
- } // namespace uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod0
8965
+ } // namespace
8966
+ // uniffi::breez_sdk_spark::cb::callbackinterfacesessionmanagermethod0
8791
8967
  // Implementation of callback function calling from Rust to JS
8792
- // CallbackInterfaceStorageMethod1
8968
+ // CallbackInterfaceSessionManagerMethod1
8793
8969
 
8794
8970
  // Callback function:
8795
- // uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod1::UniffiCallbackInterfaceStorageMethod1
8971
+ // uniffi::breez_sdk_spark::cb::callbackinterfacesessionmanagermethod1::UniffiCallbackInterfaceSessionManagerMethod1
8796
8972
  //
8797
8973
  // We have the following constraints:
8798
8974
  // - we need to pass a function pointer to Rust.
@@ -8805,13 +8981,13 @@ static void cleanup() {
8805
8981
  //
8806
8982
  // We then give the `callback` function pointer to Rust which will call the
8807
8983
  // lambda sometime in the future.
8808
- namespace uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod1 {
8984
+ namespace uniffi::breez_sdk_spark::cb::callbackinterfacesessionmanagermethod1 {
8809
8985
  using namespace facebook;
8810
8986
 
8811
8987
  // We need to store a lambda in a global so we can call it from
8812
8988
  // a function pointer. The function pointer is passed to Rust.
8813
- static std::function<void(uint64_t, RustBuffer,
8814
- UniffiForeignFutureCompleteRustBuffer, uint64_t,
8989
+ static std::function<void(uint64_t, RustBuffer, RustBuffer,
8990
+ UniffiForeignFutureCompleteVoid, uint64_t,
8815
8991
  UniffiForeignFuture *)>
8816
8992
  rsLambda = nullptr;
8817
8993
 
@@ -8820,8 +8996,9 @@ static std::function<void(uint64_t, RustBuffer,
8820
8996
  static void body(jsi::Runtime &rt,
8821
8997
  std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
8822
8998
  std::shared_ptr<jsi::Value> callbackValue,
8823
- uint64_t rs_uniffiHandle, RustBuffer rs_key,
8824
- UniffiForeignFutureCompleteRustBuffer rs_uniffiFutureCallback,
8999
+ uint64_t rs_uniffiHandle, RustBuffer rs_serviceIdentityKey,
9000
+ RustBuffer rs_session,
9001
+ UniffiForeignFutureCompleteVoid rs_uniffiFutureCallback,
8825
9002
  uint64_t rs_uniffiCallbackData,
8826
9003
  UniffiForeignFuture *rs_uniffiOutReturn) {
8827
9004
 
@@ -8829,11 +9006,14 @@ static void body(jsi::Runtime &rt,
8829
9006
  // We'll use the Bridging class to do this…
8830
9007
  auto js_uniffiHandle =
8831
9008
  uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_uniffiHandle);
8832
- auto js_key = uniffi::breez_sdk_spark::Bridging<RustBuffer>::toJs(
8833
- rt, callInvoker, rs_key);
8834
- auto js_uniffiFutureCallback = uniffi::breez_sdk_spark::Bridging<
8835
- UniffiForeignFutureCompleteRustBuffer>::toJs(rt, callInvoker,
8836
- rs_uniffiFutureCallback);
9009
+ auto js_serviceIdentityKey =
9010
+ uniffi::breez_sdk_spark::Bridging<RustBuffer>::toJs(
9011
+ rt, callInvoker, rs_serviceIdentityKey);
9012
+ auto js_session = uniffi::breez_sdk_spark::Bridging<RustBuffer>::toJs(
9013
+ rt, callInvoker, rs_session);
9014
+ auto js_uniffiFutureCallback =
9015
+ uniffi::breez_sdk_spark::Bridging<UniffiForeignFutureCompleteVoid>::toJs(
9016
+ rt, callInvoker, rs_uniffiFutureCallback);
8837
9017
  auto js_uniffiCallbackData = uniffi_jsi::Bridging<uint64_t>::toJs(
8838
9018
  rt, callInvoker, rs_uniffiCallbackData);
8839
9019
 
@@ -8843,8 +9023,9 @@ static void body(jsi::Runtime &rt,
8843
9023
  try {
8844
9024
  // Getting the callback function
8845
9025
  auto cb = callbackValue->asObject(rt).asFunction(rt);
8846
- auto uniffiResult = cb.call(rt, js_uniffiHandle, js_key,
8847
- js_uniffiFutureCallback, js_uniffiCallbackData);
9026
+ auto uniffiResult =
9027
+ cb.call(rt, js_uniffiHandle, js_serviceIdentityKey, js_session,
9028
+ js_uniffiFutureCallback, js_uniffiCallbackData);
8848
9029
 
8849
9030
  // return type is MutReference(Struct("ForeignFuture"))
8850
9031
  // Finally, we need to copy the return value back into the Rust pointer.
@@ -8852,17 +9033,18 @@ static void body(jsi::Runtime &rt,
8852
9033
  uniffi::breez_sdk_spark::Bridging<UniffiForeignFuture>::fromJs(
8853
9034
  rt, callInvoker, uniffiResult);
8854
9035
  } catch (const jsi::JSError &error) {
8855
- std::cout << "Error in callback UniffiCallbackInterfaceStorageMethod1: "
8856
- << error.what() << std::endl;
9036
+ std::cout
9037
+ << "Error in callback UniffiCallbackInterfaceSessionManagerMethod1: "
9038
+ << error.what() << std::endl;
8857
9039
  throw error;
8858
9040
  }
8859
9041
  }
8860
9042
 
8861
- static void
8862
- callback(uint64_t rs_uniffiHandle, RustBuffer rs_key,
8863
- UniffiForeignFutureCompleteRustBuffer rs_uniffiFutureCallback,
8864
- uint64_t rs_uniffiCallbackData,
8865
- UniffiForeignFuture *rs_uniffiOutReturn) {
9043
+ static void callback(uint64_t rs_uniffiHandle, RustBuffer rs_serviceIdentityKey,
9044
+ RustBuffer rs_session,
9045
+ UniffiForeignFutureCompleteVoid rs_uniffiFutureCallback,
9046
+ uint64_t rs_uniffiCallbackData,
9047
+ UniffiForeignFuture *rs_uniffiOutReturn) {
8866
9048
  // If the runtime has shutdown, then there is no point in trying to
8867
9049
  // call into Javascript. BUT how do we tell if the runtime has shutdown?
8868
9050
  //
@@ -8878,12 +9060,12 @@ callback(uint64_t rs_uniffiHandle, RustBuffer rs_key,
8878
9060
 
8879
9061
  // The runtime, the actual callback jsi::funtion, and the callInvoker
8880
9062
  // are all in the lambda.
8881
- rsLambda(rs_uniffiHandle, rs_key, rs_uniffiFutureCallback,
8882
- rs_uniffiCallbackData, rs_uniffiOutReturn);
9063
+ rsLambda(rs_uniffiHandle, rs_serviceIdentityKey, rs_session,
9064
+ rs_uniffiFutureCallback, rs_uniffiCallbackData, rs_uniffiOutReturn);
8883
9065
  }
8884
9066
 
8885
- static UniffiCallbackInterfaceStorageMethod1
8886
- makeCallbackFunction( // uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod1
9067
+ static UniffiCallbackInterfaceSessionManagerMethod1
9068
+ makeCallbackFunction( // uniffi::breez_sdk_spark::cb::callbackinterfacesessionmanagermethod1
8887
9069
  jsi::Runtime &rt,
8888
9070
  std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
8889
9071
  const jsi::Value &value) {
@@ -8902,19 +9084,20 @@ makeCallbackFunction( // uniffi::breez_sdk_spark::cb::callbackinterfacestorageme
8902
9084
  auto callbackFunction = value.asObject(rt).asFunction(rt);
8903
9085
  auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
8904
9086
  rsLambda = [&rt, callInvoker, callbackValue](
8905
- uint64_t rs_uniffiHandle, RustBuffer rs_key,
8906
- UniffiForeignFutureCompleteRustBuffer rs_uniffiFutureCallback,
9087
+ uint64_t rs_uniffiHandle, RustBuffer rs_serviceIdentityKey,
9088
+ RustBuffer rs_session,
9089
+ UniffiForeignFutureCompleteVoid rs_uniffiFutureCallback,
8907
9090
  uint64_t rs_uniffiCallbackData,
8908
9091
  UniffiForeignFuture *rs_uniffiOutReturn) {
8909
9092
  // We immediately make a lambda which will do the work of transforming the
8910
9093
  // arguments into JSI values and calling the callback.
8911
9094
  uniffi_runtime::UniffiCallFunc jsLambda =
8912
- [callInvoker, callbackValue, rs_uniffiHandle, rs_key,
8913
- rs_uniffiFutureCallback, rs_uniffiCallbackData,
9095
+ [callInvoker, callbackValue, rs_uniffiHandle, rs_serviceIdentityKey,
9096
+ rs_session, rs_uniffiFutureCallback, rs_uniffiCallbackData,
8914
9097
  rs_uniffiOutReturn](jsi::Runtime &rt) mutable {
8915
- body(rt, callInvoker, callbackValue, rs_uniffiHandle, rs_key,
8916
- rs_uniffiFutureCallback, rs_uniffiCallbackData,
8917
- rs_uniffiOutReturn);
9098
+ body(rt, callInvoker, callbackValue, rs_uniffiHandle,
9099
+ rs_serviceIdentityKey, rs_session, rs_uniffiFutureCallback,
9100
+ rs_uniffiCallbackData, rs_uniffiOutReturn);
8918
9101
  };
8919
9102
  // We'll then call that lambda from the callInvoker which will
8920
9103
  // look after calling it on the correct thread.
@@ -8930,12 +9113,13 @@ static void cleanup() {
8930
9113
  // out, then the pointer will no longer be left dangling.
8931
9114
  rsLambda = nullptr;
8932
9115
  }
8933
- } // namespace uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod1
9116
+ } // namespace
9117
+ // uniffi::breez_sdk_spark::cb::callbackinterfacesessionmanagermethod1
8934
9118
  // Implementation of callback function calling from Rust to JS
8935
- // CallbackInterfaceStorageMethod2
9119
+ // CallbackInterfaceStorageMethod0
8936
9120
 
8937
9121
  // Callback function:
8938
- // uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod2::UniffiCallbackInterfaceStorageMethod2
9122
+ // uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod0::UniffiCallbackInterfaceStorageMethod0
8939
9123
  //
8940
9124
  // We have the following constraints:
8941
9125
  // - we need to pass a function pointer to Rust.
@@ -8948,14 +9132,13 @@ static void cleanup() {
8948
9132
  //
8949
9133
  // We then give the `callback` function pointer to Rust which will call the
8950
9134
  // lambda sometime in the future.
8951
- namespace uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod2 {
9135
+ namespace uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod0 {
8952
9136
  using namespace facebook;
8953
9137
 
8954
9138
  // We need to store a lambda in a global so we can call it from
8955
9139
  // a function pointer. The function pointer is passed to Rust.
8956
- static std::function<void(uint64_t, RustBuffer, RustBuffer,
8957
- UniffiForeignFutureCompleteVoid, uint64_t,
8958
- UniffiForeignFuture *)>
9140
+ static std::function<void(uint64_t, RustBuffer, UniffiForeignFutureCompleteVoid,
9141
+ uint64_t, UniffiForeignFuture *)>
8959
9142
  rsLambda = nullptr;
8960
9143
 
8961
9144
  // This is the main body of the callback. It's called from the lambda,
@@ -8964,7 +9147,6 @@ static void body(jsi::Runtime &rt,
8964
9147
  std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
8965
9148
  std::shared_ptr<jsi::Value> callbackValue,
8966
9149
  uint64_t rs_uniffiHandle, RustBuffer rs_key,
8967
- RustBuffer rs_value,
8968
9150
  UniffiForeignFutureCompleteVoid rs_uniffiFutureCallback,
8969
9151
  uint64_t rs_uniffiCallbackData,
8970
9152
  UniffiForeignFuture *rs_uniffiOutReturn) {
@@ -8975,8 +9157,6 @@ static void body(jsi::Runtime &rt,
8975
9157
  uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_uniffiHandle);
8976
9158
  auto js_key = uniffi::breez_sdk_spark::Bridging<RustBuffer>::toJs(
8977
9159
  rt, callInvoker, rs_key);
8978
- auto js_value = uniffi::breez_sdk_spark::Bridging<RustBuffer>::toJs(
8979
- rt, callInvoker, rs_value);
8980
9160
  auto js_uniffiFutureCallback =
8981
9161
  uniffi::breez_sdk_spark::Bridging<UniffiForeignFutureCompleteVoid>::toJs(
8982
9162
  rt, callInvoker, rs_uniffiFutureCallback);
@@ -8989,7 +9169,7 @@ static void body(jsi::Runtime &rt,
8989
9169
  try {
8990
9170
  // Getting the callback function
8991
9171
  auto cb = callbackValue->asObject(rt).asFunction(rt);
8992
- auto uniffiResult = cb.call(rt, js_uniffiHandle, js_key, js_value,
9172
+ auto uniffiResult = cb.call(rt, js_uniffiHandle, js_key,
8993
9173
  js_uniffiFutureCallback, js_uniffiCallbackData);
8994
9174
 
8995
9175
  // return type is MutReference(Struct("ForeignFuture"))
@@ -8998,14 +9178,13 @@ static void body(jsi::Runtime &rt,
8998
9178
  uniffi::breez_sdk_spark::Bridging<UniffiForeignFuture>::fromJs(
8999
9179
  rt, callInvoker, uniffiResult);
9000
9180
  } catch (const jsi::JSError &error) {
9001
- std::cout << "Error in callback UniffiCallbackInterfaceStorageMethod2: "
9181
+ std::cout << "Error in callback UniffiCallbackInterfaceStorageMethod0: "
9002
9182
  << error.what() << std::endl;
9003
9183
  throw error;
9004
9184
  }
9005
9185
  }
9006
9186
 
9007
9187
  static void callback(uint64_t rs_uniffiHandle, RustBuffer rs_key,
9008
- RustBuffer rs_value,
9009
9188
  UniffiForeignFutureCompleteVoid rs_uniffiFutureCallback,
9010
9189
  uint64_t rs_uniffiCallbackData,
9011
9190
  UniffiForeignFuture *rs_uniffiOutReturn) {
@@ -9024,12 +9203,12 @@ static void callback(uint64_t rs_uniffiHandle, RustBuffer rs_key,
9024
9203
 
9025
9204
  // The runtime, the actual callback jsi::funtion, and the callInvoker
9026
9205
  // are all in the lambda.
9027
- rsLambda(rs_uniffiHandle, rs_key, rs_value, rs_uniffiFutureCallback,
9206
+ rsLambda(rs_uniffiHandle, rs_key, rs_uniffiFutureCallback,
9028
9207
  rs_uniffiCallbackData, rs_uniffiOutReturn);
9029
9208
  }
9030
9209
 
9031
- static UniffiCallbackInterfaceStorageMethod2
9032
- makeCallbackFunction( // uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod2
9210
+ static UniffiCallbackInterfaceStorageMethod0
9211
+ makeCallbackFunction( // uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod0
9033
9212
  jsi::Runtime &rt,
9034
9213
  std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
9035
9214
  const jsi::Value &value) {
@@ -9049,18 +9228,17 @@ makeCallbackFunction( // uniffi::breez_sdk_spark::cb::callbackinterfacestorageme
9049
9228
  auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
9050
9229
  rsLambda = [&rt, callInvoker, callbackValue](
9051
9230
  uint64_t rs_uniffiHandle, RustBuffer rs_key,
9052
- RustBuffer rs_value,
9053
9231
  UniffiForeignFutureCompleteVoid rs_uniffiFutureCallback,
9054
9232
  uint64_t rs_uniffiCallbackData,
9055
9233
  UniffiForeignFuture *rs_uniffiOutReturn) {
9056
9234
  // We immediately make a lambda which will do the work of transforming the
9057
9235
  // arguments into JSI values and calling the callback.
9058
9236
  uniffi_runtime::UniffiCallFunc jsLambda =
9059
- [callInvoker, callbackValue, rs_uniffiHandle, rs_key, rs_value,
9237
+ [callInvoker, callbackValue, rs_uniffiHandle, rs_key,
9060
9238
  rs_uniffiFutureCallback, rs_uniffiCallbackData,
9061
9239
  rs_uniffiOutReturn](jsi::Runtime &rt) mutable {
9062
9240
  body(rt, callInvoker, callbackValue, rs_uniffiHandle, rs_key,
9063
- rs_value, rs_uniffiFutureCallback, rs_uniffiCallbackData,
9241
+ rs_uniffiFutureCallback, rs_uniffiCallbackData,
9064
9242
  rs_uniffiOutReturn);
9065
9243
  };
9066
9244
  // We'll then call that lambda from the callInvoker which will
@@ -9077,9 +9255,299 @@ static void cleanup() {
9077
9255
  // out, then the pointer will no longer be left dangling.
9078
9256
  rsLambda = nullptr;
9079
9257
  }
9080
- } // namespace uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod2
9258
+ } // namespace uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod0
9081
9259
  // Implementation of callback function calling from Rust to JS
9082
- // CallbackInterfaceStorageMethod3
9260
+ // CallbackInterfaceStorageMethod1
9261
+
9262
+ // Callback function:
9263
+ // uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod1::UniffiCallbackInterfaceStorageMethod1
9264
+ //
9265
+ // We have the following constraints:
9266
+ // - we need to pass a function pointer to Rust.
9267
+ // - we need a jsi::Runtime and jsi::Function to call into JS.
9268
+ // - function pointers can't store state, so we can't use a lamda.
9269
+ //
9270
+ // For this, we store a lambda as a global, as `rsLambda`. The `callback`
9271
+ // function calls the lambda, which itself calls the `body` which then calls
9272
+ // into JS.
9273
+ //
9274
+ // We then give the `callback` function pointer to Rust which will call the
9275
+ // lambda sometime in the future.
9276
+ namespace uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod1 {
9277
+ using namespace facebook;
9278
+
9279
+ // We need to store a lambda in a global so we can call it from
9280
+ // a function pointer. The function pointer is passed to Rust.
9281
+ static std::function<void(uint64_t, RustBuffer,
9282
+ UniffiForeignFutureCompleteRustBuffer, uint64_t,
9283
+ UniffiForeignFuture *)>
9284
+ rsLambda = nullptr;
9285
+
9286
+ // This is the main body of the callback. It's called from the lambda,
9287
+ // which itself is called from the callback function which is passed to Rust.
9288
+ static void body(jsi::Runtime &rt,
9289
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
9290
+ std::shared_ptr<jsi::Value> callbackValue,
9291
+ uint64_t rs_uniffiHandle, RustBuffer rs_key,
9292
+ UniffiForeignFutureCompleteRustBuffer rs_uniffiFutureCallback,
9293
+ uint64_t rs_uniffiCallbackData,
9294
+ UniffiForeignFuture *rs_uniffiOutReturn) {
9295
+
9296
+ // Convert the arguments from Rust, into jsi::Values.
9297
+ // We'll use the Bridging class to do this…
9298
+ auto js_uniffiHandle =
9299
+ uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_uniffiHandle);
9300
+ auto js_key = uniffi::breez_sdk_spark::Bridging<RustBuffer>::toJs(
9301
+ rt, callInvoker, rs_key);
9302
+ auto js_uniffiFutureCallback = uniffi::breez_sdk_spark::Bridging<
9303
+ UniffiForeignFutureCompleteRustBuffer>::toJs(rt, callInvoker,
9304
+ rs_uniffiFutureCallback);
9305
+ auto js_uniffiCallbackData = uniffi_jsi::Bridging<uint64_t>::toJs(
9306
+ rt, callInvoker, rs_uniffiCallbackData);
9307
+
9308
+ // Now we are ready to call the callback.
9309
+ // We are already on the JS thread, because this `body` function was
9310
+ // invoked from the CallInvoker.
9311
+ try {
9312
+ // Getting the callback function
9313
+ auto cb = callbackValue->asObject(rt).asFunction(rt);
9314
+ auto uniffiResult = cb.call(rt, js_uniffiHandle, js_key,
9315
+ js_uniffiFutureCallback, js_uniffiCallbackData);
9316
+
9317
+ // return type is MutReference(Struct("ForeignFuture"))
9318
+ // Finally, we need to copy the return value back into the Rust pointer.
9319
+ *rs_uniffiOutReturn =
9320
+ uniffi::breez_sdk_spark::Bridging<UniffiForeignFuture>::fromJs(
9321
+ rt, callInvoker, uniffiResult);
9322
+ } catch (const jsi::JSError &error) {
9323
+ std::cout << "Error in callback UniffiCallbackInterfaceStorageMethod1: "
9324
+ << error.what() << std::endl;
9325
+ throw error;
9326
+ }
9327
+ }
9328
+
9329
+ static void
9330
+ callback(uint64_t rs_uniffiHandle, RustBuffer rs_key,
9331
+ UniffiForeignFutureCompleteRustBuffer rs_uniffiFutureCallback,
9332
+ uint64_t rs_uniffiCallbackData,
9333
+ UniffiForeignFuture *rs_uniffiOutReturn) {
9334
+ // If the runtime has shutdown, then there is no point in trying to
9335
+ // call into Javascript. BUT how do we tell if the runtime has shutdown?
9336
+ //
9337
+ // Answer: the module destructor calls into callback `cleanup` method,
9338
+ // which nulls out the rsLamda.
9339
+ //
9340
+ // If rsLamda is null, then there is no runtime to call into.
9341
+ if (rsLambda == nullptr) {
9342
+ // This only occurs when destructors are calling into Rust free/drop,
9343
+ // which causes the JS callback to be dropped.
9344
+ return;
9345
+ }
9346
+
9347
+ // The runtime, the actual callback jsi::funtion, and the callInvoker
9348
+ // are all in the lambda.
9349
+ rsLambda(rs_uniffiHandle, rs_key, rs_uniffiFutureCallback,
9350
+ rs_uniffiCallbackData, rs_uniffiOutReturn);
9351
+ }
9352
+
9353
+ static UniffiCallbackInterfaceStorageMethod1
9354
+ makeCallbackFunction( // uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod1
9355
+ jsi::Runtime &rt,
9356
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
9357
+ const jsi::Value &value) {
9358
+ if (rsLambda != nullptr) {
9359
+ // `makeCallbackFunction` is called in two circumstances:
9360
+ //
9361
+ // 1. at startup, when initializing callback interface vtables.
9362
+ // 2. when polling futures. This happens at least once per future that is
9363
+ // exposed to Javascript. We know that this is always the same function,
9364
+ // `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
9365
+ //
9366
+ // We can therefore return the callback function without making anything
9367
+ // new if we've been initialized already.
9368
+ return callback;
9369
+ }
9370
+ auto callbackFunction = value.asObject(rt).asFunction(rt);
9371
+ auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
9372
+ rsLambda = [&rt, callInvoker, callbackValue](
9373
+ uint64_t rs_uniffiHandle, RustBuffer rs_key,
9374
+ UniffiForeignFutureCompleteRustBuffer rs_uniffiFutureCallback,
9375
+ uint64_t rs_uniffiCallbackData,
9376
+ UniffiForeignFuture *rs_uniffiOutReturn) {
9377
+ // We immediately make a lambda which will do the work of transforming the
9378
+ // arguments into JSI values and calling the callback.
9379
+ uniffi_runtime::UniffiCallFunc jsLambda =
9380
+ [callInvoker, callbackValue, rs_uniffiHandle, rs_key,
9381
+ rs_uniffiFutureCallback, rs_uniffiCallbackData,
9382
+ rs_uniffiOutReturn](jsi::Runtime &rt) mutable {
9383
+ body(rt, callInvoker, callbackValue, rs_uniffiHandle, rs_key,
9384
+ rs_uniffiFutureCallback, rs_uniffiCallbackData,
9385
+ rs_uniffiOutReturn);
9386
+ };
9387
+ // We'll then call that lambda from the callInvoker which will
9388
+ // look after calling it on the correct thread.
9389
+ callInvoker->invokeBlocking(rt, jsLambda);
9390
+ };
9391
+ return callback;
9392
+ }
9393
+
9394
+ // This method is called from the destructor of NativeBreezSdkSpark, which only
9395
+ // happens when the jsi::Runtime is being destroyed.
9396
+ static void cleanup() {
9397
+ // The lambda holds a reference to the the Runtime, so when this is nulled
9398
+ // out, then the pointer will no longer be left dangling.
9399
+ rsLambda = nullptr;
9400
+ }
9401
+ } // namespace uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod1
9402
+ // Implementation of callback function calling from Rust to JS
9403
+ // CallbackInterfaceStorageMethod2
9404
+
9405
+ // Callback function:
9406
+ // uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod2::UniffiCallbackInterfaceStorageMethod2
9407
+ //
9408
+ // We have the following constraints:
9409
+ // - we need to pass a function pointer to Rust.
9410
+ // - we need a jsi::Runtime and jsi::Function to call into JS.
9411
+ // - function pointers can't store state, so we can't use a lamda.
9412
+ //
9413
+ // For this, we store a lambda as a global, as `rsLambda`. The `callback`
9414
+ // function calls the lambda, which itself calls the `body` which then calls
9415
+ // into JS.
9416
+ //
9417
+ // We then give the `callback` function pointer to Rust which will call the
9418
+ // lambda sometime in the future.
9419
+ namespace uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod2 {
9420
+ using namespace facebook;
9421
+
9422
+ // We need to store a lambda in a global so we can call it from
9423
+ // a function pointer. The function pointer is passed to Rust.
9424
+ static std::function<void(uint64_t, RustBuffer, RustBuffer,
9425
+ UniffiForeignFutureCompleteVoid, uint64_t,
9426
+ UniffiForeignFuture *)>
9427
+ rsLambda = nullptr;
9428
+
9429
+ // This is the main body of the callback. It's called from the lambda,
9430
+ // which itself is called from the callback function which is passed to Rust.
9431
+ static void body(jsi::Runtime &rt,
9432
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
9433
+ std::shared_ptr<jsi::Value> callbackValue,
9434
+ uint64_t rs_uniffiHandle, RustBuffer rs_key,
9435
+ RustBuffer rs_value,
9436
+ UniffiForeignFutureCompleteVoid rs_uniffiFutureCallback,
9437
+ uint64_t rs_uniffiCallbackData,
9438
+ UniffiForeignFuture *rs_uniffiOutReturn) {
9439
+
9440
+ // Convert the arguments from Rust, into jsi::Values.
9441
+ // We'll use the Bridging class to do this…
9442
+ auto js_uniffiHandle =
9443
+ uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_uniffiHandle);
9444
+ auto js_key = uniffi::breez_sdk_spark::Bridging<RustBuffer>::toJs(
9445
+ rt, callInvoker, rs_key);
9446
+ auto js_value = uniffi::breez_sdk_spark::Bridging<RustBuffer>::toJs(
9447
+ rt, callInvoker, rs_value);
9448
+ auto js_uniffiFutureCallback =
9449
+ uniffi::breez_sdk_spark::Bridging<UniffiForeignFutureCompleteVoid>::toJs(
9450
+ rt, callInvoker, rs_uniffiFutureCallback);
9451
+ auto js_uniffiCallbackData = uniffi_jsi::Bridging<uint64_t>::toJs(
9452
+ rt, callInvoker, rs_uniffiCallbackData);
9453
+
9454
+ // Now we are ready to call the callback.
9455
+ // We are already on the JS thread, because this `body` function was
9456
+ // invoked from the CallInvoker.
9457
+ try {
9458
+ // Getting the callback function
9459
+ auto cb = callbackValue->asObject(rt).asFunction(rt);
9460
+ auto uniffiResult = cb.call(rt, js_uniffiHandle, js_key, js_value,
9461
+ js_uniffiFutureCallback, js_uniffiCallbackData);
9462
+
9463
+ // return type is MutReference(Struct("ForeignFuture"))
9464
+ // Finally, we need to copy the return value back into the Rust pointer.
9465
+ *rs_uniffiOutReturn =
9466
+ uniffi::breez_sdk_spark::Bridging<UniffiForeignFuture>::fromJs(
9467
+ rt, callInvoker, uniffiResult);
9468
+ } catch (const jsi::JSError &error) {
9469
+ std::cout << "Error in callback UniffiCallbackInterfaceStorageMethod2: "
9470
+ << error.what() << std::endl;
9471
+ throw error;
9472
+ }
9473
+ }
9474
+
9475
+ static void callback(uint64_t rs_uniffiHandle, RustBuffer rs_key,
9476
+ RustBuffer rs_value,
9477
+ UniffiForeignFutureCompleteVoid rs_uniffiFutureCallback,
9478
+ uint64_t rs_uniffiCallbackData,
9479
+ UniffiForeignFuture *rs_uniffiOutReturn) {
9480
+ // If the runtime has shutdown, then there is no point in trying to
9481
+ // call into Javascript. BUT how do we tell if the runtime has shutdown?
9482
+ //
9483
+ // Answer: the module destructor calls into callback `cleanup` method,
9484
+ // which nulls out the rsLamda.
9485
+ //
9486
+ // If rsLamda is null, then there is no runtime to call into.
9487
+ if (rsLambda == nullptr) {
9488
+ // This only occurs when destructors are calling into Rust free/drop,
9489
+ // which causes the JS callback to be dropped.
9490
+ return;
9491
+ }
9492
+
9493
+ // The runtime, the actual callback jsi::funtion, and the callInvoker
9494
+ // are all in the lambda.
9495
+ rsLambda(rs_uniffiHandle, rs_key, rs_value, rs_uniffiFutureCallback,
9496
+ rs_uniffiCallbackData, rs_uniffiOutReturn);
9497
+ }
9498
+
9499
+ static UniffiCallbackInterfaceStorageMethod2
9500
+ makeCallbackFunction( // uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod2
9501
+ jsi::Runtime &rt,
9502
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
9503
+ const jsi::Value &value) {
9504
+ if (rsLambda != nullptr) {
9505
+ // `makeCallbackFunction` is called in two circumstances:
9506
+ //
9507
+ // 1. at startup, when initializing callback interface vtables.
9508
+ // 2. when polling futures. This happens at least once per future that is
9509
+ // exposed to Javascript. We know that this is always the same function,
9510
+ // `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
9511
+ //
9512
+ // We can therefore return the callback function without making anything
9513
+ // new if we've been initialized already.
9514
+ return callback;
9515
+ }
9516
+ auto callbackFunction = value.asObject(rt).asFunction(rt);
9517
+ auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
9518
+ rsLambda = [&rt, callInvoker, callbackValue](
9519
+ uint64_t rs_uniffiHandle, RustBuffer rs_key,
9520
+ RustBuffer rs_value,
9521
+ UniffiForeignFutureCompleteVoid rs_uniffiFutureCallback,
9522
+ uint64_t rs_uniffiCallbackData,
9523
+ UniffiForeignFuture *rs_uniffiOutReturn) {
9524
+ // We immediately make a lambda which will do the work of transforming the
9525
+ // arguments into JSI values and calling the callback.
9526
+ uniffi_runtime::UniffiCallFunc jsLambda =
9527
+ [callInvoker, callbackValue, rs_uniffiHandle, rs_key, rs_value,
9528
+ rs_uniffiFutureCallback, rs_uniffiCallbackData,
9529
+ rs_uniffiOutReturn](jsi::Runtime &rt) mutable {
9530
+ body(rt, callInvoker, callbackValue, rs_uniffiHandle, rs_key,
9531
+ rs_value, rs_uniffiFutureCallback, rs_uniffiCallbackData,
9532
+ rs_uniffiOutReturn);
9533
+ };
9534
+ // We'll then call that lambda from the callInvoker which will
9535
+ // look after calling it on the correct thread.
9536
+ callInvoker->invokeBlocking(rt, jsLambda);
9537
+ };
9538
+ return callback;
9539
+ }
9540
+
9541
+ // This method is called from the destructor of NativeBreezSdkSpark, which only
9542
+ // happens when the jsi::Runtime is being destroyed.
9543
+ static void cleanup() {
9544
+ // The lambda holds a reference to the the Runtime, so when this is nulled
9545
+ // out, then the pointer will no longer be left dangling.
9546
+ rsLambda = nullptr;
9547
+ }
9548
+ } // namespace uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod2
9549
+ // Implementation of callback function calling from Rust to JS
9550
+ // CallbackInterfaceStorageMethod3
9083
9551
 
9084
9552
  // Callback function:
9085
9553
  // uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod3::UniffiCallbackInterfaceStorageMethod3
@@ -12833,35 +13301,73 @@ namespace uniffi::breez_sdk_spark {
12833
13301
  using namespace facebook;
12834
13302
  using CallInvoker = uniffi_runtime::UniffiCallInvoker;
12835
13303
 
12836
- template <> struct Bridging<UniffiVTableCallbackInterfaceRestClient> {
12837
- static UniffiVTableCallbackInterfaceRestClient
13304
+ template <> struct Bridging<UniffiVTableCallbackInterfaceRestClient> {
13305
+ static UniffiVTableCallbackInterfaceRestClient
13306
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
13307
+ const jsi::Value &jsValue) {
13308
+ // Check if the input is an object
13309
+ if (!jsValue.isObject()) {
13310
+ throw jsi::JSError(
13311
+ rt, "Expected an object for UniffiVTableCallbackInterfaceRestClient");
13312
+ }
13313
+
13314
+ // Get the object from the jsi::Value
13315
+ auto jsObject = jsValue.getObject(rt);
13316
+
13317
+ // Create the vtable struct
13318
+ UniffiVTableCallbackInterfaceRestClient rsObject;
13319
+
13320
+ // Create the vtable from the js callbacks.
13321
+ rsObject.get_request = uniffi::breez_sdk_spark::cb::
13322
+ callbackinterfacerestclientmethod0::makeCallbackFunction(
13323
+ rt, callInvoker, jsObject.getProperty(rt, "getRequest"));
13324
+ rsObject.post_request = uniffi::breez_sdk_spark::cb::
13325
+ callbackinterfacerestclientmethod1::makeCallbackFunction(
13326
+ rt, callInvoker, jsObject.getProperty(rt, "postRequest"));
13327
+ rsObject.delete_request = uniffi::breez_sdk_spark::cb::
13328
+ callbackinterfacerestclientmethod2::makeCallbackFunction(
13329
+ rt, callInvoker, jsObject.getProperty(rt, "deleteRequest"));
13330
+ rsObject.uniffi_free =
13331
+ uniffi::breez_sdk_spark::st::vtablecallbackinterfacerestclient::
13332
+ vtablecallbackinterfacerestclient::free::makeCallbackFunction(
13333
+ rt, callInvoker, jsObject.getProperty(rt, "uniffiFree"));
13334
+
13335
+ return rsObject;
13336
+ }
13337
+ };
13338
+
13339
+ } // namespace uniffi::breez_sdk_spark
13340
+ namespace uniffi::breez_sdk_spark {
13341
+ using namespace facebook;
13342
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
13343
+
13344
+ template <> struct Bridging<UniffiVTableCallbackInterfaceSessionManager> {
13345
+ static UniffiVTableCallbackInterfaceSessionManager
12838
13346
  fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
12839
13347
  const jsi::Value &jsValue) {
12840
13348
  // Check if the input is an object
12841
13349
  if (!jsValue.isObject()) {
12842
13350
  throw jsi::JSError(
12843
- rt, "Expected an object for UniffiVTableCallbackInterfaceRestClient");
13351
+ rt,
13352
+ "Expected an object for UniffiVTableCallbackInterfaceSessionManager");
12844
13353
  }
12845
13354
 
12846
13355
  // Get the object from the jsi::Value
12847
13356
  auto jsObject = jsValue.getObject(rt);
12848
13357
 
12849
13358
  // Create the vtable struct
12850
- UniffiVTableCallbackInterfaceRestClient rsObject;
13359
+ UniffiVTableCallbackInterfaceSessionManager rsObject;
12851
13360
 
12852
13361
  // Create the vtable from the js callbacks.
12853
- rsObject.get_request = uniffi::breez_sdk_spark::cb::
12854
- callbackinterfacerestclientmethod0::makeCallbackFunction(
12855
- rt, callInvoker, jsObject.getProperty(rt, "getRequest"));
12856
- rsObject.post_request = uniffi::breez_sdk_spark::cb::
12857
- callbackinterfacerestclientmethod1::makeCallbackFunction(
12858
- rt, callInvoker, jsObject.getProperty(rt, "postRequest"));
12859
- rsObject.delete_request = uniffi::breez_sdk_spark::cb::
12860
- callbackinterfacerestclientmethod2::makeCallbackFunction(
12861
- rt, callInvoker, jsObject.getProperty(rt, "deleteRequest"));
13362
+ rsObject.get_session = uniffi::breez_sdk_spark::cb::
13363
+ callbackinterfacesessionmanagermethod0::makeCallbackFunction(
13364
+ rt, callInvoker, jsObject.getProperty(rt, "getSession"));
13365
+ rsObject.set_session = uniffi::breez_sdk_spark::cb::
13366
+ callbackinterfacesessionmanagermethod1::makeCallbackFunction(
13367
+ rt, callInvoker, jsObject.getProperty(rt, "setSession"));
12862
13368
  rsObject.uniffi_free =
12863
- uniffi::breez_sdk_spark::st::vtablecallbackinterfacerestclient::
12864
- vtablecallbackinterfacerestclient::free::makeCallbackFunction(
13369
+ uniffi::breez_sdk_spark::st::vtablecallbackinterfacesessionmanager::
13370
+ vtablecallbackinterfacesessionmanager::free::makeCallbackFunction(
12865
13371
  rt, callInvoker, jsObject.getProperty(rt, "uniffiFree"));
12866
13372
 
12867
13373
  return rsObject;
@@ -13702,6 +14208,28 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
13702
14208
  ->cpp_uniffi_breez_sdk_spark_fn_method_breezsdk_update_user_settings(
13703
14209
  rt, thisVal, args, count);
13704
14210
  });
14211
+ props["ubrn_uniffi_breez_sdk_spark_fn_clone_connectionmanager"] =
14212
+ jsi::Function::createFromHostFunction(
14213
+ rt,
14214
+ jsi::PropNameID::forAscii(
14215
+ rt, "ubrn_uniffi_breez_sdk_spark_fn_clone_connectionmanager"),
14216
+ 1,
14217
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
14218
+ const jsi::Value *args, size_t count) -> jsi::Value {
14219
+ return this->cpp_uniffi_breez_sdk_spark_fn_clone_connectionmanager(
14220
+ rt, thisVal, args, count);
14221
+ });
14222
+ props["ubrn_uniffi_breez_sdk_spark_fn_free_connectionmanager"] =
14223
+ jsi::Function::createFromHostFunction(
14224
+ rt,
14225
+ jsi::PropNameID::forAscii(
14226
+ rt, "ubrn_uniffi_breez_sdk_spark_fn_free_connectionmanager"),
14227
+ 1,
14228
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
14229
+ const jsi::Value *args, size_t count) -> jsi::Value {
14230
+ return this->cpp_uniffi_breez_sdk_spark_fn_free_connectionmanager(
14231
+ rt, thisVal, args, count);
14232
+ });
13705
14233
  props["ubrn_uniffi_breez_sdk_spark_fn_clone_externalsigner"] =
13706
14234
  jsi::Function::createFromHostFunction(
13707
14235
  rt,
@@ -14353,6 +14881,18 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
14353
14881
  ->cpp_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_chain_service(
14354
14882
  rt, thisVal, args, count);
14355
14883
  });
14884
+ props["ubrn_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_connection_"
14885
+ "manager"] = jsi::Function::createFromHostFunction(
14886
+ rt,
14887
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_fn_method_"
14888
+ "sdkbuilder_with_connection_manager"),
14889
+ 2,
14890
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
14891
+ const jsi::Value *args, size_t count) -> jsi::Value {
14892
+ return this
14893
+ ->cpp_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_connection_manager(
14894
+ rt, thisVal, args, count);
14895
+ });
14356
14896
  props["ubrn_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_default_"
14357
14897
  "storage"] = jsi::Function::createFromHostFunction(
14358
14898
  rt,
@@ -14426,6 +14966,30 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
14426
14966
  ->cpp_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_rest_chain_service(
14427
14967
  rt, thisVal, args, count);
14428
14968
  });
14969
+ props["ubrn_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_session_"
14970
+ "manager"] = jsi::Function::createFromHostFunction(
14971
+ rt,
14972
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_fn_method_"
14973
+ "sdkbuilder_with_session_manager"),
14974
+ 2,
14975
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
14976
+ const jsi::Value *args, size_t count) -> jsi::Value {
14977
+ return this
14978
+ ->cpp_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_session_manager(
14979
+ rt, thisVal, args, count);
14980
+ });
14981
+ props["ubrn_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_ssp_connection_"
14982
+ "manager"] = jsi::Function::createFromHostFunction(
14983
+ rt,
14984
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_fn_method_"
14985
+ "sdkbuilder_with_ssp_connection_manager"),
14986
+ 2,
14987
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
14988
+ const jsi::Value *args, size_t count) -> jsi::Value {
14989
+ return this
14990
+ ->cpp_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_ssp_connection_manager(
14991
+ rt, thisVal, args, count);
14992
+ });
14429
14993
  props["ubrn_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_storage"] =
14430
14994
  jsi::Function::createFromHostFunction(
14431
14995
  rt,
@@ -14439,6 +15003,88 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
14439
15003
  ->cpp_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_storage(
14440
15004
  rt, thisVal, args, count);
14441
15005
  });
15006
+ props["ubrn_uniffi_breez_sdk_spark_fn_clone_sessionmanager"] =
15007
+ jsi::Function::createFromHostFunction(
15008
+ rt,
15009
+ jsi::PropNameID::forAscii(
15010
+ rt, "ubrn_uniffi_breez_sdk_spark_fn_clone_sessionmanager"),
15011
+ 1,
15012
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
15013
+ const jsi::Value *args, size_t count) -> jsi::Value {
15014
+ return this->cpp_uniffi_breez_sdk_spark_fn_clone_sessionmanager(
15015
+ rt, thisVal, args, count);
15016
+ });
15017
+ props["ubrn_uniffi_breez_sdk_spark_fn_free_sessionmanager"] =
15018
+ jsi::Function::createFromHostFunction(
15019
+ rt,
15020
+ jsi::PropNameID::forAscii(
15021
+ rt, "ubrn_uniffi_breez_sdk_spark_fn_free_sessionmanager"),
15022
+ 1,
15023
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
15024
+ const jsi::Value *args, size_t count) -> jsi::Value {
15025
+ return this->cpp_uniffi_breez_sdk_spark_fn_free_sessionmanager(
15026
+ rt, thisVal, args, count);
15027
+ });
15028
+ props["ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_sessionmanager"] =
15029
+ jsi::Function::createFromHostFunction(
15030
+ rt,
15031
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_fn_init_"
15032
+ "callback_vtable_sessionmanager"),
15033
+ 1,
15034
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
15035
+ const jsi::Value *args, size_t count) -> jsi::Value {
15036
+ return this
15037
+ ->cpp_uniffi_breez_sdk_spark_fn_init_callback_vtable_sessionmanager(
15038
+ rt, thisVal, args, count);
15039
+ });
15040
+ props["ubrn_uniffi_breez_sdk_spark_fn_method_sessionmanager_get_session"] =
15041
+ jsi::Function::createFromHostFunction(
15042
+ rt,
15043
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_fn_method_"
15044
+ "sessionmanager_get_session"),
15045
+ 2,
15046
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
15047
+ const jsi::Value *args, size_t count) -> jsi::Value {
15048
+ return this
15049
+ ->cpp_uniffi_breez_sdk_spark_fn_method_sessionmanager_get_session(
15050
+ rt, thisVal, args, count);
15051
+ });
15052
+ props["ubrn_uniffi_breez_sdk_spark_fn_method_sessionmanager_set_session"] =
15053
+ jsi::Function::createFromHostFunction(
15054
+ rt,
15055
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_fn_method_"
15056
+ "sessionmanager_set_session"),
15057
+ 3,
15058
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
15059
+ const jsi::Value *args, size_t count) -> jsi::Value {
15060
+ return this
15061
+ ->cpp_uniffi_breez_sdk_spark_fn_method_sessionmanager_set_session(
15062
+ rt, thisVal, args, count);
15063
+ });
15064
+ props["ubrn_uniffi_breez_sdk_spark_fn_clone_sspconnectionmanager"] =
15065
+ jsi::Function::createFromHostFunction(
15066
+ rt,
15067
+ jsi::PropNameID::forAscii(
15068
+ rt, "ubrn_uniffi_breez_sdk_spark_fn_clone_sspconnectionmanager"),
15069
+ 1,
15070
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
15071
+ const jsi::Value *args, size_t count) -> jsi::Value {
15072
+ return this
15073
+ ->cpp_uniffi_breez_sdk_spark_fn_clone_sspconnectionmanager(
15074
+ rt, thisVal, args, count);
15075
+ });
15076
+ props["ubrn_uniffi_breez_sdk_spark_fn_free_sspconnectionmanager"] =
15077
+ jsi::Function::createFromHostFunction(
15078
+ rt,
15079
+ jsi::PropNameID::forAscii(
15080
+ rt, "ubrn_uniffi_breez_sdk_spark_fn_free_sspconnectionmanager"),
15081
+ 1,
15082
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
15083
+ const jsi::Value *args, size_t count) -> jsi::Value {
15084
+ return this
15085
+ ->cpp_uniffi_breez_sdk_spark_fn_free_sspconnectionmanager(
15086
+ rt, thisVal, args, count);
15087
+ });
14442
15088
  props["ubrn_uniffi_breez_sdk_spark_fn_clone_storage"] =
14443
15089
  jsi::Function::createFromHostFunction(
14444
15090
  rt,
@@ -15006,6 +15652,43 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
15006
15652
  return this->cpp_uniffi_breez_sdk_spark_fn_func_init_logging(
15007
15653
  rt, thisVal, args, count);
15008
15654
  });
15655
+ props["ubrn_uniffi_breez_sdk_spark_fn_func_new_connection_manager"] =
15656
+ jsi::Function::createFromHostFunction(
15657
+ rt,
15658
+ jsi::PropNameID::forAscii(
15659
+ rt, "ubrn_uniffi_breez_sdk_spark_fn_func_new_connection_manager"),
15660
+ 1,
15661
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
15662
+ const jsi::Value *args, size_t count) -> jsi::Value {
15663
+ return this
15664
+ ->cpp_uniffi_breez_sdk_spark_fn_func_new_connection_manager(
15665
+ rt, thisVal, args, count);
15666
+ });
15667
+ props["ubrn_uniffi_breez_sdk_spark_fn_func_new_rest_chain_service"] =
15668
+ jsi::Function::createFromHostFunction(
15669
+ rt,
15670
+ jsi::PropNameID::forAscii(
15671
+ rt, "ubrn_uniffi_breez_sdk_spark_fn_func_new_rest_chain_service"),
15672
+ 4,
15673
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
15674
+ const jsi::Value *args, size_t count) -> jsi::Value {
15675
+ return this
15676
+ ->cpp_uniffi_breez_sdk_spark_fn_func_new_rest_chain_service(
15677
+ rt, thisVal, args, count);
15678
+ });
15679
+ props["ubrn_uniffi_breez_sdk_spark_fn_func_new_ssp_connection_manager"] =
15680
+ jsi::Function::createFromHostFunction(
15681
+ rt,
15682
+ jsi::PropNameID::forAscii(
15683
+ rt,
15684
+ "ubrn_uniffi_breez_sdk_spark_fn_func_new_ssp_connection_manager"),
15685
+ 1,
15686
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
15687
+ const jsi::Value *args, size_t count) -> jsi::Value {
15688
+ return this
15689
+ ->cpp_uniffi_breez_sdk_spark_fn_func_new_ssp_connection_manager(
15690
+ rt, thisVal, args, count);
15691
+ });
15009
15692
  props["ubrn_ffi_breez_sdk_spark_rust_future_poll_u8"] =
15010
15693
  jsi::Function::createFromHostFunction(
15011
15694
  rt,
@@ -15650,6 +16333,42 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
15650
16333
  return this->cpp_uniffi_breez_sdk_spark_checksum_func_init_logging(
15651
16334
  rt, thisVal, args, count);
15652
16335
  });
16336
+ props["ubrn_uniffi_breez_sdk_spark_checksum_func_new_connection_manager"] =
16337
+ jsi::Function::createFromHostFunction(
16338
+ rt,
16339
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_checksum_"
16340
+ "func_new_connection_manager"),
16341
+ 0,
16342
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
16343
+ const jsi::Value *args, size_t count) -> jsi::Value {
16344
+ return this
16345
+ ->cpp_uniffi_breez_sdk_spark_checksum_func_new_connection_manager(
16346
+ rt, thisVal, args, count);
16347
+ });
16348
+ props["ubrn_uniffi_breez_sdk_spark_checksum_func_new_rest_chain_service"] =
16349
+ jsi::Function::createFromHostFunction(
16350
+ rt,
16351
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_checksum_"
16352
+ "func_new_rest_chain_service"),
16353
+ 0,
16354
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
16355
+ const jsi::Value *args, size_t count) -> jsi::Value {
16356
+ return this
16357
+ ->cpp_uniffi_breez_sdk_spark_checksum_func_new_rest_chain_service(
16358
+ rt, thisVal, args, count);
16359
+ });
16360
+ props["ubrn_uniffi_breez_sdk_spark_checksum_func_new_ssp_connection_"
16361
+ "manager"] = jsi::Function::createFromHostFunction(
16362
+ rt,
16363
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_checksum_func_"
16364
+ "new_ssp_connection_manager"),
16365
+ 0,
16366
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
16367
+ const jsi::Value *args, size_t count) -> jsi::Value {
16368
+ return this
16369
+ ->cpp_uniffi_breez_sdk_spark_checksum_func_new_ssp_connection_manager(
16370
+ rt, thisVal, args, count);
16371
+ });
15653
16372
  props["ubrn_uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_get_"
15654
16373
  "address_utxos"] = jsi::Function::createFromHostFunction(
15655
16374
  rt,
@@ -16671,6 +17390,19 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
16671
17390
  ->cpp_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_chain_service(
16672
17391
  rt, thisVal, args, count);
16673
17392
  });
17393
+ props["ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_"
17394
+ "connection_manager"] = jsi::Function::createFromHostFunction(
17395
+ rt,
17396
+ jsi::PropNameID::forAscii(rt,
17397
+ "ubrn_uniffi_breez_sdk_spark_checksum_method_"
17398
+ "sdkbuilder_with_connection_manager"),
17399
+ 0,
17400
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
17401
+ const jsi::Value *args, size_t count) -> jsi::Value {
17402
+ return this
17403
+ ->cpp_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_connection_manager(
17404
+ rt, thisVal, args, count);
17405
+ });
16674
17406
  props["ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_default_"
16675
17407
  "storage"] = jsi::Function::createFromHostFunction(
16676
17408
  rt,
@@ -16744,6 +17476,31 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
16744
17476
  ->cpp_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_rest_chain_service(
16745
17477
  rt, thisVal, args, count);
16746
17478
  });
17479
+ props["ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_session_"
17480
+ "manager"] = jsi::Function::createFromHostFunction(
17481
+ rt,
17482
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_checksum_"
17483
+ "method_sdkbuilder_with_session_manager"),
17484
+ 0,
17485
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
17486
+ const jsi::Value *args, size_t count) -> jsi::Value {
17487
+ return this
17488
+ ->cpp_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_session_manager(
17489
+ rt, thisVal, args, count);
17490
+ });
17491
+ props["ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_ssp_"
17492
+ "connection_manager"] = jsi::Function::createFromHostFunction(
17493
+ rt,
17494
+ jsi::PropNameID::forAscii(rt,
17495
+ "ubrn_uniffi_breez_sdk_spark_checksum_method_"
17496
+ "sdkbuilder_with_ssp_connection_manager"),
17497
+ 0,
17498
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
17499
+ const jsi::Value *args, size_t count) -> jsi::Value {
17500
+ return this
17501
+ ->cpp_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_ssp_connection_manager(
17502
+ rt, thisVal, args, count);
17503
+ });
16747
17504
  props["ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_storage"] =
16748
17505
  jsi::Function::createFromHostFunction(
16749
17506
  rt,
@@ -16756,6 +17513,30 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
16756
17513
  ->cpp_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_storage(
16757
17514
  rt, thisVal, args, count);
16758
17515
  });
17516
+ props["ubrn_uniffi_breez_sdk_spark_checksum_method_sessionmanager_get_"
17517
+ "session"] = jsi::Function::createFromHostFunction(
17518
+ rt,
17519
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_checksum_"
17520
+ "method_sessionmanager_get_session"),
17521
+ 0,
17522
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
17523
+ const jsi::Value *args, size_t count) -> jsi::Value {
17524
+ return this
17525
+ ->cpp_uniffi_breez_sdk_spark_checksum_method_sessionmanager_get_session(
17526
+ rt, thisVal, args, count);
17527
+ });
17528
+ props["ubrn_uniffi_breez_sdk_spark_checksum_method_sessionmanager_set_"
17529
+ "session"] = jsi::Function::createFromHostFunction(
17530
+ rt,
17531
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_spark_checksum_"
17532
+ "method_sessionmanager_set_session"),
17533
+ 0,
17534
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
17535
+ const jsi::Value *args, size_t count) -> jsi::Value {
17536
+ return this
17537
+ ->cpp_uniffi_breez_sdk_spark_checksum_method_sessionmanager_set_session(
17538
+ rt, thisVal, args, count);
17539
+ });
16759
17540
  props["ubrn_uniffi_breez_sdk_spark_checksum_method_storage_delete_cached_"
16760
17541
  "item"] = jsi::Function::createFromHostFunction(
16761
17542
  rt,
@@ -17253,6 +18034,18 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
17253
18034
  ->cpp_uniffi_internal_fn_method_breezsdk_ffi__bless_pointer(
17254
18035
  rt, thisVal, args, count);
17255
18036
  });
18037
+ props["ubrn_uniffi_internal_fn_method_connectionmanager_ffi__bless_pointer"] =
18038
+ jsi::Function::createFromHostFunction(
18039
+ rt,
18040
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_internal_fn_method_"
18041
+ "connectionmanager_ffi__bless_pointer"),
18042
+ 1,
18043
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
18044
+ const jsi::Value *args, size_t count) -> jsi::Value {
18045
+ return this
18046
+ ->cpp_uniffi_internal_fn_method_connectionmanager_ffi__bless_pointer(
18047
+ rt, thisVal, args, count);
18048
+ });
17256
18049
  props["ubrn_uniffi_internal_fn_method_externalsigner_ffi__bless_pointer"] =
17257
18050
  jsi::Function::createFromHostFunction(
17258
18051
  rt,
@@ -17340,6 +18133,30 @@ NativeBreezSdkSpark::NativeBreezSdkSpark(
17340
18133
  ->cpp_uniffi_internal_fn_method_sdkbuilder_ffi__bless_pointer(
17341
18134
  rt, thisVal, args, count);
17342
18135
  });
18136
+ props["ubrn_uniffi_internal_fn_method_sessionmanager_ffi__bless_pointer"] =
18137
+ jsi::Function::createFromHostFunction(
18138
+ rt,
18139
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_internal_fn_method_"
18140
+ "sessionmanager_ffi__bless_pointer"),
18141
+ 1,
18142
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
18143
+ const jsi::Value *args, size_t count) -> jsi::Value {
18144
+ return this
18145
+ ->cpp_uniffi_internal_fn_method_sessionmanager_ffi__bless_pointer(
18146
+ rt, thisVal, args, count);
18147
+ });
18148
+ props["ubrn_uniffi_internal_fn_method_sspconnectionmanager_ffi__bless_"
18149
+ "pointer"] = jsi::Function::createFromHostFunction(
18150
+ rt,
18151
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_internal_fn_method_"
18152
+ "sspconnectionmanager_ffi__bless_pointer"),
18153
+ 1,
18154
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
18155
+ const jsi::Value *args, size_t count) -> jsi::Value {
18156
+ return this
18157
+ ->cpp_uniffi_internal_fn_method_sspconnectionmanager_ffi__bless_pointer(
18158
+ rt, thisVal, args, count);
18159
+ });
17343
18160
  props["ubrn_uniffi_internal_fn_method_storage_ffi__bless_pointer"] =
17344
18161
  jsi::Function::createFromHostFunction(
17345
18162
  rt,
@@ -17424,6 +18241,8 @@ NativeBreezSdkSpark::~NativeBreezSdkSpark() {
17424
18241
  vtablecallbackinterfacepaymentobserver::free::cleanup();
17425
18242
  uniffi::breez_sdk_spark::st::vtablecallbackinterfacerestclient::
17426
18243
  vtablecallbackinterfacerestclient::free::cleanup();
18244
+ uniffi::breez_sdk_spark::st::vtablecallbackinterfacesessionmanager::
18245
+ vtablecallbackinterfacesessionmanager::free::cleanup();
17427
18246
  uniffi::breez_sdk_spark::st::vtablecallbackinterfacestorage::
17428
18247
  vtablecallbackinterfacestorage::free::cleanup();
17429
18248
  // Cleanup for callback function CallbackInterfaceEventListenerMethod0
@@ -17524,6 +18343,12 @@ NativeBreezSdkSpark::~NativeBreezSdkSpark() {
17524
18343
  uniffi::breez_sdk_spark::cb::callbackinterfacerestclientmethod1::cleanup();
17525
18344
  // Cleanup for callback function CallbackInterfaceRestClientMethod2
17526
18345
  uniffi::breez_sdk_spark::cb::callbackinterfacerestclientmethod2::cleanup();
18346
+ // Cleanup for callback function CallbackInterfaceSessionManagerMethod0
18347
+ uniffi::breez_sdk_spark::cb::callbackinterfacesessionmanagermethod0::
18348
+ cleanup();
18349
+ // Cleanup for callback function CallbackInterfaceSessionManagerMethod1
18350
+ uniffi::breez_sdk_spark::cb::callbackinterfacesessionmanagermethod1::
18351
+ cleanup();
17527
18352
  // Cleanup for callback function CallbackInterfaceStorageMethod0
17528
18353
  uniffi::breez_sdk_spark::cb::callbackinterfacestoragemethod0::cleanup();
17529
18354
  // Cleanup for callback function CallbackInterfaceStorageMethod1
@@ -17626,7 +18451,23 @@ NativeBreezSdkSpark::cpp_uniffi_internal_fn_method_breezsdk_ffi__bless_pointer(
17626
18451
  auto static destructor = [](uint64_t p) {
17627
18452
  auto pointer = reinterpret_cast<void *>(static_cast<uintptr_t>(p));
17628
18453
  RustCallStatus status = {0};
17629
- uniffi_breez_sdk_spark_fn_free_breezsdk(pointer, &status);
18454
+ uniffi_breez_sdk_spark_fn_free_breezsdk(pointer, &status);
18455
+ };
18456
+ auto ptrObj =
18457
+ std::make_shared<uniffi_jsi::DestructibleObject>(pointer, destructor);
18458
+ auto obj = jsi::Object::createFromHostObject(rt, ptrObj);
18459
+ return jsi::Value(rt, obj);
18460
+ }
18461
+ jsi::Value NativeBreezSdkSpark::
18462
+ cpp_uniffi_internal_fn_method_connectionmanager_ffi__bless_pointer(
18463
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
18464
+ size_t count) {
18465
+ auto pointer =
18466
+ uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]);
18467
+ auto static destructor = [](uint64_t p) {
18468
+ auto pointer = reinterpret_cast<void *>(static_cast<uintptr_t>(p));
18469
+ RustCallStatus status = {0};
18470
+ uniffi_breez_sdk_spark_fn_free_connectionmanager(pointer, &status);
17630
18471
  };
17631
18472
  auto ptrObj =
17632
18473
  std::make_shared<uniffi_jsi::DestructibleObject>(pointer, destructor);
@@ -17745,6 +18586,38 @@ jsi::Value NativeBreezSdkSpark::
17745
18586
  auto obj = jsi::Object::createFromHostObject(rt, ptrObj);
17746
18587
  return jsi::Value(rt, obj);
17747
18588
  }
18589
+ jsi::Value NativeBreezSdkSpark::
18590
+ cpp_uniffi_internal_fn_method_sessionmanager_ffi__bless_pointer(
18591
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
18592
+ size_t count) {
18593
+ auto pointer =
18594
+ uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]);
18595
+ auto static destructor = [](uint64_t p) {
18596
+ auto pointer = reinterpret_cast<void *>(static_cast<uintptr_t>(p));
18597
+ RustCallStatus status = {0};
18598
+ uniffi_breez_sdk_spark_fn_free_sessionmanager(pointer, &status);
18599
+ };
18600
+ auto ptrObj =
18601
+ std::make_shared<uniffi_jsi::DestructibleObject>(pointer, destructor);
18602
+ auto obj = jsi::Object::createFromHostObject(rt, ptrObj);
18603
+ return jsi::Value(rt, obj);
18604
+ }
18605
+ jsi::Value NativeBreezSdkSpark::
18606
+ cpp_uniffi_internal_fn_method_sspconnectionmanager_ffi__bless_pointer(
18607
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
18608
+ size_t count) {
18609
+ auto pointer =
18610
+ uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]);
18611
+ auto static destructor = [](uint64_t p) {
18612
+ auto pointer = reinterpret_cast<void *>(static_cast<uintptr_t>(p));
18613
+ RustCallStatus status = {0};
18614
+ uniffi_breez_sdk_spark_fn_free_sspconnectionmanager(pointer, &status);
18615
+ };
18616
+ auto ptrObj =
18617
+ std::make_shared<uniffi_jsi::DestructibleObject>(pointer, destructor);
18618
+ auto obj = jsi::Object::createFromHostObject(rt, ptrObj);
18619
+ return jsi::Value(rt, obj);
18620
+ }
17748
18621
  jsi::Value
17749
18622
  NativeBreezSdkSpark::cpp_uniffi_internal_fn_method_storage_ffi__bless_pointer(
17750
18623
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
@@ -18427,6 +19300,32 @@ jsi::Value NativeBreezSdkSpark::
18427
19300
  value);
18428
19301
  }
18429
19302
  jsi::Value
19303
+ NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_clone_connectionmanager(
19304
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
19305
+ size_t count) {
19306
+ RustCallStatus status =
19307
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::rustSuccess(rt);
19308
+ auto value = uniffi_breez_sdk_spark_fn_clone_connectionmanager(
19309
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]), &status);
19310
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::copyIntoJs(
19311
+ rt, callInvoker, status, args[count - 1]);
19312
+
19313
+ return uniffi_jsi::Bridging<void *>::toJs(rt, callInvoker, value);
19314
+ }
19315
+ jsi::Value
19316
+ NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_free_connectionmanager(
19317
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
19318
+ size_t count) {
19319
+ RustCallStatus status =
19320
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::rustSuccess(rt);
19321
+ uniffi_breez_sdk_spark_fn_free_connectionmanager(
19322
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]), &status);
19323
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::copyIntoJs(
19324
+ rt, callInvoker, status, args[count - 1]);
19325
+
19326
+ return jsi::Value::undefined();
19327
+ }
19328
+ jsi::Value
18430
19329
  NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_clone_externalsigner(
18431
19330
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
18432
19331
  size_t count) {
@@ -19143,6 +20042,18 @@ jsi::Value NativeBreezSdkSpark::
19143
20042
  return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
19144
20043
  value);
19145
20044
  }
20045
+ jsi::Value NativeBreezSdkSpark::
20046
+ cpp_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_connection_manager(
20047
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
20048
+ size_t count) {
20049
+ auto value =
20050
+ uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_connection_manager(
20051
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]),
20052
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[1]));
20053
+
20054
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
20055
+ value);
20056
+ }
19146
20057
  jsi::Value NativeBreezSdkSpark::
19147
20058
  cpp_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_default_storage(
19148
20059
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
@@ -19218,6 +20129,29 @@ jsi::Value NativeBreezSdkSpark::
19218
20129
  return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
19219
20130
  value);
19220
20131
  }
20132
+ jsi::Value NativeBreezSdkSpark::
20133
+ cpp_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_session_manager(
20134
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
20135
+ size_t count) {
20136
+ auto value = uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_session_manager(
20137
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]),
20138
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[1]));
20139
+
20140
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
20141
+ value);
20142
+ }
20143
+ jsi::Value NativeBreezSdkSpark::
20144
+ cpp_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_ssp_connection_manager(
20145
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
20146
+ size_t count) {
20147
+ auto value =
20148
+ uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_ssp_connection_manager(
20149
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]),
20150
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[1]));
20151
+
20152
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
20153
+ value);
20154
+ }
19221
20155
  jsi::Value NativeBreezSdkSpark::
19222
20156
  cpp_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_storage(
19223
20157
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
@@ -19229,6 +20163,99 @@ jsi::Value NativeBreezSdkSpark::
19229
20163
  return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
19230
20164
  value);
19231
20165
  }
20166
+ jsi::Value
20167
+ NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_clone_sessionmanager(
20168
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
20169
+ size_t count) {
20170
+ RustCallStatus status =
20171
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::rustSuccess(rt);
20172
+ auto value = uniffi_breez_sdk_spark_fn_clone_sessionmanager(
20173
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]), &status);
20174
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::copyIntoJs(
20175
+ rt, callInvoker, status, args[count - 1]);
20176
+
20177
+ return uniffi_jsi::Bridging<void *>::toJs(rt, callInvoker, value);
20178
+ }
20179
+ jsi::Value
20180
+ NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_free_sessionmanager(
20181
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
20182
+ size_t count) {
20183
+ RustCallStatus status =
20184
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::rustSuccess(rt);
20185
+ uniffi_breez_sdk_spark_fn_free_sessionmanager(
20186
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]), &status);
20187
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::copyIntoJs(
20188
+ rt, callInvoker, status, args[count - 1]);
20189
+
20190
+ return jsi::Value::undefined();
20191
+ }
20192
+ jsi::Value NativeBreezSdkSpark::
20193
+ cpp_uniffi_breez_sdk_spark_fn_init_callback_vtable_sessionmanager(
20194
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
20195
+ size_t count) {
20196
+ auto vtableInstance = uniffi::breez_sdk_spark::Bridging<
20197
+ UniffiVTableCallbackInterfaceSessionManager>::fromJs(rt, callInvoker,
20198
+ args[0]);
20199
+
20200
+ std::lock_guard<std::mutex> lock(
20201
+ uniffi::breez_sdk_spark::registry::vtableMutex);
20202
+ uniffi_breez_sdk_spark_fn_init_callback_vtable_sessionmanager(
20203
+ uniffi::breez_sdk_spark::registry::putTable(
20204
+ "UniffiVTableCallbackInterfaceSessionManager", vtableInstance));
20205
+ return jsi::Value::undefined();
20206
+ }
20207
+ jsi::Value NativeBreezSdkSpark::
20208
+ cpp_uniffi_breez_sdk_spark_fn_method_sessionmanager_get_session(
20209
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
20210
+ size_t count) {
20211
+ auto value = uniffi_breez_sdk_spark_fn_method_sessionmanager_get_session(
20212
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]),
20213
+ uniffi::breez_sdk_spark::Bridging<RustBuffer>::fromJs(rt, callInvoker,
20214
+ args[1]));
20215
+
20216
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
20217
+ value);
20218
+ }
20219
+ jsi::Value NativeBreezSdkSpark::
20220
+ cpp_uniffi_breez_sdk_spark_fn_method_sessionmanager_set_session(
20221
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
20222
+ size_t count) {
20223
+ auto value = uniffi_breez_sdk_spark_fn_method_sessionmanager_set_session(
20224
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]),
20225
+ uniffi::breez_sdk_spark::Bridging<RustBuffer>::fromJs(rt, callInvoker,
20226
+ args[1]),
20227
+ uniffi::breez_sdk_spark::Bridging<RustBuffer>::fromJs(rt, callInvoker,
20228
+ args[2]));
20229
+
20230
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
20231
+ value);
20232
+ }
20233
+ jsi::Value
20234
+ NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_clone_sspconnectionmanager(
20235
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
20236
+ size_t count) {
20237
+ RustCallStatus status =
20238
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::rustSuccess(rt);
20239
+ auto value = uniffi_breez_sdk_spark_fn_clone_sspconnectionmanager(
20240
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]), &status);
20241
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::copyIntoJs(
20242
+ rt, callInvoker, status, args[count - 1]);
20243
+
20244
+ return uniffi_jsi::Bridging<void *>::toJs(rt, callInvoker, value);
20245
+ }
20246
+ jsi::Value
20247
+ NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_free_sspconnectionmanager(
20248
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
20249
+ size_t count) {
20250
+ RustCallStatus status =
20251
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::rustSuccess(rt);
20252
+ uniffi_breez_sdk_spark_fn_free_sspconnectionmanager(
20253
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]), &status);
20254
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::copyIntoJs(
20255
+ rt, callInvoker, status, args[count - 1]);
20256
+
20257
+ return jsi::Value::undefined();
20258
+ }
19232
20259
  jsi::Value NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_clone_storage(
19233
20260
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
19234
20261
  size_t count) {
@@ -19820,6 +20847,57 @@ jsi::Value NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_func_init_logging(
19820
20847
 
19821
20848
  return jsi::Value::undefined();
19822
20849
  }
20850
+ jsi::Value
20851
+ NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_func_new_connection_manager(
20852
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
20853
+ size_t count) {
20854
+ RustCallStatus status =
20855
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::rustSuccess(rt);
20856
+ auto value = uniffi_breez_sdk_spark_fn_func_new_connection_manager(
20857
+ uniffi::breez_sdk_spark::Bridging<RustBuffer>::fromJs(rt, callInvoker,
20858
+ args[0]),
20859
+ &status);
20860
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::copyIntoJs(
20861
+ rt, callInvoker, status, args[count - 1]);
20862
+
20863
+ return uniffi_jsi::Bridging<void *>::toJs(rt, callInvoker, value);
20864
+ }
20865
+ jsi::Value
20866
+ NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_fn_func_new_rest_chain_service(
20867
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
20868
+ size_t count) {
20869
+ RustCallStatus status =
20870
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::rustSuccess(rt);
20871
+ auto value = uniffi_breez_sdk_spark_fn_func_new_rest_chain_service(
20872
+ uniffi::breez_sdk_spark::Bridging<RustBuffer>::fromJs(rt, callInvoker,
20873
+ args[0]),
20874
+ uniffi::breez_sdk_spark::Bridging<RustBuffer>::fromJs(rt, callInvoker,
20875
+ args[1]),
20876
+ uniffi::breez_sdk_spark::Bridging<RustBuffer>::fromJs(rt, callInvoker,
20877
+ args[2]),
20878
+ uniffi::breez_sdk_spark::Bridging<RustBuffer>::fromJs(rt, callInvoker,
20879
+ args[3]),
20880
+ &status);
20881
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::copyIntoJs(
20882
+ rt, callInvoker, status, args[count - 1]);
20883
+
20884
+ return uniffi_jsi::Bridging<void *>::toJs(rt, callInvoker, value);
20885
+ }
20886
+ jsi::Value NativeBreezSdkSpark::
20887
+ cpp_uniffi_breez_sdk_spark_fn_func_new_ssp_connection_manager(
20888
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
20889
+ size_t count) {
20890
+ RustCallStatus status =
20891
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::rustSuccess(rt);
20892
+ auto value = uniffi_breez_sdk_spark_fn_func_new_ssp_connection_manager(
20893
+ uniffi::breez_sdk_spark::Bridging<RustBuffer>::fromJs(rt, callInvoker,
20894
+ args[0]),
20895
+ &status);
20896
+ uniffi::breez_sdk_spark::Bridging<RustCallStatus>::copyIntoJs(
20897
+ rt, callInvoker, status, args[count - 1]);
20898
+
20899
+ return uniffi_jsi::Bridging<void *>::toJs(rt, callInvoker, value);
20900
+ }
19823
20901
  jsi::Value NativeBreezSdkSpark::cpp_ffi_breez_sdk_spark_rust_future_poll_u8(
19824
20902
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
19825
20903
  size_t count) {
@@ -20484,6 +21562,31 @@ NativeBreezSdkSpark::cpp_uniffi_breez_sdk_spark_checksum_func_init_logging(
20484
21562
 
20485
21563
  return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
20486
21564
  }
21565
+ jsi::Value NativeBreezSdkSpark::
21566
+ cpp_uniffi_breez_sdk_spark_checksum_func_new_connection_manager(
21567
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
21568
+ size_t count) {
21569
+ auto value = uniffi_breez_sdk_spark_checksum_func_new_connection_manager();
21570
+
21571
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
21572
+ }
21573
+ jsi::Value NativeBreezSdkSpark::
21574
+ cpp_uniffi_breez_sdk_spark_checksum_func_new_rest_chain_service(
21575
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
21576
+ size_t count) {
21577
+ auto value = uniffi_breez_sdk_spark_checksum_func_new_rest_chain_service();
21578
+
21579
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
21580
+ }
21581
+ jsi::Value NativeBreezSdkSpark::
21582
+ cpp_uniffi_breez_sdk_spark_checksum_func_new_ssp_connection_manager(
21583
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
21584
+ size_t count) {
21585
+ auto value =
21586
+ uniffi_breez_sdk_spark_checksum_func_new_ssp_connection_manager();
21587
+
21588
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
21589
+ }
20487
21590
  jsi::Value NativeBreezSdkSpark::
20488
21591
  cpp_uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_get_address_utxos(
20489
21592
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
@@ -21204,6 +22307,15 @@ jsi::Value NativeBreezSdkSpark::
21204
22307
 
21205
22308
  return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
21206
22309
  }
22310
+ jsi::Value NativeBreezSdkSpark::
22311
+ cpp_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_connection_manager(
22312
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
22313
+ size_t count) {
22314
+ auto value =
22315
+ uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_connection_manager();
22316
+
22317
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
22318
+ }
21207
22319
  jsi::Value NativeBreezSdkSpark::
21208
22320
  cpp_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_default_storage(
21209
22321
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
@@ -21257,6 +22369,24 @@ jsi::Value NativeBreezSdkSpark::
21257
22369
 
21258
22370
  return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
21259
22371
  }
22372
+ jsi::Value NativeBreezSdkSpark::
22373
+ cpp_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_session_manager(
22374
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
22375
+ size_t count) {
22376
+ auto value =
22377
+ uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_session_manager();
22378
+
22379
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
22380
+ }
22381
+ jsi::Value NativeBreezSdkSpark::
22382
+ cpp_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_ssp_connection_manager(
22383
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
22384
+ size_t count) {
22385
+ auto value =
22386
+ uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_ssp_connection_manager();
22387
+
22388
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
22389
+ }
21260
22390
  jsi::Value NativeBreezSdkSpark::
21261
22391
  cpp_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_storage(
21262
22392
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
@@ -21265,6 +22395,24 @@ jsi::Value NativeBreezSdkSpark::
21265
22395
 
21266
22396
  return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
21267
22397
  }
22398
+ jsi::Value NativeBreezSdkSpark::
22399
+ cpp_uniffi_breez_sdk_spark_checksum_method_sessionmanager_get_session(
22400
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
22401
+ size_t count) {
22402
+ auto value =
22403
+ uniffi_breez_sdk_spark_checksum_method_sessionmanager_get_session();
22404
+
22405
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
22406
+ }
22407
+ jsi::Value NativeBreezSdkSpark::
22408
+ cpp_uniffi_breez_sdk_spark_checksum_method_sessionmanager_set_session(
22409
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
22410
+ size_t count) {
22411
+ auto value =
22412
+ uniffi_breez_sdk_spark_checksum_method_sessionmanager_set_session();
22413
+
22414
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
22415
+ }
21268
22416
  jsi::Value NativeBreezSdkSpark::
21269
22417
  cpp_uniffi_breez_sdk_spark_checksum_method_storage_delete_cached_item(
21270
22418
  jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,