@breeztech/breez-sdk-spark-react-native 0.1.8-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.
Files changed (103) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +54 -0
  3. package/android/CMakeLists.txt +79 -0
  4. package/android/build.gradle +143 -0
  5. package/android/cpp-adapter.cpp +63 -0
  6. package/android/generated/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeBreezSdkSparkReactNativeSpec.java +41 -0
  7. package/android/generated/android/app/build/generated/source/codegen/jni/BreezSdkSparkReactNativeSpec-generated.cpp +38 -0
  8. package/android/generated/android/app/build/generated/source/codegen/jni/BreezSdkSparkReactNativeSpec.h +31 -0
  9. package/android/generated/android/app/build/generated/source/codegen/jni/CMakeLists.txt +36 -0
  10. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/BreezSdkSparkReactNativeSpec/BreezSdkSparkReactNativeSpecJSI-generated.cpp +32 -0
  11. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/BreezSdkSparkReactNativeSpec/BreezSdkSparkReactNativeSpecJSI.h +80 -0
  12. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/BreezSdkSparkReactNativeSpec/ComponentDescriptors.cpp +22 -0
  13. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/BreezSdkSparkReactNativeSpec/ComponentDescriptors.h +24 -0
  14. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/BreezSdkSparkReactNativeSpec/EventEmitters.cpp +16 -0
  15. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/BreezSdkSparkReactNativeSpec/EventEmitters.h +17 -0
  16. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/BreezSdkSparkReactNativeSpec/Props.cpp +19 -0
  17. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/BreezSdkSparkReactNativeSpec/Props.h +18 -0
  18. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/BreezSdkSparkReactNativeSpec/ShadowNodes.cpp +17 -0
  19. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/BreezSdkSparkReactNativeSpec/ShadowNodes.h +23 -0
  20. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/BreezSdkSparkReactNativeSpec/States.cpp +16 -0
  21. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/BreezSdkSparkReactNativeSpec/States.h +19 -0
  22. package/android/gradle.properties +5 -0
  23. package/android/src/main/AndroidManifest.xml +5 -0
  24. package/android/src/main/AndroidManifestNew.xml +2 -0
  25. package/android/src/main/java/com/breeztech/breezsdkspark/BreezSdkSparkReactNativeModule.kt +43 -0
  26. package/android/src/main/java/com/breeztech/breezsdkspark/BreezSdkSparkReactNativePackage.kt +34 -0
  27. package/breeztech-breez-sdk-spark-react-native.podspec +44 -0
  28. package/cpp/breeztech-breez-sdk-spark-react-native.cpp +20 -0
  29. package/cpp/breeztech-breez-sdk-spark-react-native.h +15 -0
  30. package/cpp/generated/breez_sdk_common.cpp +3834 -0
  31. package/cpp/generated/breez_sdk_common.hpp +251 -0
  32. package/cpp/generated/breez_sdk_spark.cpp +8722 -0
  33. package/cpp/generated/breez_sdk_spark.hpp +589 -0
  34. package/cpp/generated/breez_sdk_spark_bindings.cpp +1750 -0
  35. package/cpp/generated/breez_sdk_spark_bindings.hpp +65 -0
  36. package/ios/BreezSdkSparkReactNative.h +16 -0
  37. package/ios/BreezSdkSparkReactNative.mm +66 -0
  38. package/ios/generated/build/generated/ios/BreezSdkSparkReactNativeSpec/BreezSdkSparkReactNativeSpec-generated.mm +46 -0
  39. package/ios/generated/build/generated/ios/BreezSdkSparkReactNativeSpec/BreezSdkSparkReactNativeSpec.h +63 -0
  40. package/ios/generated/build/generated/ios/BreezSdkSparkReactNativeSpecJSI-generated.cpp +32 -0
  41. package/ios/generated/build/generated/ios/BreezSdkSparkReactNativeSpecJSI.h +80 -0
  42. package/ios/generated/build/generated/ios/react/renderer/components/BreezSdkSparkReactNativeSpec/ComponentDescriptors.cpp +22 -0
  43. package/ios/generated/build/generated/ios/react/renderer/components/BreezSdkSparkReactNativeSpec/ComponentDescriptors.h +24 -0
  44. package/ios/generated/build/generated/ios/react/renderer/components/BreezSdkSparkReactNativeSpec/EventEmitters.cpp +16 -0
  45. package/ios/generated/build/generated/ios/react/renderer/components/BreezSdkSparkReactNativeSpec/EventEmitters.h +17 -0
  46. package/ios/generated/build/generated/ios/react/renderer/components/BreezSdkSparkReactNativeSpec/Props.cpp +19 -0
  47. package/ios/generated/build/generated/ios/react/renderer/components/BreezSdkSparkReactNativeSpec/Props.h +18 -0
  48. package/ios/generated/build/generated/ios/react/renderer/components/BreezSdkSparkReactNativeSpec/RCTComponentViewHelpers.h +18 -0
  49. package/ios/generated/build/generated/ios/react/renderer/components/BreezSdkSparkReactNativeSpec/ShadowNodes.cpp +17 -0
  50. package/ios/generated/build/generated/ios/react/renderer/components/BreezSdkSparkReactNativeSpec/ShadowNodes.h +23 -0
  51. package/ios/generated/build/generated/ios/react/renderer/components/BreezSdkSparkReactNativeSpec/States.cpp +16 -0
  52. package/ios/generated/build/generated/ios/react/renderer/components/BreezSdkSparkReactNativeSpec/States.h +19 -0
  53. package/lib/commonjs/NativeBreezSdkSparkReactNative.js +10 -0
  54. package/lib/commonjs/NativeBreezSdkSparkReactNative.js.map +1 -0
  55. package/lib/commonjs/generated/breez_sdk_common-ffi.js +44 -0
  56. package/lib/commonjs/generated/breez_sdk_common-ffi.js.map +1 -0
  57. package/lib/commonjs/generated/breez_sdk_common.js +3948 -0
  58. package/lib/commonjs/generated/breez_sdk_common.js.map +1 -0
  59. package/lib/commonjs/generated/breez_sdk_spark-ffi.js +44 -0
  60. package/lib/commonjs/generated/breez_sdk_spark-ffi.js.map +1 -0
  61. package/lib/commonjs/generated/breez_sdk_spark.js +5775 -0
  62. package/lib/commonjs/generated/breez_sdk_spark.js.map +1 -0
  63. package/lib/commonjs/generated/breez_sdk_spark_bindings-ffi.js +44 -0
  64. package/lib/commonjs/generated/breez_sdk_spark_bindings-ffi.js.map +1 -0
  65. package/lib/commonjs/generated/breez_sdk_spark_bindings.js +51 -0
  66. package/lib/commonjs/generated/breez_sdk_spark_bindings.js.map +1 -0
  67. package/lib/commonjs/index.js +81 -0
  68. package/lib/commonjs/index.js.map +1 -0
  69. package/lib/commonjs/package.json +1 -0
  70. package/lib/module/NativeBreezSdkSparkReactNative.js +7 -0
  71. package/lib/module/NativeBreezSdkSparkReactNative.js.map +1 -0
  72. package/lib/module/generated/breez_sdk_common-ffi.js +43 -0
  73. package/lib/module/generated/breez_sdk_common-ffi.js.map +1 -0
  74. package/lib/module/generated/breez_sdk_common.js +3942 -0
  75. package/lib/module/generated/breez_sdk_common.js.map +1 -0
  76. package/lib/module/generated/breez_sdk_spark-ffi.js +43 -0
  77. package/lib/module/generated/breez_sdk_spark-ffi.js.map +1 -0
  78. package/lib/module/generated/breez_sdk_spark.js +5759 -0
  79. package/lib/module/generated/breez_sdk_spark.js.map +1 -0
  80. package/lib/module/generated/breez_sdk_spark_bindings-ffi.js +43 -0
  81. package/lib/module/generated/breez_sdk_spark_bindings-ffi.js.map +1 -0
  82. package/lib/module/generated/breez_sdk_spark_bindings.js +46 -0
  83. package/lib/module/generated/breez_sdk_spark_bindings.js.map +1 -0
  84. package/lib/module/index.js +44 -0
  85. package/lib/module/index.js.map +1 -0
  86. package/lib/module/package.json +1 -0
  87. package/lib/typescript/commonjs/package.json +1 -0
  88. package/lib/typescript/commonjs/src/NativeBreezSdkSparkReactNative.d.ts +8 -0
  89. package/lib/typescript/commonjs/src/NativeBreezSdkSparkReactNative.d.ts.map +1 -0
  90. package/lib/typescript/module/package.json +1 -0
  91. package/lib/typescript/module/src/NativeBreezSdkSparkReactNative.d.ts +8 -0
  92. package/lib/typescript/module/src/NativeBreezSdkSparkReactNative.d.ts.map +1 -0
  93. package/package.json +189 -0
  94. package/react-native.config.js +12 -0
  95. package/scripts/postinstall.sh +14 -0
  96. package/src/NativeBreezSdkSparkReactNative.ts +10 -0
  97. package/src/generated/breez_sdk_common-ffi.ts +394 -0
  98. package/src/generated/breez_sdk_common.ts +5502 -0
  99. package/src/generated/breez_sdk_spark-ffi.ts +751 -0
  100. package/src/generated/breez_sdk_spark.ts +9179 -0
  101. package/src/generated/breez_sdk_spark_bindings-ffi.ts +185 -0
  102. package/src/generated/breez_sdk_spark_bindings.ts +103 -0
  103. package/src/index.tsx +42 -0
@@ -0,0 +1,3834 @@
1
+ // This file was autogenerated by some hot garbage in the
2
+ // `uniffi-bindgen-react-native` crate. Trust me, you don't want to mess with
3
+ // it!
4
+ #include "breez_sdk_common.hpp"
5
+
6
+ #include "UniffiJsiTypes.h"
7
+ #include <iostream>
8
+ #include <map>
9
+ #include <stdexcept>
10
+ #include <thread>
11
+ #include <utility>
12
+
13
+ namespace react = facebook::react;
14
+ namespace jsi = facebook::jsi;
15
+
16
+ // Calling into Rust.
17
+ extern "C" {
18
+ typedef void (*UniffiRustFutureContinuationCallback)(uint64_t data,
19
+ int8_t poll_result);
20
+ typedef void (*UniffiForeignFutureFree)(uint64_t handle);
21
+ typedef void (*UniffiCallbackInterfaceFree)(uint64_t handle);
22
+ typedef struct UniffiForeignFuture {
23
+ uint64_t handle;
24
+ UniffiForeignFutureFree free;
25
+ } UniffiForeignFuture;
26
+ typedef struct UniffiForeignFutureStructU8 {
27
+ uint8_t return_value;
28
+ RustCallStatus call_status;
29
+ } UniffiForeignFutureStructU8;
30
+ typedef void (*UniffiForeignFutureCompleteU8)(
31
+ uint64_t callback_data, UniffiForeignFutureStructU8 result);
32
+ typedef struct UniffiForeignFutureStructI8 {
33
+ int8_t return_value;
34
+ RustCallStatus call_status;
35
+ } UniffiForeignFutureStructI8;
36
+ typedef void (*UniffiForeignFutureCompleteI8)(
37
+ uint64_t callback_data, UniffiForeignFutureStructI8 result);
38
+ typedef struct UniffiForeignFutureStructU16 {
39
+ uint16_t return_value;
40
+ RustCallStatus call_status;
41
+ } UniffiForeignFutureStructU16;
42
+ typedef void (*UniffiForeignFutureCompleteU16)(
43
+ uint64_t callback_data, UniffiForeignFutureStructU16 result);
44
+ typedef struct UniffiForeignFutureStructI16 {
45
+ int16_t return_value;
46
+ RustCallStatus call_status;
47
+ } UniffiForeignFutureStructI16;
48
+ typedef void (*UniffiForeignFutureCompleteI16)(
49
+ uint64_t callback_data, UniffiForeignFutureStructI16 result);
50
+ typedef struct UniffiForeignFutureStructU32 {
51
+ uint32_t return_value;
52
+ RustCallStatus call_status;
53
+ } UniffiForeignFutureStructU32;
54
+ typedef void (*UniffiForeignFutureCompleteU32)(
55
+ uint64_t callback_data, UniffiForeignFutureStructU32 result);
56
+ typedef struct UniffiForeignFutureStructI32 {
57
+ int32_t return_value;
58
+ RustCallStatus call_status;
59
+ } UniffiForeignFutureStructI32;
60
+ typedef void (*UniffiForeignFutureCompleteI32)(
61
+ uint64_t callback_data, UniffiForeignFutureStructI32 result);
62
+ typedef struct UniffiForeignFutureStructU64 {
63
+ uint64_t return_value;
64
+ RustCallStatus call_status;
65
+ } UniffiForeignFutureStructU64;
66
+ typedef void (*UniffiForeignFutureCompleteU64)(
67
+ uint64_t callback_data, UniffiForeignFutureStructU64 result);
68
+ typedef struct UniffiForeignFutureStructI64 {
69
+ int64_t return_value;
70
+ RustCallStatus call_status;
71
+ } UniffiForeignFutureStructI64;
72
+ typedef void (*UniffiForeignFutureCompleteI64)(
73
+ uint64_t callback_data, UniffiForeignFutureStructI64 result);
74
+ typedef struct UniffiForeignFutureStructF32 {
75
+ float return_value;
76
+ RustCallStatus call_status;
77
+ } UniffiForeignFutureStructF32;
78
+ typedef void (*UniffiForeignFutureCompleteF32)(
79
+ uint64_t callback_data, UniffiForeignFutureStructF32 result);
80
+ typedef struct UniffiForeignFutureStructF64 {
81
+ double return_value;
82
+ RustCallStatus call_status;
83
+ } UniffiForeignFutureStructF64;
84
+ typedef void (*UniffiForeignFutureCompleteF64)(
85
+ uint64_t callback_data, UniffiForeignFutureStructF64 result);
86
+ typedef struct UniffiForeignFutureStructPointer {
87
+ void *return_value;
88
+ RustCallStatus call_status;
89
+ } UniffiForeignFutureStructPointer;
90
+ typedef void (*UniffiForeignFutureCompletePointer)(
91
+ uint64_t callback_data, UniffiForeignFutureStructPointer result);
92
+ typedef struct UniffiForeignFutureStructRustBuffer {
93
+ RustBuffer return_value;
94
+ RustCallStatus call_status;
95
+ } UniffiForeignFutureStructRustBuffer;
96
+ typedef void (*UniffiForeignFutureCompleteRustBuffer)(
97
+ uint64_t callback_data, UniffiForeignFutureStructRustBuffer result);
98
+ typedef struct UniffiForeignFutureStructVoid {
99
+ RustCallStatus call_status;
100
+ } UniffiForeignFutureStructVoid;
101
+ typedef void (*UniffiForeignFutureCompleteVoid)(
102
+ uint64_t callback_data, UniffiForeignFutureStructVoid result);
103
+ typedef void (*UniffiCallbackInterfaceRestClientMethod0)(
104
+ uint64_t uniffi_handle, RustBuffer url, RustBuffer headers,
105
+ UniffiForeignFutureCompleteRustBuffer uniffi_future_callback,
106
+ uint64_t uniffi_callback_data, UniffiForeignFuture *uniffi_out_return);
107
+ typedef void (*UniffiCallbackInterfaceRestClientMethod1)(
108
+ uint64_t uniffi_handle, RustBuffer url, RustBuffer headers, RustBuffer body,
109
+ UniffiForeignFutureCompleteRustBuffer uniffi_future_callback,
110
+ uint64_t uniffi_callback_data, UniffiForeignFuture *uniffi_out_return);
111
+ typedef void (*UniffiCallbackInterfaceRestClientMethod2)(
112
+ uint64_t uniffi_handle, RustBuffer url, RustBuffer headers, RustBuffer body,
113
+ UniffiForeignFutureCompleteRustBuffer uniffi_future_callback,
114
+ uint64_t uniffi_callback_data, UniffiForeignFuture *uniffi_out_return);
115
+ typedef struct UniffiVTableCallbackInterfaceRestClient {
116
+ UniffiCallbackInterfaceRestClientMethod0 get;
117
+ UniffiCallbackInterfaceRestClientMethod1 post;
118
+ UniffiCallbackInterfaceRestClientMethod2 delete;
119
+ UniffiCallbackInterfaceFree uniffi_free;
120
+ } UniffiVTableCallbackInterfaceRestClient;
121
+ void *
122
+ uniffi_breez_sdk_common_fn_clone_restclient(void *ptr,
123
+ RustCallStatus *uniffi_out_err);
124
+ void uniffi_breez_sdk_common_fn_free_restclient(void *ptr,
125
+ RustCallStatus *uniffi_out_err);
126
+ void uniffi_breez_sdk_common_fn_init_callback_vtable_restclient(
127
+ UniffiVTableCallbackInterfaceRestClient *vtable);
128
+ /*handle*/ uint64_t
129
+ uniffi_breez_sdk_common_fn_method_restclient_get(void *ptr, RustBuffer url,
130
+ RustBuffer headers);
131
+ /*handle*/ uint64_t uniffi_breez_sdk_common_fn_method_restclient_post(
132
+ void *ptr, RustBuffer url, RustBuffer headers, RustBuffer body);
133
+ /*handle*/ uint64_t uniffi_breez_sdk_common_fn_method_restclient_delete(
134
+ void *ptr, RustBuffer url, RustBuffer headers, RustBuffer body);
135
+ RustBuffer
136
+ ffi_breez_sdk_common_rustbuffer_alloc(uint64_t size,
137
+ RustCallStatus *uniffi_out_err);
138
+ RustBuffer
139
+ ffi_breez_sdk_common_rustbuffer_from_bytes(ForeignBytes bytes,
140
+ RustCallStatus *uniffi_out_err);
141
+ void ffi_breez_sdk_common_rustbuffer_free(RustBuffer buf,
142
+ RustCallStatus *uniffi_out_err);
143
+ RustBuffer
144
+ ffi_breez_sdk_common_rustbuffer_reserve(RustBuffer buf, uint64_t additional,
145
+ RustCallStatus *uniffi_out_err);
146
+ void ffi_breez_sdk_common_rust_future_poll_u8(
147
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
148
+ /*handle*/ uint64_t callback_data);
149
+ void ffi_breez_sdk_common_rust_future_cancel_u8(
150
+ /*handle*/ uint64_t handle);
151
+ void ffi_breez_sdk_common_rust_future_free_u8(
152
+ /*handle*/ uint64_t handle);
153
+ uint8_t ffi_breez_sdk_common_rust_future_complete_u8(
154
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
155
+ void ffi_breez_sdk_common_rust_future_poll_i8(
156
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
157
+ /*handle*/ uint64_t callback_data);
158
+ void ffi_breez_sdk_common_rust_future_cancel_i8(
159
+ /*handle*/ uint64_t handle);
160
+ void ffi_breez_sdk_common_rust_future_free_i8(
161
+ /*handle*/ uint64_t handle);
162
+ int8_t ffi_breez_sdk_common_rust_future_complete_i8(
163
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
164
+ void ffi_breez_sdk_common_rust_future_poll_u16(
165
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
166
+ /*handle*/ uint64_t callback_data);
167
+ void ffi_breez_sdk_common_rust_future_cancel_u16(
168
+ /*handle*/ uint64_t handle);
169
+ void ffi_breez_sdk_common_rust_future_free_u16(
170
+ /*handle*/ uint64_t handle);
171
+ uint16_t ffi_breez_sdk_common_rust_future_complete_u16(
172
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
173
+ void ffi_breez_sdk_common_rust_future_poll_i16(
174
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
175
+ /*handle*/ uint64_t callback_data);
176
+ void ffi_breez_sdk_common_rust_future_cancel_i16(
177
+ /*handle*/ uint64_t handle);
178
+ void ffi_breez_sdk_common_rust_future_free_i16(
179
+ /*handle*/ uint64_t handle);
180
+ int16_t ffi_breez_sdk_common_rust_future_complete_i16(
181
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
182
+ void ffi_breez_sdk_common_rust_future_poll_u32(
183
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
184
+ /*handle*/ uint64_t callback_data);
185
+ void ffi_breez_sdk_common_rust_future_cancel_u32(
186
+ /*handle*/ uint64_t handle);
187
+ void ffi_breez_sdk_common_rust_future_free_u32(
188
+ /*handle*/ uint64_t handle);
189
+ uint32_t ffi_breez_sdk_common_rust_future_complete_u32(
190
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
191
+ void ffi_breez_sdk_common_rust_future_poll_i32(
192
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
193
+ /*handle*/ uint64_t callback_data);
194
+ void ffi_breez_sdk_common_rust_future_cancel_i32(
195
+ /*handle*/ uint64_t handle);
196
+ void ffi_breez_sdk_common_rust_future_free_i32(
197
+ /*handle*/ uint64_t handle);
198
+ int32_t ffi_breez_sdk_common_rust_future_complete_i32(
199
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
200
+ void ffi_breez_sdk_common_rust_future_poll_u64(
201
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
202
+ /*handle*/ uint64_t callback_data);
203
+ void ffi_breez_sdk_common_rust_future_cancel_u64(
204
+ /*handle*/ uint64_t handle);
205
+ void ffi_breez_sdk_common_rust_future_free_u64(
206
+ /*handle*/ uint64_t handle);
207
+ uint64_t ffi_breez_sdk_common_rust_future_complete_u64(
208
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
209
+ void ffi_breez_sdk_common_rust_future_poll_i64(
210
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
211
+ /*handle*/ uint64_t callback_data);
212
+ void ffi_breez_sdk_common_rust_future_cancel_i64(
213
+ /*handle*/ uint64_t handle);
214
+ void ffi_breez_sdk_common_rust_future_free_i64(
215
+ /*handle*/ uint64_t handle);
216
+ int64_t ffi_breez_sdk_common_rust_future_complete_i64(
217
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
218
+ void ffi_breez_sdk_common_rust_future_poll_f32(
219
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
220
+ /*handle*/ uint64_t callback_data);
221
+ void ffi_breez_sdk_common_rust_future_cancel_f32(
222
+ /*handle*/ uint64_t handle);
223
+ void ffi_breez_sdk_common_rust_future_free_f32(
224
+ /*handle*/ uint64_t handle);
225
+ float ffi_breez_sdk_common_rust_future_complete_f32(
226
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
227
+ void ffi_breez_sdk_common_rust_future_poll_f64(
228
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
229
+ /*handle*/ uint64_t callback_data);
230
+ void ffi_breez_sdk_common_rust_future_cancel_f64(
231
+ /*handle*/ uint64_t handle);
232
+ void ffi_breez_sdk_common_rust_future_free_f64(
233
+ /*handle*/ uint64_t handle);
234
+ double ffi_breez_sdk_common_rust_future_complete_f64(
235
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
236
+ void ffi_breez_sdk_common_rust_future_poll_pointer(
237
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
238
+ /*handle*/ uint64_t callback_data);
239
+ void ffi_breez_sdk_common_rust_future_cancel_pointer(
240
+ /*handle*/ uint64_t handle);
241
+ void ffi_breez_sdk_common_rust_future_free_pointer(
242
+ /*handle*/ uint64_t handle);
243
+ void *ffi_breez_sdk_common_rust_future_complete_pointer(
244
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
245
+ void ffi_breez_sdk_common_rust_future_poll_rust_buffer(
246
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
247
+ /*handle*/ uint64_t callback_data);
248
+ void ffi_breez_sdk_common_rust_future_cancel_rust_buffer(
249
+ /*handle*/ uint64_t handle);
250
+ void ffi_breez_sdk_common_rust_future_free_rust_buffer(
251
+ /*handle*/ uint64_t handle);
252
+ RustBuffer ffi_breez_sdk_common_rust_future_complete_rust_buffer(
253
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
254
+ void ffi_breez_sdk_common_rust_future_poll_void(
255
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
256
+ /*handle*/ uint64_t callback_data);
257
+ void ffi_breez_sdk_common_rust_future_cancel_void(
258
+ /*handle*/ uint64_t handle);
259
+ void ffi_breez_sdk_common_rust_future_free_void(
260
+ /*handle*/ uint64_t handle);
261
+ void ffi_breez_sdk_common_rust_future_complete_void(
262
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
263
+ uint16_t uniffi_breez_sdk_common_checksum_method_restclient_get();
264
+ uint16_t uniffi_breez_sdk_common_checksum_method_restclient_post();
265
+ uint16_t uniffi_breez_sdk_common_checksum_method_restclient_delete();
266
+ uint32_t ffi_breez_sdk_common_uniffi_contract_version();
267
+ }
268
+
269
+ namespace uniffi::breez_sdk_common {
270
+ template <typename T> struct Bridging;
271
+
272
+ using namespace facebook;
273
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
274
+
275
+ template <typename T> struct Bridging<ReferenceHolder<T>> {
276
+ static jsi::Value jsNew(jsi::Runtime &rt) {
277
+ auto holder = jsi::Object(rt);
278
+ return holder;
279
+ }
280
+ static T fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
281
+ const jsi::Value &value) {
282
+ auto obj = value.asObject(rt);
283
+ if (obj.hasProperty(rt, "pointee")) {
284
+ auto pointee = obj.getProperty(rt, "pointee");
285
+ return uniffi::breez_sdk_common::Bridging<T>::fromJs(rt, callInvoker,
286
+ pointee);
287
+ }
288
+ throw jsi::JSError(rt,
289
+ "Expected ReferenceHolder to have a pointee property. "
290
+ "This is likely a bug in uniffi-bindgen-react-native");
291
+ }
292
+ };
293
+ } // namespace uniffi::breez_sdk_common
294
+ namespace uniffi::breez_sdk_common {
295
+ using namespace facebook;
296
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
297
+
298
+ template <> struct Bridging<RustBuffer> {
299
+ static RustBuffer rustbuffer_alloc(int32_t size) {
300
+ RustCallStatus status = {UNIFFI_CALL_STATUS_OK};
301
+ return ffi_breez_sdk_common_rustbuffer_alloc(size, &status);
302
+ }
303
+
304
+ static void rustbuffer_free(RustBuffer buf) {
305
+ RustCallStatus status = {UNIFFI_CALL_STATUS_OK};
306
+ ffi_breez_sdk_common_rustbuffer_free(buf, &status);
307
+ }
308
+
309
+ static RustBuffer rustbuffer_from_bytes(ForeignBytes bytes) {
310
+ RustCallStatus status = {UNIFFI_CALL_STATUS_OK};
311
+ return ffi_breez_sdk_common_rustbuffer_from_bytes(bytes, &status);
312
+ }
313
+
314
+ static RustBuffer fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker>,
315
+ const jsi::Value &value) {
316
+ try {
317
+ auto buffer =
318
+ uniffi_jsi::Bridging<jsi::ArrayBuffer>::value_to_arraybuffer(rt,
319
+ value);
320
+ auto bytes = ForeignBytes{
321
+ .len = static_cast<int32_t>(buffer.length(rt)),
322
+ .data = buffer.data(rt),
323
+ };
324
+
325
+ // This buffer is constructed from foreign bytes. Rust scaffolding copies
326
+ // the bytes, to make the RustBuffer.
327
+ auto buf = rustbuffer_from_bytes(bytes);
328
+ // Once it leaves this function, the buffer is immediately passed back
329
+ // into Rust, where it's used to deserialize into the Rust versions of the
330
+ // arguments. At that point, the copy is destroyed.
331
+ return buf;
332
+ } catch (const std::logic_error &e) {
333
+ throw jsi::JSError(rt, e.what());
334
+ }
335
+ }
336
+
337
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker>,
338
+ RustBuffer buf) {
339
+ // We need to make a copy of the bytes from Rust's memory space into
340
+ // Javascripts memory space. We need to do this because the two languages
341
+ // manages memory very differently: a garbage collector needs to track all
342
+ // the memory at runtime, Rust is doing it all closer to compile time.
343
+ uint8_t *bytes = new uint8_t[buf.len];
344
+ std::memcpy(bytes, buf.data, buf.len);
345
+
346
+ // Construct an ArrayBuffer with copy of the bytes from the RustBuffer.
347
+ auto payload = std::make_shared<uniffi_jsi::CMutableBuffer>(
348
+ uniffi_jsi::CMutableBuffer((uint8_t *)bytes, buf.len));
349
+ auto arrayBuffer = jsi::ArrayBuffer(rt, payload);
350
+
351
+ // Once we have a Javascript version, we no longer need the Rust version, so
352
+ // we can call into Rust to tell it it's okay to free that memory.
353
+ rustbuffer_free(buf);
354
+
355
+ // Finally, return the ArrayBuffer.
356
+ return uniffi_jsi::Bridging<jsi::ArrayBuffer>::arraybuffer_to_value(
357
+ rt, arrayBuffer);
358
+ ;
359
+ }
360
+ };
361
+
362
+ } // namespace uniffi::breez_sdk_common
363
+
364
+ namespace uniffi::breez_sdk_common {
365
+ using namespace facebook;
366
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
367
+
368
+ template <> struct Bridging<RustCallStatus> {
369
+ static jsi::Value jsSuccess(jsi::Runtime &rt) {
370
+ auto statusObject = jsi::Object(rt);
371
+ statusObject.setProperty(rt, "code", jsi::Value(rt, UNIFFI_CALL_STATUS_OK));
372
+ return statusObject;
373
+ }
374
+ static RustCallStatus rustSuccess(jsi::Runtime &rt) {
375
+ return {UNIFFI_CALL_STATUS_OK};
376
+ }
377
+ static void copyIntoJs(jsi::Runtime &rt,
378
+ std::shared_ptr<CallInvoker> callInvoker,
379
+ const RustCallStatus status,
380
+ const jsi::Value &jsStatus) {
381
+ auto statusObject = jsStatus.asObject(rt);
382
+ if (status.error_buf.data != nullptr) {
383
+ auto rbuf = Bridging<RustBuffer>::toJs(rt, callInvoker, status.error_buf);
384
+ statusObject.setProperty(rt, "errorBuf", rbuf);
385
+ }
386
+ if (status.code != UNIFFI_CALL_STATUS_OK) {
387
+ auto code =
388
+ uniffi_jsi::Bridging<uint8_t>::toJs(rt, callInvoker, status.code);
389
+ statusObject.setProperty(rt, "code", code);
390
+ }
391
+ }
392
+
393
+ static RustCallStatus fromJs(jsi::Runtime &rt,
394
+ std::shared_ptr<CallInvoker> invoker,
395
+ const jsi::Value &jsStatus) {
396
+ RustCallStatus status;
397
+ auto statusObject = jsStatus.asObject(rt);
398
+ if (statusObject.hasProperty(rt, "errorBuf")) {
399
+ auto rbuf = statusObject.getProperty(rt, "errorBuf");
400
+ status.error_buf = Bridging<RustBuffer>::fromJs(rt, invoker, rbuf);
401
+ }
402
+ if (statusObject.hasProperty(rt, "code")) {
403
+ auto code = statusObject.getProperty(rt, "code");
404
+ status.code = uniffi_jsi::Bridging<uint8_t>::fromJs(rt, invoker, code);
405
+ }
406
+ return status;
407
+ }
408
+
409
+ static void copyFromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> invoker,
410
+ const jsi::Value &jsStatus, RustCallStatus *status) {
411
+ auto statusObject = jsStatus.asObject(rt);
412
+ if (statusObject.hasProperty(rt, "errorBuf")) {
413
+ auto rbuf = statusObject.getProperty(rt, "errorBuf");
414
+ status->error_buf = Bridging<RustBuffer>::fromJs(rt, invoker, rbuf);
415
+ }
416
+ if (statusObject.hasProperty(rt, "code")) {
417
+ auto code = statusObject.getProperty(rt, "code");
418
+ status->code = uniffi_jsi::Bridging<uint8_t>::fromJs(rt, invoker, code);
419
+ }
420
+ }
421
+ };
422
+
423
+ } // namespace uniffi::breez_sdk_common
424
+ // In other uniffi bindings, it is assumed that the foreign language holds on
425
+ // to the vtable, which the Rust just gets a pointer to.
426
+ // Here, we need to hold on to them, but also be able to clear them at just the
427
+ // right time so we can support hot-reloading.
428
+ namespace uniffi::breez_sdk_common::registry {
429
+ template <typename T> class VTableHolder {
430
+ public:
431
+ T vtable;
432
+ VTableHolder(T v) : vtable(v) {}
433
+ };
434
+
435
+ // Mutex to bind the storage and setting of vtable together.
436
+ // We declare it here, but the lock is taken by callers of the putTable
437
+ // method who are also sending a pointer to Rust.
438
+ static std::mutex vtableMutex;
439
+
440
+ // Registry to hold all vtables so they persist even when JS objects are GC'd.
441
+ // The only reason this exists is to prevent a dangling pointer in the
442
+ // Rust machinery: i.e. we don't need to access or write to this registry
443
+ // after startup.
444
+ // Registry to hold all vtables so they persist even when JS objects are GC'd.
445
+ // Maps string identifiers to vtable holders using type erasure
446
+ static std::unordered_map<std::string, std::shared_ptr<void>> vtableRegistry;
447
+
448
+ // Add a vtable to the registry with an identifier
449
+ template <typename T>
450
+ static T *putTable(std::string_view identifier, T vtable) {
451
+ auto holder = std::make_shared<VTableHolder<T>>(vtable);
452
+ // Store the raw pointer to the vtable before type erasure
453
+ T *rawPtr = &(holder->vtable);
454
+ // Store the holder using type erasure with the string identifier
455
+ vtableRegistry[std::string(identifier)] = std::shared_ptr<void>(holder);
456
+ return rawPtr;
457
+ }
458
+
459
+ // Clear the registry.
460
+ //
461
+ // Conceptually, this is called after teardown of the module (i.e. after
462
+ // teardown of the jsi::Runtime). However, because Rust is dropping callbacks
463
+ // because the Runtime is being torn down, we must keep the registry intact
464
+ // until after the runtime goes away.
465
+ //
466
+ // Therefore, in practice we should call this when the next runtime is
467
+ // being stood up.
468
+ static void clearRegistry() {
469
+ std::lock_guard<std::mutex> lock(vtableMutex);
470
+ vtableRegistry.clear();
471
+ }
472
+ } // namespace uniffi::breez_sdk_common::registry
473
+
474
+ // This calls into Rust.
475
+ // Implementation of callback function calling from Rust to JS
476
+ // RustFutureContinuationCallback
477
+
478
+ // Callback function:
479
+ // uniffi::breez_sdk_common::cb::rustfuturecontinuationcallback::UniffiRustFutureContinuationCallback
480
+ //
481
+ // We have the following constraints:
482
+ // - we need to pass a function pointer to Rust.
483
+ // - we need a jsi::Runtime and jsi::Function to call into JS.
484
+ // - function pointers can't store state, so we can't use a lamda.
485
+ //
486
+ // For this, we store a lambda as a global, as `rsLambda`. The `callback`
487
+ // function calls the lambda, which itself calls the `body` which then calls
488
+ // into JS.
489
+ //
490
+ // We then give the `callback` function pointer to Rust which will call the
491
+ // lambda sometime in the future.
492
+ namespace uniffi::breez_sdk_common::cb::rustfuturecontinuationcallback {
493
+ using namespace facebook;
494
+
495
+ // We need to store a lambda in a global so we can call it from
496
+ // a function pointer. The function pointer is passed to Rust.
497
+ static std::function<void(uint64_t, int8_t)> rsLambda = nullptr;
498
+
499
+ // This is the main body of the callback. It's called from the lambda,
500
+ // which itself is called from the callback function which is passed to Rust.
501
+ static void body(jsi::Runtime &rt,
502
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
503
+ std::shared_ptr<jsi::Value> callbackValue, uint64_t rs_data,
504
+ int8_t rs_pollResult) {
505
+
506
+ // Convert the arguments from Rust, into jsi::Values.
507
+ // We'll use the Bridging class to do this…
508
+ auto js_data = uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_data);
509
+ auto js_pollResult =
510
+ uniffi_jsi::Bridging<int8_t>::toJs(rt, callInvoker, rs_pollResult);
511
+
512
+ // Now we are ready to call the callback.
513
+ // We are already on the JS thread, because this `body` function was
514
+ // invoked from the CallInvoker.
515
+ try {
516
+ // Getting the callback function
517
+ auto cb = callbackValue->asObject(rt).asFunction(rt);
518
+ auto uniffiResult = cb.call(rt, js_data, js_pollResult);
519
+
520
+ } catch (const jsi::JSError &error) {
521
+ std::cout << "Error in callback UniffiRustFutureContinuationCallback: "
522
+ << error.what() << std::endl;
523
+ throw error;
524
+ }
525
+ }
526
+
527
+ static void callback(uint64_t rs_data, int8_t rs_pollResult) {
528
+ // If the runtime has shutdown, then there is no point in trying to
529
+ // call into Javascript. BUT how do we tell if the runtime has shutdown?
530
+ //
531
+ // Answer: the module destructor calls into callback `cleanup` method,
532
+ // which nulls out the rsLamda.
533
+ //
534
+ // If rsLamda is null, then there is no runtime to call into.
535
+ if (rsLambda == nullptr) {
536
+ // This only occurs when destructors are calling into Rust free/drop,
537
+ // which causes the JS callback to be dropped.
538
+ return;
539
+ }
540
+
541
+ // The runtime, the actual callback jsi::funtion, and the callInvoker
542
+ // are all in the lambda.
543
+ rsLambda(rs_data, rs_pollResult);
544
+ }
545
+
546
+ static UniffiRustFutureContinuationCallback
547
+ makeCallbackFunction( // uniffi::breez_sdk_common::cb::rustfuturecontinuationcallback
548
+ jsi::Runtime &rt,
549
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
550
+ const jsi::Value &value) {
551
+ if (rsLambda != nullptr) {
552
+ // `makeCallbackFunction` is called in two circumstances:
553
+ //
554
+ // 1. at startup, when initializing callback interface vtables.
555
+ // 2. when polling futures. This happens at least once per future that is
556
+ // exposed to Javascript. We know that this is always the same function,
557
+ // `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
558
+ //
559
+ // We can therefore return the callback function without making anything
560
+ // new if we've been initialized already.
561
+ return callback;
562
+ }
563
+ auto callbackFunction = value.asObject(rt).asFunction(rt);
564
+ auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
565
+ rsLambda = [&rt, callInvoker, callbackValue](uint64_t rs_data,
566
+ int8_t rs_pollResult) {
567
+ // We immediately make a lambda which will do the work of transforming the
568
+ // arguments into JSI values and calling the callback.
569
+ uniffi_runtime::UniffiCallFunc jsLambda =
570
+ [callInvoker, callbackValue, rs_data,
571
+ rs_pollResult](jsi::Runtime &rt) mutable {
572
+ body(rt, callInvoker, callbackValue, rs_data, rs_pollResult);
573
+ };
574
+ // We'll then call that lambda from the callInvoker which will
575
+ // look after calling it on the correct thread.
576
+
577
+ callInvoker->invokeNonBlocking(rt, jsLambda);
578
+ };
579
+ return callback;
580
+ }
581
+
582
+ // This method is called from the destructor of NativeBreezSdkCommon, which only
583
+ // happens when the jsi::Runtime is being destroyed.
584
+ static void cleanup() {
585
+ // The lambda holds a reference to the the Runtime, so when this is nulled
586
+ // out, then the pointer will no longer be left dangling.
587
+ rsLambda = nullptr;
588
+ }
589
+ } // namespace uniffi::breez_sdk_common::cb::rustfuturecontinuationcallback
590
+ // Implementation of callback function calling from JS to Rust
591
+ // ForeignFutureFree, passed from Rust to JS as part of async callbacks.
592
+ namespace uniffi::breez_sdk_common {
593
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
594
+
595
+ template <> struct Bridging<UniffiForeignFutureFree> {
596
+ static jsi::Value toJs(jsi::Runtime &rt,
597
+ std::shared_ptr<CallInvoker> callInvoker,
598
+ UniffiForeignFutureFree rsCallback) {
599
+ return jsi::Function::createFromHostFunction(
600
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureFree"), 1,
601
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
602
+ const jsi::Value *arguments,
603
+ size_t count) -> jsi::Value {
604
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
605
+ rsCallback);
606
+ });
607
+ }
608
+
609
+ static jsi::Value intoRust(jsi::Runtime &rt,
610
+ std::shared_ptr<CallInvoker> callInvoker,
611
+ const jsi::Value &thisValue,
612
+ const jsi::Value *args, size_t count,
613
+ UniffiForeignFutureFree func) {
614
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
615
+ // then call the rs_callback with those arguments.
616
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]));
617
+
618
+ return jsi::Value::undefined();
619
+ }
620
+ };
621
+ } // namespace uniffi::breez_sdk_common
622
+ // Implementation of free callback function CallbackInterfaceFree
623
+
624
+ // Callback function:
625
+ // uniffi::breez_sdk_common::st::foreignfuture::foreignfuture::free::UniffiCallbackInterfaceFree
626
+ //
627
+ // We have the following constraints:
628
+ // - we need to pass a function pointer to Rust.
629
+ // - we need a jsi::Runtime and jsi::Function to call into JS.
630
+ // - function pointers can't store state, so we can't use a lamda.
631
+ //
632
+ // For this, we store a lambda as a global, as `rsLambda`. The `callback`
633
+ // function calls the lambda, which itself calls the `body` which then calls
634
+ // into JS.
635
+ //
636
+ // We then give the `callback` function pointer to Rust which will call the
637
+ // lambda sometime in the future.
638
+ namespace uniffi::breez_sdk_common::st::foreignfuture::foreignfuture::free {
639
+ using namespace facebook;
640
+
641
+ // We need to store a lambda in a global so we can call it from
642
+ // a function pointer. The function pointer is passed to Rust.
643
+ static std::function<void(uint64_t)> rsLambda = nullptr;
644
+
645
+ // This is the main body of the callback. It's called from the lambda,
646
+ // which itself is called from the callback function which is passed to Rust.
647
+ static void body(jsi::Runtime &rt,
648
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
649
+ std::shared_ptr<jsi::Value> callbackValue,
650
+ uint64_t rs_handle) {
651
+
652
+ // Convert the arguments from Rust, into jsi::Values.
653
+ // We'll use the Bridging class to do this…
654
+ auto js_handle =
655
+ uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_handle);
656
+
657
+ // Now we are ready to call the callback.
658
+ // We are already on the JS thread, because this `body` function was
659
+ // invoked from the CallInvoker.
660
+ try {
661
+ // Getting the callback function
662
+ auto cb = callbackValue->asObject(rt).asFunction(rt);
663
+ auto uniffiResult = cb.call(rt, js_handle);
664
+
665
+ } catch (const jsi::JSError &error) {
666
+ std::cout << "Error in callback UniffiCallbackInterfaceFree: "
667
+ << error.what() << std::endl;
668
+ throw error;
669
+ }
670
+ }
671
+
672
+ static void callback(uint64_t rs_handle) {
673
+ // If the runtime has shutdown, then there is no point in trying to
674
+ // call into Javascript. BUT how do we tell if the runtime has shutdown?
675
+ //
676
+ // Answer: the module destructor calls into callback `cleanup` method,
677
+ // which nulls out the rsLamda.
678
+ //
679
+ // If rsLamda is null, then there is no runtime to call into.
680
+ if (rsLambda == nullptr) {
681
+ // This only occurs when destructors are calling into Rust free/drop,
682
+ // which causes the JS callback to be dropped.
683
+ return;
684
+ }
685
+
686
+ // The runtime, the actual callback jsi::funtion, and the callInvoker
687
+ // are all in the lambda.
688
+ rsLambda(rs_handle);
689
+ }
690
+
691
+ static UniffiCallbackInterfaceFree
692
+ makeCallbackFunction( // uniffi::breez_sdk_common::st::foreignfuture::foreignfuture::free
693
+ jsi::Runtime &rt,
694
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
695
+ const jsi::Value &value) {
696
+ if (rsLambda != nullptr) {
697
+ // `makeCallbackFunction` is called in two circumstances:
698
+ //
699
+ // 1. at startup, when initializing callback interface vtables.
700
+ // 2. when polling futures. This happens at least once per future that is
701
+ // exposed to Javascript. We know that this is always the same function,
702
+ // `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
703
+ //
704
+ // We can therefore return the callback function without making anything
705
+ // new if we've been initialized already.
706
+ return callback;
707
+ }
708
+ auto callbackFunction = value.asObject(rt).asFunction(rt);
709
+ auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
710
+ rsLambda = [&rt, callInvoker, callbackValue](uint64_t rs_handle) {
711
+ // We immediately make a lambda which will do the work of transforming the
712
+ // arguments into JSI values and calling the callback.
713
+ uniffi_runtime::UniffiCallFunc jsLambda =
714
+ [callInvoker, callbackValue, rs_handle](jsi::Runtime &rt) mutable {
715
+ body(rt, callInvoker, callbackValue, rs_handle);
716
+ };
717
+ // We'll then call that lambda from the callInvoker which will
718
+ // look after calling it on the correct thread.
719
+
720
+ callInvoker->invokeNonBlocking(rt, jsLambda);
721
+ };
722
+ return callback;
723
+ }
724
+
725
+ // This method is called from the destructor of NativeBreezSdkCommon, which only
726
+ // happens when the jsi::Runtime is being destroyed.
727
+ static void cleanup() {
728
+ // The lambda holds a reference to the the Runtime, so when this is nulled
729
+ // out, then the pointer will no longer be left dangling.
730
+ rsLambda = nullptr;
731
+ }
732
+ } // namespace uniffi::breez_sdk_common::st::foreignfuture::foreignfuture::free
733
+
734
+ // Callback function:
735
+ // uniffi::breez_sdk_common::st::vtablecallbackinterfacerestclient::vtablecallbackinterfacerestclient::free::UniffiCallbackInterfaceFree
736
+ //
737
+ // We have the following constraints:
738
+ // - we need to pass a function pointer to Rust.
739
+ // - we need a jsi::Runtime and jsi::Function to call into JS.
740
+ // - function pointers can't store state, so we can't use a lamda.
741
+ //
742
+ // For this, we store a lambda as a global, as `rsLambda`. The `callback`
743
+ // function calls the lambda, which itself calls the `body` which then calls
744
+ // into JS.
745
+ //
746
+ // We then give the `callback` function pointer to Rust which will call the
747
+ // lambda sometime in the future.
748
+ namespace uniffi::breez_sdk_common::st::vtablecallbackinterfacerestclient::
749
+ vtablecallbackinterfacerestclient::free {
750
+ using namespace facebook;
751
+
752
+ // We need to store a lambda in a global so we can call it from
753
+ // a function pointer. The function pointer is passed to Rust.
754
+ static std::function<void(uint64_t)> rsLambda = nullptr;
755
+
756
+ // This is the main body of the callback. It's called from the lambda,
757
+ // which itself is called from the callback function which is passed to Rust.
758
+ static void body(jsi::Runtime &rt,
759
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
760
+ std::shared_ptr<jsi::Value> callbackValue,
761
+ uint64_t rs_handle) {
762
+
763
+ // Convert the arguments from Rust, into jsi::Values.
764
+ // We'll use the Bridging class to do this…
765
+ auto js_handle =
766
+ uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_handle);
767
+
768
+ // Now we are ready to call the callback.
769
+ // We are already on the JS thread, because this `body` function was
770
+ // invoked from the CallInvoker.
771
+ try {
772
+ // Getting the callback function
773
+ auto cb = callbackValue->asObject(rt).asFunction(rt);
774
+ auto uniffiResult = cb.call(rt, js_handle);
775
+
776
+ } catch (const jsi::JSError &error) {
777
+ std::cout << "Error in callback UniffiCallbackInterfaceFree: "
778
+ << error.what() << std::endl;
779
+ throw error;
780
+ }
781
+ }
782
+
783
+ static void callback(uint64_t rs_handle) {
784
+ // If the runtime has shutdown, then there is no point in trying to
785
+ // call into Javascript. BUT how do we tell if the runtime has shutdown?
786
+ //
787
+ // Answer: the module destructor calls into callback `cleanup` method,
788
+ // which nulls out the rsLamda.
789
+ //
790
+ // If rsLamda is null, then there is no runtime to call into.
791
+ if (rsLambda == nullptr) {
792
+ // This only occurs when destructors are calling into Rust free/drop,
793
+ // which causes the JS callback to be dropped.
794
+ return;
795
+ }
796
+
797
+ // The runtime, the actual callback jsi::funtion, and the callInvoker
798
+ // are all in the lambda.
799
+ rsLambda(rs_handle);
800
+ }
801
+
802
+ static UniffiCallbackInterfaceFree
803
+ makeCallbackFunction( // uniffi::breez_sdk_common::st::vtablecallbackinterfacerestclient::vtablecallbackinterfacerestclient::free
804
+ jsi::Runtime &rt,
805
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
806
+ const jsi::Value &value) {
807
+ if (rsLambda != nullptr) {
808
+ // `makeCallbackFunction` is called in two circumstances:
809
+ //
810
+ // 1. at startup, when initializing callback interface vtables.
811
+ // 2. when polling futures. This happens at least once per future that is
812
+ // exposed to Javascript. We know that this is always the same function,
813
+ // `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
814
+ //
815
+ // We can therefore return the callback function without making anything
816
+ // new if we've been initialized already.
817
+ return callback;
818
+ }
819
+ auto callbackFunction = value.asObject(rt).asFunction(rt);
820
+ auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
821
+ rsLambda = [&rt, callInvoker, callbackValue](uint64_t rs_handle) {
822
+ // We immediately make a lambda which will do the work of transforming the
823
+ // arguments into JSI values and calling the callback.
824
+ uniffi_runtime::UniffiCallFunc jsLambda =
825
+ [callInvoker, callbackValue, rs_handle](jsi::Runtime &rt) mutable {
826
+ body(rt, callInvoker, callbackValue, rs_handle);
827
+ };
828
+ // We'll then call that lambda from the callInvoker which will
829
+ // look after calling it on the correct thread.
830
+
831
+ callInvoker->invokeNonBlocking(rt, jsLambda);
832
+ };
833
+ return callback;
834
+ }
835
+
836
+ // This method is called from the destructor of NativeBreezSdkCommon, which only
837
+ // happens when the jsi::Runtime is being destroyed.
838
+ static void cleanup() {
839
+ // The lambda holds a reference to the the Runtime, so when this is nulled
840
+ // out, then the pointer will no longer be left dangling.
841
+ rsLambda = nullptr;
842
+ }
843
+ } // namespace
844
+ // uniffi::breez_sdk_common::st::vtablecallbackinterfacerestclient::vtablecallbackinterfacerestclient::free
845
+ namespace uniffi::breez_sdk_common {
846
+ using namespace facebook;
847
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
848
+
849
+ template <> struct Bridging<UniffiForeignFuture> {
850
+ static UniffiForeignFuture fromJs(jsi::Runtime &rt,
851
+ std::shared_ptr<CallInvoker> callInvoker,
852
+ const jsi::Value &jsValue) {
853
+ // Check if the input is an object
854
+ if (!jsValue.isObject()) {
855
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFuture");
856
+ }
857
+
858
+ // Get the object from the jsi::Value
859
+ auto jsObject = jsValue.getObject(rt);
860
+
861
+ // Create the vtable struct
862
+ UniffiForeignFuture rsObject;
863
+
864
+ // Create the vtable from the js callbacks.
865
+ rsObject.handle = uniffi_jsi::Bridging<uint64_t>::fromJs(
866
+ rt, callInvoker, jsObject.getProperty(rt, "handle"));
867
+ rsObject.free = uniffi::breez_sdk_common::st::foreignfuture::foreignfuture::
868
+ free::makeCallbackFunction(rt, callInvoker,
869
+ jsObject.getProperty(rt, "free"));
870
+
871
+ return rsObject;
872
+ }
873
+ };
874
+
875
+ } // namespace uniffi::breez_sdk_common
876
+ namespace uniffi::breez_sdk_common {
877
+ using namespace facebook;
878
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
879
+
880
+ template <> struct Bridging<UniffiForeignFutureStructU8> {
881
+ static UniffiForeignFutureStructU8
882
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
883
+ const jsi::Value &jsValue) {
884
+ // Check if the input is an object
885
+ if (!jsValue.isObject()) {
886
+ throw jsi::JSError(rt,
887
+ "Expected an object for UniffiForeignFutureStructU8");
888
+ }
889
+
890
+ // Get the object from the jsi::Value
891
+ auto jsObject = jsValue.getObject(rt);
892
+
893
+ // Create the vtable struct
894
+ UniffiForeignFutureStructU8 rsObject;
895
+
896
+ // Create the vtable from the js callbacks.
897
+ rsObject.return_value = uniffi_jsi::Bridging<uint8_t>::fromJs(
898
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
899
+ rsObject.call_status =
900
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::fromJs(
901
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
902
+
903
+ return rsObject;
904
+ }
905
+ };
906
+
907
+ } // namespace uniffi::breez_sdk_common
908
+ // Implementation of callback function calling from JS to Rust
909
+ // ForeignFutureCompleteU8, passed from Rust to JS as part of async callbacks.
910
+ namespace uniffi::breez_sdk_common {
911
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
912
+
913
+ template <> struct Bridging<UniffiForeignFutureCompleteU8> {
914
+ static jsi::Value toJs(jsi::Runtime &rt,
915
+ std::shared_ptr<CallInvoker> callInvoker,
916
+ UniffiForeignFutureCompleteU8 rsCallback) {
917
+ return jsi::Function::createFromHostFunction(
918
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU8"), 2,
919
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
920
+ const jsi::Value *arguments,
921
+ size_t count) -> jsi::Value {
922
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
923
+ rsCallback);
924
+ });
925
+ }
926
+
927
+ static jsi::Value intoRust(jsi::Runtime &rt,
928
+ std::shared_ptr<CallInvoker> callInvoker,
929
+ const jsi::Value &thisValue,
930
+ const jsi::Value *args, size_t count,
931
+ UniffiForeignFutureCompleteU8 func) {
932
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
933
+ // then call the rs_callback with those arguments.
934
+ func(
935
+ uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
936
+ uniffi::breez_sdk_common::Bridging<UniffiForeignFutureStructU8>::fromJs(
937
+ rt, callInvoker, args[1]));
938
+
939
+ return jsi::Value::undefined();
940
+ }
941
+ };
942
+ } // namespace uniffi::breez_sdk_common
943
+ namespace uniffi::breez_sdk_common {
944
+ using namespace facebook;
945
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
946
+
947
+ template <> struct Bridging<UniffiForeignFutureStructI8> {
948
+ static UniffiForeignFutureStructI8
949
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
950
+ const jsi::Value &jsValue) {
951
+ // Check if the input is an object
952
+ if (!jsValue.isObject()) {
953
+ throw jsi::JSError(rt,
954
+ "Expected an object for UniffiForeignFutureStructI8");
955
+ }
956
+
957
+ // Get the object from the jsi::Value
958
+ auto jsObject = jsValue.getObject(rt);
959
+
960
+ // Create the vtable struct
961
+ UniffiForeignFutureStructI8 rsObject;
962
+
963
+ // Create the vtable from the js callbacks.
964
+ rsObject.return_value = uniffi_jsi::Bridging<int8_t>::fromJs(
965
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
966
+ rsObject.call_status =
967
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::fromJs(
968
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
969
+
970
+ return rsObject;
971
+ }
972
+ };
973
+
974
+ } // namespace uniffi::breez_sdk_common
975
+ // Implementation of callback function calling from JS to Rust
976
+ // ForeignFutureCompleteI8, passed from Rust to JS as part of async callbacks.
977
+ namespace uniffi::breez_sdk_common {
978
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
979
+
980
+ template <> struct Bridging<UniffiForeignFutureCompleteI8> {
981
+ static jsi::Value toJs(jsi::Runtime &rt,
982
+ std::shared_ptr<CallInvoker> callInvoker,
983
+ UniffiForeignFutureCompleteI8 rsCallback) {
984
+ return jsi::Function::createFromHostFunction(
985
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI8"), 2,
986
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
987
+ const jsi::Value *arguments,
988
+ size_t count) -> jsi::Value {
989
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
990
+ rsCallback);
991
+ });
992
+ }
993
+
994
+ static jsi::Value intoRust(jsi::Runtime &rt,
995
+ std::shared_ptr<CallInvoker> callInvoker,
996
+ const jsi::Value &thisValue,
997
+ const jsi::Value *args, size_t count,
998
+ UniffiForeignFutureCompleteI8 func) {
999
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1000
+ // then call the rs_callback with those arguments.
1001
+ func(
1002
+ uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
1003
+ uniffi::breez_sdk_common::Bridging<UniffiForeignFutureStructI8>::fromJs(
1004
+ rt, callInvoker, args[1]));
1005
+
1006
+ return jsi::Value::undefined();
1007
+ }
1008
+ };
1009
+ } // namespace uniffi::breez_sdk_common
1010
+ namespace uniffi::breez_sdk_common {
1011
+ using namespace facebook;
1012
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1013
+
1014
+ template <> struct Bridging<UniffiForeignFutureStructU16> {
1015
+ static UniffiForeignFutureStructU16
1016
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
1017
+ const jsi::Value &jsValue) {
1018
+ // Check if the input is an object
1019
+ if (!jsValue.isObject()) {
1020
+ throw jsi::JSError(rt,
1021
+ "Expected an object for UniffiForeignFutureStructU16");
1022
+ }
1023
+
1024
+ // Get the object from the jsi::Value
1025
+ auto jsObject = jsValue.getObject(rt);
1026
+
1027
+ // Create the vtable struct
1028
+ UniffiForeignFutureStructU16 rsObject;
1029
+
1030
+ // Create the vtable from the js callbacks.
1031
+ rsObject.return_value = uniffi_jsi::Bridging<uint16_t>::fromJs(
1032
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
1033
+ rsObject.call_status =
1034
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::fromJs(
1035
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
1036
+
1037
+ return rsObject;
1038
+ }
1039
+ };
1040
+
1041
+ } // namespace uniffi::breez_sdk_common
1042
+ // Implementation of callback function calling from JS to Rust
1043
+ // ForeignFutureCompleteU16, passed from Rust to JS as part of async
1044
+ // callbacks.
1045
+ namespace uniffi::breez_sdk_common {
1046
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1047
+
1048
+ template <> struct Bridging<UniffiForeignFutureCompleteU16> {
1049
+ static jsi::Value toJs(jsi::Runtime &rt,
1050
+ std::shared_ptr<CallInvoker> callInvoker,
1051
+ UniffiForeignFutureCompleteU16 rsCallback) {
1052
+ return jsi::Function::createFromHostFunction(
1053
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU16"), 2,
1054
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
1055
+ const jsi::Value *arguments,
1056
+ size_t count) -> jsi::Value {
1057
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
1058
+ rsCallback);
1059
+ });
1060
+ }
1061
+
1062
+ static jsi::Value intoRust(jsi::Runtime &rt,
1063
+ std::shared_ptr<CallInvoker> callInvoker,
1064
+ const jsi::Value &thisValue,
1065
+ const jsi::Value *args, size_t count,
1066
+ UniffiForeignFutureCompleteU16 func) {
1067
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1068
+ // then call the rs_callback with those arguments.
1069
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
1070
+ uniffi::breez_sdk_common::Bridging<
1071
+ UniffiForeignFutureStructU16>::fromJs(rt, callInvoker, args[1]));
1072
+
1073
+ return jsi::Value::undefined();
1074
+ }
1075
+ };
1076
+ } // namespace uniffi::breez_sdk_common
1077
+ namespace uniffi::breez_sdk_common {
1078
+ using namespace facebook;
1079
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1080
+
1081
+ template <> struct Bridging<UniffiForeignFutureStructI16> {
1082
+ static UniffiForeignFutureStructI16
1083
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
1084
+ const jsi::Value &jsValue) {
1085
+ // Check if the input is an object
1086
+ if (!jsValue.isObject()) {
1087
+ throw jsi::JSError(rt,
1088
+ "Expected an object for UniffiForeignFutureStructI16");
1089
+ }
1090
+
1091
+ // Get the object from the jsi::Value
1092
+ auto jsObject = jsValue.getObject(rt);
1093
+
1094
+ // Create the vtable struct
1095
+ UniffiForeignFutureStructI16 rsObject;
1096
+
1097
+ // Create the vtable from the js callbacks.
1098
+ rsObject.return_value = uniffi_jsi::Bridging<int16_t>::fromJs(
1099
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
1100
+ rsObject.call_status =
1101
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::fromJs(
1102
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
1103
+
1104
+ return rsObject;
1105
+ }
1106
+ };
1107
+
1108
+ } // namespace uniffi::breez_sdk_common
1109
+ // Implementation of callback function calling from JS to Rust
1110
+ // ForeignFutureCompleteI16, passed from Rust to JS as part of async
1111
+ // callbacks.
1112
+ namespace uniffi::breez_sdk_common {
1113
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1114
+
1115
+ template <> struct Bridging<UniffiForeignFutureCompleteI16> {
1116
+ static jsi::Value toJs(jsi::Runtime &rt,
1117
+ std::shared_ptr<CallInvoker> callInvoker,
1118
+ UniffiForeignFutureCompleteI16 rsCallback) {
1119
+ return jsi::Function::createFromHostFunction(
1120
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI16"), 2,
1121
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
1122
+ const jsi::Value *arguments,
1123
+ size_t count) -> jsi::Value {
1124
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
1125
+ rsCallback);
1126
+ });
1127
+ }
1128
+
1129
+ static jsi::Value intoRust(jsi::Runtime &rt,
1130
+ std::shared_ptr<CallInvoker> callInvoker,
1131
+ const jsi::Value &thisValue,
1132
+ const jsi::Value *args, size_t count,
1133
+ UniffiForeignFutureCompleteI16 func) {
1134
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1135
+ // then call the rs_callback with those arguments.
1136
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
1137
+ uniffi::breez_sdk_common::Bridging<
1138
+ UniffiForeignFutureStructI16>::fromJs(rt, callInvoker, args[1]));
1139
+
1140
+ return jsi::Value::undefined();
1141
+ }
1142
+ };
1143
+ } // namespace uniffi::breez_sdk_common
1144
+ namespace uniffi::breez_sdk_common {
1145
+ using namespace facebook;
1146
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1147
+
1148
+ template <> struct Bridging<UniffiForeignFutureStructU32> {
1149
+ static UniffiForeignFutureStructU32
1150
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
1151
+ const jsi::Value &jsValue) {
1152
+ // Check if the input is an object
1153
+ if (!jsValue.isObject()) {
1154
+ throw jsi::JSError(rt,
1155
+ "Expected an object for UniffiForeignFutureStructU32");
1156
+ }
1157
+
1158
+ // Get the object from the jsi::Value
1159
+ auto jsObject = jsValue.getObject(rt);
1160
+
1161
+ // Create the vtable struct
1162
+ UniffiForeignFutureStructU32 rsObject;
1163
+
1164
+ // Create the vtable from the js callbacks.
1165
+ rsObject.return_value = uniffi_jsi::Bridging<uint32_t>::fromJs(
1166
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
1167
+ rsObject.call_status =
1168
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::fromJs(
1169
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
1170
+
1171
+ return rsObject;
1172
+ }
1173
+ };
1174
+
1175
+ } // namespace uniffi::breez_sdk_common
1176
+ // Implementation of callback function calling from JS to Rust
1177
+ // ForeignFutureCompleteU32, passed from Rust to JS as part of async
1178
+ // callbacks.
1179
+ namespace uniffi::breez_sdk_common {
1180
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1181
+
1182
+ template <> struct Bridging<UniffiForeignFutureCompleteU32> {
1183
+ static jsi::Value toJs(jsi::Runtime &rt,
1184
+ std::shared_ptr<CallInvoker> callInvoker,
1185
+ UniffiForeignFutureCompleteU32 rsCallback) {
1186
+ return jsi::Function::createFromHostFunction(
1187
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU32"), 2,
1188
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
1189
+ const jsi::Value *arguments,
1190
+ size_t count) -> jsi::Value {
1191
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
1192
+ rsCallback);
1193
+ });
1194
+ }
1195
+
1196
+ static jsi::Value intoRust(jsi::Runtime &rt,
1197
+ std::shared_ptr<CallInvoker> callInvoker,
1198
+ const jsi::Value &thisValue,
1199
+ const jsi::Value *args, size_t count,
1200
+ UniffiForeignFutureCompleteU32 func) {
1201
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1202
+ // then call the rs_callback with those arguments.
1203
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
1204
+ uniffi::breez_sdk_common::Bridging<
1205
+ UniffiForeignFutureStructU32>::fromJs(rt, callInvoker, args[1]));
1206
+
1207
+ return jsi::Value::undefined();
1208
+ }
1209
+ };
1210
+ } // namespace uniffi::breez_sdk_common
1211
+ namespace uniffi::breez_sdk_common {
1212
+ using namespace facebook;
1213
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1214
+
1215
+ template <> struct Bridging<UniffiForeignFutureStructI32> {
1216
+ static UniffiForeignFutureStructI32
1217
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
1218
+ const jsi::Value &jsValue) {
1219
+ // Check if the input is an object
1220
+ if (!jsValue.isObject()) {
1221
+ throw jsi::JSError(rt,
1222
+ "Expected an object for UniffiForeignFutureStructI32");
1223
+ }
1224
+
1225
+ // Get the object from the jsi::Value
1226
+ auto jsObject = jsValue.getObject(rt);
1227
+
1228
+ // Create the vtable struct
1229
+ UniffiForeignFutureStructI32 rsObject;
1230
+
1231
+ // Create the vtable from the js callbacks.
1232
+ rsObject.return_value = uniffi_jsi::Bridging<int32_t>::fromJs(
1233
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
1234
+ rsObject.call_status =
1235
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::fromJs(
1236
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
1237
+
1238
+ return rsObject;
1239
+ }
1240
+ };
1241
+
1242
+ } // namespace uniffi::breez_sdk_common
1243
+ // Implementation of callback function calling from JS to Rust
1244
+ // ForeignFutureCompleteI32, passed from Rust to JS as part of async
1245
+ // callbacks.
1246
+ namespace uniffi::breez_sdk_common {
1247
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1248
+
1249
+ template <> struct Bridging<UniffiForeignFutureCompleteI32> {
1250
+ static jsi::Value toJs(jsi::Runtime &rt,
1251
+ std::shared_ptr<CallInvoker> callInvoker,
1252
+ UniffiForeignFutureCompleteI32 rsCallback) {
1253
+ return jsi::Function::createFromHostFunction(
1254
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI32"), 2,
1255
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
1256
+ const jsi::Value *arguments,
1257
+ size_t count) -> jsi::Value {
1258
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
1259
+ rsCallback);
1260
+ });
1261
+ }
1262
+
1263
+ static jsi::Value intoRust(jsi::Runtime &rt,
1264
+ std::shared_ptr<CallInvoker> callInvoker,
1265
+ const jsi::Value &thisValue,
1266
+ const jsi::Value *args, size_t count,
1267
+ UniffiForeignFutureCompleteI32 func) {
1268
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1269
+ // then call the rs_callback with those arguments.
1270
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
1271
+ uniffi::breez_sdk_common::Bridging<
1272
+ UniffiForeignFutureStructI32>::fromJs(rt, callInvoker, args[1]));
1273
+
1274
+ return jsi::Value::undefined();
1275
+ }
1276
+ };
1277
+ } // namespace uniffi::breez_sdk_common
1278
+ namespace uniffi::breez_sdk_common {
1279
+ using namespace facebook;
1280
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1281
+
1282
+ template <> struct Bridging<UniffiForeignFutureStructU64> {
1283
+ static UniffiForeignFutureStructU64
1284
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
1285
+ const jsi::Value &jsValue) {
1286
+ // Check if the input is an object
1287
+ if (!jsValue.isObject()) {
1288
+ throw jsi::JSError(rt,
1289
+ "Expected an object for UniffiForeignFutureStructU64");
1290
+ }
1291
+
1292
+ // Get the object from the jsi::Value
1293
+ auto jsObject = jsValue.getObject(rt);
1294
+
1295
+ // Create the vtable struct
1296
+ UniffiForeignFutureStructU64 rsObject;
1297
+
1298
+ // Create the vtable from the js callbacks.
1299
+ rsObject.return_value = uniffi_jsi::Bridging<uint64_t>::fromJs(
1300
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
1301
+ rsObject.call_status =
1302
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::fromJs(
1303
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
1304
+
1305
+ return rsObject;
1306
+ }
1307
+ };
1308
+
1309
+ } // namespace uniffi::breez_sdk_common
1310
+ // Implementation of callback function calling from JS to Rust
1311
+ // ForeignFutureCompleteU64, passed from Rust to JS as part of async
1312
+ // callbacks.
1313
+ namespace uniffi::breez_sdk_common {
1314
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1315
+
1316
+ template <> struct Bridging<UniffiForeignFutureCompleteU64> {
1317
+ static jsi::Value toJs(jsi::Runtime &rt,
1318
+ std::shared_ptr<CallInvoker> callInvoker,
1319
+ UniffiForeignFutureCompleteU64 rsCallback) {
1320
+ return jsi::Function::createFromHostFunction(
1321
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU64"), 2,
1322
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
1323
+ const jsi::Value *arguments,
1324
+ size_t count) -> jsi::Value {
1325
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
1326
+ rsCallback);
1327
+ });
1328
+ }
1329
+
1330
+ static jsi::Value intoRust(jsi::Runtime &rt,
1331
+ std::shared_ptr<CallInvoker> callInvoker,
1332
+ const jsi::Value &thisValue,
1333
+ const jsi::Value *args, size_t count,
1334
+ UniffiForeignFutureCompleteU64 func) {
1335
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1336
+ // then call the rs_callback with those arguments.
1337
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
1338
+ uniffi::breez_sdk_common::Bridging<
1339
+ UniffiForeignFutureStructU64>::fromJs(rt, callInvoker, args[1]));
1340
+
1341
+ return jsi::Value::undefined();
1342
+ }
1343
+ };
1344
+ } // namespace uniffi::breez_sdk_common
1345
+ namespace uniffi::breez_sdk_common {
1346
+ using namespace facebook;
1347
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1348
+
1349
+ template <> struct Bridging<UniffiForeignFutureStructI64> {
1350
+ static UniffiForeignFutureStructI64
1351
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
1352
+ const jsi::Value &jsValue) {
1353
+ // Check if the input is an object
1354
+ if (!jsValue.isObject()) {
1355
+ throw jsi::JSError(rt,
1356
+ "Expected an object for UniffiForeignFutureStructI64");
1357
+ }
1358
+
1359
+ // Get the object from the jsi::Value
1360
+ auto jsObject = jsValue.getObject(rt);
1361
+
1362
+ // Create the vtable struct
1363
+ UniffiForeignFutureStructI64 rsObject;
1364
+
1365
+ // Create the vtable from the js callbacks.
1366
+ rsObject.return_value = uniffi_jsi::Bridging<int64_t>::fromJs(
1367
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
1368
+ rsObject.call_status =
1369
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::fromJs(
1370
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
1371
+
1372
+ return rsObject;
1373
+ }
1374
+ };
1375
+
1376
+ } // namespace uniffi::breez_sdk_common
1377
+ // Implementation of callback function calling from JS to Rust
1378
+ // ForeignFutureCompleteI64, passed from Rust to JS as part of async
1379
+ // callbacks.
1380
+ namespace uniffi::breez_sdk_common {
1381
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1382
+
1383
+ template <> struct Bridging<UniffiForeignFutureCompleteI64> {
1384
+ static jsi::Value toJs(jsi::Runtime &rt,
1385
+ std::shared_ptr<CallInvoker> callInvoker,
1386
+ UniffiForeignFutureCompleteI64 rsCallback) {
1387
+ return jsi::Function::createFromHostFunction(
1388
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI64"), 2,
1389
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
1390
+ const jsi::Value *arguments,
1391
+ size_t count) -> jsi::Value {
1392
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
1393
+ rsCallback);
1394
+ });
1395
+ }
1396
+
1397
+ static jsi::Value intoRust(jsi::Runtime &rt,
1398
+ std::shared_ptr<CallInvoker> callInvoker,
1399
+ const jsi::Value &thisValue,
1400
+ const jsi::Value *args, size_t count,
1401
+ UniffiForeignFutureCompleteI64 func) {
1402
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1403
+ // then call the rs_callback with those arguments.
1404
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
1405
+ uniffi::breez_sdk_common::Bridging<
1406
+ UniffiForeignFutureStructI64>::fromJs(rt, callInvoker, args[1]));
1407
+
1408
+ return jsi::Value::undefined();
1409
+ }
1410
+ };
1411
+ } // namespace uniffi::breez_sdk_common
1412
+ namespace uniffi::breez_sdk_common {
1413
+ using namespace facebook;
1414
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1415
+
1416
+ template <> struct Bridging<UniffiForeignFutureStructF32> {
1417
+ static UniffiForeignFutureStructF32
1418
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
1419
+ const jsi::Value &jsValue) {
1420
+ // Check if the input is an object
1421
+ if (!jsValue.isObject()) {
1422
+ throw jsi::JSError(rt,
1423
+ "Expected an object for UniffiForeignFutureStructF32");
1424
+ }
1425
+
1426
+ // Get the object from the jsi::Value
1427
+ auto jsObject = jsValue.getObject(rt);
1428
+
1429
+ // Create the vtable struct
1430
+ UniffiForeignFutureStructF32 rsObject;
1431
+
1432
+ // Create the vtable from the js callbacks.
1433
+ rsObject.return_value = uniffi_jsi::Bridging<float>::fromJs(
1434
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
1435
+ rsObject.call_status =
1436
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::fromJs(
1437
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
1438
+
1439
+ return rsObject;
1440
+ }
1441
+ };
1442
+
1443
+ } // namespace uniffi::breez_sdk_common
1444
+ // Implementation of callback function calling from JS to Rust
1445
+ // ForeignFutureCompleteF32, passed from Rust to JS as part of async
1446
+ // callbacks.
1447
+ namespace uniffi::breez_sdk_common {
1448
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1449
+
1450
+ template <> struct Bridging<UniffiForeignFutureCompleteF32> {
1451
+ static jsi::Value toJs(jsi::Runtime &rt,
1452
+ std::shared_ptr<CallInvoker> callInvoker,
1453
+ UniffiForeignFutureCompleteF32 rsCallback) {
1454
+ return jsi::Function::createFromHostFunction(
1455
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteF32"), 2,
1456
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
1457
+ const jsi::Value *arguments,
1458
+ size_t count) -> jsi::Value {
1459
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
1460
+ rsCallback);
1461
+ });
1462
+ }
1463
+
1464
+ static jsi::Value intoRust(jsi::Runtime &rt,
1465
+ std::shared_ptr<CallInvoker> callInvoker,
1466
+ const jsi::Value &thisValue,
1467
+ const jsi::Value *args, size_t count,
1468
+ UniffiForeignFutureCompleteF32 func) {
1469
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1470
+ // then call the rs_callback with those arguments.
1471
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
1472
+ uniffi::breez_sdk_common::Bridging<
1473
+ UniffiForeignFutureStructF32>::fromJs(rt, callInvoker, args[1]));
1474
+
1475
+ return jsi::Value::undefined();
1476
+ }
1477
+ };
1478
+ } // namespace uniffi::breez_sdk_common
1479
+ namespace uniffi::breez_sdk_common {
1480
+ using namespace facebook;
1481
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1482
+
1483
+ template <> struct Bridging<UniffiForeignFutureStructF64> {
1484
+ static UniffiForeignFutureStructF64
1485
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
1486
+ const jsi::Value &jsValue) {
1487
+ // Check if the input is an object
1488
+ if (!jsValue.isObject()) {
1489
+ throw jsi::JSError(rt,
1490
+ "Expected an object for UniffiForeignFutureStructF64");
1491
+ }
1492
+
1493
+ // Get the object from the jsi::Value
1494
+ auto jsObject = jsValue.getObject(rt);
1495
+
1496
+ // Create the vtable struct
1497
+ UniffiForeignFutureStructF64 rsObject;
1498
+
1499
+ // Create the vtable from the js callbacks.
1500
+ rsObject.return_value = uniffi_jsi::Bridging<double>::fromJs(
1501
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
1502
+ rsObject.call_status =
1503
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::fromJs(
1504
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
1505
+
1506
+ return rsObject;
1507
+ }
1508
+ };
1509
+
1510
+ } // namespace uniffi::breez_sdk_common
1511
+ // Implementation of callback function calling from JS to Rust
1512
+ // ForeignFutureCompleteF64, passed from Rust to JS as part of async
1513
+ // callbacks.
1514
+ namespace uniffi::breez_sdk_common {
1515
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1516
+
1517
+ template <> struct Bridging<UniffiForeignFutureCompleteF64> {
1518
+ static jsi::Value toJs(jsi::Runtime &rt,
1519
+ std::shared_ptr<CallInvoker> callInvoker,
1520
+ UniffiForeignFutureCompleteF64 rsCallback) {
1521
+ return jsi::Function::createFromHostFunction(
1522
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteF64"), 2,
1523
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
1524
+ const jsi::Value *arguments,
1525
+ size_t count) -> jsi::Value {
1526
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
1527
+ rsCallback);
1528
+ });
1529
+ }
1530
+
1531
+ static jsi::Value intoRust(jsi::Runtime &rt,
1532
+ std::shared_ptr<CallInvoker> callInvoker,
1533
+ const jsi::Value &thisValue,
1534
+ const jsi::Value *args, size_t count,
1535
+ UniffiForeignFutureCompleteF64 func) {
1536
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1537
+ // then call the rs_callback with those arguments.
1538
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
1539
+ uniffi::breez_sdk_common::Bridging<
1540
+ UniffiForeignFutureStructF64>::fromJs(rt, callInvoker, args[1]));
1541
+
1542
+ return jsi::Value::undefined();
1543
+ }
1544
+ };
1545
+ } // namespace uniffi::breez_sdk_common
1546
+ namespace uniffi::breez_sdk_common {
1547
+ using namespace facebook;
1548
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1549
+
1550
+ template <> struct Bridging<UniffiForeignFutureStructPointer> {
1551
+ static UniffiForeignFutureStructPointer
1552
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
1553
+ const jsi::Value &jsValue) {
1554
+ // Check if the input is an object
1555
+ if (!jsValue.isObject()) {
1556
+ throw jsi::JSError(
1557
+ rt, "Expected an object for UniffiForeignFutureStructPointer");
1558
+ }
1559
+
1560
+ // Get the object from the jsi::Value
1561
+ auto jsObject = jsValue.getObject(rt);
1562
+
1563
+ // Create the vtable struct
1564
+ UniffiForeignFutureStructPointer rsObject;
1565
+
1566
+ // Create the vtable from the js callbacks.
1567
+ rsObject.return_value = uniffi_jsi::Bridging<void *>::fromJs(
1568
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
1569
+ rsObject.call_status =
1570
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::fromJs(
1571
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
1572
+
1573
+ return rsObject;
1574
+ }
1575
+ };
1576
+
1577
+ } // namespace uniffi::breez_sdk_common
1578
+ // Implementation of callback function calling from JS to Rust
1579
+ // ForeignFutureCompletePointer, passed from Rust to JS as part of async
1580
+ // callbacks.
1581
+ namespace uniffi::breez_sdk_common {
1582
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1583
+
1584
+ template <> struct Bridging<UniffiForeignFutureCompletePointer> {
1585
+ static jsi::Value toJs(jsi::Runtime &rt,
1586
+ std::shared_ptr<CallInvoker> callInvoker,
1587
+ UniffiForeignFutureCompletePointer rsCallback) {
1588
+ return jsi::Function::createFromHostFunction(
1589
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompletePointer"), 2,
1590
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
1591
+ const jsi::Value *arguments,
1592
+ size_t count) -> jsi::Value {
1593
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
1594
+ rsCallback);
1595
+ });
1596
+ }
1597
+
1598
+ static jsi::Value intoRust(jsi::Runtime &rt,
1599
+ std::shared_ptr<CallInvoker> callInvoker,
1600
+ const jsi::Value &thisValue,
1601
+ const jsi::Value *args, size_t count,
1602
+ UniffiForeignFutureCompletePointer func) {
1603
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1604
+ // then call the rs_callback with those arguments.
1605
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
1606
+ uniffi::breez_sdk_common::Bridging<
1607
+ UniffiForeignFutureStructPointer>::fromJs(rt, callInvoker,
1608
+ args[1]));
1609
+
1610
+ return jsi::Value::undefined();
1611
+ }
1612
+ };
1613
+ } // namespace uniffi::breez_sdk_common
1614
+ namespace uniffi::breez_sdk_common {
1615
+ using namespace facebook;
1616
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1617
+
1618
+ template <> struct Bridging<UniffiForeignFutureStructRustBuffer> {
1619
+ static UniffiForeignFutureStructRustBuffer
1620
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
1621
+ const jsi::Value &jsValue) {
1622
+ // Check if the input is an object
1623
+ if (!jsValue.isObject()) {
1624
+ throw jsi::JSError(
1625
+ rt, "Expected an object for UniffiForeignFutureStructRustBuffer");
1626
+ }
1627
+
1628
+ // Get the object from the jsi::Value
1629
+ auto jsObject = jsValue.getObject(rt);
1630
+
1631
+ // Create the vtable struct
1632
+ UniffiForeignFutureStructRustBuffer rsObject;
1633
+
1634
+ // Create the vtable from the js callbacks.
1635
+ rsObject.return_value =
1636
+ uniffi::breez_sdk_common::Bridging<RustBuffer>::fromJs(
1637
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
1638
+ rsObject.call_status =
1639
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::fromJs(
1640
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
1641
+
1642
+ return rsObject;
1643
+ }
1644
+ };
1645
+
1646
+ } // namespace uniffi::breez_sdk_common
1647
+ // Implementation of callback function calling from JS to Rust
1648
+ // ForeignFutureCompleteRustBuffer, passed from Rust to JS as part of async
1649
+ // callbacks.
1650
+ namespace uniffi::breez_sdk_common {
1651
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1652
+
1653
+ template <> struct Bridging<UniffiForeignFutureCompleteRustBuffer> {
1654
+ static jsi::Value toJs(jsi::Runtime &rt,
1655
+ std::shared_ptr<CallInvoker> callInvoker,
1656
+ UniffiForeignFutureCompleteRustBuffer rsCallback) {
1657
+ return jsi::Function::createFromHostFunction(
1658
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteRustBuffer"),
1659
+ 2,
1660
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
1661
+ const jsi::Value *arguments,
1662
+ size_t count) -> jsi::Value {
1663
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
1664
+ rsCallback);
1665
+ });
1666
+ }
1667
+
1668
+ static jsi::Value intoRust(jsi::Runtime &rt,
1669
+ std::shared_ptr<CallInvoker> callInvoker,
1670
+ const jsi::Value &thisValue,
1671
+ const jsi::Value *args, size_t count,
1672
+ UniffiForeignFutureCompleteRustBuffer func) {
1673
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1674
+ // then call the rs_callback with those arguments.
1675
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
1676
+ uniffi::breez_sdk_common::Bridging<
1677
+ UniffiForeignFutureStructRustBuffer>::fromJs(rt, callInvoker,
1678
+ args[1]));
1679
+
1680
+ return jsi::Value::undefined();
1681
+ }
1682
+ };
1683
+ } // namespace uniffi::breez_sdk_common
1684
+ namespace uniffi::breez_sdk_common {
1685
+ using namespace facebook;
1686
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1687
+
1688
+ template <> struct Bridging<UniffiForeignFutureStructVoid> {
1689
+ static UniffiForeignFutureStructVoid
1690
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
1691
+ const jsi::Value &jsValue) {
1692
+ // Check if the input is an object
1693
+ if (!jsValue.isObject()) {
1694
+ throw jsi::JSError(
1695
+ rt, "Expected an object for UniffiForeignFutureStructVoid");
1696
+ }
1697
+
1698
+ // Get the object from the jsi::Value
1699
+ auto jsObject = jsValue.getObject(rt);
1700
+
1701
+ // Create the vtable struct
1702
+ UniffiForeignFutureStructVoid rsObject;
1703
+
1704
+ // Create the vtable from the js callbacks.
1705
+ rsObject.call_status =
1706
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::fromJs(
1707
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
1708
+
1709
+ return rsObject;
1710
+ }
1711
+ };
1712
+
1713
+ } // namespace uniffi::breez_sdk_common
1714
+ // Implementation of callback function calling from JS to Rust
1715
+ // ForeignFutureCompleteVoid, passed from Rust to JS as part of async
1716
+ // callbacks.
1717
+ namespace uniffi::breez_sdk_common {
1718
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1719
+
1720
+ template <> struct Bridging<UniffiForeignFutureCompleteVoid> {
1721
+ static jsi::Value toJs(jsi::Runtime &rt,
1722
+ std::shared_ptr<CallInvoker> callInvoker,
1723
+ UniffiForeignFutureCompleteVoid rsCallback) {
1724
+ return jsi::Function::createFromHostFunction(
1725
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteVoid"), 2,
1726
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
1727
+ const jsi::Value *arguments,
1728
+ size_t count) -> jsi::Value {
1729
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
1730
+ rsCallback);
1731
+ });
1732
+ }
1733
+
1734
+ static jsi::Value intoRust(jsi::Runtime &rt,
1735
+ std::shared_ptr<CallInvoker> callInvoker,
1736
+ const jsi::Value &thisValue,
1737
+ const jsi::Value *args, size_t count,
1738
+ UniffiForeignFutureCompleteVoid func) {
1739
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1740
+ // then call the rs_callback with those arguments.
1741
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
1742
+ uniffi::breez_sdk_common::Bridging<
1743
+ UniffiForeignFutureStructVoid>::fromJs(rt, callInvoker, args[1]));
1744
+
1745
+ return jsi::Value::undefined();
1746
+ }
1747
+ };
1748
+ } // namespace uniffi::breez_sdk_common
1749
+ // Implementation of callback function calling from Rust to JS
1750
+ // CallbackInterfaceRestClientMethod0
1751
+
1752
+ // Callback function:
1753
+ // uniffi::breez_sdk_common::cb::callbackinterfacerestclientmethod0::UniffiCallbackInterfaceRestClientMethod0
1754
+ //
1755
+ // We have the following constraints:
1756
+ // - we need to pass a function pointer to Rust.
1757
+ // - we need a jsi::Runtime and jsi::Function to call into JS.
1758
+ // - function pointers can't store state, so we can't use a lamda.
1759
+ //
1760
+ // For this, we store a lambda as a global, as `rsLambda`. The `callback`
1761
+ // function calls the lambda, which itself calls the `body` which then calls
1762
+ // into JS.
1763
+ //
1764
+ // We then give the `callback` function pointer to Rust which will call the
1765
+ // lambda sometime in the future.
1766
+ namespace uniffi::breez_sdk_common::cb::callbackinterfacerestclientmethod0 {
1767
+ using namespace facebook;
1768
+
1769
+ // We need to store a lambda in a global so we can call it from
1770
+ // a function pointer. The function pointer is passed to Rust.
1771
+ static std::function<void(uint64_t, RustBuffer, RustBuffer,
1772
+ UniffiForeignFutureCompleteRustBuffer, uint64_t,
1773
+ UniffiForeignFuture *)>
1774
+ rsLambda = nullptr;
1775
+
1776
+ // This is the main body of the callback. It's called from the lambda,
1777
+ // which itself is called from the callback function which is passed to Rust.
1778
+ static void body(jsi::Runtime &rt,
1779
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
1780
+ std::shared_ptr<jsi::Value> callbackValue,
1781
+ uint64_t rs_uniffiHandle, RustBuffer rs_url,
1782
+ RustBuffer rs_headers,
1783
+ UniffiForeignFutureCompleteRustBuffer rs_uniffiFutureCallback,
1784
+ uint64_t rs_uniffiCallbackData,
1785
+ UniffiForeignFuture *rs_uniffiOutReturn) {
1786
+
1787
+ // Convert the arguments from Rust, into jsi::Values.
1788
+ // We'll use the Bridging class to do this…
1789
+ auto js_uniffiHandle =
1790
+ uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_uniffiHandle);
1791
+ auto js_url = uniffi::breez_sdk_common::Bridging<RustBuffer>::toJs(
1792
+ rt, callInvoker, rs_url);
1793
+ auto js_headers = uniffi::breez_sdk_common::Bridging<RustBuffer>::toJs(
1794
+ rt, callInvoker, rs_headers);
1795
+ auto js_uniffiFutureCallback = uniffi::breez_sdk_common::Bridging<
1796
+ UniffiForeignFutureCompleteRustBuffer>::toJs(rt, callInvoker,
1797
+ rs_uniffiFutureCallback);
1798
+ auto js_uniffiCallbackData = uniffi_jsi::Bridging<uint64_t>::toJs(
1799
+ rt, callInvoker, rs_uniffiCallbackData);
1800
+
1801
+ // Now we are ready to call the callback.
1802
+ // We are already on the JS thread, because this `body` function was
1803
+ // invoked from the CallInvoker.
1804
+ try {
1805
+ // Getting the callback function
1806
+ auto cb = callbackValue->asObject(rt).asFunction(rt);
1807
+ auto uniffiResult = cb.call(rt, js_uniffiHandle, js_url, js_headers,
1808
+ js_uniffiFutureCallback, js_uniffiCallbackData);
1809
+
1810
+ // Finally, we need to copy the return value back into the Rust pointer.
1811
+ *rs_uniffiOutReturn = uniffi::breez_sdk_common::Bridging<
1812
+ ReferenceHolder<UniffiForeignFuture>>::fromJs(rt, callInvoker,
1813
+ uniffiResult);
1814
+ } catch (const jsi::JSError &error) {
1815
+ std::cout << "Error in callback UniffiCallbackInterfaceRestClientMethod0: "
1816
+ << error.what() << std::endl;
1817
+ throw error;
1818
+ }
1819
+ }
1820
+
1821
+ static void
1822
+ callback(uint64_t rs_uniffiHandle, RustBuffer rs_url, RustBuffer rs_headers,
1823
+ UniffiForeignFutureCompleteRustBuffer rs_uniffiFutureCallback,
1824
+ uint64_t rs_uniffiCallbackData,
1825
+ UniffiForeignFuture *rs_uniffiOutReturn) {
1826
+ // If the runtime has shutdown, then there is no point in trying to
1827
+ // call into Javascript. BUT how do we tell if the runtime has shutdown?
1828
+ //
1829
+ // Answer: the module destructor calls into callback `cleanup` method,
1830
+ // which nulls out the rsLamda.
1831
+ //
1832
+ // If rsLamda is null, then there is no runtime to call into.
1833
+ if (rsLambda == nullptr) {
1834
+ // This only occurs when destructors are calling into Rust free/drop,
1835
+ // which causes the JS callback to be dropped.
1836
+ return;
1837
+ }
1838
+
1839
+ // The runtime, the actual callback jsi::funtion, and the callInvoker
1840
+ // are all in the lambda.
1841
+ rsLambda(rs_uniffiHandle, rs_url, rs_headers, rs_uniffiFutureCallback,
1842
+ rs_uniffiCallbackData, rs_uniffiOutReturn);
1843
+ }
1844
+
1845
+ static UniffiCallbackInterfaceRestClientMethod0
1846
+ makeCallbackFunction( // uniffi::breez_sdk_common::cb::callbackinterfacerestclientmethod0
1847
+ jsi::Runtime &rt,
1848
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
1849
+ const jsi::Value &value) {
1850
+ if (rsLambda != nullptr) {
1851
+ // `makeCallbackFunction` is called in two circumstances:
1852
+ //
1853
+ // 1. at startup, when initializing callback interface vtables.
1854
+ // 2. when polling futures. This happens at least once per future that is
1855
+ // exposed to Javascript. We know that this is always the same function,
1856
+ // `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
1857
+ //
1858
+ // We can therefore return the callback function without making anything
1859
+ // new if we've been initialized already.
1860
+ return callback;
1861
+ }
1862
+ auto callbackFunction = value.asObject(rt).asFunction(rt);
1863
+ auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
1864
+ rsLambda = [&rt, callInvoker, callbackValue](
1865
+ uint64_t rs_uniffiHandle, RustBuffer rs_url,
1866
+ RustBuffer rs_headers,
1867
+ UniffiForeignFutureCompleteRustBuffer rs_uniffiFutureCallback,
1868
+ uint64_t rs_uniffiCallbackData,
1869
+ UniffiForeignFuture *rs_uniffiOutReturn) {
1870
+ // We immediately make a lambda which will do the work of transforming the
1871
+ // arguments into JSI values and calling the callback.
1872
+ uniffi_runtime::UniffiCallFunc jsLambda =
1873
+ [callInvoker, callbackValue, rs_uniffiHandle, rs_url, rs_headers,
1874
+ rs_uniffiFutureCallback, rs_uniffiCallbackData,
1875
+ rs_uniffiOutReturn](jsi::Runtime &rt) mutable {
1876
+ body(rt, callInvoker, callbackValue, rs_uniffiHandle, rs_url,
1877
+ rs_headers, rs_uniffiFutureCallback, rs_uniffiCallbackData,
1878
+ rs_uniffiOutReturn);
1879
+ };
1880
+ // We'll then call that lambda from the callInvoker which will
1881
+ // look after calling it on the correct thread.
1882
+ callInvoker->invokeBlocking(rt, jsLambda);
1883
+ };
1884
+ return callback;
1885
+ }
1886
+
1887
+ // This method is called from the destructor of NativeBreezSdkCommon, which only
1888
+ // happens when the jsi::Runtime is being destroyed.
1889
+ static void cleanup() {
1890
+ // The lambda holds a reference to the the Runtime, so when this is nulled
1891
+ // out, then the pointer will no longer be left dangling.
1892
+ rsLambda = nullptr;
1893
+ }
1894
+ } // namespace uniffi::breez_sdk_common::cb::callbackinterfacerestclientmethod0
1895
+ // Implementation of callback function calling from Rust to JS
1896
+ // CallbackInterfaceRestClientMethod1
1897
+
1898
+ // Callback function:
1899
+ // uniffi::breez_sdk_common::cb::callbackinterfacerestclientmethod1::UniffiCallbackInterfaceRestClientMethod1
1900
+ //
1901
+ // We have the following constraints:
1902
+ // - we need to pass a function pointer to Rust.
1903
+ // - we need a jsi::Runtime and jsi::Function to call into JS.
1904
+ // - function pointers can't store state, so we can't use a lamda.
1905
+ //
1906
+ // For this, we store a lambda as a global, as `rsLambda`. The `callback`
1907
+ // function calls the lambda, which itself calls the `body` which then calls
1908
+ // into JS.
1909
+ //
1910
+ // We then give the `callback` function pointer to Rust which will call the
1911
+ // lambda sometime in the future.
1912
+ namespace uniffi::breez_sdk_common::cb::callbackinterfacerestclientmethod1 {
1913
+ using namespace facebook;
1914
+
1915
+ // We need to store a lambda in a global so we can call it from
1916
+ // a function pointer. The function pointer is passed to Rust.
1917
+ static std::function<void(uint64_t, RustBuffer, RustBuffer, RustBuffer,
1918
+ UniffiForeignFutureCompleteRustBuffer, uint64_t,
1919
+ UniffiForeignFuture *)>
1920
+ rsLambda = nullptr;
1921
+
1922
+ // This is the main body of the callback. It's called from the lambda,
1923
+ // which itself is called from the callback function which is passed to Rust.
1924
+ static void body(jsi::Runtime &rt,
1925
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
1926
+ std::shared_ptr<jsi::Value> callbackValue,
1927
+ uint64_t rs_uniffiHandle, RustBuffer rs_url,
1928
+ RustBuffer rs_headers, RustBuffer rs_body,
1929
+ UniffiForeignFutureCompleteRustBuffer rs_uniffiFutureCallback,
1930
+ uint64_t rs_uniffiCallbackData,
1931
+ UniffiForeignFuture *rs_uniffiOutReturn) {
1932
+
1933
+ // Convert the arguments from Rust, into jsi::Values.
1934
+ // We'll use the Bridging class to do this…
1935
+ auto js_uniffiHandle =
1936
+ uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_uniffiHandle);
1937
+ auto js_url = uniffi::breez_sdk_common::Bridging<RustBuffer>::toJs(
1938
+ rt, callInvoker, rs_url);
1939
+ auto js_headers = uniffi::breez_sdk_common::Bridging<RustBuffer>::toJs(
1940
+ rt, callInvoker, rs_headers);
1941
+ auto js_body = uniffi::breez_sdk_common::Bridging<RustBuffer>::toJs(
1942
+ rt, callInvoker, rs_body);
1943
+ auto js_uniffiFutureCallback = uniffi::breez_sdk_common::Bridging<
1944
+ UniffiForeignFutureCompleteRustBuffer>::toJs(rt, callInvoker,
1945
+ rs_uniffiFutureCallback);
1946
+ auto js_uniffiCallbackData = uniffi_jsi::Bridging<uint64_t>::toJs(
1947
+ rt, callInvoker, rs_uniffiCallbackData);
1948
+
1949
+ // Now we are ready to call the callback.
1950
+ // We are already on the JS thread, because this `body` function was
1951
+ // invoked from the CallInvoker.
1952
+ try {
1953
+ // Getting the callback function
1954
+ auto cb = callbackValue->asObject(rt).asFunction(rt);
1955
+ auto uniffiResult =
1956
+ cb.call(rt, js_uniffiHandle, js_url, js_headers, js_body,
1957
+ js_uniffiFutureCallback, js_uniffiCallbackData);
1958
+
1959
+ // Finally, we need to copy the return value back into the Rust pointer.
1960
+ *rs_uniffiOutReturn = uniffi::breez_sdk_common::Bridging<
1961
+ ReferenceHolder<UniffiForeignFuture>>::fromJs(rt, callInvoker,
1962
+ uniffiResult);
1963
+ } catch (const jsi::JSError &error) {
1964
+ std::cout << "Error in callback UniffiCallbackInterfaceRestClientMethod1: "
1965
+ << error.what() << std::endl;
1966
+ throw error;
1967
+ }
1968
+ }
1969
+
1970
+ static void
1971
+ callback(uint64_t rs_uniffiHandle, RustBuffer rs_url, RustBuffer rs_headers,
1972
+ RustBuffer rs_body,
1973
+ UniffiForeignFutureCompleteRustBuffer rs_uniffiFutureCallback,
1974
+ uint64_t rs_uniffiCallbackData,
1975
+ UniffiForeignFuture *rs_uniffiOutReturn) {
1976
+ // If the runtime has shutdown, then there is no point in trying to
1977
+ // call into Javascript. BUT how do we tell if the runtime has shutdown?
1978
+ //
1979
+ // Answer: the module destructor calls into callback `cleanup` method,
1980
+ // which nulls out the rsLamda.
1981
+ //
1982
+ // If rsLamda is null, then there is no runtime to call into.
1983
+ if (rsLambda == nullptr) {
1984
+ // This only occurs when destructors are calling into Rust free/drop,
1985
+ // which causes the JS callback to be dropped.
1986
+ return;
1987
+ }
1988
+
1989
+ // The runtime, the actual callback jsi::funtion, and the callInvoker
1990
+ // are all in the lambda.
1991
+ rsLambda(rs_uniffiHandle, rs_url, rs_headers, rs_body,
1992
+ rs_uniffiFutureCallback, rs_uniffiCallbackData, rs_uniffiOutReturn);
1993
+ }
1994
+
1995
+ static UniffiCallbackInterfaceRestClientMethod1
1996
+ makeCallbackFunction( // uniffi::breez_sdk_common::cb::callbackinterfacerestclientmethod1
1997
+ jsi::Runtime &rt,
1998
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
1999
+ const jsi::Value &value) {
2000
+ if (rsLambda != nullptr) {
2001
+ // `makeCallbackFunction` is called in two circumstances:
2002
+ //
2003
+ // 1. at startup, when initializing callback interface vtables.
2004
+ // 2. when polling futures. This happens at least once per future that is
2005
+ // exposed to Javascript. We know that this is always the same function,
2006
+ // `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
2007
+ //
2008
+ // We can therefore return the callback function without making anything
2009
+ // new if we've been initialized already.
2010
+ return callback;
2011
+ }
2012
+ auto callbackFunction = value.asObject(rt).asFunction(rt);
2013
+ auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
2014
+ rsLambda = [&rt, callInvoker, callbackValue](
2015
+ uint64_t rs_uniffiHandle, RustBuffer rs_url,
2016
+ RustBuffer rs_headers, RustBuffer rs_body,
2017
+ UniffiForeignFutureCompleteRustBuffer rs_uniffiFutureCallback,
2018
+ uint64_t rs_uniffiCallbackData,
2019
+ UniffiForeignFuture *rs_uniffiOutReturn) {
2020
+ // We immediately make a lambda which will do the work of transforming the
2021
+ // arguments into JSI values and calling the callback.
2022
+ uniffi_runtime::UniffiCallFunc jsLambda =
2023
+ [callInvoker, callbackValue, rs_uniffiHandle, rs_url, rs_headers,
2024
+ rs_body, rs_uniffiFutureCallback, rs_uniffiCallbackData,
2025
+ rs_uniffiOutReturn](jsi::Runtime &rt) mutable {
2026
+ body(rt, callInvoker, callbackValue, rs_uniffiHandle, rs_url,
2027
+ rs_headers, rs_body, rs_uniffiFutureCallback,
2028
+ rs_uniffiCallbackData, rs_uniffiOutReturn);
2029
+ };
2030
+ // We'll then call that lambda from the callInvoker which will
2031
+ // look after calling it on the correct thread.
2032
+ callInvoker->invokeBlocking(rt, jsLambda);
2033
+ };
2034
+ return callback;
2035
+ }
2036
+
2037
+ // This method is called from the destructor of NativeBreezSdkCommon, which only
2038
+ // happens when the jsi::Runtime is being destroyed.
2039
+ static void cleanup() {
2040
+ // The lambda holds a reference to the the Runtime, so when this is nulled
2041
+ // out, then the pointer will no longer be left dangling.
2042
+ rsLambda = nullptr;
2043
+ }
2044
+ } // namespace uniffi::breez_sdk_common::cb::callbackinterfacerestclientmethod1
2045
+ // Implementation of callback function calling from Rust to JS
2046
+ // CallbackInterfaceRestClientMethod2
2047
+
2048
+ // Callback function:
2049
+ // uniffi::breez_sdk_common::cb::callbackinterfacerestclientmethod2::UniffiCallbackInterfaceRestClientMethod2
2050
+ //
2051
+ // We have the following constraints:
2052
+ // - we need to pass a function pointer to Rust.
2053
+ // - we need a jsi::Runtime and jsi::Function to call into JS.
2054
+ // - function pointers can't store state, so we can't use a lamda.
2055
+ //
2056
+ // For this, we store a lambda as a global, as `rsLambda`. The `callback`
2057
+ // function calls the lambda, which itself calls the `body` which then calls
2058
+ // into JS.
2059
+ //
2060
+ // We then give the `callback` function pointer to Rust which will call the
2061
+ // lambda sometime in the future.
2062
+ namespace uniffi::breez_sdk_common::cb::callbackinterfacerestclientmethod2 {
2063
+ using namespace facebook;
2064
+
2065
+ // We need to store a lambda in a global so we can call it from
2066
+ // a function pointer. The function pointer is passed to Rust.
2067
+ static std::function<void(uint64_t, RustBuffer, RustBuffer, RustBuffer,
2068
+ UniffiForeignFutureCompleteRustBuffer, uint64_t,
2069
+ UniffiForeignFuture *)>
2070
+ rsLambda = nullptr;
2071
+
2072
+ // This is the main body of the callback. It's called from the lambda,
2073
+ // which itself is called from the callback function which is passed to Rust.
2074
+ static void body(jsi::Runtime &rt,
2075
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
2076
+ std::shared_ptr<jsi::Value> callbackValue,
2077
+ uint64_t rs_uniffiHandle, RustBuffer rs_url,
2078
+ RustBuffer rs_headers, RustBuffer rs_body,
2079
+ UniffiForeignFutureCompleteRustBuffer rs_uniffiFutureCallback,
2080
+ uint64_t rs_uniffiCallbackData,
2081
+ UniffiForeignFuture *rs_uniffiOutReturn) {
2082
+
2083
+ // Convert the arguments from Rust, into jsi::Values.
2084
+ // We'll use the Bridging class to do this…
2085
+ auto js_uniffiHandle =
2086
+ uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_uniffiHandle);
2087
+ auto js_url = uniffi::breez_sdk_common::Bridging<RustBuffer>::toJs(
2088
+ rt, callInvoker, rs_url);
2089
+ auto js_headers = uniffi::breez_sdk_common::Bridging<RustBuffer>::toJs(
2090
+ rt, callInvoker, rs_headers);
2091
+ auto js_body = uniffi::breez_sdk_common::Bridging<RustBuffer>::toJs(
2092
+ rt, callInvoker, rs_body);
2093
+ auto js_uniffiFutureCallback = uniffi::breez_sdk_common::Bridging<
2094
+ UniffiForeignFutureCompleteRustBuffer>::toJs(rt, callInvoker,
2095
+ rs_uniffiFutureCallback);
2096
+ auto js_uniffiCallbackData = uniffi_jsi::Bridging<uint64_t>::toJs(
2097
+ rt, callInvoker, rs_uniffiCallbackData);
2098
+
2099
+ // Now we are ready to call the callback.
2100
+ // We are already on the JS thread, because this `body` function was
2101
+ // invoked from the CallInvoker.
2102
+ try {
2103
+ // Getting the callback function
2104
+ auto cb = callbackValue->asObject(rt).asFunction(rt);
2105
+ auto uniffiResult =
2106
+ cb.call(rt, js_uniffiHandle, js_url, js_headers, js_body,
2107
+ js_uniffiFutureCallback, js_uniffiCallbackData);
2108
+
2109
+ // Finally, we need to copy the return value back into the Rust pointer.
2110
+ *rs_uniffiOutReturn = uniffi::breez_sdk_common::Bridging<
2111
+ ReferenceHolder<UniffiForeignFuture>>::fromJs(rt, callInvoker,
2112
+ uniffiResult);
2113
+ } catch (const jsi::JSError &error) {
2114
+ std::cout << "Error in callback UniffiCallbackInterfaceRestClientMethod2: "
2115
+ << error.what() << std::endl;
2116
+ throw error;
2117
+ }
2118
+ }
2119
+
2120
+ static void
2121
+ callback(uint64_t rs_uniffiHandle, RustBuffer rs_url, RustBuffer rs_headers,
2122
+ RustBuffer rs_body,
2123
+ UniffiForeignFutureCompleteRustBuffer rs_uniffiFutureCallback,
2124
+ uint64_t rs_uniffiCallbackData,
2125
+ UniffiForeignFuture *rs_uniffiOutReturn) {
2126
+ // If the runtime has shutdown, then there is no point in trying to
2127
+ // call into Javascript. BUT how do we tell if the runtime has shutdown?
2128
+ //
2129
+ // Answer: the module destructor calls into callback `cleanup` method,
2130
+ // which nulls out the rsLamda.
2131
+ //
2132
+ // If rsLamda is null, then there is no runtime to call into.
2133
+ if (rsLambda == nullptr) {
2134
+ // This only occurs when destructors are calling into Rust free/drop,
2135
+ // which causes the JS callback to be dropped.
2136
+ return;
2137
+ }
2138
+
2139
+ // The runtime, the actual callback jsi::funtion, and the callInvoker
2140
+ // are all in the lambda.
2141
+ rsLambda(rs_uniffiHandle, rs_url, rs_headers, rs_body,
2142
+ rs_uniffiFutureCallback, rs_uniffiCallbackData, rs_uniffiOutReturn);
2143
+ }
2144
+
2145
+ static UniffiCallbackInterfaceRestClientMethod2
2146
+ makeCallbackFunction( // uniffi::breez_sdk_common::cb::callbackinterfacerestclientmethod2
2147
+ jsi::Runtime &rt,
2148
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
2149
+ const jsi::Value &value) {
2150
+ if (rsLambda != nullptr) {
2151
+ // `makeCallbackFunction` is called in two circumstances:
2152
+ //
2153
+ // 1. at startup, when initializing callback interface vtables.
2154
+ // 2. when polling futures. This happens at least once per future that is
2155
+ // exposed to Javascript. We know that this is always the same function,
2156
+ // `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
2157
+ //
2158
+ // We can therefore return the callback function without making anything
2159
+ // new if we've been initialized already.
2160
+ return callback;
2161
+ }
2162
+ auto callbackFunction = value.asObject(rt).asFunction(rt);
2163
+ auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
2164
+ rsLambda = [&rt, callInvoker, callbackValue](
2165
+ uint64_t rs_uniffiHandle, RustBuffer rs_url,
2166
+ RustBuffer rs_headers, RustBuffer rs_body,
2167
+ UniffiForeignFutureCompleteRustBuffer rs_uniffiFutureCallback,
2168
+ uint64_t rs_uniffiCallbackData,
2169
+ UniffiForeignFuture *rs_uniffiOutReturn) {
2170
+ // We immediately make a lambda which will do the work of transforming the
2171
+ // arguments into JSI values and calling the callback.
2172
+ uniffi_runtime::UniffiCallFunc jsLambda =
2173
+ [callInvoker, callbackValue, rs_uniffiHandle, rs_url, rs_headers,
2174
+ rs_body, rs_uniffiFutureCallback, rs_uniffiCallbackData,
2175
+ rs_uniffiOutReturn](jsi::Runtime &rt) mutable {
2176
+ body(rt, callInvoker, callbackValue, rs_uniffiHandle, rs_url,
2177
+ rs_headers, rs_body, rs_uniffiFutureCallback,
2178
+ rs_uniffiCallbackData, rs_uniffiOutReturn);
2179
+ };
2180
+ // We'll then call that lambda from the callInvoker which will
2181
+ // look after calling it on the correct thread.
2182
+ callInvoker->invokeBlocking(rt, jsLambda);
2183
+ };
2184
+ return callback;
2185
+ }
2186
+
2187
+ // This method is called from the destructor of NativeBreezSdkCommon, which only
2188
+ // happens when the jsi::Runtime is being destroyed.
2189
+ static void cleanup() {
2190
+ // The lambda holds a reference to the the Runtime, so when this is nulled
2191
+ // out, then the pointer will no longer be left dangling.
2192
+ rsLambda = nullptr;
2193
+ }
2194
+ } // namespace uniffi::breez_sdk_common::cb::callbackinterfacerestclientmethod2
2195
+ namespace uniffi::breez_sdk_common {
2196
+ using namespace facebook;
2197
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
2198
+
2199
+ template <> struct Bridging<UniffiVTableCallbackInterfaceRestClient> {
2200
+ static UniffiVTableCallbackInterfaceRestClient
2201
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
2202
+ const jsi::Value &jsValue) {
2203
+ // Check if the input is an object
2204
+ if (!jsValue.isObject()) {
2205
+ throw jsi::JSError(
2206
+ rt, "Expected an object for UniffiVTableCallbackInterfaceRestClient");
2207
+ }
2208
+
2209
+ // Get the object from the jsi::Value
2210
+ auto jsObject = jsValue.getObject(rt);
2211
+
2212
+ // Create the vtable struct
2213
+ UniffiVTableCallbackInterfaceRestClient rsObject;
2214
+
2215
+ // Create the vtable from the js callbacks.
2216
+ rsObject.get = uniffi::breez_sdk_common::cb::
2217
+ callbackinterfacerestclientmethod0::makeCallbackFunction(
2218
+ rt, callInvoker, jsObject.getProperty(rt, "get"));
2219
+ rsObject.post = uniffi::breez_sdk_common::cb::
2220
+ callbackinterfacerestclientmethod1::makeCallbackFunction(
2221
+ rt, callInvoker, jsObject.getProperty(rt, "post"));
2222
+ rsObject.delete = uniffi::breez_sdk_common::cb::
2223
+ callbackinterfacerestclientmethod2::makeCallbackFunction(
2224
+ rt, callInvoker, jsObject.getProperty(rt, "delete"));
2225
+ rsObject.uniffi_free =
2226
+ uniffi::breez_sdk_common::st::vtablecallbackinterfacerestclient::
2227
+ vtablecallbackinterfacerestclient::free::makeCallbackFunction(
2228
+ rt, callInvoker, jsObject.getProperty(rt, "uniffiFree"));
2229
+
2230
+ return rsObject;
2231
+ }
2232
+ };
2233
+
2234
+ } // namespace uniffi::breez_sdk_common
2235
+
2236
+ namespace uniffi::breez_sdk_common {
2237
+ using namespace facebook;
2238
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
2239
+
2240
+ template <> struct Bridging<UniffiRustFutureContinuationCallback> {
2241
+ static UniffiRustFutureContinuationCallback
2242
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
2243
+ const jsi::Value &value) {
2244
+ try {
2245
+ return uniffi::breez_sdk_common::cb::rustfuturecontinuationcallback::
2246
+ makeCallbackFunction(rt, callInvoker, value);
2247
+ } catch (const std::logic_error &e) {
2248
+ throw jsi::JSError(rt, e.what());
2249
+ }
2250
+ }
2251
+ };
2252
+
2253
+ } // namespace uniffi::breez_sdk_common
2254
+
2255
+ NativeBreezSdkCommon::NativeBreezSdkCommon(
2256
+ jsi::Runtime &rt,
2257
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> invoker)
2258
+ : callInvoker(invoker), props() {
2259
+ // Map from Javascript names to the cpp names
2260
+ props["ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length"] =
2261
+ jsi::Function::createFromHostFunction(
2262
+ rt,
2263
+ jsi::PropNameID::forAscii(
2264
+ rt, "ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length"),
2265
+ 1,
2266
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2267
+ const jsi::Value *args, size_t count) -> jsi::Value {
2268
+ return this->cpp_uniffi_internal_fn_func_ffi__string_to_byte_length(
2269
+ rt, thisVal, args, count);
2270
+ });
2271
+ props["ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer"] =
2272
+ jsi::Function::createFromHostFunction(
2273
+ rt,
2274
+ jsi::PropNameID::forAscii(
2275
+ rt, "ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer"),
2276
+ 1,
2277
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2278
+ const jsi::Value *args, size_t count) -> jsi::Value {
2279
+ return this->cpp_uniffi_internal_fn_func_ffi__string_to_arraybuffer(
2280
+ rt, thisVal, args, count);
2281
+ });
2282
+ props["ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string"] =
2283
+ jsi::Function::createFromHostFunction(
2284
+ rt,
2285
+ jsi::PropNameID::forAscii(
2286
+ rt, "ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string"),
2287
+ 1,
2288
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2289
+ const jsi::Value *args, size_t count) -> jsi::Value {
2290
+ return this->cpp_uniffi_internal_fn_func_ffi__arraybuffer_to_string(
2291
+ rt, thisVal, args, count);
2292
+ });
2293
+ props["ubrn_uniffi_breez_sdk_common_fn_clone_restclient"] =
2294
+ jsi::Function::createFromHostFunction(
2295
+ rt,
2296
+ jsi::PropNameID::forAscii(
2297
+ rt, "ubrn_uniffi_breez_sdk_common_fn_clone_restclient"),
2298
+ 1,
2299
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2300
+ const jsi::Value *args, size_t count) -> jsi::Value {
2301
+ return this->cpp_uniffi_breez_sdk_common_fn_clone_restclient(
2302
+ rt, thisVal, args, count);
2303
+ });
2304
+ props["ubrn_uniffi_breez_sdk_common_fn_free_restclient"] =
2305
+ jsi::Function::createFromHostFunction(
2306
+ rt,
2307
+ jsi::PropNameID::forAscii(
2308
+ rt, "ubrn_uniffi_breez_sdk_common_fn_free_restclient"),
2309
+ 1,
2310
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2311
+ const jsi::Value *args, size_t count) -> jsi::Value {
2312
+ return this->cpp_uniffi_breez_sdk_common_fn_free_restclient(
2313
+ rt, thisVal, args, count);
2314
+ });
2315
+ props["ubrn_uniffi_breez_sdk_common_fn_method_restclient_get"] =
2316
+ jsi::Function::createFromHostFunction(
2317
+ rt,
2318
+ jsi::PropNameID::forAscii(
2319
+ rt, "ubrn_uniffi_breez_sdk_common_fn_method_restclient_get"),
2320
+ 3,
2321
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2322
+ const jsi::Value *args, size_t count) -> jsi::Value {
2323
+ return this->cpp_uniffi_breez_sdk_common_fn_method_restclient_get(
2324
+ rt, thisVal, args, count);
2325
+ });
2326
+ props["ubrn_uniffi_breez_sdk_common_fn_method_restclient_post"] =
2327
+ jsi::Function::createFromHostFunction(
2328
+ rt,
2329
+ jsi::PropNameID::forAscii(
2330
+ rt, "ubrn_uniffi_breez_sdk_common_fn_method_restclient_post"),
2331
+ 4,
2332
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2333
+ const jsi::Value *args, size_t count) -> jsi::Value {
2334
+ return this->cpp_uniffi_breez_sdk_common_fn_method_restclient_post(
2335
+ rt, thisVal, args, count);
2336
+ });
2337
+ props["ubrn_uniffi_breez_sdk_common_fn_method_restclient_delete"] =
2338
+ jsi::Function::createFromHostFunction(
2339
+ rt,
2340
+ jsi::PropNameID::forAscii(
2341
+ rt, "ubrn_uniffi_breez_sdk_common_fn_method_restclient_delete"),
2342
+ 4,
2343
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2344
+ const jsi::Value *args, size_t count) -> jsi::Value {
2345
+ return this
2346
+ ->cpp_uniffi_breez_sdk_common_fn_method_restclient_delete(
2347
+ rt, thisVal, args, count);
2348
+ });
2349
+ props["ubrn_ffi_breez_sdk_common_rust_future_poll_u8"] =
2350
+ jsi::Function::createFromHostFunction(
2351
+ rt,
2352
+ jsi::PropNameID::forAscii(
2353
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_poll_u8"),
2354
+ 3,
2355
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2356
+ const jsi::Value *args, size_t count) -> jsi::Value {
2357
+ return this->cpp_ffi_breez_sdk_common_rust_future_poll_u8(
2358
+ rt, thisVal, args, count);
2359
+ });
2360
+ props["ubrn_ffi_breez_sdk_common_rust_future_cancel_u8"] =
2361
+ jsi::Function::createFromHostFunction(
2362
+ rt,
2363
+ jsi::PropNameID::forAscii(
2364
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_cancel_u8"),
2365
+ 1,
2366
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2367
+ const jsi::Value *args, size_t count) -> jsi::Value {
2368
+ return this->cpp_ffi_breez_sdk_common_rust_future_cancel_u8(
2369
+ rt, thisVal, args, count);
2370
+ });
2371
+ props["ubrn_ffi_breez_sdk_common_rust_future_free_u8"] =
2372
+ jsi::Function::createFromHostFunction(
2373
+ rt,
2374
+ jsi::PropNameID::forAscii(
2375
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_free_u8"),
2376
+ 1,
2377
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2378
+ const jsi::Value *args, size_t count) -> jsi::Value {
2379
+ return this->cpp_ffi_breez_sdk_common_rust_future_free_u8(
2380
+ rt, thisVal, args, count);
2381
+ });
2382
+ props["ubrn_ffi_breez_sdk_common_rust_future_complete_u8"] =
2383
+ jsi::Function::createFromHostFunction(
2384
+ rt,
2385
+ jsi::PropNameID::forAscii(
2386
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_complete_u8"),
2387
+ 1,
2388
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2389
+ const jsi::Value *args, size_t count) -> jsi::Value {
2390
+ return this->cpp_ffi_breez_sdk_common_rust_future_complete_u8(
2391
+ rt, thisVal, args, count);
2392
+ });
2393
+ props["ubrn_ffi_breez_sdk_common_rust_future_poll_i8"] =
2394
+ jsi::Function::createFromHostFunction(
2395
+ rt,
2396
+ jsi::PropNameID::forAscii(
2397
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_poll_i8"),
2398
+ 3,
2399
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2400
+ const jsi::Value *args, size_t count) -> jsi::Value {
2401
+ return this->cpp_ffi_breez_sdk_common_rust_future_poll_i8(
2402
+ rt, thisVal, args, count);
2403
+ });
2404
+ props["ubrn_ffi_breez_sdk_common_rust_future_cancel_i8"] =
2405
+ jsi::Function::createFromHostFunction(
2406
+ rt,
2407
+ jsi::PropNameID::forAscii(
2408
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_cancel_i8"),
2409
+ 1,
2410
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2411
+ const jsi::Value *args, size_t count) -> jsi::Value {
2412
+ return this->cpp_ffi_breez_sdk_common_rust_future_cancel_i8(
2413
+ rt, thisVal, args, count);
2414
+ });
2415
+ props["ubrn_ffi_breez_sdk_common_rust_future_free_i8"] =
2416
+ jsi::Function::createFromHostFunction(
2417
+ rt,
2418
+ jsi::PropNameID::forAscii(
2419
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_free_i8"),
2420
+ 1,
2421
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2422
+ const jsi::Value *args, size_t count) -> jsi::Value {
2423
+ return this->cpp_ffi_breez_sdk_common_rust_future_free_i8(
2424
+ rt, thisVal, args, count);
2425
+ });
2426
+ props["ubrn_ffi_breez_sdk_common_rust_future_complete_i8"] =
2427
+ jsi::Function::createFromHostFunction(
2428
+ rt,
2429
+ jsi::PropNameID::forAscii(
2430
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_complete_i8"),
2431
+ 1,
2432
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2433
+ const jsi::Value *args, size_t count) -> jsi::Value {
2434
+ return this->cpp_ffi_breez_sdk_common_rust_future_complete_i8(
2435
+ rt, thisVal, args, count);
2436
+ });
2437
+ props["ubrn_ffi_breez_sdk_common_rust_future_poll_u16"] =
2438
+ jsi::Function::createFromHostFunction(
2439
+ rt,
2440
+ jsi::PropNameID::forAscii(
2441
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_poll_u16"),
2442
+ 3,
2443
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2444
+ const jsi::Value *args, size_t count) -> jsi::Value {
2445
+ return this->cpp_ffi_breez_sdk_common_rust_future_poll_u16(
2446
+ rt, thisVal, args, count);
2447
+ });
2448
+ props["ubrn_ffi_breez_sdk_common_rust_future_cancel_u16"] =
2449
+ jsi::Function::createFromHostFunction(
2450
+ rt,
2451
+ jsi::PropNameID::forAscii(
2452
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_cancel_u16"),
2453
+ 1,
2454
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2455
+ const jsi::Value *args, size_t count) -> jsi::Value {
2456
+ return this->cpp_ffi_breez_sdk_common_rust_future_cancel_u16(
2457
+ rt, thisVal, args, count);
2458
+ });
2459
+ props["ubrn_ffi_breez_sdk_common_rust_future_free_u16"] =
2460
+ jsi::Function::createFromHostFunction(
2461
+ rt,
2462
+ jsi::PropNameID::forAscii(
2463
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_free_u16"),
2464
+ 1,
2465
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2466
+ const jsi::Value *args, size_t count) -> jsi::Value {
2467
+ return this->cpp_ffi_breez_sdk_common_rust_future_free_u16(
2468
+ rt, thisVal, args, count);
2469
+ });
2470
+ props["ubrn_ffi_breez_sdk_common_rust_future_complete_u16"] =
2471
+ jsi::Function::createFromHostFunction(
2472
+ rt,
2473
+ jsi::PropNameID::forAscii(
2474
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_complete_u16"),
2475
+ 1,
2476
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2477
+ const jsi::Value *args, size_t count) -> jsi::Value {
2478
+ return this->cpp_ffi_breez_sdk_common_rust_future_complete_u16(
2479
+ rt, thisVal, args, count);
2480
+ });
2481
+ props["ubrn_ffi_breez_sdk_common_rust_future_poll_i16"] =
2482
+ jsi::Function::createFromHostFunction(
2483
+ rt,
2484
+ jsi::PropNameID::forAscii(
2485
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_poll_i16"),
2486
+ 3,
2487
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2488
+ const jsi::Value *args, size_t count) -> jsi::Value {
2489
+ return this->cpp_ffi_breez_sdk_common_rust_future_poll_i16(
2490
+ rt, thisVal, args, count);
2491
+ });
2492
+ props["ubrn_ffi_breez_sdk_common_rust_future_cancel_i16"] =
2493
+ jsi::Function::createFromHostFunction(
2494
+ rt,
2495
+ jsi::PropNameID::forAscii(
2496
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_cancel_i16"),
2497
+ 1,
2498
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2499
+ const jsi::Value *args, size_t count) -> jsi::Value {
2500
+ return this->cpp_ffi_breez_sdk_common_rust_future_cancel_i16(
2501
+ rt, thisVal, args, count);
2502
+ });
2503
+ props["ubrn_ffi_breez_sdk_common_rust_future_free_i16"] =
2504
+ jsi::Function::createFromHostFunction(
2505
+ rt,
2506
+ jsi::PropNameID::forAscii(
2507
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_free_i16"),
2508
+ 1,
2509
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2510
+ const jsi::Value *args, size_t count) -> jsi::Value {
2511
+ return this->cpp_ffi_breez_sdk_common_rust_future_free_i16(
2512
+ rt, thisVal, args, count);
2513
+ });
2514
+ props["ubrn_ffi_breez_sdk_common_rust_future_complete_i16"] =
2515
+ jsi::Function::createFromHostFunction(
2516
+ rt,
2517
+ jsi::PropNameID::forAscii(
2518
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_complete_i16"),
2519
+ 1,
2520
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2521
+ const jsi::Value *args, size_t count) -> jsi::Value {
2522
+ return this->cpp_ffi_breez_sdk_common_rust_future_complete_i16(
2523
+ rt, thisVal, args, count);
2524
+ });
2525
+ props["ubrn_ffi_breez_sdk_common_rust_future_poll_u32"] =
2526
+ jsi::Function::createFromHostFunction(
2527
+ rt,
2528
+ jsi::PropNameID::forAscii(
2529
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_poll_u32"),
2530
+ 3,
2531
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2532
+ const jsi::Value *args, size_t count) -> jsi::Value {
2533
+ return this->cpp_ffi_breez_sdk_common_rust_future_poll_u32(
2534
+ rt, thisVal, args, count);
2535
+ });
2536
+ props["ubrn_ffi_breez_sdk_common_rust_future_cancel_u32"] =
2537
+ jsi::Function::createFromHostFunction(
2538
+ rt,
2539
+ jsi::PropNameID::forAscii(
2540
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_cancel_u32"),
2541
+ 1,
2542
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2543
+ const jsi::Value *args, size_t count) -> jsi::Value {
2544
+ return this->cpp_ffi_breez_sdk_common_rust_future_cancel_u32(
2545
+ rt, thisVal, args, count);
2546
+ });
2547
+ props["ubrn_ffi_breez_sdk_common_rust_future_free_u32"] =
2548
+ jsi::Function::createFromHostFunction(
2549
+ rt,
2550
+ jsi::PropNameID::forAscii(
2551
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_free_u32"),
2552
+ 1,
2553
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2554
+ const jsi::Value *args, size_t count) -> jsi::Value {
2555
+ return this->cpp_ffi_breez_sdk_common_rust_future_free_u32(
2556
+ rt, thisVal, args, count);
2557
+ });
2558
+ props["ubrn_ffi_breez_sdk_common_rust_future_complete_u32"] =
2559
+ jsi::Function::createFromHostFunction(
2560
+ rt,
2561
+ jsi::PropNameID::forAscii(
2562
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_complete_u32"),
2563
+ 1,
2564
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2565
+ const jsi::Value *args, size_t count) -> jsi::Value {
2566
+ return this->cpp_ffi_breez_sdk_common_rust_future_complete_u32(
2567
+ rt, thisVal, args, count);
2568
+ });
2569
+ props["ubrn_ffi_breez_sdk_common_rust_future_poll_i32"] =
2570
+ jsi::Function::createFromHostFunction(
2571
+ rt,
2572
+ jsi::PropNameID::forAscii(
2573
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_poll_i32"),
2574
+ 3,
2575
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2576
+ const jsi::Value *args, size_t count) -> jsi::Value {
2577
+ return this->cpp_ffi_breez_sdk_common_rust_future_poll_i32(
2578
+ rt, thisVal, args, count);
2579
+ });
2580
+ props["ubrn_ffi_breez_sdk_common_rust_future_cancel_i32"] =
2581
+ jsi::Function::createFromHostFunction(
2582
+ rt,
2583
+ jsi::PropNameID::forAscii(
2584
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_cancel_i32"),
2585
+ 1,
2586
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2587
+ const jsi::Value *args, size_t count) -> jsi::Value {
2588
+ return this->cpp_ffi_breez_sdk_common_rust_future_cancel_i32(
2589
+ rt, thisVal, args, count);
2590
+ });
2591
+ props["ubrn_ffi_breez_sdk_common_rust_future_free_i32"] =
2592
+ jsi::Function::createFromHostFunction(
2593
+ rt,
2594
+ jsi::PropNameID::forAscii(
2595
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_free_i32"),
2596
+ 1,
2597
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2598
+ const jsi::Value *args, size_t count) -> jsi::Value {
2599
+ return this->cpp_ffi_breez_sdk_common_rust_future_free_i32(
2600
+ rt, thisVal, args, count);
2601
+ });
2602
+ props["ubrn_ffi_breez_sdk_common_rust_future_complete_i32"] =
2603
+ jsi::Function::createFromHostFunction(
2604
+ rt,
2605
+ jsi::PropNameID::forAscii(
2606
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_complete_i32"),
2607
+ 1,
2608
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2609
+ const jsi::Value *args, size_t count) -> jsi::Value {
2610
+ return this->cpp_ffi_breez_sdk_common_rust_future_complete_i32(
2611
+ rt, thisVal, args, count);
2612
+ });
2613
+ props["ubrn_ffi_breez_sdk_common_rust_future_poll_u64"] =
2614
+ jsi::Function::createFromHostFunction(
2615
+ rt,
2616
+ jsi::PropNameID::forAscii(
2617
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_poll_u64"),
2618
+ 3,
2619
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2620
+ const jsi::Value *args, size_t count) -> jsi::Value {
2621
+ return this->cpp_ffi_breez_sdk_common_rust_future_poll_u64(
2622
+ rt, thisVal, args, count);
2623
+ });
2624
+ props["ubrn_ffi_breez_sdk_common_rust_future_cancel_u64"] =
2625
+ jsi::Function::createFromHostFunction(
2626
+ rt,
2627
+ jsi::PropNameID::forAscii(
2628
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_cancel_u64"),
2629
+ 1,
2630
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2631
+ const jsi::Value *args, size_t count) -> jsi::Value {
2632
+ return this->cpp_ffi_breez_sdk_common_rust_future_cancel_u64(
2633
+ rt, thisVal, args, count);
2634
+ });
2635
+ props["ubrn_ffi_breez_sdk_common_rust_future_free_u64"] =
2636
+ jsi::Function::createFromHostFunction(
2637
+ rt,
2638
+ jsi::PropNameID::forAscii(
2639
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_free_u64"),
2640
+ 1,
2641
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2642
+ const jsi::Value *args, size_t count) -> jsi::Value {
2643
+ return this->cpp_ffi_breez_sdk_common_rust_future_free_u64(
2644
+ rt, thisVal, args, count);
2645
+ });
2646
+ props["ubrn_ffi_breez_sdk_common_rust_future_complete_u64"] =
2647
+ jsi::Function::createFromHostFunction(
2648
+ rt,
2649
+ jsi::PropNameID::forAscii(
2650
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_complete_u64"),
2651
+ 1,
2652
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2653
+ const jsi::Value *args, size_t count) -> jsi::Value {
2654
+ return this->cpp_ffi_breez_sdk_common_rust_future_complete_u64(
2655
+ rt, thisVal, args, count);
2656
+ });
2657
+ props["ubrn_ffi_breez_sdk_common_rust_future_poll_i64"] =
2658
+ jsi::Function::createFromHostFunction(
2659
+ rt,
2660
+ jsi::PropNameID::forAscii(
2661
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_poll_i64"),
2662
+ 3,
2663
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2664
+ const jsi::Value *args, size_t count) -> jsi::Value {
2665
+ return this->cpp_ffi_breez_sdk_common_rust_future_poll_i64(
2666
+ rt, thisVal, args, count);
2667
+ });
2668
+ props["ubrn_ffi_breez_sdk_common_rust_future_cancel_i64"] =
2669
+ jsi::Function::createFromHostFunction(
2670
+ rt,
2671
+ jsi::PropNameID::forAscii(
2672
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_cancel_i64"),
2673
+ 1,
2674
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2675
+ const jsi::Value *args, size_t count) -> jsi::Value {
2676
+ return this->cpp_ffi_breez_sdk_common_rust_future_cancel_i64(
2677
+ rt, thisVal, args, count);
2678
+ });
2679
+ props["ubrn_ffi_breez_sdk_common_rust_future_free_i64"] =
2680
+ jsi::Function::createFromHostFunction(
2681
+ rt,
2682
+ jsi::PropNameID::forAscii(
2683
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_free_i64"),
2684
+ 1,
2685
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2686
+ const jsi::Value *args, size_t count) -> jsi::Value {
2687
+ return this->cpp_ffi_breez_sdk_common_rust_future_free_i64(
2688
+ rt, thisVal, args, count);
2689
+ });
2690
+ props["ubrn_ffi_breez_sdk_common_rust_future_complete_i64"] =
2691
+ jsi::Function::createFromHostFunction(
2692
+ rt,
2693
+ jsi::PropNameID::forAscii(
2694
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_complete_i64"),
2695
+ 1,
2696
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2697
+ const jsi::Value *args, size_t count) -> jsi::Value {
2698
+ return this->cpp_ffi_breez_sdk_common_rust_future_complete_i64(
2699
+ rt, thisVal, args, count);
2700
+ });
2701
+ props["ubrn_ffi_breez_sdk_common_rust_future_poll_f32"] =
2702
+ jsi::Function::createFromHostFunction(
2703
+ rt,
2704
+ jsi::PropNameID::forAscii(
2705
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_poll_f32"),
2706
+ 3,
2707
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2708
+ const jsi::Value *args, size_t count) -> jsi::Value {
2709
+ return this->cpp_ffi_breez_sdk_common_rust_future_poll_f32(
2710
+ rt, thisVal, args, count);
2711
+ });
2712
+ props["ubrn_ffi_breez_sdk_common_rust_future_cancel_f32"] =
2713
+ jsi::Function::createFromHostFunction(
2714
+ rt,
2715
+ jsi::PropNameID::forAscii(
2716
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_cancel_f32"),
2717
+ 1,
2718
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2719
+ const jsi::Value *args, size_t count) -> jsi::Value {
2720
+ return this->cpp_ffi_breez_sdk_common_rust_future_cancel_f32(
2721
+ rt, thisVal, args, count);
2722
+ });
2723
+ props["ubrn_ffi_breez_sdk_common_rust_future_free_f32"] =
2724
+ jsi::Function::createFromHostFunction(
2725
+ rt,
2726
+ jsi::PropNameID::forAscii(
2727
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_free_f32"),
2728
+ 1,
2729
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2730
+ const jsi::Value *args, size_t count) -> jsi::Value {
2731
+ return this->cpp_ffi_breez_sdk_common_rust_future_free_f32(
2732
+ rt, thisVal, args, count);
2733
+ });
2734
+ props["ubrn_ffi_breez_sdk_common_rust_future_complete_f32"] =
2735
+ jsi::Function::createFromHostFunction(
2736
+ rt,
2737
+ jsi::PropNameID::forAscii(
2738
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_complete_f32"),
2739
+ 1,
2740
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2741
+ const jsi::Value *args, size_t count) -> jsi::Value {
2742
+ return this->cpp_ffi_breez_sdk_common_rust_future_complete_f32(
2743
+ rt, thisVal, args, count);
2744
+ });
2745
+ props["ubrn_ffi_breez_sdk_common_rust_future_poll_f64"] =
2746
+ jsi::Function::createFromHostFunction(
2747
+ rt,
2748
+ jsi::PropNameID::forAscii(
2749
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_poll_f64"),
2750
+ 3,
2751
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2752
+ const jsi::Value *args, size_t count) -> jsi::Value {
2753
+ return this->cpp_ffi_breez_sdk_common_rust_future_poll_f64(
2754
+ rt, thisVal, args, count);
2755
+ });
2756
+ props["ubrn_ffi_breez_sdk_common_rust_future_cancel_f64"] =
2757
+ jsi::Function::createFromHostFunction(
2758
+ rt,
2759
+ jsi::PropNameID::forAscii(
2760
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_cancel_f64"),
2761
+ 1,
2762
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2763
+ const jsi::Value *args, size_t count) -> jsi::Value {
2764
+ return this->cpp_ffi_breez_sdk_common_rust_future_cancel_f64(
2765
+ rt, thisVal, args, count);
2766
+ });
2767
+ props["ubrn_ffi_breez_sdk_common_rust_future_free_f64"] =
2768
+ jsi::Function::createFromHostFunction(
2769
+ rt,
2770
+ jsi::PropNameID::forAscii(
2771
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_free_f64"),
2772
+ 1,
2773
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2774
+ const jsi::Value *args, size_t count) -> jsi::Value {
2775
+ return this->cpp_ffi_breez_sdk_common_rust_future_free_f64(
2776
+ rt, thisVal, args, count);
2777
+ });
2778
+ props["ubrn_ffi_breez_sdk_common_rust_future_complete_f64"] =
2779
+ jsi::Function::createFromHostFunction(
2780
+ rt,
2781
+ jsi::PropNameID::forAscii(
2782
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_complete_f64"),
2783
+ 1,
2784
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2785
+ const jsi::Value *args, size_t count) -> jsi::Value {
2786
+ return this->cpp_ffi_breez_sdk_common_rust_future_complete_f64(
2787
+ rt, thisVal, args, count);
2788
+ });
2789
+ props["ubrn_ffi_breez_sdk_common_rust_future_poll_pointer"] =
2790
+ jsi::Function::createFromHostFunction(
2791
+ rt,
2792
+ jsi::PropNameID::forAscii(
2793
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_poll_pointer"),
2794
+ 3,
2795
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2796
+ const jsi::Value *args, size_t count) -> jsi::Value {
2797
+ return this->cpp_ffi_breez_sdk_common_rust_future_poll_pointer(
2798
+ rt, thisVal, args, count);
2799
+ });
2800
+ props["ubrn_ffi_breez_sdk_common_rust_future_cancel_pointer"] =
2801
+ jsi::Function::createFromHostFunction(
2802
+ rt,
2803
+ jsi::PropNameID::forAscii(
2804
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_cancel_pointer"),
2805
+ 1,
2806
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2807
+ const jsi::Value *args, size_t count) -> jsi::Value {
2808
+ return this->cpp_ffi_breez_sdk_common_rust_future_cancel_pointer(
2809
+ rt, thisVal, args, count);
2810
+ });
2811
+ props["ubrn_ffi_breez_sdk_common_rust_future_free_pointer"] =
2812
+ jsi::Function::createFromHostFunction(
2813
+ rt,
2814
+ jsi::PropNameID::forAscii(
2815
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_free_pointer"),
2816
+ 1,
2817
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2818
+ const jsi::Value *args, size_t count) -> jsi::Value {
2819
+ return this->cpp_ffi_breez_sdk_common_rust_future_free_pointer(
2820
+ rt, thisVal, args, count);
2821
+ });
2822
+ props["ubrn_ffi_breez_sdk_common_rust_future_complete_pointer"] =
2823
+ jsi::Function::createFromHostFunction(
2824
+ rt,
2825
+ jsi::PropNameID::forAscii(
2826
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_complete_pointer"),
2827
+ 1,
2828
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2829
+ const jsi::Value *args, size_t count) -> jsi::Value {
2830
+ return this->cpp_ffi_breez_sdk_common_rust_future_complete_pointer(
2831
+ rt, thisVal, args, count);
2832
+ });
2833
+ props["ubrn_ffi_breez_sdk_common_rust_future_poll_rust_buffer"] =
2834
+ jsi::Function::createFromHostFunction(
2835
+ rt,
2836
+ jsi::PropNameID::forAscii(
2837
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_poll_rust_buffer"),
2838
+ 3,
2839
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2840
+ const jsi::Value *args, size_t count) -> jsi::Value {
2841
+ return this->cpp_ffi_breez_sdk_common_rust_future_poll_rust_buffer(
2842
+ rt, thisVal, args, count);
2843
+ });
2844
+ props["ubrn_ffi_breez_sdk_common_rust_future_cancel_rust_buffer"] =
2845
+ jsi::Function::createFromHostFunction(
2846
+ rt,
2847
+ jsi::PropNameID::forAscii(
2848
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_cancel_rust_buffer"),
2849
+ 1,
2850
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2851
+ const jsi::Value *args, size_t count) -> jsi::Value {
2852
+ return this
2853
+ ->cpp_ffi_breez_sdk_common_rust_future_cancel_rust_buffer(
2854
+ rt, thisVal, args, count);
2855
+ });
2856
+ props["ubrn_ffi_breez_sdk_common_rust_future_free_rust_buffer"] =
2857
+ jsi::Function::createFromHostFunction(
2858
+ rt,
2859
+ jsi::PropNameID::forAscii(
2860
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_free_rust_buffer"),
2861
+ 1,
2862
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2863
+ const jsi::Value *args, size_t count) -> jsi::Value {
2864
+ return this->cpp_ffi_breez_sdk_common_rust_future_free_rust_buffer(
2865
+ rt, thisVal, args, count);
2866
+ });
2867
+ props["ubrn_ffi_breez_sdk_common_rust_future_complete_rust_buffer"] =
2868
+ jsi::Function::createFromHostFunction(
2869
+ rt,
2870
+ jsi::PropNameID::forAscii(
2871
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_complete_rust_buffer"),
2872
+ 1,
2873
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2874
+ const jsi::Value *args, size_t count) -> jsi::Value {
2875
+ return this
2876
+ ->cpp_ffi_breez_sdk_common_rust_future_complete_rust_buffer(
2877
+ rt, thisVal, args, count);
2878
+ });
2879
+ props["ubrn_ffi_breez_sdk_common_rust_future_poll_void"] =
2880
+ jsi::Function::createFromHostFunction(
2881
+ rt,
2882
+ jsi::PropNameID::forAscii(
2883
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_poll_void"),
2884
+ 3,
2885
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2886
+ const jsi::Value *args, size_t count) -> jsi::Value {
2887
+ return this->cpp_ffi_breez_sdk_common_rust_future_poll_void(
2888
+ rt, thisVal, args, count);
2889
+ });
2890
+ props["ubrn_ffi_breez_sdk_common_rust_future_cancel_void"] =
2891
+ jsi::Function::createFromHostFunction(
2892
+ rt,
2893
+ jsi::PropNameID::forAscii(
2894
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_cancel_void"),
2895
+ 1,
2896
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2897
+ const jsi::Value *args, size_t count) -> jsi::Value {
2898
+ return this->cpp_ffi_breez_sdk_common_rust_future_cancel_void(
2899
+ rt, thisVal, args, count);
2900
+ });
2901
+ props["ubrn_ffi_breez_sdk_common_rust_future_free_void"] =
2902
+ jsi::Function::createFromHostFunction(
2903
+ rt,
2904
+ jsi::PropNameID::forAscii(
2905
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_free_void"),
2906
+ 1,
2907
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2908
+ const jsi::Value *args, size_t count) -> jsi::Value {
2909
+ return this->cpp_ffi_breez_sdk_common_rust_future_free_void(
2910
+ rt, thisVal, args, count);
2911
+ });
2912
+ props["ubrn_ffi_breez_sdk_common_rust_future_complete_void"] =
2913
+ jsi::Function::createFromHostFunction(
2914
+ rt,
2915
+ jsi::PropNameID::forAscii(
2916
+ rt, "ubrn_ffi_breez_sdk_common_rust_future_complete_void"),
2917
+ 1,
2918
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2919
+ const jsi::Value *args, size_t count) -> jsi::Value {
2920
+ return this->cpp_ffi_breez_sdk_common_rust_future_complete_void(
2921
+ rt, thisVal, args, count);
2922
+ });
2923
+ props["ubrn_uniffi_breez_sdk_common_checksum_method_restclient_get"] =
2924
+ jsi::Function::createFromHostFunction(
2925
+ rt,
2926
+ jsi::PropNameID::forAscii(
2927
+ rt,
2928
+ "ubrn_uniffi_breez_sdk_common_checksum_method_restclient_get"),
2929
+ 0,
2930
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2931
+ const jsi::Value *args, size_t count) -> jsi::Value {
2932
+ return this
2933
+ ->cpp_uniffi_breez_sdk_common_checksum_method_restclient_get(
2934
+ rt, thisVal, args, count);
2935
+ });
2936
+ props["ubrn_uniffi_breez_sdk_common_checksum_method_restclient_post"] =
2937
+ jsi::Function::createFromHostFunction(
2938
+ rt,
2939
+ jsi::PropNameID::forAscii(
2940
+ rt,
2941
+ "ubrn_uniffi_breez_sdk_common_checksum_method_restclient_post"),
2942
+ 0,
2943
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2944
+ const jsi::Value *args, size_t count) -> jsi::Value {
2945
+ return this
2946
+ ->cpp_uniffi_breez_sdk_common_checksum_method_restclient_post(
2947
+ rt, thisVal, args, count);
2948
+ });
2949
+ props["ubrn_uniffi_breez_sdk_common_checksum_method_restclient_delete"] =
2950
+ jsi::Function::createFromHostFunction(
2951
+ rt,
2952
+ jsi::PropNameID::forAscii(
2953
+ rt,
2954
+ "ubrn_uniffi_breez_sdk_common_checksum_method_restclient_delete"),
2955
+ 0,
2956
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2957
+ const jsi::Value *args, size_t count) -> jsi::Value {
2958
+ return this
2959
+ ->cpp_uniffi_breez_sdk_common_checksum_method_restclient_delete(
2960
+ rt, thisVal, args, count);
2961
+ });
2962
+ props["ubrn_ffi_breez_sdk_common_uniffi_contract_version"] =
2963
+ jsi::Function::createFromHostFunction(
2964
+ rt,
2965
+ jsi::PropNameID::forAscii(
2966
+ rt, "ubrn_ffi_breez_sdk_common_uniffi_contract_version"),
2967
+ 0,
2968
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2969
+ const jsi::Value *args, size_t count) -> jsi::Value {
2970
+ return this->cpp_ffi_breez_sdk_common_uniffi_contract_version(
2971
+ rt, thisVal, args, count);
2972
+ });
2973
+ props["ubrn_uniffi_breez_sdk_common_fn_init_callback_vtable_restclient"] =
2974
+ jsi::Function::createFromHostFunction(
2975
+ rt,
2976
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_breez_sdk_common_fn_init_"
2977
+ "callback_vtable_restclient"),
2978
+ 1,
2979
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2980
+ const jsi::Value *args, size_t count) -> jsi::Value {
2981
+ return this
2982
+ ->cpp_uniffi_breez_sdk_common_fn_init_callback_vtable_restclient(
2983
+ rt, thisVal, args, count);
2984
+ });
2985
+ props["ubrn_uniffi_internal_fn_method_restclient_ffi__bless_pointer"] =
2986
+ jsi::Function::createFromHostFunction(
2987
+ rt,
2988
+ jsi::PropNameID::forAscii(
2989
+ rt,
2990
+ "ubrn_uniffi_internal_fn_method_restclient_ffi__bless_pointer"),
2991
+ 1,
2992
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
2993
+ const jsi::Value *args, size_t count) -> jsi::Value {
2994
+ return this
2995
+ ->cpp_uniffi_internal_fn_method_restclient_ffi__bless_pointer(
2996
+ rt, thisVal, args, count);
2997
+ });
2998
+ }
2999
+
3000
+ void NativeBreezSdkCommon::registerModule(
3001
+ jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> callInvoker) {
3002
+ auto invoker =
3003
+ std::make_shared<uniffi_runtime::UniffiCallInvoker>(callInvoker);
3004
+ auto tm = std::make_shared<NativeBreezSdkCommon>(rt, invoker);
3005
+ auto obj = rt.global().createFromHostObject(rt, tm);
3006
+ rt.global().setProperty(rt, "NativeBreezSdkCommon", obj);
3007
+ }
3008
+
3009
+ void NativeBreezSdkCommon::unregisterModule(jsi::Runtime &rt) {
3010
+ uniffi::breez_sdk_common::registry::clearRegistry();
3011
+ }
3012
+
3013
+ jsi::Value NativeBreezSdkCommon::get(jsi::Runtime &rt,
3014
+ const jsi::PropNameID &name) {
3015
+ try {
3016
+ return jsi::Value(rt, props.at(name.utf8(rt)));
3017
+ } catch (std::out_of_range &e) {
3018
+ return jsi::Value::undefined();
3019
+ }
3020
+ }
3021
+
3022
+ std::vector<jsi::PropNameID>
3023
+ NativeBreezSdkCommon::getPropertyNames(jsi::Runtime &rt) {
3024
+ std::vector<jsi::PropNameID> rval;
3025
+ for (auto &[key, value] : props) {
3026
+ rval.push_back(jsi::PropNameID::forUtf8(rt, key));
3027
+ }
3028
+ return rval;
3029
+ }
3030
+
3031
+ void NativeBreezSdkCommon::set(jsi::Runtime &rt, const jsi::PropNameID &name,
3032
+ const jsi::Value &value) {
3033
+ props.insert_or_assign(name.utf8(rt), &value);
3034
+ }
3035
+
3036
+ NativeBreezSdkCommon::~NativeBreezSdkCommon() {
3037
+ // Cleanup for callback function RustFutureContinuationCallback
3038
+ uniffi::breez_sdk_common::cb::rustfuturecontinuationcallback::cleanup();
3039
+ // Cleanup for "free" callback function CallbackInterfaceFree
3040
+ uniffi::breez_sdk_common::st::foreignfuture::foreignfuture::free::cleanup();
3041
+ uniffi::breez_sdk_common::st::vtablecallbackinterfacerestclient::
3042
+ vtablecallbackinterfacerestclient::free::cleanup();
3043
+ // Cleanup for callback function CallbackInterfaceRestClientMethod0
3044
+ uniffi::breez_sdk_common::cb::callbackinterfacerestclientmethod0::cleanup();
3045
+ // Cleanup for callback function CallbackInterfaceRestClientMethod1
3046
+ uniffi::breez_sdk_common::cb::callbackinterfacerestclientmethod1::cleanup();
3047
+ // Cleanup for callback function CallbackInterfaceRestClientMethod2
3048
+ uniffi::breez_sdk_common::cb::callbackinterfacerestclientmethod2::cleanup();
3049
+ }
3050
+
3051
+ // Utility functions for serialization/deserialization of strings.
3052
+ jsi::Value
3053
+ NativeBreezSdkCommon::cpp_uniffi_internal_fn_func_ffi__string_to_byte_length(
3054
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3055
+ size_t count) {
3056
+ return uniffi_jsi::Bridging<std::string>::string_to_bytelength(rt, args[0]);
3057
+ }
3058
+
3059
+ jsi::Value
3060
+ NativeBreezSdkCommon::cpp_uniffi_internal_fn_func_ffi__string_to_arraybuffer(
3061
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3062
+ size_t count) {
3063
+ return uniffi_jsi::Bridging<std::string>::string_to_arraybuffer(rt, args[0]);
3064
+ }
3065
+
3066
+ jsi::Value
3067
+ NativeBreezSdkCommon::cpp_uniffi_internal_fn_func_ffi__arraybuffer_to_string(
3068
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3069
+ size_t count) {
3070
+ return uniffi_jsi::Bridging<std::string>::arraybuffer_to_string(rt, args[0]);
3071
+ }
3072
+ jsi::Value NativeBreezSdkCommon::
3073
+ cpp_uniffi_internal_fn_method_restclient_ffi__bless_pointer(
3074
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3075
+ size_t count) {
3076
+ auto pointer =
3077
+ uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]);
3078
+ auto static destructor = [](uint64_t p) {
3079
+ auto pointer = reinterpret_cast<void *>(static_cast<uintptr_t>(p));
3080
+ RustCallStatus status = {0};
3081
+ uniffi_breez_sdk_common_fn_free_restclient(pointer, &status);
3082
+ };
3083
+ auto ptrObj =
3084
+ std::make_shared<uniffi_jsi::DestructibleObject>(pointer, destructor);
3085
+ auto obj = jsi::Object::createFromHostObject(rt, ptrObj);
3086
+ return jsi::Value(rt, obj);
3087
+ }
3088
+
3089
+ // Methods calling directly into the uniffi generated C API of the Rust crate.
3090
+ jsi::Value
3091
+ NativeBreezSdkCommon::cpp_uniffi_breez_sdk_common_fn_clone_restclient(
3092
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3093
+ size_t count) {
3094
+ RustCallStatus status =
3095
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::rustSuccess(rt);
3096
+ auto value = uniffi_breez_sdk_common_fn_clone_restclient(
3097
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]), &status);
3098
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::copyIntoJs(
3099
+ rt, callInvoker, status, args[count - 1]);
3100
+
3101
+ return uniffi_jsi::Bridging<void *>::toJs(rt, callInvoker, value);
3102
+ }
3103
+ jsi::Value NativeBreezSdkCommon::cpp_uniffi_breez_sdk_common_fn_free_restclient(
3104
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3105
+ size_t count) {
3106
+ RustCallStatus status =
3107
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::rustSuccess(rt);
3108
+ uniffi_breez_sdk_common_fn_free_restclient(
3109
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]), &status);
3110
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::copyIntoJs(
3111
+ rt, callInvoker, status, args[count - 1]);
3112
+
3113
+ return jsi::Value::undefined();
3114
+ }
3115
+ jsi::Value
3116
+ NativeBreezSdkCommon::cpp_uniffi_breez_sdk_common_fn_method_restclient_get(
3117
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3118
+ size_t count) {
3119
+ auto value = uniffi_breez_sdk_common_fn_method_restclient_get(
3120
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]),
3121
+ uniffi::breez_sdk_common::Bridging<RustBuffer>::fromJs(rt, callInvoker,
3122
+ args[1]),
3123
+ uniffi::breez_sdk_common::Bridging<RustBuffer>::fromJs(rt, callInvoker,
3124
+ args[2]));
3125
+
3126
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
3127
+ value);
3128
+ }
3129
+ jsi::Value
3130
+ NativeBreezSdkCommon::cpp_uniffi_breez_sdk_common_fn_method_restclient_post(
3131
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3132
+ size_t count) {
3133
+ auto value = uniffi_breez_sdk_common_fn_method_restclient_post(
3134
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]),
3135
+ uniffi::breez_sdk_common::Bridging<RustBuffer>::fromJs(rt, callInvoker,
3136
+ args[1]),
3137
+ uniffi::breez_sdk_common::Bridging<RustBuffer>::fromJs(rt, callInvoker,
3138
+ args[2]),
3139
+ uniffi::breez_sdk_common::Bridging<RustBuffer>::fromJs(rt, callInvoker,
3140
+ args[3]));
3141
+
3142
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
3143
+ value);
3144
+ }
3145
+ jsi::Value
3146
+ NativeBreezSdkCommon::cpp_uniffi_breez_sdk_common_fn_method_restclient_delete(
3147
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3148
+ size_t count) {
3149
+ auto value = uniffi_breez_sdk_common_fn_method_restclient_delete(
3150
+ uniffi_jsi::Bridging<void *>::fromJs(rt, callInvoker, args[0]),
3151
+ uniffi::breez_sdk_common::Bridging<RustBuffer>::fromJs(rt, callInvoker,
3152
+ args[1]),
3153
+ uniffi::breez_sdk_common::Bridging<RustBuffer>::fromJs(rt, callInvoker,
3154
+ args[2]),
3155
+ uniffi::breez_sdk_common::Bridging<RustBuffer>::fromJs(rt, callInvoker,
3156
+ args[3]));
3157
+
3158
+ return uniffi_jsi::Bridging</*handle*/ uint64_t>::toJs(rt, callInvoker,
3159
+ value);
3160
+ }
3161
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_poll_u8(
3162
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3163
+ size_t count) {
3164
+ ffi_breez_sdk_common_rust_future_poll_u8(
3165
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3166
+ args[0]),
3167
+ uniffi::breez_sdk_common::Bridging<
3168
+ UniffiRustFutureContinuationCallback>::fromJs(rt, callInvoker,
3169
+ args[1]),
3170
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3171
+ args[2]));
3172
+
3173
+ return jsi::Value::undefined();
3174
+ }
3175
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_cancel_u8(
3176
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3177
+ size_t count) {
3178
+ ffi_breez_sdk_common_rust_future_cancel_u8(
3179
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3180
+ args[0]));
3181
+
3182
+ return jsi::Value::undefined();
3183
+ }
3184
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_free_u8(
3185
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3186
+ size_t count) {
3187
+ ffi_breez_sdk_common_rust_future_free_u8(
3188
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3189
+ args[0]));
3190
+
3191
+ return jsi::Value::undefined();
3192
+ }
3193
+ jsi::Value
3194
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_complete_u8(
3195
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3196
+ size_t count) {
3197
+ RustCallStatus status =
3198
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::rustSuccess(rt);
3199
+ auto value = ffi_breez_sdk_common_rust_future_complete_u8(
3200
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3201
+ args[0]),
3202
+ &status);
3203
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::copyIntoJs(
3204
+ rt, callInvoker, status, args[count - 1]);
3205
+
3206
+ return uniffi_jsi::Bridging<uint8_t>::toJs(rt, callInvoker, value);
3207
+ }
3208
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_poll_i8(
3209
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3210
+ size_t count) {
3211
+ ffi_breez_sdk_common_rust_future_poll_i8(
3212
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3213
+ args[0]),
3214
+ uniffi::breez_sdk_common::Bridging<
3215
+ UniffiRustFutureContinuationCallback>::fromJs(rt, callInvoker,
3216
+ args[1]),
3217
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3218
+ args[2]));
3219
+
3220
+ return jsi::Value::undefined();
3221
+ }
3222
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_cancel_i8(
3223
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3224
+ size_t count) {
3225
+ ffi_breez_sdk_common_rust_future_cancel_i8(
3226
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3227
+ args[0]));
3228
+
3229
+ return jsi::Value::undefined();
3230
+ }
3231
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_free_i8(
3232
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3233
+ size_t count) {
3234
+ ffi_breez_sdk_common_rust_future_free_i8(
3235
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3236
+ args[0]));
3237
+
3238
+ return jsi::Value::undefined();
3239
+ }
3240
+ jsi::Value
3241
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_complete_i8(
3242
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3243
+ size_t count) {
3244
+ RustCallStatus status =
3245
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::rustSuccess(rt);
3246
+ auto value = ffi_breez_sdk_common_rust_future_complete_i8(
3247
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3248
+ args[0]),
3249
+ &status);
3250
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::copyIntoJs(
3251
+ rt, callInvoker, status, args[count - 1]);
3252
+
3253
+ return uniffi_jsi::Bridging<int8_t>::toJs(rt, callInvoker, value);
3254
+ }
3255
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_poll_u16(
3256
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3257
+ size_t count) {
3258
+ ffi_breez_sdk_common_rust_future_poll_u16(
3259
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3260
+ args[0]),
3261
+ uniffi::breez_sdk_common::Bridging<
3262
+ UniffiRustFutureContinuationCallback>::fromJs(rt, callInvoker,
3263
+ args[1]),
3264
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3265
+ args[2]));
3266
+
3267
+ return jsi::Value::undefined();
3268
+ }
3269
+ jsi::Value
3270
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_cancel_u16(
3271
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3272
+ size_t count) {
3273
+ ffi_breez_sdk_common_rust_future_cancel_u16(
3274
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3275
+ args[0]));
3276
+
3277
+ return jsi::Value::undefined();
3278
+ }
3279
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_free_u16(
3280
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3281
+ size_t count) {
3282
+ ffi_breez_sdk_common_rust_future_free_u16(
3283
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3284
+ args[0]));
3285
+
3286
+ return jsi::Value::undefined();
3287
+ }
3288
+ jsi::Value
3289
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_complete_u16(
3290
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3291
+ size_t count) {
3292
+ RustCallStatus status =
3293
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::rustSuccess(rt);
3294
+ auto value = ffi_breez_sdk_common_rust_future_complete_u16(
3295
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3296
+ args[0]),
3297
+ &status);
3298
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::copyIntoJs(
3299
+ rt, callInvoker, status, args[count - 1]);
3300
+
3301
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
3302
+ }
3303
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_poll_i16(
3304
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3305
+ size_t count) {
3306
+ ffi_breez_sdk_common_rust_future_poll_i16(
3307
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3308
+ args[0]),
3309
+ uniffi::breez_sdk_common::Bridging<
3310
+ UniffiRustFutureContinuationCallback>::fromJs(rt, callInvoker,
3311
+ args[1]),
3312
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3313
+ args[2]));
3314
+
3315
+ return jsi::Value::undefined();
3316
+ }
3317
+ jsi::Value
3318
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_cancel_i16(
3319
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3320
+ size_t count) {
3321
+ ffi_breez_sdk_common_rust_future_cancel_i16(
3322
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3323
+ args[0]));
3324
+
3325
+ return jsi::Value::undefined();
3326
+ }
3327
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_free_i16(
3328
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3329
+ size_t count) {
3330
+ ffi_breez_sdk_common_rust_future_free_i16(
3331
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3332
+ args[0]));
3333
+
3334
+ return jsi::Value::undefined();
3335
+ }
3336
+ jsi::Value
3337
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_complete_i16(
3338
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3339
+ size_t count) {
3340
+ RustCallStatus status =
3341
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::rustSuccess(rt);
3342
+ auto value = ffi_breez_sdk_common_rust_future_complete_i16(
3343
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3344
+ args[0]),
3345
+ &status);
3346
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::copyIntoJs(
3347
+ rt, callInvoker, status, args[count - 1]);
3348
+
3349
+ return uniffi_jsi::Bridging<int16_t>::toJs(rt, callInvoker, value);
3350
+ }
3351
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_poll_u32(
3352
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3353
+ size_t count) {
3354
+ ffi_breez_sdk_common_rust_future_poll_u32(
3355
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3356
+ args[0]),
3357
+ uniffi::breez_sdk_common::Bridging<
3358
+ UniffiRustFutureContinuationCallback>::fromJs(rt, callInvoker,
3359
+ args[1]),
3360
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3361
+ args[2]));
3362
+
3363
+ return jsi::Value::undefined();
3364
+ }
3365
+ jsi::Value
3366
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_cancel_u32(
3367
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3368
+ size_t count) {
3369
+ ffi_breez_sdk_common_rust_future_cancel_u32(
3370
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3371
+ args[0]));
3372
+
3373
+ return jsi::Value::undefined();
3374
+ }
3375
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_free_u32(
3376
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3377
+ size_t count) {
3378
+ ffi_breez_sdk_common_rust_future_free_u32(
3379
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3380
+ args[0]));
3381
+
3382
+ return jsi::Value::undefined();
3383
+ }
3384
+ jsi::Value
3385
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_complete_u32(
3386
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3387
+ size_t count) {
3388
+ RustCallStatus status =
3389
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::rustSuccess(rt);
3390
+ auto value = ffi_breez_sdk_common_rust_future_complete_u32(
3391
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3392
+ args[0]),
3393
+ &status);
3394
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::copyIntoJs(
3395
+ rt, callInvoker, status, args[count - 1]);
3396
+
3397
+ return uniffi_jsi::Bridging<uint32_t>::toJs(rt, callInvoker, value);
3398
+ }
3399
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_poll_i32(
3400
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3401
+ size_t count) {
3402
+ ffi_breez_sdk_common_rust_future_poll_i32(
3403
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3404
+ args[0]),
3405
+ uniffi::breez_sdk_common::Bridging<
3406
+ UniffiRustFutureContinuationCallback>::fromJs(rt, callInvoker,
3407
+ args[1]),
3408
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3409
+ args[2]));
3410
+
3411
+ return jsi::Value::undefined();
3412
+ }
3413
+ jsi::Value
3414
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_cancel_i32(
3415
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3416
+ size_t count) {
3417
+ ffi_breez_sdk_common_rust_future_cancel_i32(
3418
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3419
+ args[0]));
3420
+
3421
+ return jsi::Value::undefined();
3422
+ }
3423
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_free_i32(
3424
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3425
+ size_t count) {
3426
+ ffi_breez_sdk_common_rust_future_free_i32(
3427
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3428
+ args[0]));
3429
+
3430
+ return jsi::Value::undefined();
3431
+ }
3432
+ jsi::Value
3433
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_complete_i32(
3434
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3435
+ size_t count) {
3436
+ RustCallStatus status =
3437
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::rustSuccess(rt);
3438
+ auto value = ffi_breez_sdk_common_rust_future_complete_i32(
3439
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3440
+ args[0]),
3441
+ &status);
3442
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::copyIntoJs(
3443
+ rt, callInvoker, status, args[count - 1]);
3444
+
3445
+ return uniffi_jsi::Bridging<int32_t>::toJs(rt, callInvoker, value);
3446
+ }
3447
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_poll_u64(
3448
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3449
+ size_t count) {
3450
+ ffi_breez_sdk_common_rust_future_poll_u64(
3451
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3452
+ args[0]),
3453
+ uniffi::breez_sdk_common::Bridging<
3454
+ UniffiRustFutureContinuationCallback>::fromJs(rt, callInvoker,
3455
+ args[1]),
3456
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3457
+ args[2]));
3458
+
3459
+ return jsi::Value::undefined();
3460
+ }
3461
+ jsi::Value
3462
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_cancel_u64(
3463
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3464
+ size_t count) {
3465
+ ffi_breez_sdk_common_rust_future_cancel_u64(
3466
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3467
+ args[0]));
3468
+
3469
+ return jsi::Value::undefined();
3470
+ }
3471
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_free_u64(
3472
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3473
+ size_t count) {
3474
+ ffi_breez_sdk_common_rust_future_free_u64(
3475
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3476
+ args[0]));
3477
+
3478
+ return jsi::Value::undefined();
3479
+ }
3480
+ jsi::Value
3481
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_complete_u64(
3482
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3483
+ size_t count) {
3484
+ RustCallStatus status =
3485
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::rustSuccess(rt);
3486
+ auto value = ffi_breez_sdk_common_rust_future_complete_u64(
3487
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3488
+ args[0]),
3489
+ &status);
3490
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::copyIntoJs(
3491
+ rt, callInvoker, status, args[count - 1]);
3492
+
3493
+ return uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, value);
3494
+ }
3495
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_poll_i64(
3496
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3497
+ size_t count) {
3498
+ ffi_breez_sdk_common_rust_future_poll_i64(
3499
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3500
+ args[0]),
3501
+ uniffi::breez_sdk_common::Bridging<
3502
+ UniffiRustFutureContinuationCallback>::fromJs(rt, callInvoker,
3503
+ args[1]),
3504
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3505
+ args[2]));
3506
+
3507
+ return jsi::Value::undefined();
3508
+ }
3509
+ jsi::Value
3510
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_cancel_i64(
3511
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3512
+ size_t count) {
3513
+ ffi_breez_sdk_common_rust_future_cancel_i64(
3514
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3515
+ args[0]));
3516
+
3517
+ return jsi::Value::undefined();
3518
+ }
3519
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_free_i64(
3520
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3521
+ size_t count) {
3522
+ ffi_breez_sdk_common_rust_future_free_i64(
3523
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3524
+ args[0]));
3525
+
3526
+ return jsi::Value::undefined();
3527
+ }
3528
+ jsi::Value
3529
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_complete_i64(
3530
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3531
+ size_t count) {
3532
+ RustCallStatus status =
3533
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::rustSuccess(rt);
3534
+ auto value = ffi_breez_sdk_common_rust_future_complete_i64(
3535
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3536
+ args[0]),
3537
+ &status);
3538
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::copyIntoJs(
3539
+ rt, callInvoker, status, args[count - 1]);
3540
+
3541
+ return uniffi_jsi::Bridging<int64_t>::toJs(rt, callInvoker, value);
3542
+ }
3543
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_poll_f32(
3544
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3545
+ size_t count) {
3546
+ ffi_breez_sdk_common_rust_future_poll_f32(
3547
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3548
+ args[0]),
3549
+ uniffi::breez_sdk_common::Bridging<
3550
+ UniffiRustFutureContinuationCallback>::fromJs(rt, callInvoker,
3551
+ args[1]),
3552
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3553
+ args[2]));
3554
+
3555
+ return jsi::Value::undefined();
3556
+ }
3557
+ jsi::Value
3558
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_cancel_f32(
3559
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3560
+ size_t count) {
3561
+ ffi_breez_sdk_common_rust_future_cancel_f32(
3562
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3563
+ args[0]));
3564
+
3565
+ return jsi::Value::undefined();
3566
+ }
3567
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_free_f32(
3568
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3569
+ size_t count) {
3570
+ ffi_breez_sdk_common_rust_future_free_f32(
3571
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3572
+ args[0]));
3573
+
3574
+ return jsi::Value::undefined();
3575
+ }
3576
+ jsi::Value
3577
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_complete_f32(
3578
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3579
+ size_t count) {
3580
+ RustCallStatus status =
3581
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::rustSuccess(rt);
3582
+ auto value = ffi_breez_sdk_common_rust_future_complete_f32(
3583
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3584
+ args[0]),
3585
+ &status);
3586
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::copyIntoJs(
3587
+ rt, callInvoker, status, args[count - 1]);
3588
+
3589
+ return uniffi_jsi::Bridging<float>::toJs(rt, callInvoker, value);
3590
+ }
3591
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_poll_f64(
3592
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3593
+ size_t count) {
3594
+ ffi_breez_sdk_common_rust_future_poll_f64(
3595
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3596
+ args[0]),
3597
+ uniffi::breez_sdk_common::Bridging<
3598
+ UniffiRustFutureContinuationCallback>::fromJs(rt, callInvoker,
3599
+ args[1]),
3600
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3601
+ args[2]));
3602
+
3603
+ return jsi::Value::undefined();
3604
+ }
3605
+ jsi::Value
3606
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_cancel_f64(
3607
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3608
+ size_t count) {
3609
+ ffi_breez_sdk_common_rust_future_cancel_f64(
3610
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3611
+ args[0]));
3612
+
3613
+ return jsi::Value::undefined();
3614
+ }
3615
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_free_f64(
3616
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3617
+ size_t count) {
3618
+ ffi_breez_sdk_common_rust_future_free_f64(
3619
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3620
+ args[0]));
3621
+
3622
+ return jsi::Value::undefined();
3623
+ }
3624
+ jsi::Value
3625
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_complete_f64(
3626
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3627
+ size_t count) {
3628
+ RustCallStatus status =
3629
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::rustSuccess(rt);
3630
+ auto value = ffi_breez_sdk_common_rust_future_complete_f64(
3631
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3632
+ args[0]),
3633
+ &status);
3634
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::copyIntoJs(
3635
+ rt, callInvoker, status, args[count - 1]);
3636
+
3637
+ return uniffi_jsi::Bridging<double>::toJs(rt, callInvoker, value);
3638
+ }
3639
+ jsi::Value
3640
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_poll_pointer(
3641
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3642
+ size_t count) {
3643
+ ffi_breez_sdk_common_rust_future_poll_pointer(
3644
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3645
+ args[0]),
3646
+ uniffi::breez_sdk_common::Bridging<
3647
+ UniffiRustFutureContinuationCallback>::fromJs(rt, callInvoker,
3648
+ args[1]),
3649
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3650
+ args[2]));
3651
+
3652
+ return jsi::Value::undefined();
3653
+ }
3654
+ jsi::Value
3655
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_cancel_pointer(
3656
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3657
+ size_t count) {
3658
+ ffi_breez_sdk_common_rust_future_cancel_pointer(
3659
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3660
+ args[0]));
3661
+
3662
+ return jsi::Value::undefined();
3663
+ }
3664
+ jsi::Value
3665
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_free_pointer(
3666
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3667
+ size_t count) {
3668
+ ffi_breez_sdk_common_rust_future_free_pointer(
3669
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3670
+ args[0]));
3671
+
3672
+ return jsi::Value::undefined();
3673
+ }
3674
+ jsi::Value
3675
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_complete_pointer(
3676
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3677
+ size_t count) {
3678
+ RustCallStatus status =
3679
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::rustSuccess(rt);
3680
+ auto value = ffi_breez_sdk_common_rust_future_complete_pointer(
3681
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3682
+ args[0]),
3683
+ &status);
3684
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::copyIntoJs(
3685
+ rt, callInvoker, status, args[count - 1]);
3686
+
3687
+ return uniffi_jsi::Bridging<void *>::toJs(rt, callInvoker, value);
3688
+ }
3689
+ jsi::Value
3690
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_poll_rust_buffer(
3691
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3692
+ size_t count) {
3693
+ ffi_breez_sdk_common_rust_future_poll_rust_buffer(
3694
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3695
+ args[0]),
3696
+ uniffi::breez_sdk_common::Bridging<
3697
+ UniffiRustFutureContinuationCallback>::fromJs(rt, callInvoker,
3698
+ args[1]),
3699
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3700
+ args[2]));
3701
+
3702
+ return jsi::Value::undefined();
3703
+ }
3704
+ jsi::Value
3705
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_cancel_rust_buffer(
3706
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3707
+ size_t count) {
3708
+ ffi_breez_sdk_common_rust_future_cancel_rust_buffer(
3709
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3710
+ args[0]));
3711
+
3712
+ return jsi::Value::undefined();
3713
+ }
3714
+ jsi::Value
3715
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_free_rust_buffer(
3716
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3717
+ size_t count) {
3718
+ ffi_breez_sdk_common_rust_future_free_rust_buffer(
3719
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3720
+ args[0]));
3721
+
3722
+ return jsi::Value::undefined();
3723
+ }
3724
+ jsi::Value
3725
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_complete_rust_buffer(
3726
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3727
+ size_t count) {
3728
+ RustCallStatus status =
3729
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::rustSuccess(rt);
3730
+ auto value = ffi_breez_sdk_common_rust_future_complete_rust_buffer(
3731
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3732
+ args[0]),
3733
+ &status);
3734
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::copyIntoJs(
3735
+ rt, callInvoker, status, args[count - 1]);
3736
+
3737
+ return uniffi::breez_sdk_common::Bridging<RustBuffer>::toJs(rt, callInvoker,
3738
+ value);
3739
+ }
3740
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_poll_void(
3741
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3742
+ size_t count) {
3743
+ ffi_breez_sdk_common_rust_future_poll_void(
3744
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3745
+ args[0]),
3746
+ uniffi::breez_sdk_common::Bridging<
3747
+ UniffiRustFutureContinuationCallback>::fromJs(rt, callInvoker,
3748
+ args[1]),
3749
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3750
+ args[2]));
3751
+
3752
+ return jsi::Value::undefined();
3753
+ }
3754
+ jsi::Value
3755
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_cancel_void(
3756
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3757
+ size_t count) {
3758
+ ffi_breez_sdk_common_rust_future_cancel_void(
3759
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3760
+ args[0]));
3761
+
3762
+ return jsi::Value::undefined();
3763
+ }
3764
+ jsi::Value NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_free_void(
3765
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3766
+ size_t count) {
3767
+ ffi_breez_sdk_common_rust_future_free_void(
3768
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3769
+ args[0]));
3770
+
3771
+ return jsi::Value::undefined();
3772
+ }
3773
+ jsi::Value
3774
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_rust_future_complete_void(
3775
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3776
+ size_t count) {
3777
+ RustCallStatus status =
3778
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::rustSuccess(rt);
3779
+ ffi_breez_sdk_common_rust_future_complete_void(
3780
+ uniffi_jsi::Bridging</*handle*/ uint64_t>::fromJs(rt, callInvoker,
3781
+ args[0]),
3782
+ &status);
3783
+ uniffi::breez_sdk_common::Bridging<RustCallStatus>::copyIntoJs(
3784
+ rt, callInvoker, status, args[count - 1]);
3785
+
3786
+ return jsi::Value::undefined();
3787
+ }
3788
+ jsi::Value NativeBreezSdkCommon::
3789
+ cpp_uniffi_breez_sdk_common_checksum_method_restclient_get(
3790
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3791
+ size_t count) {
3792
+ auto value = uniffi_breez_sdk_common_checksum_method_restclient_get();
3793
+
3794
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
3795
+ }
3796
+ jsi::Value NativeBreezSdkCommon::
3797
+ cpp_uniffi_breez_sdk_common_checksum_method_restclient_post(
3798
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3799
+ size_t count) {
3800
+ auto value = uniffi_breez_sdk_common_checksum_method_restclient_post();
3801
+
3802
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
3803
+ }
3804
+ jsi::Value NativeBreezSdkCommon::
3805
+ cpp_uniffi_breez_sdk_common_checksum_method_restclient_delete(
3806
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3807
+ size_t count) {
3808
+ auto value = uniffi_breez_sdk_common_checksum_method_restclient_delete();
3809
+
3810
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
3811
+ }
3812
+ jsi::Value
3813
+ NativeBreezSdkCommon::cpp_ffi_breez_sdk_common_uniffi_contract_version(
3814
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3815
+ size_t count) {
3816
+ auto value = ffi_breez_sdk_common_uniffi_contract_version();
3817
+
3818
+ return uniffi_jsi::Bridging<uint32_t>::toJs(rt, callInvoker, value);
3819
+ }
3820
+ jsi::Value NativeBreezSdkCommon::
3821
+ cpp_uniffi_breez_sdk_common_fn_init_callback_vtable_restclient(
3822
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
3823
+ size_t count) {
3824
+ auto vtableInstance = uniffi::breez_sdk_common::Bridging<
3825
+ UniffiVTableCallbackInterfaceRestClient>::fromJs(rt, callInvoker,
3826
+ args[0]);
3827
+
3828
+ std::lock_guard<std::mutex> lock(
3829
+ uniffi::breez_sdk_common::registry::vtableMutex);
3830
+ uniffi_breez_sdk_common_fn_init_callback_vtable_restclient(
3831
+ uniffi::breez_sdk_common::registry::putTable(
3832
+ "UniffiVTableCallbackInterfaceRestClient", vtableInstance));
3833
+ return jsi::Value::undefined();
3834
+ }