@breeztech/breez-sdk-spark-react-native 0.3.4 → 0.4.0-dev3

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