@bennyblader/ddk-rn 0.1.4

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 (60) hide show
  1. package/DdkRn.podspec +44 -0
  2. package/LICENSE +20 -0
  3. package/README.md +33 -0
  4. package/android/CMakeLists.txt +76 -0
  5. package/android/build.gradle +144 -0
  6. package/android/cpp-adapter.cpp +63 -0
  7. package/android/gradle.properties +5 -0
  8. package/android/proguard-rules.pro +4 -0
  9. package/android/src/main/AndroidManifest.xml +5 -0
  10. package/android/src/main/AndroidManifestNew.xml +2 -0
  11. package/android/src/main/java/com/ddkrn/DdkRnModule.kt +43 -0
  12. package/android/src/main/java/com/ddkrn/DdkRnPackage.kt +34 -0
  13. package/cpp/bennyblader-ddk-rn.cpp +16 -0
  14. package/cpp/bennyblader-ddk-rn.h +15 -0
  15. package/cpp/ddk_ffi.cpp +2557 -0
  16. package/cpp/ddk_ffi.hpp +78 -0
  17. package/ios/DdkRn.h +16 -0
  18. package/ios/DdkRn.mm +66 -0
  19. package/lib/commonjs/NativeDdkRn.js +10 -0
  20. package/lib/commonjs/NativeDdkRn.js.map +1 -0
  21. package/lib/commonjs/ddk_ffi-ffi.js +44 -0
  22. package/lib/commonjs/ddk_ffi-ffi.js.map +1 -0
  23. package/lib/commonjs/ddk_ffi.js +1072 -0
  24. package/lib/commonjs/ddk_ffi.js.map +1 -0
  25. package/lib/commonjs/index.js +63 -0
  26. package/lib/commonjs/index.js.map +1 -0
  27. package/lib/commonjs/package.json +1 -0
  28. package/lib/module/NativeDdkRn.js +7 -0
  29. package/lib/module/NativeDdkRn.js.map +1 -0
  30. package/lib/module/ddk_ffi-ffi.js +43 -0
  31. package/lib/module/ddk_ffi-ffi.js.map +1 -0
  32. package/lib/module/ddk_ffi.js +1052 -0
  33. package/lib/module/ddk_ffi.js.map +1 -0
  34. package/lib/module/index.js +43 -0
  35. package/lib/module/index.js.map +1 -0
  36. package/lib/module/package.json +1 -0
  37. package/lib/typescript/commonjs/package.json +1 -0
  38. package/lib/typescript/commonjs/src/NativeDdkRn.d.ts +8 -0
  39. package/lib/typescript/commonjs/src/NativeDdkRn.d.ts.map +1 -0
  40. package/lib/typescript/commonjs/src/ddk_ffi-ffi.d.ts +108 -0
  41. package/lib/typescript/commonjs/src/ddk_ffi-ffi.d.ts.map +1 -0
  42. package/lib/typescript/commonjs/src/ddk_ffi.d.ts +773 -0
  43. package/lib/typescript/commonjs/src/ddk_ffi.d.ts.map +1 -0
  44. package/lib/typescript/commonjs/src/index.d.ts +8 -0
  45. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  46. package/lib/typescript/module/package.json +1 -0
  47. package/lib/typescript/module/src/NativeDdkRn.d.ts +8 -0
  48. package/lib/typescript/module/src/NativeDdkRn.d.ts.map +1 -0
  49. package/lib/typescript/module/src/ddk_ffi-ffi.d.ts +108 -0
  50. package/lib/typescript/module/src/ddk_ffi-ffi.d.ts.map +1 -0
  51. package/lib/typescript/module/src/ddk_ffi.d.ts +773 -0
  52. package/lib/typescript/module/src/ddk_ffi.d.ts.map +1 -0
  53. package/lib/typescript/module/src/index.d.ts +8 -0
  54. package/lib/typescript/module/src/index.d.ts.map +1 -0
  55. package/package.json +206 -0
  56. package/scripts/postinstall.js +130 -0
  57. package/src/NativeDdkRn.ts +10 -0
  58. package/src/ddk_ffi-ffi.ts +307 -0
  59. package/src/ddk_ffi.ts +1743 -0
  60. package/src/index.tsx +41 -0
@@ -0,0 +1,2557 @@
1
+ // This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
2
+ // Trust me, you don't want to mess with it!
3
+ #include "ddk_ffi.hpp"
4
+
5
+ #include "UniffiJsiTypes.h"
6
+ #include <stdexcept>
7
+ #include <map>
8
+ #include <utility>
9
+ #include <iostream>
10
+ #include <thread>
11
+
12
+ namespace react = facebook::react;
13
+ namespace jsi = facebook::jsi;
14
+
15
+ // Calling into Rust.
16
+ extern "C" {
17
+ typedef void
18
+ (*UniffiRustFutureContinuationCallback)(
19
+ uint64_t data,
20
+ int8_t poll_result
21
+ );
22
+ typedef void
23
+ (*UniffiForeignFutureFree)(
24
+ uint64_t handle
25
+ );
26
+ typedef void
27
+ (*UniffiCallbackInterfaceFree)(
28
+ uint64_t handle
29
+ );typedef struct UniffiForeignFuture {
30
+ uint64_t handle;
31
+ UniffiForeignFutureFree free;
32
+ } UniffiForeignFuture;typedef struct UniffiForeignFutureStructU8 {
33
+ uint8_t return_value;
34
+ RustCallStatus call_status;
35
+ } UniffiForeignFutureStructU8;
36
+ typedef void
37
+ (*UniffiForeignFutureCompleteU8)(
38
+ uint64_t callback_data,
39
+ UniffiForeignFutureStructU8 result
40
+ );typedef struct UniffiForeignFutureStructI8 {
41
+ int8_t return_value;
42
+ RustCallStatus call_status;
43
+ } UniffiForeignFutureStructI8;
44
+ typedef void
45
+ (*UniffiForeignFutureCompleteI8)(
46
+ uint64_t callback_data,
47
+ UniffiForeignFutureStructI8 result
48
+ );typedef struct UniffiForeignFutureStructU16 {
49
+ uint16_t return_value;
50
+ RustCallStatus call_status;
51
+ } UniffiForeignFutureStructU16;
52
+ typedef void
53
+ (*UniffiForeignFutureCompleteU16)(
54
+ uint64_t callback_data,
55
+ UniffiForeignFutureStructU16 result
56
+ );typedef struct UniffiForeignFutureStructI16 {
57
+ int16_t return_value;
58
+ RustCallStatus call_status;
59
+ } UniffiForeignFutureStructI16;
60
+ typedef void
61
+ (*UniffiForeignFutureCompleteI16)(
62
+ uint64_t callback_data,
63
+ UniffiForeignFutureStructI16 result
64
+ );typedef struct UniffiForeignFutureStructU32 {
65
+ uint32_t return_value;
66
+ RustCallStatus call_status;
67
+ } UniffiForeignFutureStructU32;
68
+ typedef void
69
+ (*UniffiForeignFutureCompleteU32)(
70
+ uint64_t callback_data,
71
+ UniffiForeignFutureStructU32 result
72
+ );typedef struct UniffiForeignFutureStructI32 {
73
+ int32_t return_value;
74
+ RustCallStatus call_status;
75
+ } UniffiForeignFutureStructI32;
76
+ typedef void
77
+ (*UniffiForeignFutureCompleteI32)(
78
+ uint64_t callback_data,
79
+ UniffiForeignFutureStructI32 result
80
+ );typedef struct UniffiForeignFutureStructU64 {
81
+ uint64_t return_value;
82
+ RustCallStatus call_status;
83
+ } UniffiForeignFutureStructU64;
84
+ typedef void
85
+ (*UniffiForeignFutureCompleteU64)(
86
+ uint64_t callback_data,
87
+ UniffiForeignFutureStructU64 result
88
+ );typedef struct UniffiForeignFutureStructI64 {
89
+ int64_t return_value;
90
+ RustCallStatus call_status;
91
+ } UniffiForeignFutureStructI64;
92
+ typedef void
93
+ (*UniffiForeignFutureCompleteI64)(
94
+ uint64_t callback_data,
95
+ UniffiForeignFutureStructI64 result
96
+ );typedef struct UniffiForeignFutureStructF32 {
97
+ float return_value;
98
+ RustCallStatus call_status;
99
+ } UniffiForeignFutureStructF32;
100
+ typedef void
101
+ (*UniffiForeignFutureCompleteF32)(
102
+ uint64_t callback_data,
103
+ UniffiForeignFutureStructF32 result
104
+ );typedef struct UniffiForeignFutureStructF64 {
105
+ double return_value;
106
+ RustCallStatus call_status;
107
+ } UniffiForeignFutureStructF64;
108
+ typedef void
109
+ (*UniffiForeignFutureCompleteF64)(
110
+ uint64_t callback_data,
111
+ UniffiForeignFutureStructF64 result
112
+ );typedef struct UniffiForeignFutureStructPointer {
113
+ void * return_value;
114
+ RustCallStatus call_status;
115
+ } UniffiForeignFutureStructPointer;
116
+ typedef void
117
+ (*UniffiForeignFutureCompletePointer)(
118
+ uint64_t callback_data,
119
+ UniffiForeignFutureStructPointer result
120
+ );typedef struct UniffiForeignFutureStructRustBuffer {
121
+ RustBuffer return_value;
122
+ RustCallStatus call_status;
123
+ } UniffiForeignFutureStructRustBuffer;
124
+ typedef void
125
+ (*UniffiForeignFutureCompleteRustBuffer)(
126
+ uint64_t callback_data,
127
+ UniffiForeignFutureStructRustBuffer result
128
+ );typedef struct UniffiForeignFutureStructVoid {
129
+ RustCallStatus call_status;
130
+ } UniffiForeignFutureStructVoid;
131
+ typedef void
132
+ (*UniffiForeignFutureCompleteVoid)(
133
+ uint64_t callback_data,
134
+ UniffiForeignFutureStructVoid result
135
+ );
136
+ RustBuffer uniffi_ddk_ffi_fn_func_create_cet(
137
+ RustBuffer local_output,
138
+ uint64_t local_payout_serial_id,
139
+ RustBuffer remote_output,
140
+ uint64_t remote_payout_serial_id,
141
+ RustBuffer fund_tx_id,
142
+ uint32_t fund_vout,
143
+ uint32_t lock_time,
144
+ RustCallStatus *uniffi_out_err
145
+ );
146
+ RustBuffer uniffi_ddk_ffi_fn_func_create_cet_adaptor_signature_from_oracle_info(
147
+ RustBuffer cet,
148
+ RustBuffer oracle_info,
149
+ RustBuffer funding_sk,
150
+ RustBuffer funding_script_pubkey,
151
+ uint64_t total_collateral,
152
+ RustBuffer msgs,
153
+ RustCallStatus *uniffi_out_err
154
+ );
155
+ RustBuffer uniffi_ddk_ffi_fn_func_create_cets(
156
+ RustBuffer fund_tx_id,
157
+ uint32_t fund_vout,
158
+ RustBuffer local_final_script_pubkey,
159
+ RustBuffer remote_final_script_pubkey,
160
+ RustBuffer outcomes,
161
+ uint32_t lock_time,
162
+ uint64_t local_serial_id,
163
+ uint64_t remote_serial_id,
164
+ RustCallStatus *uniffi_out_err
165
+ );
166
+ RustBuffer uniffi_ddk_ffi_fn_func_create_dlc_transactions(
167
+ RustBuffer outcomes,
168
+ RustBuffer local_params,
169
+ RustBuffer remote_params,
170
+ uint32_t refund_locktime,
171
+ uint64_t fee_rate,
172
+ uint32_t fund_lock_time,
173
+ uint32_t cet_lock_time,
174
+ uint64_t fund_output_serial_id,
175
+ RustCallStatus *uniffi_out_err
176
+ );
177
+ RustBuffer uniffi_ddk_ffi_fn_func_create_fund_tx_locking_script(
178
+ RustBuffer local_fund_pubkey,
179
+ RustBuffer remote_fund_pubkey,
180
+ RustCallStatus *uniffi_out_err
181
+ );
182
+ RustBuffer uniffi_ddk_ffi_fn_func_create_refund_transaction(
183
+ RustBuffer local_final_script_pubkey,
184
+ RustBuffer remote_final_script_pubkey,
185
+ uint64_t local_amount,
186
+ uint64_t remote_amount,
187
+ uint32_t lock_time,
188
+ RustBuffer fund_tx_id,
189
+ uint32_t fund_vout,
190
+ RustCallStatus *uniffi_out_err
191
+ );
192
+ RustBuffer uniffi_ddk_ffi_fn_func_create_spliced_dlc_transactions(
193
+ RustBuffer outcomes,
194
+ RustBuffer local_params,
195
+ RustBuffer remote_params,
196
+ uint32_t refund_locktime,
197
+ uint64_t fee_rate,
198
+ uint32_t fund_lock_time,
199
+ uint32_t cet_lock_time,
200
+ uint64_t fund_output_serial_id,
201
+ RustCallStatus *uniffi_out_err
202
+ );
203
+ RustBuffer uniffi_ddk_ffi_fn_func_get_change_output_and_fees(
204
+ RustBuffer params,
205
+ uint64_t fee_rate,
206
+ RustCallStatus *uniffi_out_err
207
+ );
208
+ RustBuffer uniffi_ddk_ffi_fn_func_get_raw_funding_transaction_input_signature(
209
+ RustBuffer funding_transaction,
210
+ RustBuffer privkey,
211
+ RustBuffer prev_tx_id,
212
+ uint32_t prev_tx_vout,
213
+ uint64_t value,
214
+ RustCallStatus *uniffi_out_err
215
+ );
216
+ uint32_t uniffi_ddk_ffi_fn_func_get_total_input_vsize(
217
+ RustBuffer inputs,
218
+ RustCallStatus *uniffi_out_err
219
+ );
220
+ int8_t uniffi_ddk_ffi_fn_func_is_dust_output(
221
+ RustBuffer output,
222
+ RustCallStatus *uniffi_out_err
223
+ );
224
+ RustBuffer uniffi_ddk_ffi_fn_func_sign_fund_transaction_input(
225
+ RustBuffer fund_transaction,
226
+ RustBuffer privkey,
227
+ RustBuffer prev_tx_id,
228
+ uint32_t prev_tx_vout,
229
+ uint64_t value,
230
+ RustCallStatus *uniffi_out_err
231
+ );
232
+ int8_t uniffi_ddk_ffi_fn_func_verify_fund_tx_signature(
233
+ RustBuffer fund_tx,
234
+ RustBuffer signature,
235
+ RustBuffer pubkey,
236
+ RustBuffer txid,
237
+ uint32_t vout,
238
+ uint64_t input_amount,
239
+ RustCallStatus *uniffi_out_err
240
+ );
241
+ RustBuffer uniffi_ddk_ffi_fn_func_version(RustCallStatus *uniffi_out_err
242
+ );
243
+ RustBuffer ffi_ddk_ffi_rustbuffer_alloc(
244
+ uint64_t size,
245
+ RustCallStatus *uniffi_out_err
246
+ );
247
+ RustBuffer ffi_ddk_ffi_rustbuffer_from_bytes(
248
+ ForeignBytes bytes,
249
+ RustCallStatus *uniffi_out_err
250
+ );
251
+ void ffi_ddk_ffi_rustbuffer_free(
252
+ RustBuffer buf,
253
+ RustCallStatus *uniffi_out_err
254
+ );
255
+ RustBuffer ffi_ddk_ffi_rustbuffer_reserve(
256
+ RustBuffer buf,
257
+ uint64_t additional,
258
+ RustCallStatus *uniffi_out_err
259
+ );
260
+ void ffi_ddk_ffi_rust_future_poll_u8(
261
+ /*handle*/ uint64_t handle,
262
+ UniffiRustFutureContinuationCallback callback,
263
+ /*handle*/ uint64_t callback_data
264
+ );
265
+ void ffi_ddk_ffi_rust_future_cancel_u8(
266
+ /*handle*/ uint64_t handle
267
+ );
268
+ void ffi_ddk_ffi_rust_future_free_u8(
269
+ /*handle*/ uint64_t handle
270
+ );
271
+ uint8_t ffi_ddk_ffi_rust_future_complete_u8(
272
+ /*handle*/ uint64_t handle,
273
+ RustCallStatus *uniffi_out_err
274
+ );
275
+ void ffi_ddk_ffi_rust_future_poll_i8(
276
+ /*handle*/ uint64_t handle,
277
+ UniffiRustFutureContinuationCallback callback,
278
+ /*handle*/ uint64_t callback_data
279
+ );
280
+ void ffi_ddk_ffi_rust_future_cancel_i8(
281
+ /*handle*/ uint64_t handle
282
+ );
283
+ void ffi_ddk_ffi_rust_future_free_i8(
284
+ /*handle*/ uint64_t handle
285
+ );
286
+ int8_t ffi_ddk_ffi_rust_future_complete_i8(
287
+ /*handle*/ uint64_t handle,
288
+ RustCallStatus *uniffi_out_err
289
+ );
290
+ void ffi_ddk_ffi_rust_future_poll_u16(
291
+ /*handle*/ uint64_t handle,
292
+ UniffiRustFutureContinuationCallback callback,
293
+ /*handle*/ uint64_t callback_data
294
+ );
295
+ void ffi_ddk_ffi_rust_future_cancel_u16(
296
+ /*handle*/ uint64_t handle
297
+ );
298
+ void ffi_ddk_ffi_rust_future_free_u16(
299
+ /*handle*/ uint64_t handle
300
+ );
301
+ uint16_t ffi_ddk_ffi_rust_future_complete_u16(
302
+ /*handle*/ uint64_t handle,
303
+ RustCallStatus *uniffi_out_err
304
+ );
305
+ void ffi_ddk_ffi_rust_future_poll_i16(
306
+ /*handle*/ uint64_t handle,
307
+ UniffiRustFutureContinuationCallback callback,
308
+ /*handle*/ uint64_t callback_data
309
+ );
310
+ void ffi_ddk_ffi_rust_future_cancel_i16(
311
+ /*handle*/ uint64_t handle
312
+ );
313
+ void ffi_ddk_ffi_rust_future_free_i16(
314
+ /*handle*/ uint64_t handle
315
+ );
316
+ int16_t ffi_ddk_ffi_rust_future_complete_i16(
317
+ /*handle*/ uint64_t handle,
318
+ RustCallStatus *uniffi_out_err
319
+ );
320
+ void ffi_ddk_ffi_rust_future_poll_u32(
321
+ /*handle*/ uint64_t handle,
322
+ UniffiRustFutureContinuationCallback callback,
323
+ /*handle*/ uint64_t callback_data
324
+ );
325
+ void ffi_ddk_ffi_rust_future_cancel_u32(
326
+ /*handle*/ uint64_t handle
327
+ );
328
+ void ffi_ddk_ffi_rust_future_free_u32(
329
+ /*handle*/ uint64_t handle
330
+ );
331
+ uint32_t ffi_ddk_ffi_rust_future_complete_u32(
332
+ /*handle*/ uint64_t handle,
333
+ RustCallStatus *uniffi_out_err
334
+ );
335
+ void ffi_ddk_ffi_rust_future_poll_i32(
336
+ /*handle*/ uint64_t handle,
337
+ UniffiRustFutureContinuationCallback callback,
338
+ /*handle*/ uint64_t callback_data
339
+ );
340
+ void ffi_ddk_ffi_rust_future_cancel_i32(
341
+ /*handle*/ uint64_t handle
342
+ );
343
+ void ffi_ddk_ffi_rust_future_free_i32(
344
+ /*handle*/ uint64_t handle
345
+ );
346
+ int32_t ffi_ddk_ffi_rust_future_complete_i32(
347
+ /*handle*/ uint64_t handle,
348
+ RustCallStatus *uniffi_out_err
349
+ );
350
+ void ffi_ddk_ffi_rust_future_poll_u64(
351
+ /*handle*/ uint64_t handle,
352
+ UniffiRustFutureContinuationCallback callback,
353
+ /*handle*/ uint64_t callback_data
354
+ );
355
+ void ffi_ddk_ffi_rust_future_cancel_u64(
356
+ /*handle*/ uint64_t handle
357
+ );
358
+ void ffi_ddk_ffi_rust_future_free_u64(
359
+ /*handle*/ uint64_t handle
360
+ );
361
+ uint64_t ffi_ddk_ffi_rust_future_complete_u64(
362
+ /*handle*/ uint64_t handle,
363
+ RustCallStatus *uniffi_out_err
364
+ );
365
+ void ffi_ddk_ffi_rust_future_poll_i64(
366
+ /*handle*/ uint64_t handle,
367
+ UniffiRustFutureContinuationCallback callback,
368
+ /*handle*/ uint64_t callback_data
369
+ );
370
+ void ffi_ddk_ffi_rust_future_cancel_i64(
371
+ /*handle*/ uint64_t handle
372
+ );
373
+ void ffi_ddk_ffi_rust_future_free_i64(
374
+ /*handle*/ uint64_t handle
375
+ );
376
+ int64_t ffi_ddk_ffi_rust_future_complete_i64(
377
+ /*handle*/ uint64_t handle,
378
+ RustCallStatus *uniffi_out_err
379
+ );
380
+ void ffi_ddk_ffi_rust_future_poll_f32(
381
+ /*handle*/ uint64_t handle,
382
+ UniffiRustFutureContinuationCallback callback,
383
+ /*handle*/ uint64_t callback_data
384
+ );
385
+ void ffi_ddk_ffi_rust_future_cancel_f32(
386
+ /*handle*/ uint64_t handle
387
+ );
388
+ void ffi_ddk_ffi_rust_future_free_f32(
389
+ /*handle*/ uint64_t handle
390
+ );
391
+ float ffi_ddk_ffi_rust_future_complete_f32(
392
+ /*handle*/ uint64_t handle,
393
+ RustCallStatus *uniffi_out_err
394
+ );
395
+ void ffi_ddk_ffi_rust_future_poll_f64(
396
+ /*handle*/ uint64_t handle,
397
+ UniffiRustFutureContinuationCallback callback,
398
+ /*handle*/ uint64_t callback_data
399
+ );
400
+ void ffi_ddk_ffi_rust_future_cancel_f64(
401
+ /*handle*/ uint64_t handle
402
+ );
403
+ void ffi_ddk_ffi_rust_future_free_f64(
404
+ /*handle*/ uint64_t handle
405
+ );
406
+ double ffi_ddk_ffi_rust_future_complete_f64(
407
+ /*handle*/ uint64_t handle,
408
+ RustCallStatus *uniffi_out_err
409
+ );
410
+ void ffi_ddk_ffi_rust_future_poll_pointer(
411
+ /*handle*/ uint64_t handle,
412
+ UniffiRustFutureContinuationCallback callback,
413
+ /*handle*/ uint64_t callback_data
414
+ );
415
+ void ffi_ddk_ffi_rust_future_cancel_pointer(
416
+ /*handle*/ uint64_t handle
417
+ );
418
+ void ffi_ddk_ffi_rust_future_free_pointer(
419
+ /*handle*/ uint64_t handle
420
+ );
421
+ void * ffi_ddk_ffi_rust_future_complete_pointer(
422
+ /*handle*/ uint64_t handle,
423
+ RustCallStatus *uniffi_out_err
424
+ );
425
+ void ffi_ddk_ffi_rust_future_poll_rust_buffer(
426
+ /*handle*/ uint64_t handle,
427
+ UniffiRustFutureContinuationCallback callback,
428
+ /*handle*/ uint64_t callback_data
429
+ );
430
+ void ffi_ddk_ffi_rust_future_cancel_rust_buffer(
431
+ /*handle*/ uint64_t handle
432
+ );
433
+ void ffi_ddk_ffi_rust_future_free_rust_buffer(
434
+ /*handle*/ uint64_t handle
435
+ );
436
+ RustBuffer ffi_ddk_ffi_rust_future_complete_rust_buffer(
437
+ /*handle*/ uint64_t handle,
438
+ RustCallStatus *uniffi_out_err
439
+ );
440
+ void ffi_ddk_ffi_rust_future_poll_void(
441
+ /*handle*/ uint64_t handle,
442
+ UniffiRustFutureContinuationCallback callback,
443
+ /*handle*/ uint64_t callback_data
444
+ );
445
+ void ffi_ddk_ffi_rust_future_cancel_void(
446
+ /*handle*/ uint64_t handle
447
+ );
448
+ void ffi_ddk_ffi_rust_future_free_void(
449
+ /*handle*/ uint64_t handle
450
+ );
451
+ void ffi_ddk_ffi_rust_future_complete_void(
452
+ /*handle*/ uint64_t handle,
453
+ RustCallStatus *uniffi_out_err
454
+ );
455
+ uint16_t uniffi_ddk_ffi_checksum_func_create_cet(
456
+ );
457
+ uint16_t uniffi_ddk_ffi_checksum_func_create_cet_adaptor_signature_from_oracle_info(
458
+ );
459
+ uint16_t uniffi_ddk_ffi_checksum_func_create_cets(
460
+ );
461
+ uint16_t uniffi_ddk_ffi_checksum_func_create_dlc_transactions(
462
+ );
463
+ uint16_t uniffi_ddk_ffi_checksum_func_create_fund_tx_locking_script(
464
+ );
465
+ uint16_t uniffi_ddk_ffi_checksum_func_create_refund_transaction(
466
+ );
467
+ uint16_t uniffi_ddk_ffi_checksum_func_create_spliced_dlc_transactions(
468
+ );
469
+ uint16_t uniffi_ddk_ffi_checksum_func_get_change_output_and_fees(
470
+ );
471
+ uint16_t uniffi_ddk_ffi_checksum_func_get_raw_funding_transaction_input_signature(
472
+ );
473
+ uint16_t uniffi_ddk_ffi_checksum_func_get_total_input_vsize(
474
+ );
475
+ uint16_t uniffi_ddk_ffi_checksum_func_is_dust_output(
476
+ );
477
+ uint16_t uniffi_ddk_ffi_checksum_func_sign_fund_transaction_input(
478
+ );
479
+ uint16_t uniffi_ddk_ffi_checksum_func_verify_fund_tx_signature(
480
+ );
481
+ uint16_t uniffi_ddk_ffi_checksum_func_version(
482
+ );
483
+ uint32_t ffi_ddk_ffi_uniffi_contract_version(
484
+ );
485
+ }
486
+
487
+
488
+ namespace uniffi::ddk_ffi {
489
+ template <typename T> struct Bridging;
490
+
491
+ using namespace facebook;
492
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
493
+
494
+ template <typename T> struct Bridging<ReferenceHolder<T>> {
495
+ static jsi::Value jsNew(jsi::Runtime &rt) {
496
+ auto holder = jsi::Object(rt);
497
+ return holder;
498
+ }
499
+ static T fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
500
+ const jsi::Value &value) {
501
+ auto obj = value.asObject(rt);
502
+ if (obj.hasProperty(rt, "pointee")) {
503
+ auto pointee = obj.getProperty(rt, "pointee");
504
+ return uniffi::ddk_ffi::Bridging<T>::fromJs(rt, callInvoker, pointee);
505
+ }
506
+ throw jsi::JSError(
507
+ rt,
508
+ "Expected ReferenceHolder to have a pointee property. This is likely a bug in uniffi-bindgen-react-native"
509
+ );
510
+ }
511
+ };
512
+ } // namespace uniffi::ddk_ffi
513
+ namespace uniffi::ddk_ffi {
514
+ using namespace facebook;
515
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
516
+
517
+ template <> struct Bridging<RustBuffer> {
518
+ static RustBuffer rustbuffer_alloc(int32_t size) {
519
+ RustCallStatus status = { UNIFFI_CALL_STATUS_OK };
520
+ return ffi_ddk_ffi_rustbuffer_alloc(
521
+ size,
522
+ &status
523
+ );
524
+ }
525
+
526
+ static void rustbuffer_free(RustBuffer buf) {
527
+ RustCallStatus status = { UNIFFI_CALL_STATUS_OK };
528
+ ffi_ddk_ffi_rustbuffer_free(
529
+ buf,
530
+ &status
531
+ );
532
+ }
533
+
534
+ static RustBuffer rustbuffer_from_bytes(ForeignBytes bytes) {
535
+ RustCallStatus status = { UNIFFI_CALL_STATUS_OK };
536
+ return ffi_ddk_ffi_rustbuffer_from_bytes(
537
+ bytes,
538
+ &status
539
+ );
540
+ }
541
+
542
+ static RustBuffer fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker>,
543
+ const jsi::Value &value) {
544
+ try {
545
+ auto buffer = uniffi_jsi::Bridging<jsi::ArrayBuffer>::value_to_arraybuffer(rt, value);
546
+ auto bytes = ForeignBytes{
547
+ .len = static_cast<int32_t>(buffer.length(rt)),
548
+ .data = buffer.data(rt),
549
+ };
550
+
551
+ // This buffer is constructed from foreign bytes. Rust scaffolding copies
552
+ // the bytes, to make the RustBuffer.
553
+ auto buf = rustbuffer_from_bytes(bytes);
554
+ // Once it leaves this function, the buffer is immediately passed back
555
+ // into Rust, where it's used to deserialize into the Rust versions of the
556
+ // arguments. At that point, the copy is destroyed.
557
+ return buf;
558
+ } catch (const std::logic_error &e) {
559
+ throw jsi::JSError(rt, e.what());
560
+ }
561
+ }
562
+
563
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker>,
564
+ RustBuffer buf) {
565
+ // We need to make a copy of the bytes from Rust's memory space into
566
+ // Javascripts memory space. We need to do this because the two languages
567
+ // manages memory very differently: a garbage collector needs to track all
568
+ // the memory at runtime, Rust is doing it all closer to compile time.
569
+ uint8_t *bytes = new uint8_t[buf.len];
570
+ std::memcpy(bytes, buf.data, buf.len);
571
+
572
+ // Construct an ArrayBuffer with copy of the bytes from the RustBuffer.
573
+ auto payload = std::make_shared<uniffi_jsi::CMutableBuffer>(
574
+ uniffi_jsi::CMutableBuffer((uint8_t *)bytes, buf.len));
575
+ auto arrayBuffer = jsi::ArrayBuffer(rt, payload);
576
+
577
+ // Once we have a Javascript version, we no longer need the Rust version, so
578
+ // we can call into Rust to tell it it's okay to free that memory.
579
+ rustbuffer_free(buf);
580
+
581
+ // Finally, return the ArrayBuffer.
582
+ return uniffi_jsi::Bridging<jsi::ArrayBuffer>::arraybuffer_to_value(rt, arrayBuffer);;
583
+ }
584
+ };
585
+
586
+ } // namespace uniffi::ddk_ffi
587
+
588
+ namespace uniffi::ddk_ffi {
589
+ using namespace facebook;
590
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
591
+
592
+ template <> struct Bridging<RustCallStatus> {
593
+ static jsi::Value jsSuccess(jsi::Runtime &rt) {
594
+ auto statusObject = jsi::Object(rt);
595
+ statusObject.setProperty(rt, "code", jsi::Value(rt, UNIFFI_CALL_STATUS_OK));
596
+ return statusObject;
597
+ }
598
+ static RustCallStatus rustSuccess(jsi::Runtime &rt) {
599
+ return {UNIFFI_CALL_STATUS_OK};
600
+ }
601
+ static void copyIntoJs(jsi::Runtime &rt,
602
+ std::shared_ptr<CallInvoker> callInvoker,
603
+ const RustCallStatus status,
604
+ const jsi::Value &jsStatus) {
605
+ auto statusObject = jsStatus.asObject(rt);
606
+ if (status.error_buf.data != nullptr) {
607
+ auto rbuf = Bridging<RustBuffer>::toJs(rt, callInvoker,
608
+ status.error_buf);
609
+ statusObject.setProperty(rt, "errorBuf", rbuf);
610
+ }
611
+ if (status.code != UNIFFI_CALL_STATUS_OK) {
612
+ auto code =
613
+ uniffi_jsi::Bridging<uint8_t>::toJs(rt, callInvoker, status.code);
614
+ statusObject.setProperty(rt, "code", code);
615
+ }
616
+ }
617
+
618
+ static RustCallStatus fromJs(jsi::Runtime &rt,
619
+ std::shared_ptr<CallInvoker> invoker,
620
+ const jsi::Value &jsStatus) {
621
+ RustCallStatus status;
622
+ auto statusObject = jsStatus.asObject(rt);
623
+ if (statusObject.hasProperty(rt, "errorBuf")) {
624
+ auto rbuf = statusObject.getProperty(rt, "errorBuf");
625
+ status.error_buf =
626
+ Bridging<RustBuffer>::fromJs(rt, invoker, rbuf);
627
+ }
628
+ if (statusObject.hasProperty(rt, "code")) {
629
+ auto code = statusObject.getProperty(rt, "code");
630
+ status.code = uniffi_jsi::Bridging<uint8_t>::fromJs(rt, invoker, code);
631
+ }
632
+ return status;
633
+ }
634
+
635
+ static void copyFromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> invoker,
636
+ const jsi::Value &jsStatus, RustCallStatus *status) {
637
+ auto statusObject = jsStatus.asObject(rt);
638
+ if (statusObject.hasProperty(rt, "errorBuf")) {
639
+ auto rbuf = statusObject.getProperty(rt, "errorBuf");
640
+ status->error_buf =
641
+ Bridging<RustBuffer>::fromJs(rt, invoker, rbuf);
642
+ }
643
+ if (statusObject.hasProperty(rt, "code")) {
644
+ auto code = statusObject.getProperty(rt, "code");
645
+ status->code = uniffi_jsi::Bridging<uint8_t>::fromJs(rt, invoker, code);
646
+ }
647
+ }
648
+ };
649
+
650
+ } // namespace uniffi::ddk_ffi
651
+ // In other uniffi bindings, it is assumed that the foreign language holds on
652
+ // to the vtable, which the Rust just gets a pointer to.
653
+ // Here, we need to hold on to them, but also be able to clear them at just the
654
+ // right time so we can support hot-reloading.
655
+ namespace uniffi::ddk_ffi::registry {
656
+ template <typename T>
657
+ class VTableHolder {
658
+ public:
659
+ T vtable;
660
+ VTableHolder(T v) : vtable(v) {}
661
+ };
662
+
663
+ // Mutex to bind the storage and setting of vtable together.
664
+ // We declare it here, but the lock is taken by callers of the putTable
665
+ // method who are also sending a pointer to Rust.
666
+ static std::mutex vtableMutex;
667
+
668
+ // Registry to hold all vtables so they persist even when JS objects are GC'd.
669
+ // The only reason this exists is to prevent a dangling pointer in the
670
+ // Rust machinery: i.e. we don't need to access or write to this registry
671
+ // after startup.
672
+ // Registry to hold all vtables so they persist even when JS objects are GC'd.
673
+ // Maps string identifiers to vtable holders using type erasure
674
+ static std::unordered_map<std::string, std::shared_ptr<void>> vtableRegistry;
675
+
676
+ // Add a vtable to the registry with an identifier
677
+ template <typename T>
678
+ static T* putTable(std::string_view identifier, T vtable) {
679
+ auto holder = std::make_shared<VTableHolder<T>>(vtable);
680
+ // Store the raw pointer to the vtable before type erasure
681
+ T* rawPtr = &(holder->vtable);
682
+ // Store the holder using type erasure with the string identifier
683
+ vtableRegistry[std::string(identifier)] = std::shared_ptr<void>(holder);
684
+ return rawPtr;
685
+ }
686
+
687
+ // Clear the registry.
688
+ //
689
+ // Conceptually, this is called after teardown of the module (i.e. after
690
+ // teardown of the jsi::Runtime). However, because Rust is dropping callbacks
691
+ // because the Runtime is being torn down, we must keep the registry intact
692
+ // until after the runtime goes away.
693
+ //
694
+ // Therefore, in practice we should call this when the next runtime is
695
+ // being stood up.
696
+ static void clearRegistry() {
697
+ std::lock_guard<std::mutex> lock(vtableMutex);
698
+ vtableRegistry.clear();
699
+ }
700
+ } // namespace uniffi::ddk_ffi::registry
701
+
702
+ // This calls into Rust.
703
+ // Implementation of callback function calling from Rust to JS RustFutureContinuationCallback
704
+
705
+ // Callback function: uniffi::ddk_ffi::cb::rustfuturecontinuationcallback::UniffiRustFutureContinuationCallback
706
+ //
707
+ // We have the following constraints:
708
+ // - we need to pass a function pointer to Rust.
709
+ // - we need a jsi::Runtime and jsi::Function to call into JS.
710
+ // - function pointers can't store state, so we can't use a lamda.
711
+ //
712
+ // For this, we store a lambda as a global, as `rsLambda`. The `callback` function calls
713
+ // the lambda, which itself calls the `body` which then calls into JS.
714
+ //
715
+ // We then give the `callback` function pointer to Rust which will call the lambda sometime in the
716
+ // future.
717
+ namespace uniffi::ddk_ffi::cb::rustfuturecontinuationcallback {
718
+ using namespace facebook;
719
+
720
+ // We need to store a lambda in a global so we can call it from
721
+ // a function pointer. The function pointer is passed to Rust.
722
+ static std::function<void(uint64_t, int8_t)> rsLambda = nullptr;
723
+
724
+ // This is the main body of the callback. It's called from the lambda,
725
+ // which itself is called from the callback function which is passed to Rust.
726
+ static void body(jsi::Runtime &rt,
727
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
728
+ std::shared_ptr<jsi::Value> callbackValue
729
+ ,uint64_t rs_data
730
+ ,int8_t rs_pollResult) {
731
+
732
+ // Convert the arguments from Rust, into jsi::Values.
733
+ // We'll use the Bridging class to do this…
734
+ auto js_data = uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_data);
735
+ auto js_pollResult = uniffi_jsi::Bridging<int8_t>::toJs(rt, callInvoker, rs_pollResult);
736
+
737
+ // Now we are ready to call the callback.
738
+ // We are already on the JS thread, because this `body` function was
739
+ // invoked from the CallInvoker.
740
+ try {
741
+ // Getting the callback function
742
+ auto cb = callbackValue->asObject(rt).asFunction(rt);
743
+ auto uniffiResult = cb.call(rt, js_data, js_pollResult
744
+ );
745
+
746
+
747
+
748
+
749
+ } catch (const jsi::JSError &error) {
750
+ std::cout << "Error in callback UniffiRustFutureContinuationCallback: "
751
+ << error.what() << std::endl;
752
+ throw error;
753
+ }
754
+ }
755
+
756
+ static void callback(uint64_t rs_data, int8_t rs_pollResult) {
757
+ // If the runtime has shutdown, then there is no point in trying to
758
+ // call into Javascript. BUT how do we tell if the runtime has shutdown?
759
+ //
760
+ // Answer: the module destructor calls into callback `cleanup` method,
761
+ // which nulls out the rsLamda.
762
+ //
763
+ // If rsLamda is null, then there is no runtime to call into.
764
+ if (rsLambda == nullptr) {
765
+ // This only occurs when destructors are calling into Rust free/drop,
766
+ // which causes the JS callback to be dropped.
767
+ return;
768
+ }
769
+
770
+ // The runtime, the actual callback jsi::funtion, and the callInvoker
771
+ // are all in the lambda.
772
+ rsLambda(
773
+ rs_data,
774
+ rs_pollResult);
775
+ }
776
+
777
+ static UniffiRustFutureContinuationCallback
778
+ makeCallbackFunction( // uniffi::ddk_ffi::cb::rustfuturecontinuationcallback
779
+ jsi::Runtime &rt,
780
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
781
+ const jsi::Value &value) {
782
+ if (rsLambda != nullptr) {
783
+ // `makeCallbackFunction` is called in two circumstances:
784
+ //
785
+ // 1. at startup, when initializing callback interface vtables.
786
+ // 2. when polling futures. This happens at least once per future that is
787
+ // exposed to Javascript. We know that this is always the same function,
788
+ // `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
789
+ //
790
+ // We can therefore return the callback function without making anything
791
+ // new if we've been initialized already.
792
+ return callback;
793
+ }
794
+ auto callbackFunction = value.asObject(rt).asFunction(rt);
795
+ auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
796
+ rsLambda = [&rt, callInvoker, callbackValue](uint64_t rs_data, int8_t rs_pollResult) {
797
+ // We immediately make a lambda which will do the work of transforming the
798
+ // arguments into JSI values and calling the callback.
799
+ uniffi_runtime::UniffiCallFunc jsLambda = [
800
+ callInvoker,
801
+ callbackValue
802
+ , rs_data
803
+ , rs_pollResult](jsi::Runtime &rt) mutable {
804
+ body(rt, callInvoker, callbackValue
805
+ , rs_data
806
+ , rs_pollResult);
807
+ };
808
+ // We'll then call that lambda from the callInvoker which will
809
+ // look after calling it on the correct thread.
810
+
811
+ callInvoker->invokeNonBlocking(rt, jsLambda);
812
+ };
813
+ return callback;
814
+ }
815
+
816
+ // This method is called from the destructor of NativeDdkFfi, which only happens
817
+ // when the jsi::Runtime is being destroyed.
818
+ static void cleanup() {
819
+ // The lambda holds a reference to the the Runtime, so when this is nulled out,
820
+ // then the pointer will no longer be left dangling.
821
+ rsLambda = nullptr;
822
+ }
823
+ } // namespace uniffi::ddk_ffi::cb::rustfuturecontinuationcallback
824
+ // Implementation of callback function calling from JS to Rust ForeignFutureFree,
825
+ // passed from Rust to JS as part of async callbacks.
826
+ namespace uniffi::ddk_ffi {
827
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
828
+
829
+ template <> struct Bridging<UniffiForeignFutureFree> {
830
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureFree rsCallback) {
831
+ return jsi::Function::createFromHostFunction(
832
+ rt,
833
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureFree"),
834
+ 1,
835
+ [rsCallback, callInvoker](
836
+ jsi::Runtime &rt,
837
+ const jsi::Value &thisValue,
838
+ const jsi::Value *arguments,
839
+ size_t count) -> jsi::Value
840
+ {
841
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
842
+ }
843
+ );
844
+ }
845
+
846
+ static jsi::Value intoRust(
847
+ jsi::Runtime &rt,
848
+ std::shared_ptr<CallInvoker> callInvoker,
849
+ const jsi::Value &thisValue,
850
+ const jsi::Value *args,
851
+ size_t count,
852
+ UniffiForeignFutureFree func) {
853
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
854
+ // then call the rs_callback with those arguments.
855
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0])
856
+ );
857
+
858
+
859
+ return jsi::Value::undefined();
860
+ }
861
+ };
862
+ } // namespace uniffi::ddk_ffi
863
+ // Implementation of free callback function CallbackInterfaceFree
864
+
865
+
866
+ // Callback function: uniffi::ddk_ffi::st::foreignfuture::foreignfuture::free::UniffiCallbackInterfaceFree
867
+ //
868
+ // We have the following constraints:
869
+ // - we need to pass a function pointer to Rust.
870
+ // - we need a jsi::Runtime and jsi::Function to call into JS.
871
+ // - function pointers can't store state, so we can't use a lamda.
872
+ //
873
+ // For this, we store a lambda as a global, as `rsLambda`. The `callback` function calls
874
+ // the lambda, which itself calls the `body` which then calls into JS.
875
+ //
876
+ // We then give the `callback` function pointer to Rust which will call the lambda sometime in the
877
+ // future.
878
+ namespace uniffi::ddk_ffi::st::foreignfuture::foreignfuture::free {
879
+ using namespace facebook;
880
+
881
+ // We need to store a lambda in a global so we can call it from
882
+ // a function pointer. The function pointer is passed to Rust.
883
+ static std::function<void(uint64_t)> rsLambda = nullptr;
884
+
885
+ // This is the main body of the callback. It's called from the lambda,
886
+ // which itself is called from the callback function which is passed to Rust.
887
+ static void body(jsi::Runtime &rt,
888
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
889
+ std::shared_ptr<jsi::Value> callbackValue
890
+ ,uint64_t rs_handle) {
891
+
892
+ // Convert the arguments from Rust, into jsi::Values.
893
+ // We'll use the Bridging class to do this…
894
+ auto js_handle = uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_handle);
895
+
896
+ // Now we are ready to call the callback.
897
+ // We are already on the JS thread, because this `body` function was
898
+ // invoked from the CallInvoker.
899
+ try {
900
+ // Getting the callback function
901
+ auto cb = callbackValue->asObject(rt).asFunction(rt);
902
+ auto uniffiResult = cb.call(rt, js_handle
903
+ );
904
+
905
+
906
+
907
+
908
+ } catch (const jsi::JSError &error) {
909
+ std::cout << "Error in callback UniffiCallbackInterfaceFree: "
910
+ << error.what() << std::endl;
911
+ throw error;
912
+ }
913
+ }
914
+
915
+ static void callback(uint64_t rs_handle) {
916
+ // If the runtime has shutdown, then there is no point in trying to
917
+ // call into Javascript. BUT how do we tell if the runtime has shutdown?
918
+ //
919
+ // Answer: the module destructor calls into callback `cleanup` method,
920
+ // which nulls out the rsLamda.
921
+ //
922
+ // If rsLamda is null, then there is no runtime to call into.
923
+ if (rsLambda == nullptr) {
924
+ // This only occurs when destructors are calling into Rust free/drop,
925
+ // which causes the JS callback to be dropped.
926
+ return;
927
+ }
928
+
929
+ // The runtime, the actual callback jsi::funtion, and the callInvoker
930
+ // are all in the lambda.
931
+ rsLambda(
932
+ rs_handle);
933
+ }
934
+
935
+ static UniffiCallbackInterfaceFree
936
+ makeCallbackFunction( // uniffi::ddk_ffi::st::foreignfuture::foreignfuture::free
937
+ jsi::Runtime &rt,
938
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
939
+ const jsi::Value &value) {
940
+ if (rsLambda != nullptr) {
941
+ // `makeCallbackFunction` is called in two circumstances:
942
+ //
943
+ // 1. at startup, when initializing callback interface vtables.
944
+ // 2. when polling futures. This happens at least once per future that is
945
+ // exposed to Javascript. We know that this is always the same function,
946
+ // `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
947
+ //
948
+ // We can therefore return the callback function without making anything
949
+ // new if we've been initialized already.
950
+ return callback;
951
+ }
952
+ auto callbackFunction = value.asObject(rt).asFunction(rt);
953
+ auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
954
+ rsLambda = [&rt, callInvoker, callbackValue](uint64_t rs_handle) {
955
+ // We immediately make a lambda which will do the work of transforming the
956
+ // arguments into JSI values and calling the callback.
957
+ uniffi_runtime::UniffiCallFunc jsLambda = [
958
+ callInvoker,
959
+ callbackValue
960
+ , rs_handle](jsi::Runtime &rt) mutable {
961
+ body(rt, callInvoker, callbackValue
962
+ , rs_handle);
963
+ };
964
+ // We'll then call that lambda from the callInvoker which will
965
+ // look after calling it on the correct thread.
966
+
967
+ callInvoker->invokeNonBlocking(rt, jsLambda);
968
+ };
969
+ return callback;
970
+ }
971
+
972
+ // This method is called from the destructor of NativeDdkFfi, which only happens
973
+ // when the jsi::Runtime is being destroyed.
974
+ static void cleanup() {
975
+ // The lambda holds a reference to the the Runtime, so when this is nulled out,
976
+ // then the pointer will no longer be left dangling.
977
+ rsLambda = nullptr;
978
+ }
979
+ } // namespace uniffi::ddk_ffi::st::foreignfuture::foreignfuture::free
980
+ namespace uniffi::ddk_ffi {
981
+ using namespace facebook;
982
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
983
+
984
+ template <> struct Bridging<UniffiForeignFuture> {
985
+ static UniffiForeignFuture fromJs(jsi::Runtime &rt,
986
+ std::shared_ptr<CallInvoker> callInvoker,
987
+ const jsi::Value &jsValue
988
+ ) {
989
+ // Check if the input is an object
990
+ if (!jsValue.isObject()) {
991
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFuture");
992
+ }
993
+
994
+ // Get the object from the jsi::Value
995
+ auto jsObject = jsValue.getObject(rt);
996
+
997
+ // Create the vtable struct
998
+ UniffiForeignFuture rsObject;
999
+
1000
+ // Create the vtable from the js callbacks.
1001
+ rsObject.handle = uniffi_jsi::Bridging<uint64_t>::fromJs(
1002
+ rt, callInvoker,
1003
+ jsObject.getProperty(rt, "handle")
1004
+ );
1005
+ rsObject.free = uniffi::ddk_ffi::st::foreignfuture::foreignfuture::free::makeCallbackFunction(
1006
+ rt, callInvoker, jsObject.getProperty(rt, "free")
1007
+ );
1008
+
1009
+ return rsObject;
1010
+ }
1011
+ };
1012
+
1013
+ } // namespace uniffi::ddk_ffi
1014
+ namespace uniffi::ddk_ffi {
1015
+ using namespace facebook;
1016
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1017
+
1018
+ template <> struct Bridging<UniffiForeignFutureStructU8> {
1019
+ static UniffiForeignFutureStructU8 fromJs(jsi::Runtime &rt,
1020
+ std::shared_ptr<CallInvoker> callInvoker,
1021
+ const jsi::Value &jsValue
1022
+ ) {
1023
+ // Check if the input is an object
1024
+ if (!jsValue.isObject()) {
1025
+ throw jsi::JSError(rt, "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,
1037
+ jsObject.getProperty(rt, "returnValue")
1038
+ );
1039
+ rsObject.call_status = uniffi::ddk_ffi::Bridging<RustCallStatus>::fromJs(
1040
+ rt, callInvoker,
1041
+ jsObject.getProperty(rt, "callStatus")
1042
+ );
1043
+
1044
+ return rsObject;
1045
+ }
1046
+ };
1047
+
1048
+ } // namespace uniffi::ddk_ffi
1049
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteU8,
1050
+ // passed from Rust to JS as part of async callbacks.
1051
+ namespace uniffi::ddk_ffi {
1052
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1053
+
1054
+ template <> struct Bridging<UniffiForeignFutureCompleteU8> {
1055
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteU8 rsCallback) {
1056
+ return jsi::Function::createFromHostFunction(
1057
+ rt,
1058
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU8"),
1059
+ 2,
1060
+ [rsCallback, callInvoker](
1061
+ jsi::Runtime &rt,
1062
+ const jsi::Value &thisValue,
1063
+ const jsi::Value *arguments,
1064
+ size_t count) -> jsi::Value
1065
+ {
1066
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1067
+ }
1068
+ );
1069
+ }
1070
+
1071
+ static jsi::Value intoRust(
1072
+ jsi::Runtime &rt,
1073
+ std::shared_ptr<CallInvoker> callInvoker,
1074
+ const jsi::Value &thisValue,
1075
+ const jsi::Value *args,
1076
+ size_t count,
1077
+ UniffiForeignFutureCompleteU8 func) {
1078
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1079
+ // then call the rs_callback with those arguments.
1080
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<UniffiForeignFutureStructU8>::fromJs(rt, callInvoker, args[1])
1081
+ );
1082
+
1083
+
1084
+ return jsi::Value::undefined();
1085
+ }
1086
+ };
1087
+ } // namespace uniffi::ddk_ffi
1088
+ namespace uniffi::ddk_ffi {
1089
+ using namespace facebook;
1090
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1091
+
1092
+ template <> struct Bridging<UniffiForeignFutureStructI8> {
1093
+ static UniffiForeignFutureStructI8 fromJs(jsi::Runtime &rt,
1094
+ std::shared_ptr<CallInvoker> callInvoker,
1095
+ const jsi::Value &jsValue
1096
+ ) {
1097
+ // Check if the input is an object
1098
+ if (!jsValue.isObject()) {
1099
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructI8");
1100
+ }
1101
+
1102
+ // Get the object from the jsi::Value
1103
+ auto jsObject = jsValue.getObject(rt);
1104
+
1105
+ // Create the vtable struct
1106
+ UniffiForeignFutureStructI8 rsObject;
1107
+
1108
+ // Create the vtable from the js callbacks.
1109
+ rsObject.return_value = uniffi_jsi::Bridging<int8_t>::fromJs(
1110
+ rt, callInvoker,
1111
+ jsObject.getProperty(rt, "returnValue")
1112
+ );
1113
+ rsObject.call_status = uniffi::ddk_ffi::Bridging<RustCallStatus>::fromJs(
1114
+ rt, callInvoker,
1115
+ jsObject.getProperty(rt, "callStatus")
1116
+ );
1117
+
1118
+ return rsObject;
1119
+ }
1120
+ };
1121
+
1122
+ } // namespace uniffi::ddk_ffi
1123
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteI8,
1124
+ // passed from Rust to JS as part of async callbacks.
1125
+ namespace uniffi::ddk_ffi {
1126
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1127
+
1128
+ template <> struct Bridging<UniffiForeignFutureCompleteI8> {
1129
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteI8 rsCallback) {
1130
+ return jsi::Function::createFromHostFunction(
1131
+ rt,
1132
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI8"),
1133
+ 2,
1134
+ [rsCallback, callInvoker](
1135
+ jsi::Runtime &rt,
1136
+ const jsi::Value &thisValue,
1137
+ const jsi::Value *arguments,
1138
+ size_t count) -> jsi::Value
1139
+ {
1140
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1141
+ }
1142
+ );
1143
+ }
1144
+
1145
+ static jsi::Value intoRust(
1146
+ jsi::Runtime &rt,
1147
+ std::shared_ptr<CallInvoker> callInvoker,
1148
+ const jsi::Value &thisValue,
1149
+ const jsi::Value *args,
1150
+ size_t count,
1151
+ UniffiForeignFutureCompleteI8 func) {
1152
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1153
+ // then call the rs_callback with those arguments.
1154
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<UniffiForeignFutureStructI8>::fromJs(rt, callInvoker, args[1])
1155
+ );
1156
+
1157
+
1158
+ return jsi::Value::undefined();
1159
+ }
1160
+ };
1161
+ } // namespace uniffi::ddk_ffi
1162
+ namespace uniffi::ddk_ffi {
1163
+ using namespace facebook;
1164
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1165
+
1166
+ template <> struct Bridging<UniffiForeignFutureStructU16> {
1167
+ static UniffiForeignFutureStructU16 fromJs(jsi::Runtime &rt,
1168
+ std::shared_ptr<CallInvoker> callInvoker,
1169
+ const jsi::Value &jsValue
1170
+ ) {
1171
+ // Check if the input is an object
1172
+ if (!jsValue.isObject()) {
1173
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructU16");
1174
+ }
1175
+
1176
+ // Get the object from the jsi::Value
1177
+ auto jsObject = jsValue.getObject(rt);
1178
+
1179
+ // Create the vtable struct
1180
+ UniffiForeignFutureStructU16 rsObject;
1181
+
1182
+ // Create the vtable from the js callbacks.
1183
+ rsObject.return_value = uniffi_jsi::Bridging<uint16_t>::fromJs(
1184
+ rt, callInvoker,
1185
+ jsObject.getProperty(rt, "returnValue")
1186
+ );
1187
+ rsObject.call_status = uniffi::ddk_ffi::Bridging<RustCallStatus>::fromJs(
1188
+ rt, callInvoker,
1189
+ jsObject.getProperty(rt, "callStatus")
1190
+ );
1191
+
1192
+ return rsObject;
1193
+ }
1194
+ };
1195
+
1196
+ } // namespace uniffi::ddk_ffi
1197
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteU16,
1198
+ // passed from Rust to JS as part of async callbacks.
1199
+ namespace uniffi::ddk_ffi {
1200
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1201
+
1202
+ template <> struct Bridging<UniffiForeignFutureCompleteU16> {
1203
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteU16 rsCallback) {
1204
+ return jsi::Function::createFromHostFunction(
1205
+ rt,
1206
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU16"),
1207
+ 2,
1208
+ [rsCallback, callInvoker](
1209
+ jsi::Runtime &rt,
1210
+ const jsi::Value &thisValue,
1211
+ const jsi::Value *arguments,
1212
+ size_t count) -> jsi::Value
1213
+ {
1214
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1215
+ }
1216
+ );
1217
+ }
1218
+
1219
+ static jsi::Value intoRust(
1220
+ jsi::Runtime &rt,
1221
+ std::shared_ptr<CallInvoker> callInvoker,
1222
+ const jsi::Value &thisValue,
1223
+ const jsi::Value *args,
1224
+ size_t count,
1225
+ UniffiForeignFutureCompleteU16 func) {
1226
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1227
+ // then call the rs_callback with those arguments.
1228
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<UniffiForeignFutureStructU16>::fromJs(rt, callInvoker, args[1])
1229
+ );
1230
+
1231
+
1232
+ return jsi::Value::undefined();
1233
+ }
1234
+ };
1235
+ } // namespace uniffi::ddk_ffi
1236
+ namespace uniffi::ddk_ffi {
1237
+ using namespace facebook;
1238
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1239
+
1240
+ template <> struct Bridging<UniffiForeignFutureStructI16> {
1241
+ static UniffiForeignFutureStructI16 fromJs(jsi::Runtime &rt,
1242
+ std::shared_ptr<CallInvoker> callInvoker,
1243
+ const jsi::Value &jsValue
1244
+ ) {
1245
+ // Check if the input is an object
1246
+ if (!jsValue.isObject()) {
1247
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructI16");
1248
+ }
1249
+
1250
+ // Get the object from the jsi::Value
1251
+ auto jsObject = jsValue.getObject(rt);
1252
+
1253
+ // Create the vtable struct
1254
+ UniffiForeignFutureStructI16 rsObject;
1255
+
1256
+ // Create the vtable from the js callbacks.
1257
+ rsObject.return_value = uniffi_jsi::Bridging<int16_t>::fromJs(
1258
+ rt, callInvoker,
1259
+ jsObject.getProperty(rt, "returnValue")
1260
+ );
1261
+ rsObject.call_status = uniffi::ddk_ffi::Bridging<RustCallStatus>::fromJs(
1262
+ rt, callInvoker,
1263
+ jsObject.getProperty(rt, "callStatus")
1264
+ );
1265
+
1266
+ return rsObject;
1267
+ }
1268
+ };
1269
+
1270
+ } // namespace uniffi::ddk_ffi
1271
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteI16,
1272
+ // passed from Rust to JS as part of async callbacks.
1273
+ namespace uniffi::ddk_ffi {
1274
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1275
+
1276
+ template <> struct Bridging<UniffiForeignFutureCompleteI16> {
1277
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteI16 rsCallback) {
1278
+ return jsi::Function::createFromHostFunction(
1279
+ rt,
1280
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI16"),
1281
+ 2,
1282
+ [rsCallback, callInvoker](
1283
+ jsi::Runtime &rt,
1284
+ const jsi::Value &thisValue,
1285
+ const jsi::Value *arguments,
1286
+ size_t count) -> jsi::Value
1287
+ {
1288
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1289
+ }
1290
+ );
1291
+ }
1292
+
1293
+ static jsi::Value intoRust(
1294
+ jsi::Runtime &rt,
1295
+ std::shared_ptr<CallInvoker> callInvoker,
1296
+ const jsi::Value &thisValue,
1297
+ const jsi::Value *args,
1298
+ size_t count,
1299
+ UniffiForeignFutureCompleteI16 func) {
1300
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1301
+ // then call the rs_callback with those arguments.
1302
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<UniffiForeignFutureStructI16>::fromJs(rt, callInvoker, args[1])
1303
+ );
1304
+
1305
+
1306
+ return jsi::Value::undefined();
1307
+ }
1308
+ };
1309
+ } // namespace uniffi::ddk_ffi
1310
+ namespace uniffi::ddk_ffi {
1311
+ using namespace facebook;
1312
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1313
+
1314
+ template <> struct Bridging<UniffiForeignFutureStructU32> {
1315
+ static UniffiForeignFutureStructU32 fromJs(jsi::Runtime &rt,
1316
+ std::shared_ptr<CallInvoker> callInvoker,
1317
+ const jsi::Value &jsValue
1318
+ ) {
1319
+ // Check if the input is an object
1320
+ if (!jsValue.isObject()) {
1321
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructU32");
1322
+ }
1323
+
1324
+ // Get the object from the jsi::Value
1325
+ auto jsObject = jsValue.getObject(rt);
1326
+
1327
+ // Create the vtable struct
1328
+ UniffiForeignFutureStructU32 rsObject;
1329
+
1330
+ // Create the vtable from the js callbacks.
1331
+ rsObject.return_value = uniffi_jsi::Bridging<uint32_t>::fromJs(
1332
+ rt, callInvoker,
1333
+ jsObject.getProperty(rt, "returnValue")
1334
+ );
1335
+ rsObject.call_status = uniffi::ddk_ffi::Bridging<RustCallStatus>::fromJs(
1336
+ rt, callInvoker,
1337
+ jsObject.getProperty(rt, "callStatus")
1338
+ );
1339
+
1340
+ return rsObject;
1341
+ }
1342
+ };
1343
+
1344
+ } // namespace uniffi::ddk_ffi
1345
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteU32,
1346
+ // passed from Rust to JS as part of async callbacks.
1347
+ namespace uniffi::ddk_ffi {
1348
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1349
+
1350
+ template <> struct Bridging<UniffiForeignFutureCompleteU32> {
1351
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteU32 rsCallback) {
1352
+ return jsi::Function::createFromHostFunction(
1353
+ rt,
1354
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU32"),
1355
+ 2,
1356
+ [rsCallback, callInvoker](
1357
+ jsi::Runtime &rt,
1358
+ const jsi::Value &thisValue,
1359
+ const jsi::Value *arguments,
1360
+ size_t count) -> jsi::Value
1361
+ {
1362
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1363
+ }
1364
+ );
1365
+ }
1366
+
1367
+ static jsi::Value intoRust(
1368
+ jsi::Runtime &rt,
1369
+ std::shared_ptr<CallInvoker> callInvoker,
1370
+ const jsi::Value &thisValue,
1371
+ const jsi::Value *args,
1372
+ size_t count,
1373
+ UniffiForeignFutureCompleteU32 func) {
1374
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1375
+ // then call the rs_callback with those arguments.
1376
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<UniffiForeignFutureStructU32>::fromJs(rt, callInvoker, args[1])
1377
+ );
1378
+
1379
+
1380
+ return jsi::Value::undefined();
1381
+ }
1382
+ };
1383
+ } // namespace uniffi::ddk_ffi
1384
+ namespace uniffi::ddk_ffi {
1385
+ using namespace facebook;
1386
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1387
+
1388
+ template <> struct Bridging<UniffiForeignFutureStructI32> {
1389
+ static UniffiForeignFutureStructI32 fromJs(jsi::Runtime &rt,
1390
+ std::shared_ptr<CallInvoker> callInvoker,
1391
+ const jsi::Value &jsValue
1392
+ ) {
1393
+ // Check if the input is an object
1394
+ if (!jsValue.isObject()) {
1395
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructI32");
1396
+ }
1397
+
1398
+ // Get the object from the jsi::Value
1399
+ auto jsObject = jsValue.getObject(rt);
1400
+
1401
+ // Create the vtable struct
1402
+ UniffiForeignFutureStructI32 rsObject;
1403
+
1404
+ // Create the vtable from the js callbacks.
1405
+ rsObject.return_value = uniffi_jsi::Bridging<int32_t>::fromJs(
1406
+ rt, callInvoker,
1407
+ jsObject.getProperty(rt, "returnValue")
1408
+ );
1409
+ rsObject.call_status = uniffi::ddk_ffi::Bridging<RustCallStatus>::fromJs(
1410
+ rt, callInvoker,
1411
+ jsObject.getProperty(rt, "callStatus")
1412
+ );
1413
+
1414
+ return rsObject;
1415
+ }
1416
+ };
1417
+
1418
+ } // namespace uniffi::ddk_ffi
1419
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteI32,
1420
+ // passed from Rust to JS as part of async callbacks.
1421
+ namespace uniffi::ddk_ffi {
1422
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1423
+
1424
+ template <> struct Bridging<UniffiForeignFutureCompleteI32> {
1425
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteI32 rsCallback) {
1426
+ return jsi::Function::createFromHostFunction(
1427
+ rt,
1428
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI32"),
1429
+ 2,
1430
+ [rsCallback, callInvoker](
1431
+ jsi::Runtime &rt,
1432
+ const jsi::Value &thisValue,
1433
+ const jsi::Value *arguments,
1434
+ size_t count) -> jsi::Value
1435
+ {
1436
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1437
+ }
1438
+ );
1439
+ }
1440
+
1441
+ static jsi::Value intoRust(
1442
+ jsi::Runtime &rt,
1443
+ std::shared_ptr<CallInvoker> callInvoker,
1444
+ const jsi::Value &thisValue,
1445
+ const jsi::Value *args,
1446
+ size_t count,
1447
+ UniffiForeignFutureCompleteI32 func) {
1448
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1449
+ // then call the rs_callback with those arguments.
1450
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<UniffiForeignFutureStructI32>::fromJs(rt, callInvoker, args[1])
1451
+ );
1452
+
1453
+
1454
+ return jsi::Value::undefined();
1455
+ }
1456
+ };
1457
+ } // namespace uniffi::ddk_ffi
1458
+ namespace uniffi::ddk_ffi {
1459
+ using namespace facebook;
1460
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1461
+
1462
+ template <> struct Bridging<UniffiForeignFutureStructU64> {
1463
+ static UniffiForeignFutureStructU64 fromJs(jsi::Runtime &rt,
1464
+ std::shared_ptr<CallInvoker> callInvoker,
1465
+ const jsi::Value &jsValue
1466
+ ) {
1467
+ // Check if the input is an object
1468
+ if (!jsValue.isObject()) {
1469
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructU64");
1470
+ }
1471
+
1472
+ // Get the object from the jsi::Value
1473
+ auto jsObject = jsValue.getObject(rt);
1474
+
1475
+ // Create the vtable struct
1476
+ UniffiForeignFutureStructU64 rsObject;
1477
+
1478
+ // Create the vtable from the js callbacks.
1479
+ rsObject.return_value = uniffi_jsi::Bridging<uint64_t>::fromJs(
1480
+ rt, callInvoker,
1481
+ jsObject.getProperty(rt, "returnValue")
1482
+ );
1483
+ rsObject.call_status = uniffi::ddk_ffi::Bridging<RustCallStatus>::fromJs(
1484
+ rt, callInvoker,
1485
+ jsObject.getProperty(rt, "callStatus")
1486
+ );
1487
+
1488
+ return rsObject;
1489
+ }
1490
+ };
1491
+
1492
+ } // namespace uniffi::ddk_ffi
1493
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteU64,
1494
+ // passed from Rust to JS as part of async callbacks.
1495
+ namespace uniffi::ddk_ffi {
1496
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1497
+
1498
+ template <> struct Bridging<UniffiForeignFutureCompleteU64> {
1499
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteU64 rsCallback) {
1500
+ return jsi::Function::createFromHostFunction(
1501
+ rt,
1502
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU64"),
1503
+ 2,
1504
+ [rsCallback, callInvoker](
1505
+ jsi::Runtime &rt,
1506
+ const jsi::Value &thisValue,
1507
+ const jsi::Value *arguments,
1508
+ size_t count) -> jsi::Value
1509
+ {
1510
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1511
+ }
1512
+ );
1513
+ }
1514
+
1515
+ static jsi::Value intoRust(
1516
+ jsi::Runtime &rt,
1517
+ std::shared_ptr<CallInvoker> callInvoker,
1518
+ const jsi::Value &thisValue,
1519
+ const jsi::Value *args,
1520
+ size_t count,
1521
+ UniffiForeignFutureCompleteU64 func) {
1522
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1523
+ // then call the rs_callback with those arguments.
1524
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<UniffiForeignFutureStructU64>::fromJs(rt, callInvoker, args[1])
1525
+ );
1526
+
1527
+
1528
+ return jsi::Value::undefined();
1529
+ }
1530
+ };
1531
+ } // namespace uniffi::ddk_ffi
1532
+ namespace uniffi::ddk_ffi {
1533
+ using namespace facebook;
1534
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1535
+
1536
+ template <> struct Bridging<UniffiForeignFutureStructI64> {
1537
+ static UniffiForeignFutureStructI64 fromJs(jsi::Runtime &rt,
1538
+ std::shared_ptr<CallInvoker> callInvoker,
1539
+ const jsi::Value &jsValue
1540
+ ) {
1541
+ // Check if the input is an object
1542
+ if (!jsValue.isObject()) {
1543
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructI64");
1544
+ }
1545
+
1546
+ // Get the object from the jsi::Value
1547
+ auto jsObject = jsValue.getObject(rt);
1548
+
1549
+ // Create the vtable struct
1550
+ UniffiForeignFutureStructI64 rsObject;
1551
+
1552
+ // Create the vtable from the js callbacks.
1553
+ rsObject.return_value = uniffi_jsi::Bridging<int64_t>::fromJs(
1554
+ rt, callInvoker,
1555
+ jsObject.getProperty(rt, "returnValue")
1556
+ );
1557
+ rsObject.call_status = uniffi::ddk_ffi::Bridging<RustCallStatus>::fromJs(
1558
+ rt, callInvoker,
1559
+ jsObject.getProperty(rt, "callStatus")
1560
+ );
1561
+
1562
+ return rsObject;
1563
+ }
1564
+ };
1565
+
1566
+ } // namespace uniffi::ddk_ffi
1567
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteI64,
1568
+ // passed from Rust to JS as part of async callbacks.
1569
+ namespace uniffi::ddk_ffi {
1570
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1571
+
1572
+ template <> struct Bridging<UniffiForeignFutureCompleteI64> {
1573
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteI64 rsCallback) {
1574
+ return jsi::Function::createFromHostFunction(
1575
+ rt,
1576
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI64"),
1577
+ 2,
1578
+ [rsCallback, callInvoker](
1579
+ jsi::Runtime &rt,
1580
+ const jsi::Value &thisValue,
1581
+ const jsi::Value *arguments,
1582
+ size_t count) -> jsi::Value
1583
+ {
1584
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1585
+ }
1586
+ );
1587
+ }
1588
+
1589
+ static jsi::Value intoRust(
1590
+ jsi::Runtime &rt,
1591
+ std::shared_ptr<CallInvoker> callInvoker,
1592
+ const jsi::Value &thisValue,
1593
+ const jsi::Value *args,
1594
+ size_t count,
1595
+ UniffiForeignFutureCompleteI64 func) {
1596
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1597
+ // then call the rs_callback with those arguments.
1598
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<UniffiForeignFutureStructI64>::fromJs(rt, callInvoker, args[1])
1599
+ );
1600
+
1601
+
1602
+ return jsi::Value::undefined();
1603
+ }
1604
+ };
1605
+ } // namespace uniffi::ddk_ffi
1606
+ namespace uniffi::ddk_ffi {
1607
+ using namespace facebook;
1608
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1609
+
1610
+ template <> struct Bridging<UniffiForeignFutureStructF32> {
1611
+ static UniffiForeignFutureStructF32 fromJs(jsi::Runtime &rt,
1612
+ std::shared_ptr<CallInvoker> callInvoker,
1613
+ const jsi::Value &jsValue
1614
+ ) {
1615
+ // Check if the input is an object
1616
+ if (!jsValue.isObject()) {
1617
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructF32");
1618
+ }
1619
+
1620
+ // Get the object from the jsi::Value
1621
+ auto jsObject = jsValue.getObject(rt);
1622
+
1623
+ // Create the vtable struct
1624
+ UniffiForeignFutureStructF32 rsObject;
1625
+
1626
+ // Create the vtable from the js callbacks.
1627
+ rsObject.return_value = uniffi_jsi::Bridging<float>::fromJs(
1628
+ rt, callInvoker,
1629
+ jsObject.getProperty(rt, "returnValue")
1630
+ );
1631
+ rsObject.call_status = uniffi::ddk_ffi::Bridging<RustCallStatus>::fromJs(
1632
+ rt, callInvoker,
1633
+ jsObject.getProperty(rt, "callStatus")
1634
+ );
1635
+
1636
+ return rsObject;
1637
+ }
1638
+ };
1639
+
1640
+ } // namespace uniffi::ddk_ffi
1641
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteF32,
1642
+ // passed from Rust to JS as part of async callbacks.
1643
+ namespace uniffi::ddk_ffi {
1644
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1645
+
1646
+ template <> struct Bridging<UniffiForeignFutureCompleteF32> {
1647
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteF32 rsCallback) {
1648
+ return jsi::Function::createFromHostFunction(
1649
+ rt,
1650
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteF32"),
1651
+ 2,
1652
+ [rsCallback, callInvoker](
1653
+ jsi::Runtime &rt,
1654
+ const jsi::Value &thisValue,
1655
+ const jsi::Value *arguments,
1656
+ size_t count) -> jsi::Value
1657
+ {
1658
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1659
+ }
1660
+ );
1661
+ }
1662
+
1663
+ static jsi::Value intoRust(
1664
+ jsi::Runtime &rt,
1665
+ std::shared_ptr<CallInvoker> callInvoker,
1666
+ const jsi::Value &thisValue,
1667
+ const jsi::Value *args,
1668
+ size_t count,
1669
+ UniffiForeignFutureCompleteF32 func) {
1670
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1671
+ // then call the rs_callback with those arguments.
1672
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<UniffiForeignFutureStructF32>::fromJs(rt, callInvoker, args[1])
1673
+ );
1674
+
1675
+
1676
+ return jsi::Value::undefined();
1677
+ }
1678
+ };
1679
+ } // namespace uniffi::ddk_ffi
1680
+ namespace uniffi::ddk_ffi {
1681
+ using namespace facebook;
1682
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1683
+
1684
+ template <> struct Bridging<UniffiForeignFutureStructF64> {
1685
+ static UniffiForeignFutureStructF64 fromJs(jsi::Runtime &rt,
1686
+ std::shared_ptr<CallInvoker> callInvoker,
1687
+ const jsi::Value &jsValue
1688
+ ) {
1689
+ // Check if the input is an object
1690
+ if (!jsValue.isObject()) {
1691
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructF64");
1692
+ }
1693
+
1694
+ // Get the object from the jsi::Value
1695
+ auto jsObject = jsValue.getObject(rt);
1696
+
1697
+ // Create the vtable struct
1698
+ UniffiForeignFutureStructF64 rsObject;
1699
+
1700
+ // Create the vtable from the js callbacks.
1701
+ rsObject.return_value = uniffi_jsi::Bridging<double>::fromJs(
1702
+ rt, callInvoker,
1703
+ jsObject.getProperty(rt, "returnValue")
1704
+ );
1705
+ rsObject.call_status = uniffi::ddk_ffi::Bridging<RustCallStatus>::fromJs(
1706
+ rt, callInvoker,
1707
+ jsObject.getProperty(rt, "callStatus")
1708
+ );
1709
+
1710
+ return rsObject;
1711
+ }
1712
+ };
1713
+
1714
+ } // namespace uniffi::ddk_ffi
1715
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteF64,
1716
+ // passed from Rust to JS as part of async callbacks.
1717
+ namespace uniffi::ddk_ffi {
1718
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1719
+
1720
+ template <> struct Bridging<UniffiForeignFutureCompleteF64> {
1721
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteF64 rsCallback) {
1722
+ return jsi::Function::createFromHostFunction(
1723
+ rt,
1724
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteF64"),
1725
+ 2,
1726
+ [rsCallback, callInvoker](
1727
+ jsi::Runtime &rt,
1728
+ const jsi::Value &thisValue,
1729
+ const jsi::Value *arguments,
1730
+ size_t count) -> jsi::Value
1731
+ {
1732
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1733
+ }
1734
+ );
1735
+ }
1736
+
1737
+ static jsi::Value intoRust(
1738
+ jsi::Runtime &rt,
1739
+ std::shared_ptr<CallInvoker> callInvoker,
1740
+ const jsi::Value &thisValue,
1741
+ const jsi::Value *args,
1742
+ size_t count,
1743
+ UniffiForeignFutureCompleteF64 func) {
1744
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1745
+ // then call the rs_callback with those arguments.
1746
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<UniffiForeignFutureStructF64>::fromJs(rt, callInvoker, args[1])
1747
+ );
1748
+
1749
+
1750
+ return jsi::Value::undefined();
1751
+ }
1752
+ };
1753
+ } // namespace uniffi::ddk_ffi
1754
+ namespace uniffi::ddk_ffi {
1755
+ using namespace facebook;
1756
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1757
+
1758
+ template <> struct Bridging<UniffiForeignFutureStructPointer> {
1759
+ static UniffiForeignFutureStructPointer fromJs(jsi::Runtime &rt,
1760
+ std::shared_ptr<CallInvoker> callInvoker,
1761
+ const jsi::Value &jsValue
1762
+ ) {
1763
+ // Check if the input is an object
1764
+ if (!jsValue.isObject()) {
1765
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructPointer");
1766
+ }
1767
+
1768
+ // Get the object from the jsi::Value
1769
+ auto jsObject = jsValue.getObject(rt);
1770
+
1771
+ // Create the vtable struct
1772
+ UniffiForeignFutureStructPointer rsObject;
1773
+
1774
+ // Create the vtable from the js callbacks.
1775
+ rsObject.return_value = uniffi_jsi::Bridging<void *>::fromJs(
1776
+ rt, callInvoker,
1777
+ jsObject.getProperty(rt, "returnValue")
1778
+ );
1779
+ rsObject.call_status = uniffi::ddk_ffi::Bridging<RustCallStatus>::fromJs(
1780
+ rt, callInvoker,
1781
+ jsObject.getProperty(rt, "callStatus")
1782
+ );
1783
+
1784
+ return rsObject;
1785
+ }
1786
+ };
1787
+
1788
+ } // namespace uniffi::ddk_ffi
1789
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompletePointer,
1790
+ // passed from Rust to JS as part of async callbacks.
1791
+ namespace uniffi::ddk_ffi {
1792
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1793
+
1794
+ template <> struct Bridging<UniffiForeignFutureCompletePointer> {
1795
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompletePointer rsCallback) {
1796
+ return jsi::Function::createFromHostFunction(
1797
+ rt,
1798
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompletePointer"),
1799
+ 2,
1800
+ [rsCallback, callInvoker](
1801
+ jsi::Runtime &rt,
1802
+ const jsi::Value &thisValue,
1803
+ const jsi::Value *arguments,
1804
+ size_t count) -> jsi::Value
1805
+ {
1806
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1807
+ }
1808
+ );
1809
+ }
1810
+
1811
+ static jsi::Value intoRust(
1812
+ jsi::Runtime &rt,
1813
+ std::shared_ptr<CallInvoker> callInvoker,
1814
+ const jsi::Value &thisValue,
1815
+ const jsi::Value *args,
1816
+ size_t count,
1817
+ UniffiForeignFutureCompletePointer func) {
1818
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1819
+ // then call the rs_callback with those arguments.
1820
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<UniffiForeignFutureStructPointer>::fromJs(rt, callInvoker, args[1])
1821
+ );
1822
+
1823
+
1824
+ return jsi::Value::undefined();
1825
+ }
1826
+ };
1827
+ } // namespace uniffi::ddk_ffi
1828
+ namespace uniffi::ddk_ffi {
1829
+ using namespace facebook;
1830
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1831
+
1832
+ template <> struct Bridging<UniffiForeignFutureStructRustBuffer> {
1833
+ static UniffiForeignFutureStructRustBuffer fromJs(jsi::Runtime &rt,
1834
+ std::shared_ptr<CallInvoker> callInvoker,
1835
+ const jsi::Value &jsValue
1836
+ ) {
1837
+ // Check if the input is an object
1838
+ if (!jsValue.isObject()) {
1839
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructRustBuffer");
1840
+ }
1841
+
1842
+ // Get the object from the jsi::Value
1843
+ auto jsObject = jsValue.getObject(rt);
1844
+
1845
+ // Create the vtable struct
1846
+ UniffiForeignFutureStructRustBuffer rsObject;
1847
+
1848
+ // Create the vtable from the js callbacks.
1849
+ rsObject.return_value = uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(
1850
+ rt, callInvoker,
1851
+ jsObject.getProperty(rt, "returnValue")
1852
+ );
1853
+ rsObject.call_status = uniffi::ddk_ffi::Bridging<RustCallStatus>::fromJs(
1854
+ rt, callInvoker,
1855
+ jsObject.getProperty(rt, "callStatus")
1856
+ );
1857
+
1858
+ return rsObject;
1859
+ }
1860
+ };
1861
+
1862
+ } // namespace uniffi::ddk_ffi
1863
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteRustBuffer,
1864
+ // passed from Rust to JS as part of async callbacks.
1865
+ namespace uniffi::ddk_ffi {
1866
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1867
+
1868
+ template <> struct Bridging<UniffiForeignFutureCompleteRustBuffer> {
1869
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteRustBuffer rsCallback) {
1870
+ return jsi::Function::createFromHostFunction(
1871
+ rt,
1872
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteRustBuffer"),
1873
+ 2,
1874
+ [rsCallback, callInvoker](
1875
+ jsi::Runtime &rt,
1876
+ const jsi::Value &thisValue,
1877
+ const jsi::Value *arguments,
1878
+ size_t count) -> jsi::Value
1879
+ {
1880
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1881
+ }
1882
+ );
1883
+ }
1884
+
1885
+ static jsi::Value intoRust(
1886
+ jsi::Runtime &rt,
1887
+ std::shared_ptr<CallInvoker> callInvoker,
1888
+ const jsi::Value &thisValue,
1889
+ const jsi::Value *args,
1890
+ size_t count,
1891
+ UniffiForeignFutureCompleteRustBuffer func) {
1892
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1893
+ // then call the rs_callback with those arguments.
1894
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<UniffiForeignFutureStructRustBuffer>::fromJs(rt, callInvoker, args[1])
1895
+ );
1896
+
1897
+
1898
+ return jsi::Value::undefined();
1899
+ }
1900
+ };
1901
+ } // namespace uniffi::ddk_ffi
1902
+ namespace uniffi::ddk_ffi {
1903
+ using namespace facebook;
1904
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1905
+
1906
+ template <> struct Bridging<UniffiForeignFutureStructVoid> {
1907
+ static UniffiForeignFutureStructVoid fromJs(jsi::Runtime &rt,
1908
+ std::shared_ptr<CallInvoker> callInvoker,
1909
+ const jsi::Value &jsValue
1910
+ ) {
1911
+ // Check if the input is an object
1912
+ if (!jsValue.isObject()) {
1913
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFutureStructVoid");
1914
+ }
1915
+
1916
+ // Get the object from the jsi::Value
1917
+ auto jsObject = jsValue.getObject(rt);
1918
+
1919
+ // Create the vtable struct
1920
+ UniffiForeignFutureStructVoid rsObject;
1921
+
1922
+ // Create the vtable from the js callbacks.
1923
+ rsObject.call_status = uniffi::ddk_ffi::Bridging<RustCallStatus>::fromJs(
1924
+ rt, callInvoker,
1925
+ jsObject.getProperty(rt, "callStatus")
1926
+ );
1927
+
1928
+ return rsObject;
1929
+ }
1930
+ };
1931
+
1932
+ } // namespace uniffi::ddk_ffi
1933
+ // Implementation of callback function calling from JS to Rust ForeignFutureCompleteVoid,
1934
+ // passed from Rust to JS as part of async callbacks.
1935
+ namespace uniffi::ddk_ffi {
1936
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1937
+
1938
+ template <> struct Bridging<UniffiForeignFutureCompleteVoid> {
1939
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker, UniffiForeignFutureCompleteVoid rsCallback) {
1940
+ return jsi::Function::createFromHostFunction(
1941
+ rt,
1942
+ jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteVoid"),
1943
+ 2,
1944
+ [rsCallback, callInvoker](
1945
+ jsi::Runtime &rt,
1946
+ const jsi::Value &thisValue,
1947
+ const jsi::Value *arguments,
1948
+ size_t count) -> jsi::Value
1949
+ {
1950
+ return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
1951
+ }
1952
+ );
1953
+ }
1954
+
1955
+ static jsi::Value intoRust(
1956
+ jsi::Runtime &rt,
1957
+ std::shared_ptr<CallInvoker> callInvoker,
1958
+ const jsi::Value &thisValue,
1959
+ const jsi::Value *args,
1960
+ size_t count,
1961
+ UniffiForeignFutureCompleteVoid func) {
1962
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1963
+ // then call the rs_callback with those arguments.
1964
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<UniffiForeignFutureStructVoid>::fromJs(rt, callInvoker, args[1])
1965
+ );
1966
+
1967
+
1968
+ return jsi::Value::undefined();
1969
+ }
1970
+ };
1971
+ } // namespace uniffi::ddk_ffi
1972
+
1973
+
1974
+ namespace uniffi::ddk_ffi {
1975
+ using namespace facebook;
1976
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1977
+
1978
+ template <> struct Bridging<UniffiRustFutureContinuationCallback> {
1979
+ static UniffiRustFutureContinuationCallback fromJs(
1980
+ jsi::Runtime &rt,
1981
+ std::shared_ptr<CallInvoker> callInvoker,
1982
+ const jsi::Value &value
1983
+ ) {
1984
+ try {
1985
+ return uniffi::ddk_ffi::cb::rustfuturecontinuationcallback::makeCallbackFunction(
1986
+ rt,
1987
+ callInvoker,
1988
+ value
1989
+ );
1990
+ } catch (const std::logic_error &e) {
1991
+ throw jsi::JSError(rt, e.what());
1992
+ }
1993
+ }
1994
+ };
1995
+
1996
+ } // namespace uniffi::ddk_ffi
1997
+
1998
+ NativeDdkFfi::NativeDdkFfi(
1999
+ jsi::Runtime &rt,
2000
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> invoker
2001
+ ) : callInvoker(invoker), props() {
2002
+ // Map from Javascript names to the cpp names
2003
+ props["ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length"] = jsi::Function::createFromHostFunction(
2004
+ rt,
2005
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length"),
2006
+ 1,
2007
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2008
+ return this->cpp_uniffi_internal_fn_func_ffi__string_to_byte_length(rt, thisVal, args, count);
2009
+ }
2010
+ );
2011
+ props["ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer"] = jsi::Function::createFromHostFunction(
2012
+ rt,
2013
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer"),
2014
+ 1,
2015
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2016
+ return this->cpp_uniffi_internal_fn_func_ffi__string_to_arraybuffer(rt, thisVal, args, count);
2017
+ }
2018
+ );
2019
+ props["ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string"] = jsi::Function::createFromHostFunction(
2020
+ rt,
2021
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string"),
2022
+ 1,
2023
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2024
+ return this->cpp_uniffi_internal_fn_func_ffi__arraybuffer_to_string(rt, thisVal, args, count);
2025
+ }
2026
+ );
2027
+ props["ubrn_uniffi_ddk_ffi_fn_func_create_cet"] = jsi::Function::createFromHostFunction(
2028
+ rt,
2029
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_fn_func_create_cet"),
2030
+ 7,
2031
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2032
+ return this->cpp_uniffi_ddk_ffi_fn_func_create_cet(rt, thisVal, args, count);
2033
+ }
2034
+ );
2035
+ props["ubrn_uniffi_ddk_ffi_fn_func_create_cet_adaptor_signature_from_oracle_info"] = jsi::Function::createFromHostFunction(
2036
+ rt,
2037
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_fn_func_create_cet_adaptor_signature_from_oracle_info"),
2038
+ 6,
2039
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2040
+ return this->cpp_uniffi_ddk_ffi_fn_func_create_cet_adaptor_signature_from_oracle_info(rt, thisVal, args, count);
2041
+ }
2042
+ );
2043
+ props["ubrn_uniffi_ddk_ffi_fn_func_create_cets"] = jsi::Function::createFromHostFunction(
2044
+ rt,
2045
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_fn_func_create_cets"),
2046
+ 8,
2047
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2048
+ return this->cpp_uniffi_ddk_ffi_fn_func_create_cets(rt, thisVal, args, count);
2049
+ }
2050
+ );
2051
+ props["ubrn_uniffi_ddk_ffi_fn_func_create_dlc_transactions"] = jsi::Function::createFromHostFunction(
2052
+ rt,
2053
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_fn_func_create_dlc_transactions"),
2054
+ 8,
2055
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2056
+ return this->cpp_uniffi_ddk_ffi_fn_func_create_dlc_transactions(rt, thisVal, args, count);
2057
+ }
2058
+ );
2059
+ props["ubrn_uniffi_ddk_ffi_fn_func_create_fund_tx_locking_script"] = jsi::Function::createFromHostFunction(
2060
+ rt,
2061
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_fn_func_create_fund_tx_locking_script"),
2062
+ 2,
2063
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2064
+ return this->cpp_uniffi_ddk_ffi_fn_func_create_fund_tx_locking_script(rt, thisVal, args, count);
2065
+ }
2066
+ );
2067
+ props["ubrn_uniffi_ddk_ffi_fn_func_create_refund_transaction"] = jsi::Function::createFromHostFunction(
2068
+ rt,
2069
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_fn_func_create_refund_transaction"),
2070
+ 7,
2071
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2072
+ return this->cpp_uniffi_ddk_ffi_fn_func_create_refund_transaction(rt, thisVal, args, count);
2073
+ }
2074
+ );
2075
+ props["ubrn_uniffi_ddk_ffi_fn_func_create_spliced_dlc_transactions"] = jsi::Function::createFromHostFunction(
2076
+ rt,
2077
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_fn_func_create_spliced_dlc_transactions"),
2078
+ 8,
2079
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2080
+ return this->cpp_uniffi_ddk_ffi_fn_func_create_spliced_dlc_transactions(rt, thisVal, args, count);
2081
+ }
2082
+ );
2083
+ props["ubrn_uniffi_ddk_ffi_fn_func_get_change_output_and_fees"] = jsi::Function::createFromHostFunction(
2084
+ rt,
2085
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_fn_func_get_change_output_and_fees"),
2086
+ 2,
2087
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2088
+ return this->cpp_uniffi_ddk_ffi_fn_func_get_change_output_and_fees(rt, thisVal, args, count);
2089
+ }
2090
+ );
2091
+ props["ubrn_uniffi_ddk_ffi_fn_func_get_raw_funding_transaction_input_signature"] = jsi::Function::createFromHostFunction(
2092
+ rt,
2093
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_fn_func_get_raw_funding_transaction_input_signature"),
2094
+ 5,
2095
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2096
+ return this->cpp_uniffi_ddk_ffi_fn_func_get_raw_funding_transaction_input_signature(rt, thisVal, args, count);
2097
+ }
2098
+ );
2099
+ props["ubrn_uniffi_ddk_ffi_fn_func_get_total_input_vsize"] = jsi::Function::createFromHostFunction(
2100
+ rt,
2101
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_fn_func_get_total_input_vsize"),
2102
+ 1,
2103
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2104
+ return this->cpp_uniffi_ddk_ffi_fn_func_get_total_input_vsize(rt, thisVal, args, count);
2105
+ }
2106
+ );
2107
+ props["ubrn_uniffi_ddk_ffi_fn_func_is_dust_output"] = jsi::Function::createFromHostFunction(
2108
+ rt,
2109
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_fn_func_is_dust_output"),
2110
+ 1,
2111
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2112
+ return this->cpp_uniffi_ddk_ffi_fn_func_is_dust_output(rt, thisVal, args, count);
2113
+ }
2114
+ );
2115
+ props["ubrn_uniffi_ddk_ffi_fn_func_sign_fund_transaction_input"] = jsi::Function::createFromHostFunction(
2116
+ rt,
2117
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_fn_func_sign_fund_transaction_input"),
2118
+ 5,
2119
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2120
+ return this->cpp_uniffi_ddk_ffi_fn_func_sign_fund_transaction_input(rt, thisVal, args, count);
2121
+ }
2122
+ );
2123
+ props["ubrn_uniffi_ddk_ffi_fn_func_verify_fund_tx_signature"] = jsi::Function::createFromHostFunction(
2124
+ rt,
2125
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_fn_func_verify_fund_tx_signature"),
2126
+ 6,
2127
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2128
+ return this->cpp_uniffi_ddk_ffi_fn_func_verify_fund_tx_signature(rt, thisVal, args, count);
2129
+ }
2130
+ );
2131
+ props["ubrn_uniffi_ddk_ffi_fn_func_version"] = jsi::Function::createFromHostFunction(
2132
+ rt,
2133
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_fn_func_version"),
2134
+ 0,
2135
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2136
+ return this->cpp_uniffi_ddk_ffi_fn_func_version(rt, thisVal, args, count);
2137
+ }
2138
+ );
2139
+ props["ubrn_uniffi_ddk_ffi_checksum_func_create_cet"] = jsi::Function::createFromHostFunction(
2140
+ rt,
2141
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_checksum_func_create_cet"),
2142
+ 0,
2143
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2144
+ return this->cpp_uniffi_ddk_ffi_checksum_func_create_cet(rt, thisVal, args, count);
2145
+ }
2146
+ );
2147
+ props["ubrn_uniffi_ddk_ffi_checksum_func_create_cet_adaptor_signature_from_oracle_info"] = jsi::Function::createFromHostFunction(
2148
+ rt,
2149
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_checksum_func_create_cet_adaptor_signature_from_oracle_info"),
2150
+ 0,
2151
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2152
+ return this->cpp_uniffi_ddk_ffi_checksum_func_create_cet_adaptor_signature_from_oracle_info(rt, thisVal, args, count);
2153
+ }
2154
+ );
2155
+ props["ubrn_uniffi_ddk_ffi_checksum_func_create_cets"] = jsi::Function::createFromHostFunction(
2156
+ rt,
2157
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_checksum_func_create_cets"),
2158
+ 0,
2159
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2160
+ return this->cpp_uniffi_ddk_ffi_checksum_func_create_cets(rt, thisVal, args, count);
2161
+ }
2162
+ );
2163
+ props["ubrn_uniffi_ddk_ffi_checksum_func_create_dlc_transactions"] = jsi::Function::createFromHostFunction(
2164
+ rt,
2165
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_checksum_func_create_dlc_transactions"),
2166
+ 0,
2167
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2168
+ return this->cpp_uniffi_ddk_ffi_checksum_func_create_dlc_transactions(rt, thisVal, args, count);
2169
+ }
2170
+ );
2171
+ props["ubrn_uniffi_ddk_ffi_checksum_func_create_fund_tx_locking_script"] = jsi::Function::createFromHostFunction(
2172
+ rt,
2173
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_checksum_func_create_fund_tx_locking_script"),
2174
+ 0,
2175
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2176
+ return this->cpp_uniffi_ddk_ffi_checksum_func_create_fund_tx_locking_script(rt, thisVal, args, count);
2177
+ }
2178
+ );
2179
+ props["ubrn_uniffi_ddk_ffi_checksum_func_create_refund_transaction"] = jsi::Function::createFromHostFunction(
2180
+ rt,
2181
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_checksum_func_create_refund_transaction"),
2182
+ 0,
2183
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2184
+ return this->cpp_uniffi_ddk_ffi_checksum_func_create_refund_transaction(rt, thisVal, args, count);
2185
+ }
2186
+ );
2187
+ props["ubrn_uniffi_ddk_ffi_checksum_func_create_spliced_dlc_transactions"] = jsi::Function::createFromHostFunction(
2188
+ rt,
2189
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_checksum_func_create_spliced_dlc_transactions"),
2190
+ 0,
2191
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2192
+ return this->cpp_uniffi_ddk_ffi_checksum_func_create_spliced_dlc_transactions(rt, thisVal, args, count);
2193
+ }
2194
+ );
2195
+ props["ubrn_uniffi_ddk_ffi_checksum_func_get_change_output_and_fees"] = jsi::Function::createFromHostFunction(
2196
+ rt,
2197
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_checksum_func_get_change_output_and_fees"),
2198
+ 0,
2199
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2200
+ return this->cpp_uniffi_ddk_ffi_checksum_func_get_change_output_and_fees(rt, thisVal, args, count);
2201
+ }
2202
+ );
2203
+ props["ubrn_uniffi_ddk_ffi_checksum_func_get_raw_funding_transaction_input_signature"] = jsi::Function::createFromHostFunction(
2204
+ rt,
2205
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_checksum_func_get_raw_funding_transaction_input_signature"),
2206
+ 0,
2207
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2208
+ return this->cpp_uniffi_ddk_ffi_checksum_func_get_raw_funding_transaction_input_signature(rt, thisVal, args, count);
2209
+ }
2210
+ );
2211
+ props["ubrn_uniffi_ddk_ffi_checksum_func_get_total_input_vsize"] = jsi::Function::createFromHostFunction(
2212
+ rt,
2213
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_checksum_func_get_total_input_vsize"),
2214
+ 0,
2215
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2216
+ return this->cpp_uniffi_ddk_ffi_checksum_func_get_total_input_vsize(rt, thisVal, args, count);
2217
+ }
2218
+ );
2219
+ props["ubrn_uniffi_ddk_ffi_checksum_func_is_dust_output"] = jsi::Function::createFromHostFunction(
2220
+ rt,
2221
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_checksum_func_is_dust_output"),
2222
+ 0,
2223
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2224
+ return this->cpp_uniffi_ddk_ffi_checksum_func_is_dust_output(rt, thisVal, args, count);
2225
+ }
2226
+ );
2227
+ props["ubrn_uniffi_ddk_ffi_checksum_func_sign_fund_transaction_input"] = jsi::Function::createFromHostFunction(
2228
+ rt,
2229
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_checksum_func_sign_fund_transaction_input"),
2230
+ 0,
2231
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2232
+ return this->cpp_uniffi_ddk_ffi_checksum_func_sign_fund_transaction_input(rt, thisVal, args, count);
2233
+ }
2234
+ );
2235
+ props["ubrn_uniffi_ddk_ffi_checksum_func_verify_fund_tx_signature"] = jsi::Function::createFromHostFunction(
2236
+ rt,
2237
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_checksum_func_verify_fund_tx_signature"),
2238
+ 0,
2239
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2240
+ return this->cpp_uniffi_ddk_ffi_checksum_func_verify_fund_tx_signature(rt, thisVal, args, count);
2241
+ }
2242
+ );
2243
+ props["ubrn_uniffi_ddk_ffi_checksum_func_version"] = jsi::Function::createFromHostFunction(
2244
+ rt,
2245
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_checksum_func_version"),
2246
+ 0,
2247
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2248
+ return this->cpp_uniffi_ddk_ffi_checksum_func_version(rt, thisVal, args, count);
2249
+ }
2250
+ );
2251
+ props["ubrn_ffi_ddk_ffi_uniffi_contract_version"] = jsi::Function::createFromHostFunction(
2252
+ rt,
2253
+ jsi::PropNameID::forAscii(rt, "ubrn_ffi_ddk_ffi_uniffi_contract_version"),
2254
+ 0,
2255
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
2256
+ return this->cpp_ffi_ddk_ffi_uniffi_contract_version(rt, thisVal, args, count);
2257
+ }
2258
+ );
2259
+ }
2260
+
2261
+ void NativeDdkFfi::registerModule(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> callInvoker) {
2262
+ auto invoker = std::make_shared<uniffi_runtime::UniffiCallInvoker>(callInvoker);
2263
+ auto tm = std::make_shared<NativeDdkFfi>(rt, invoker);
2264
+ auto obj = rt.global().createFromHostObject(rt, tm);
2265
+ rt.global().setProperty(rt, "NativeDdkFfi", obj);
2266
+ }
2267
+
2268
+ void NativeDdkFfi::unregisterModule(jsi::Runtime &rt) {
2269
+ uniffi::ddk_ffi::registry::clearRegistry();
2270
+ }
2271
+
2272
+ jsi::Value NativeDdkFfi::get(jsi::Runtime& rt, const jsi::PropNameID& name) {
2273
+ try {
2274
+ return jsi::Value(rt, props.at(name.utf8(rt)));
2275
+ }
2276
+ catch (std::out_of_range &e) {
2277
+ return jsi::Value::undefined();
2278
+ }
2279
+ }
2280
+
2281
+ std::vector<jsi::PropNameID> NativeDdkFfi::getPropertyNames(jsi::Runtime& rt) {
2282
+ std::vector<jsi::PropNameID> rval;
2283
+ for (auto& [key, value] : props) {
2284
+ rval.push_back(jsi::PropNameID::forUtf8(rt, key));
2285
+ }
2286
+ return rval;
2287
+ }
2288
+
2289
+ void NativeDdkFfi::set(jsi::Runtime& rt, const jsi::PropNameID& name, const jsi::Value& value) {
2290
+ props.insert_or_assign(name.utf8(rt), &value);
2291
+ }
2292
+
2293
+ NativeDdkFfi::~NativeDdkFfi() {
2294
+ // Cleanup for callback function RustFutureContinuationCallback
2295
+ uniffi::ddk_ffi::cb::rustfuturecontinuationcallback::cleanup();
2296
+ // Cleanup for "free" callback function CallbackInterfaceFree
2297
+ uniffi::ddk_ffi::st::foreignfuture::foreignfuture::free::cleanup();
2298
+ }
2299
+
2300
+ // Utility functions for serialization/deserialization of strings.
2301
+ jsi::Value NativeDdkFfi::cpp_uniffi_internal_fn_func_ffi__string_to_byte_length(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2302
+ return uniffi_jsi::Bridging<std::string>::string_to_bytelength(rt, args[0]);
2303
+ }
2304
+
2305
+ jsi::Value NativeDdkFfi::cpp_uniffi_internal_fn_func_ffi__string_to_arraybuffer(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2306
+ return uniffi_jsi::Bridging<std::string>::string_to_arraybuffer(rt, args[0]);
2307
+ }
2308
+
2309
+ jsi::Value NativeDdkFfi::cpp_uniffi_internal_fn_func_ffi__arraybuffer_to_string(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2310
+ return uniffi_jsi::Bridging<std::string>::arraybuffer_to_string(rt, args[0]);
2311
+ }
2312
+
2313
+ // Methods calling directly into the uniffi generated C API of the Rust crate.
2314
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_fn_func_create_cet(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2315
+ RustCallStatus status = uniffi::ddk_ffi::Bridging<RustCallStatus>::rustSuccess(rt);
2316
+ auto value = uniffi_ddk_ffi_fn_func_create_cet(uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]), uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[1]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[2]), uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[3]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[4]), uniffi_jsi::Bridging<uint32_t>::fromJs(rt, callInvoker, args[5]), uniffi_jsi::Bridging<uint32_t>::fromJs(rt, callInvoker, args[6]),
2317
+ &status
2318
+ );
2319
+ uniffi::ddk_ffi::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2320
+
2321
+
2322
+ return uniffi::ddk_ffi::Bridging<RustBuffer>::toJs(rt, callInvoker, value);
2323
+ }
2324
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_fn_func_create_cet_adaptor_signature_from_oracle_info(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2325
+ RustCallStatus status = uniffi::ddk_ffi::Bridging<RustCallStatus>::rustSuccess(rt);
2326
+ auto value = uniffi_ddk_ffi_fn_func_create_cet_adaptor_signature_from_oracle_info(uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[1]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[2]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[3]), uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[4]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[5]),
2327
+ &status
2328
+ );
2329
+ uniffi::ddk_ffi::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2330
+
2331
+
2332
+ return uniffi::ddk_ffi::Bridging<RustBuffer>::toJs(rt, callInvoker, value);
2333
+ }
2334
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_fn_func_create_cets(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2335
+ RustCallStatus status = uniffi::ddk_ffi::Bridging<RustCallStatus>::rustSuccess(rt);
2336
+ auto value = uniffi_ddk_ffi_fn_func_create_cets(uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]), uniffi_jsi::Bridging<uint32_t>::fromJs(rt, callInvoker, args[1]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[2]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[3]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[4]), uniffi_jsi::Bridging<uint32_t>::fromJs(rt, callInvoker, args[5]), uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[6]), uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[7]),
2337
+ &status
2338
+ );
2339
+ uniffi::ddk_ffi::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2340
+
2341
+
2342
+ return uniffi::ddk_ffi::Bridging<RustBuffer>::toJs(rt, callInvoker, value);
2343
+ }
2344
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_fn_func_create_dlc_transactions(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2345
+ RustCallStatus status = uniffi::ddk_ffi::Bridging<RustCallStatus>::rustSuccess(rt);
2346
+ auto value = uniffi_ddk_ffi_fn_func_create_dlc_transactions(uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[1]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[2]), uniffi_jsi::Bridging<uint32_t>::fromJs(rt, callInvoker, args[3]), uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[4]), uniffi_jsi::Bridging<uint32_t>::fromJs(rt, callInvoker, args[5]), uniffi_jsi::Bridging<uint32_t>::fromJs(rt, callInvoker, args[6]), uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[7]),
2347
+ &status
2348
+ );
2349
+ uniffi::ddk_ffi::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2350
+
2351
+
2352
+ return uniffi::ddk_ffi::Bridging<RustBuffer>::toJs(rt, callInvoker, value);
2353
+ }
2354
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_fn_func_create_fund_tx_locking_script(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2355
+ RustCallStatus status = uniffi::ddk_ffi::Bridging<RustCallStatus>::rustSuccess(rt);
2356
+ auto value = uniffi_ddk_ffi_fn_func_create_fund_tx_locking_script(uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[1]),
2357
+ &status
2358
+ );
2359
+ uniffi::ddk_ffi::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2360
+
2361
+
2362
+ return uniffi::ddk_ffi::Bridging<RustBuffer>::toJs(rt, callInvoker, value);
2363
+ }
2364
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_fn_func_create_refund_transaction(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2365
+ RustCallStatus status = uniffi::ddk_ffi::Bridging<RustCallStatus>::rustSuccess(rt);
2366
+ auto value = uniffi_ddk_ffi_fn_func_create_refund_transaction(uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[1]), uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[2]), uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[3]), uniffi_jsi::Bridging<uint32_t>::fromJs(rt, callInvoker, args[4]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[5]), uniffi_jsi::Bridging<uint32_t>::fromJs(rt, callInvoker, args[6]),
2367
+ &status
2368
+ );
2369
+ uniffi::ddk_ffi::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2370
+
2371
+
2372
+ return uniffi::ddk_ffi::Bridging<RustBuffer>::toJs(rt, callInvoker, value);
2373
+ }
2374
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_fn_func_create_spliced_dlc_transactions(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2375
+ RustCallStatus status = uniffi::ddk_ffi::Bridging<RustCallStatus>::rustSuccess(rt);
2376
+ auto value = uniffi_ddk_ffi_fn_func_create_spliced_dlc_transactions(uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[1]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[2]), uniffi_jsi::Bridging<uint32_t>::fromJs(rt, callInvoker, args[3]), uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[4]), uniffi_jsi::Bridging<uint32_t>::fromJs(rt, callInvoker, args[5]), uniffi_jsi::Bridging<uint32_t>::fromJs(rt, callInvoker, args[6]), uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[7]),
2377
+ &status
2378
+ );
2379
+ uniffi::ddk_ffi::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2380
+
2381
+
2382
+ return uniffi::ddk_ffi::Bridging<RustBuffer>::toJs(rt, callInvoker, value);
2383
+ }
2384
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_fn_func_get_change_output_and_fees(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2385
+ RustCallStatus status = uniffi::ddk_ffi::Bridging<RustCallStatus>::rustSuccess(rt);
2386
+ auto value = uniffi_ddk_ffi_fn_func_get_change_output_and_fees(uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]), uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[1]),
2387
+ &status
2388
+ );
2389
+ uniffi::ddk_ffi::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2390
+
2391
+
2392
+ return uniffi::ddk_ffi::Bridging<RustBuffer>::toJs(rt, callInvoker, value);
2393
+ }
2394
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_fn_func_get_raw_funding_transaction_input_signature(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2395
+ RustCallStatus status = uniffi::ddk_ffi::Bridging<RustCallStatus>::rustSuccess(rt);
2396
+ auto value = uniffi_ddk_ffi_fn_func_get_raw_funding_transaction_input_signature(uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[1]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[2]), uniffi_jsi::Bridging<uint32_t>::fromJs(rt, callInvoker, args[3]), uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[4]),
2397
+ &status
2398
+ );
2399
+ uniffi::ddk_ffi::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2400
+
2401
+
2402
+ return uniffi::ddk_ffi::Bridging<RustBuffer>::toJs(rt, callInvoker, value);
2403
+ }
2404
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_fn_func_get_total_input_vsize(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2405
+ RustCallStatus status = uniffi::ddk_ffi::Bridging<RustCallStatus>::rustSuccess(rt);
2406
+ auto value = uniffi_ddk_ffi_fn_func_get_total_input_vsize(uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]),
2407
+ &status
2408
+ );
2409
+ uniffi::ddk_ffi::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2410
+
2411
+
2412
+ return uniffi_jsi::Bridging<uint32_t>::toJs(rt, callInvoker, value);
2413
+ }
2414
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_fn_func_is_dust_output(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2415
+ RustCallStatus status = uniffi::ddk_ffi::Bridging<RustCallStatus>::rustSuccess(rt);
2416
+ auto value = uniffi_ddk_ffi_fn_func_is_dust_output(uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]),
2417
+ &status
2418
+ );
2419
+ uniffi::ddk_ffi::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2420
+
2421
+
2422
+ return uniffi_jsi::Bridging<int8_t>::toJs(rt, callInvoker, value);
2423
+ }
2424
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_fn_func_sign_fund_transaction_input(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2425
+ RustCallStatus status = uniffi::ddk_ffi::Bridging<RustCallStatus>::rustSuccess(rt);
2426
+ auto value = uniffi_ddk_ffi_fn_func_sign_fund_transaction_input(uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[1]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[2]), uniffi_jsi::Bridging<uint32_t>::fromJs(rt, callInvoker, args[3]), uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[4]),
2427
+ &status
2428
+ );
2429
+ uniffi::ddk_ffi::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2430
+
2431
+
2432
+ return uniffi::ddk_ffi::Bridging<RustBuffer>::toJs(rt, callInvoker, value);
2433
+ }
2434
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_fn_func_verify_fund_tx_signature(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2435
+ RustCallStatus status = uniffi::ddk_ffi::Bridging<RustCallStatus>::rustSuccess(rt);
2436
+ auto value = uniffi_ddk_ffi_fn_func_verify_fund_tx_signature(uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[1]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[2]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[3]), uniffi_jsi::Bridging<uint32_t>::fromJs(rt, callInvoker, args[4]), uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[5]),
2437
+ &status
2438
+ );
2439
+ uniffi::ddk_ffi::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2440
+
2441
+
2442
+ return uniffi_jsi::Bridging<int8_t>::toJs(rt, callInvoker, value);
2443
+ }
2444
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_fn_func_version(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2445
+ RustCallStatus status = uniffi::ddk_ffi::Bridging<RustCallStatus>::rustSuccess(rt);
2446
+ auto value = uniffi_ddk_ffi_fn_func_version(&status
2447
+ );
2448
+ uniffi::ddk_ffi::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
2449
+
2450
+
2451
+ return uniffi::ddk_ffi::Bridging<RustBuffer>::toJs(rt, callInvoker, value);
2452
+ }
2453
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_checksum_func_create_cet(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2454
+ auto value = uniffi_ddk_ffi_checksum_func_create_cet(
2455
+ );
2456
+
2457
+
2458
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2459
+ }
2460
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_checksum_func_create_cet_adaptor_signature_from_oracle_info(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2461
+ auto value = uniffi_ddk_ffi_checksum_func_create_cet_adaptor_signature_from_oracle_info(
2462
+ );
2463
+
2464
+
2465
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2466
+ }
2467
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_checksum_func_create_cets(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2468
+ auto value = uniffi_ddk_ffi_checksum_func_create_cets(
2469
+ );
2470
+
2471
+
2472
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2473
+ }
2474
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_checksum_func_create_dlc_transactions(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2475
+ auto value = uniffi_ddk_ffi_checksum_func_create_dlc_transactions(
2476
+ );
2477
+
2478
+
2479
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2480
+ }
2481
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_checksum_func_create_fund_tx_locking_script(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2482
+ auto value = uniffi_ddk_ffi_checksum_func_create_fund_tx_locking_script(
2483
+ );
2484
+
2485
+
2486
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2487
+ }
2488
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_checksum_func_create_refund_transaction(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2489
+ auto value = uniffi_ddk_ffi_checksum_func_create_refund_transaction(
2490
+ );
2491
+
2492
+
2493
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2494
+ }
2495
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_checksum_func_create_spliced_dlc_transactions(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2496
+ auto value = uniffi_ddk_ffi_checksum_func_create_spliced_dlc_transactions(
2497
+ );
2498
+
2499
+
2500
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2501
+ }
2502
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_checksum_func_get_change_output_and_fees(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2503
+ auto value = uniffi_ddk_ffi_checksum_func_get_change_output_and_fees(
2504
+ );
2505
+
2506
+
2507
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2508
+ }
2509
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_checksum_func_get_raw_funding_transaction_input_signature(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2510
+ auto value = uniffi_ddk_ffi_checksum_func_get_raw_funding_transaction_input_signature(
2511
+ );
2512
+
2513
+
2514
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2515
+ }
2516
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_checksum_func_get_total_input_vsize(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2517
+ auto value = uniffi_ddk_ffi_checksum_func_get_total_input_vsize(
2518
+ );
2519
+
2520
+
2521
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2522
+ }
2523
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_checksum_func_is_dust_output(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2524
+ auto value = uniffi_ddk_ffi_checksum_func_is_dust_output(
2525
+ );
2526
+
2527
+
2528
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2529
+ }
2530
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_checksum_func_sign_fund_transaction_input(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2531
+ auto value = uniffi_ddk_ffi_checksum_func_sign_fund_transaction_input(
2532
+ );
2533
+
2534
+
2535
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2536
+ }
2537
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_checksum_func_verify_fund_tx_signature(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2538
+ auto value = uniffi_ddk_ffi_checksum_func_verify_fund_tx_signature(
2539
+ );
2540
+
2541
+
2542
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2543
+ }
2544
+ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_checksum_func_version(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2545
+ auto value = uniffi_ddk_ffi_checksum_func_version(
2546
+ );
2547
+
2548
+
2549
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
2550
+ }
2551
+ jsi::Value NativeDdkFfi::cpp_ffi_ddk_ffi_uniffi_contract_version(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
2552
+ auto value = ffi_ddk_ffi_uniffi_contract_version(
2553
+ );
2554
+
2555
+
2556
+ return uniffi_jsi::Bridging<uint32_t>::toJs(rt, callInvoker, value);
2557
+ }