@baerae/zkap-zkp-react-native 0.1.6 → 0.1.7
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.
- package/android/libs/arm64-v8a/libzkap_uniffi_bindings.so +0 -0
- package/android/libs/x86_64/libzkap_uniffi_bindings.so +0 -0
- package/cpp/generated/zkap_uniffi_bindings.cpp +1367 -1448
- package/cpp/generated/zkap_uniffi_bindings.hpp +102 -51
- package/ios/ZkapReactNative.mm +1 -1
- package/ios/ZkapZkp.xcframework/ios-arm64/libzkap_uniffi_bindings.a +0 -0
- package/ios/ZkapZkp.xcframework/ios-arm64_x86_64-simulator/libzkap_uniffi_bindings.a +0 -0
- package/package.json +3 -3
- package/src/generated/zkap_uniffi_bindings.ts +108 -107
|
@@ -1,394 +1,250 @@
|
|
|
1
|
-
// This file was autogenerated by some hot garbage in the
|
|
2
|
-
// Trust me, you don't want to mess with
|
|
1
|
+
// This file was autogenerated by some hot garbage in the
|
|
2
|
+
// `uniffi-bindgen-react-native` crate. Trust me, you don't want to mess with
|
|
3
|
+
// it!
|
|
3
4
|
#include "zkap_uniffi_bindings.hpp"
|
|
4
5
|
|
|
5
6
|
#include "UniffiJsiTypes.h"
|
|
6
|
-
#include <stdexcept>
|
|
7
|
-
#include <map>
|
|
8
|
-
#include <utility>
|
|
9
7
|
#include <iostream>
|
|
8
|
+
#include <map>
|
|
9
|
+
#include <stdexcept>
|
|
10
10
|
#include <thread>
|
|
11
|
+
#include <utility>
|
|
11
12
|
|
|
12
13
|
namespace react = facebook::react;
|
|
13
14
|
namespace jsi = facebook::jsi;
|
|
14
15
|
|
|
15
16
|
// Calling into Rust.
|
|
16
17
|
extern "C" {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
uint64_t callback_data
|
|
130
|
-
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
);
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
);
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
);
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
);
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
);
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
);
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
);
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
);
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
);
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
);
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
/*handle*/ uint64_t handle
|
|
246
|
-
);
|
|
247
|
-
int16_t ffi_zkap_uniffi_bindings_rust_future_complete_i16(
|
|
248
|
-
/*handle*/ uint64_t handle,
|
|
249
|
-
RustCallStatus *uniffi_out_err
|
|
250
|
-
);
|
|
251
|
-
void ffi_zkap_uniffi_bindings_rust_future_poll_u32(
|
|
252
|
-
/*handle*/ uint64_t handle,
|
|
253
|
-
UniffiRustFutureContinuationCallback callback,
|
|
254
|
-
/*handle*/ uint64_t callback_data
|
|
255
|
-
);
|
|
256
|
-
void ffi_zkap_uniffi_bindings_rust_future_cancel_u32(
|
|
257
|
-
/*handle*/ uint64_t handle
|
|
258
|
-
);
|
|
259
|
-
void ffi_zkap_uniffi_bindings_rust_future_free_u32(
|
|
260
|
-
/*handle*/ uint64_t handle
|
|
261
|
-
);
|
|
262
|
-
uint32_t ffi_zkap_uniffi_bindings_rust_future_complete_u32(
|
|
263
|
-
/*handle*/ uint64_t handle,
|
|
264
|
-
RustCallStatus *uniffi_out_err
|
|
265
|
-
);
|
|
266
|
-
void ffi_zkap_uniffi_bindings_rust_future_poll_i32(
|
|
267
|
-
/*handle*/ uint64_t handle,
|
|
268
|
-
UniffiRustFutureContinuationCallback callback,
|
|
269
|
-
/*handle*/ uint64_t callback_data
|
|
270
|
-
);
|
|
271
|
-
void ffi_zkap_uniffi_bindings_rust_future_cancel_i32(
|
|
272
|
-
/*handle*/ uint64_t handle
|
|
273
|
-
);
|
|
274
|
-
void ffi_zkap_uniffi_bindings_rust_future_free_i32(
|
|
275
|
-
/*handle*/ uint64_t handle
|
|
276
|
-
);
|
|
277
|
-
int32_t ffi_zkap_uniffi_bindings_rust_future_complete_i32(
|
|
278
|
-
/*handle*/ uint64_t handle,
|
|
279
|
-
RustCallStatus *uniffi_out_err
|
|
280
|
-
);
|
|
281
|
-
void ffi_zkap_uniffi_bindings_rust_future_poll_u64(
|
|
282
|
-
/*handle*/ uint64_t handle,
|
|
283
|
-
UniffiRustFutureContinuationCallback callback,
|
|
284
|
-
/*handle*/ uint64_t callback_data
|
|
285
|
-
);
|
|
286
|
-
void ffi_zkap_uniffi_bindings_rust_future_cancel_u64(
|
|
287
|
-
/*handle*/ uint64_t handle
|
|
288
|
-
);
|
|
289
|
-
void ffi_zkap_uniffi_bindings_rust_future_free_u64(
|
|
290
|
-
/*handle*/ uint64_t handle
|
|
291
|
-
);
|
|
292
|
-
uint64_t ffi_zkap_uniffi_bindings_rust_future_complete_u64(
|
|
293
|
-
/*handle*/ uint64_t handle,
|
|
294
|
-
RustCallStatus *uniffi_out_err
|
|
295
|
-
);
|
|
296
|
-
void ffi_zkap_uniffi_bindings_rust_future_poll_i64(
|
|
297
|
-
/*handle*/ uint64_t handle,
|
|
298
|
-
UniffiRustFutureContinuationCallback callback,
|
|
299
|
-
/*handle*/ uint64_t callback_data
|
|
300
|
-
);
|
|
301
|
-
void ffi_zkap_uniffi_bindings_rust_future_cancel_i64(
|
|
302
|
-
/*handle*/ uint64_t handle
|
|
303
|
-
);
|
|
304
|
-
void ffi_zkap_uniffi_bindings_rust_future_free_i64(
|
|
305
|
-
/*handle*/ uint64_t handle
|
|
306
|
-
);
|
|
307
|
-
int64_t ffi_zkap_uniffi_bindings_rust_future_complete_i64(
|
|
308
|
-
/*handle*/ uint64_t handle,
|
|
309
|
-
RustCallStatus *uniffi_out_err
|
|
310
|
-
);
|
|
311
|
-
void ffi_zkap_uniffi_bindings_rust_future_poll_f32(
|
|
312
|
-
/*handle*/ uint64_t handle,
|
|
313
|
-
UniffiRustFutureContinuationCallback callback,
|
|
314
|
-
/*handle*/ uint64_t callback_data
|
|
315
|
-
);
|
|
316
|
-
void ffi_zkap_uniffi_bindings_rust_future_cancel_f32(
|
|
317
|
-
/*handle*/ uint64_t handle
|
|
318
|
-
);
|
|
319
|
-
void ffi_zkap_uniffi_bindings_rust_future_free_f32(
|
|
320
|
-
/*handle*/ uint64_t handle
|
|
321
|
-
);
|
|
322
|
-
float ffi_zkap_uniffi_bindings_rust_future_complete_f32(
|
|
323
|
-
/*handle*/ uint64_t handle,
|
|
324
|
-
RustCallStatus *uniffi_out_err
|
|
325
|
-
);
|
|
326
|
-
void ffi_zkap_uniffi_bindings_rust_future_poll_f64(
|
|
327
|
-
/*handle*/ uint64_t handle,
|
|
328
|
-
UniffiRustFutureContinuationCallback callback,
|
|
329
|
-
/*handle*/ uint64_t callback_data
|
|
330
|
-
);
|
|
331
|
-
void ffi_zkap_uniffi_bindings_rust_future_cancel_f64(
|
|
332
|
-
/*handle*/ uint64_t handle
|
|
333
|
-
);
|
|
334
|
-
void ffi_zkap_uniffi_bindings_rust_future_free_f64(
|
|
335
|
-
/*handle*/ uint64_t handle
|
|
336
|
-
);
|
|
337
|
-
double ffi_zkap_uniffi_bindings_rust_future_complete_f64(
|
|
338
|
-
/*handle*/ uint64_t handle,
|
|
339
|
-
RustCallStatus *uniffi_out_err
|
|
340
|
-
);
|
|
341
|
-
void ffi_zkap_uniffi_bindings_rust_future_poll_rust_buffer(
|
|
342
|
-
/*handle*/ uint64_t handle,
|
|
343
|
-
UniffiRustFutureContinuationCallback callback,
|
|
344
|
-
/*handle*/ uint64_t callback_data
|
|
345
|
-
);
|
|
346
|
-
void ffi_zkap_uniffi_bindings_rust_future_cancel_rust_buffer(
|
|
347
|
-
/*handle*/ uint64_t handle
|
|
348
|
-
);
|
|
349
|
-
void ffi_zkap_uniffi_bindings_rust_future_free_rust_buffer(
|
|
350
|
-
/*handle*/ uint64_t handle
|
|
351
|
-
);
|
|
352
|
-
RustBuffer ffi_zkap_uniffi_bindings_rust_future_complete_rust_buffer(
|
|
353
|
-
/*handle*/ uint64_t handle,
|
|
354
|
-
RustCallStatus *uniffi_out_err
|
|
355
|
-
);
|
|
356
|
-
void ffi_zkap_uniffi_bindings_rust_future_poll_void(
|
|
357
|
-
/*handle*/ uint64_t handle,
|
|
358
|
-
UniffiRustFutureContinuationCallback callback,
|
|
359
|
-
/*handle*/ uint64_t callback_data
|
|
360
|
-
);
|
|
361
|
-
void ffi_zkap_uniffi_bindings_rust_future_cancel_void(
|
|
362
|
-
/*handle*/ uint64_t handle
|
|
363
|
-
);
|
|
364
|
-
void ffi_zkap_uniffi_bindings_rust_future_free_void(
|
|
365
|
-
/*handle*/ uint64_t handle
|
|
366
|
-
);
|
|
367
|
-
void ffi_zkap_uniffi_bindings_rust_future_complete_void(
|
|
368
|
-
/*handle*/ uint64_t handle,
|
|
369
|
-
RustCallStatus *uniffi_out_err
|
|
370
|
-
);
|
|
371
|
-
uint16_t uniffi_zkap_uniffi_bindings_checksum_func_generate_anchor(
|
|
372
|
-
);
|
|
373
|
-
uint16_t uniffi_zkap_uniffi_bindings_checksum_func_generate_aud_hash(
|
|
374
|
-
);
|
|
375
|
-
uint16_t uniffi_zkap_uniffi_bindings_checksum_func_generate_hash(
|
|
376
|
-
);
|
|
377
|
-
uint16_t uniffi_zkap_uniffi_bindings_checksum_func_generate_leaf_hash(
|
|
378
|
-
);
|
|
379
|
-
uint16_t uniffi_zkap_uniffi_bindings_checksum_func_prepare_witness_inputs(
|
|
380
|
-
);
|
|
381
|
-
uint16_t uniffi_zkap_uniffi_bindings_checksum_func_prove(
|
|
382
|
-
);
|
|
383
|
-
uint16_t uniffi_zkap_uniffi_bindings_checksum_func_prove_from_witness_bundle_file(
|
|
384
|
-
);
|
|
385
|
-
uint16_t uniffi_zkap_uniffi_bindings_checksum_func_prove_from_witness_bundles(
|
|
386
|
-
);
|
|
387
|
-
uint32_t ffi_zkap_uniffi_bindings_uniffi_contract_version(
|
|
388
|
-
);
|
|
18
|
+
typedef void (*UniffiRustFutureContinuationCallback)(uint64_t data,
|
|
19
|
+
int8_t poll_result);
|
|
20
|
+
typedef void (*UniffiForeignFutureDroppedCallback)(uint64_t handle);
|
|
21
|
+
typedef void (*UniffiCallbackInterfaceFree)(uint64_t handle);
|
|
22
|
+
typedef uint64_t (*UniffiCallbackInterfaceClone)(uint64_t handle);
|
|
23
|
+
typedef struct UniffiForeignFutureDroppedCallbackStruct {
|
|
24
|
+
uint64_t handle;
|
|
25
|
+
UniffiForeignFutureDroppedCallback free;
|
|
26
|
+
} UniffiForeignFutureDroppedCallbackStruct;
|
|
27
|
+
typedef struct UniffiForeignFutureResultU8 {
|
|
28
|
+
uint8_t return_value;
|
|
29
|
+
RustCallStatus call_status;
|
|
30
|
+
} UniffiForeignFutureResultU8;
|
|
31
|
+
typedef void (*UniffiForeignFutureCompleteU8)(
|
|
32
|
+
uint64_t callback_data, UniffiForeignFutureResultU8 result);
|
|
33
|
+
typedef struct UniffiForeignFutureResultI8 {
|
|
34
|
+
int8_t return_value;
|
|
35
|
+
RustCallStatus call_status;
|
|
36
|
+
} UniffiForeignFutureResultI8;
|
|
37
|
+
typedef void (*UniffiForeignFutureCompleteI8)(
|
|
38
|
+
uint64_t callback_data, UniffiForeignFutureResultI8 result);
|
|
39
|
+
typedef struct UniffiForeignFutureResultU16 {
|
|
40
|
+
uint16_t return_value;
|
|
41
|
+
RustCallStatus call_status;
|
|
42
|
+
} UniffiForeignFutureResultU16;
|
|
43
|
+
typedef void (*UniffiForeignFutureCompleteU16)(
|
|
44
|
+
uint64_t callback_data, UniffiForeignFutureResultU16 result);
|
|
45
|
+
typedef struct UniffiForeignFutureResultI16 {
|
|
46
|
+
int16_t return_value;
|
|
47
|
+
RustCallStatus call_status;
|
|
48
|
+
} UniffiForeignFutureResultI16;
|
|
49
|
+
typedef void (*UniffiForeignFutureCompleteI16)(
|
|
50
|
+
uint64_t callback_data, UniffiForeignFutureResultI16 result);
|
|
51
|
+
typedef struct UniffiForeignFutureResultU32 {
|
|
52
|
+
uint32_t return_value;
|
|
53
|
+
RustCallStatus call_status;
|
|
54
|
+
} UniffiForeignFutureResultU32;
|
|
55
|
+
typedef void (*UniffiForeignFutureCompleteU32)(
|
|
56
|
+
uint64_t callback_data, UniffiForeignFutureResultU32 result);
|
|
57
|
+
typedef struct UniffiForeignFutureResultI32 {
|
|
58
|
+
int32_t return_value;
|
|
59
|
+
RustCallStatus call_status;
|
|
60
|
+
} UniffiForeignFutureResultI32;
|
|
61
|
+
typedef void (*UniffiForeignFutureCompleteI32)(
|
|
62
|
+
uint64_t callback_data, UniffiForeignFutureResultI32 result);
|
|
63
|
+
typedef struct UniffiForeignFutureResultU64 {
|
|
64
|
+
uint64_t return_value;
|
|
65
|
+
RustCallStatus call_status;
|
|
66
|
+
} UniffiForeignFutureResultU64;
|
|
67
|
+
typedef void (*UniffiForeignFutureCompleteU64)(
|
|
68
|
+
uint64_t callback_data, UniffiForeignFutureResultU64 result);
|
|
69
|
+
typedef struct UniffiForeignFutureResultI64 {
|
|
70
|
+
int64_t return_value;
|
|
71
|
+
RustCallStatus call_status;
|
|
72
|
+
} UniffiForeignFutureResultI64;
|
|
73
|
+
typedef void (*UniffiForeignFutureCompleteI64)(
|
|
74
|
+
uint64_t callback_data, UniffiForeignFutureResultI64 result);
|
|
75
|
+
typedef struct UniffiForeignFutureResultF32 {
|
|
76
|
+
float return_value;
|
|
77
|
+
RustCallStatus call_status;
|
|
78
|
+
} UniffiForeignFutureResultF32;
|
|
79
|
+
typedef void (*UniffiForeignFutureCompleteF32)(
|
|
80
|
+
uint64_t callback_data, UniffiForeignFutureResultF32 result);
|
|
81
|
+
typedef struct UniffiForeignFutureResultF64 {
|
|
82
|
+
double return_value;
|
|
83
|
+
RustCallStatus call_status;
|
|
84
|
+
} UniffiForeignFutureResultF64;
|
|
85
|
+
typedef void (*UniffiForeignFutureCompleteF64)(
|
|
86
|
+
uint64_t callback_data, UniffiForeignFutureResultF64 result);
|
|
87
|
+
typedef struct UniffiForeignFutureResultRustBuffer {
|
|
88
|
+
RustBuffer return_value;
|
|
89
|
+
RustCallStatus call_status;
|
|
90
|
+
} UniffiForeignFutureResultRustBuffer;
|
|
91
|
+
typedef void (*UniffiForeignFutureCompleteRustBuffer)(
|
|
92
|
+
uint64_t callback_data, UniffiForeignFutureResultRustBuffer result);
|
|
93
|
+
typedef struct UniffiForeignFutureResultVoid {
|
|
94
|
+
RustCallStatus call_status;
|
|
95
|
+
} UniffiForeignFutureResultVoid;
|
|
96
|
+
typedef void (*UniffiForeignFutureCompleteVoid)(
|
|
97
|
+
uint64_t callback_data, UniffiForeignFutureResultVoid result);
|
|
98
|
+
RustBuffer uniffi_zkap_uniffi_bindings_fn_func_generate_anchor(
|
|
99
|
+
RustBuffer config, RustBuffer secrets, RustCallStatus *uniffi_out_err);
|
|
100
|
+
RustBuffer uniffi_zkap_uniffi_bindings_fn_func_generate_aud_hash(
|
|
101
|
+
RustBuffer config, RustBuffer aud_list, RustCallStatus *uniffi_out_err);
|
|
102
|
+
RustBuffer uniffi_zkap_uniffi_bindings_fn_func_generate_hash(
|
|
103
|
+
RustBuffer messages, RustCallStatus *uniffi_out_err);
|
|
104
|
+
RustBuffer uniffi_zkap_uniffi_bindings_fn_func_generate_leaf_hash(
|
|
105
|
+
RustBuffer config, RustBuffer iss, RustBuffer pk_b64,
|
|
106
|
+
RustCallStatus *uniffi_out_err);
|
|
107
|
+
RustBuffer uniffi_zkap_uniffi_bindings_fn_func_prepare_witness_inputs(
|
|
108
|
+
RustBuffer _config, RustBuffer request, RustCallStatus *uniffi_out_err);
|
|
109
|
+
RustBuffer uniffi_zkap_uniffi_bindings_fn_func_prove(
|
|
110
|
+
RustBuffer _config, RustBuffer request, RustCallStatus *uniffi_out_err);
|
|
111
|
+
RustBuffer uniffi_zkap_uniffi_bindings_fn_func_prove_from_witness_bundle_file(
|
|
112
|
+
RustBuffer _config, RustBuffer request, RustBuffer witness,
|
|
113
|
+
RustCallStatus *uniffi_out_err);
|
|
114
|
+
RustBuffer uniffi_zkap_uniffi_bindings_fn_func_prove_from_witness_bundles(
|
|
115
|
+
RustBuffer _config, RustBuffer request, RustBuffer witness,
|
|
116
|
+
RustCallStatus *uniffi_out_err);
|
|
117
|
+
RustBuffer
|
|
118
|
+
ffi_zkap_uniffi_bindings_rustbuffer_alloc(uint64_t size,
|
|
119
|
+
RustCallStatus *uniffi_out_err);
|
|
120
|
+
RustBuffer
|
|
121
|
+
ffi_zkap_uniffi_bindings_rustbuffer_from_bytes(ForeignBytes bytes,
|
|
122
|
+
RustCallStatus *uniffi_out_err);
|
|
123
|
+
void ffi_zkap_uniffi_bindings_rustbuffer_free(RustBuffer buf,
|
|
124
|
+
RustCallStatus *uniffi_out_err);
|
|
125
|
+
RustBuffer
|
|
126
|
+
ffi_zkap_uniffi_bindings_rustbuffer_reserve(RustBuffer buf, uint64_t additional,
|
|
127
|
+
RustCallStatus *uniffi_out_err);
|
|
128
|
+
void ffi_zkap_uniffi_bindings_rust_future_poll_u8(
|
|
129
|
+
/*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
|
|
130
|
+
/*handle*/ uint64_t callback_data);
|
|
131
|
+
void ffi_zkap_uniffi_bindings_rust_future_cancel_u8(
|
|
132
|
+
/*handle*/ uint64_t handle);
|
|
133
|
+
void ffi_zkap_uniffi_bindings_rust_future_free_u8(
|
|
134
|
+
/*handle*/ uint64_t handle);
|
|
135
|
+
uint8_t ffi_zkap_uniffi_bindings_rust_future_complete_u8(
|
|
136
|
+
/*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
|
|
137
|
+
void ffi_zkap_uniffi_bindings_rust_future_poll_i8(
|
|
138
|
+
/*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
|
|
139
|
+
/*handle*/ uint64_t callback_data);
|
|
140
|
+
void ffi_zkap_uniffi_bindings_rust_future_cancel_i8(
|
|
141
|
+
/*handle*/ uint64_t handle);
|
|
142
|
+
void ffi_zkap_uniffi_bindings_rust_future_free_i8(
|
|
143
|
+
/*handle*/ uint64_t handle);
|
|
144
|
+
int8_t ffi_zkap_uniffi_bindings_rust_future_complete_i8(
|
|
145
|
+
/*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
|
|
146
|
+
void ffi_zkap_uniffi_bindings_rust_future_poll_u16(
|
|
147
|
+
/*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
|
|
148
|
+
/*handle*/ uint64_t callback_data);
|
|
149
|
+
void ffi_zkap_uniffi_bindings_rust_future_cancel_u16(
|
|
150
|
+
/*handle*/ uint64_t handle);
|
|
151
|
+
void ffi_zkap_uniffi_bindings_rust_future_free_u16(
|
|
152
|
+
/*handle*/ uint64_t handle);
|
|
153
|
+
uint16_t ffi_zkap_uniffi_bindings_rust_future_complete_u16(
|
|
154
|
+
/*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
|
|
155
|
+
void ffi_zkap_uniffi_bindings_rust_future_poll_i16(
|
|
156
|
+
/*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
|
|
157
|
+
/*handle*/ uint64_t callback_data);
|
|
158
|
+
void ffi_zkap_uniffi_bindings_rust_future_cancel_i16(
|
|
159
|
+
/*handle*/ uint64_t handle);
|
|
160
|
+
void ffi_zkap_uniffi_bindings_rust_future_free_i16(
|
|
161
|
+
/*handle*/ uint64_t handle);
|
|
162
|
+
int16_t ffi_zkap_uniffi_bindings_rust_future_complete_i16(
|
|
163
|
+
/*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
|
|
164
|
+
void ffi_zkap_uniffi_bindings_rust_future_poll_u32(
|
|
165
|
+
/*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
|
|
166
|
+
/*handle*/ uint64_t callback_data);
|
|
167
|
+
void ffi_zkap_uniffi_bindings_rust_future_cancel_u32(
|
|
168
|
+
/*handle*/ uint64_t handle);
|
|
169
|
+
void ffi_zkap_uniffi_bindings_rust_future_free_u32(
|
|
170
|
+
/*handle*/ uint64_t handle);
|
|
171
|
+
uint32_t ffi_zkap_uniffi_bindings_rust_future_complete_u32(
|
|
172
|
+
/*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
|
|
173
|
+
void ffi_zkap_uniffi_bindings_rust_future_poll_i32(
|
|
174
|
+
/*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
|
|
175
|
+
/*handle*/ uint64_t callback_data);
|
|
176
|
+
void ffi_zkap_uniffi_bindings_rust_future_cancel_i32(
|
|
177
|
+
/*handle*/ uint64_t handle);
|
|
178
|
+
void ffi_zkap_uniffi_bindings_rust_future_free_i32(
|
|
179
|
+
/*handle*/ uint64_t handle);
|
|
180
|
+
int32_t ffi_zkap_uniffi_bindings_rust_future_complete_i32(
|
|
181
|
+
/*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
|
|
182
|
+
void ffi_zkap_uniffi_bindings_rust_future_poll_u64(
|
|
183
|
+
/*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
|
|
184
|
+
/*handle*/ uint64_t callback_data);
|
|
185
|
+
void ffi_zkap_uniffi_bindings_rust_future_cancel_u64(
|
|
186
|
+
/*handle*/ uint64_t handle);
|
|
187
|
+
void ffi_zkap_uniffi_bindings_rust_future_free_u64(
|
|
188
|
+
/*handle*/ uint64_t handle);
|
|
189
|
+
uint64_t ffi_zkap_uniffi_bindings_rust_future_complete_u64(
|
|
190
|
+
/*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
|
|
191
|
+
void ffi_zkap_uniffi_bindings_rust_future_poll_i64(
|
|
192
|
+
/*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
|
|
193
|
+
/*handle*/ uint64_t callback_data);
|
|
194
|
+
void ffi_zkap_uniffi_bindings_rust_future_cancel_i64(
|
|
195
|
+
/*handle*/ uint64_t handle);
|
|
196
|
+
void ffi_zkap_uniffi_bindings_rust_future_free_i64(
|
|
197
|
+
/*handle*/ uint64_t handle);
|
|
198
|
+
int64_t ffi_zkap_uniffi_bindings_rust_future_complete_i64(
|
|
199
|
+
/*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
|
|
200
|
+
void ffi_zkap_uniffi_bindings_rust_future_poll_f32(
|
|
201
|
+
/*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
|
|
202
|
+
/*handle*/ uint64_t callback_data);
|
|
203
|
+
void ffi_zkap_uniffi_bindings_rust_future_cancel_f32(
|
|
204
|
+
/*handle*/ uint64_t handle);
|
|
205
|
+
void ffi_zkap_uniffi_bindings_rust_future_free_f32(
|
|
206
|
+
/*handle*/ uint64_t handle);
|
|
207
|
+
float ffi_zkap_uniffi_bindings_rust_future_complete_f32(
|
|
208
|
+
/*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
|
|
209
|
+
void ffi_zkap_uniffi_bindings_rust_future_poll_f64(
|
|
210
|
+
/*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
|
|
211
|
+
/*handle*/ uint64_t callback_data);
|
|
212
|
+
void ffi_zkap_uniffi_bindings_rust_future_cancel_f64(
|
|
213
|
+
/*handle*/ uint64_t handle);
|
|
214
|
+
void ffi_zkap_uniffi_bindings_rust_future_free_f64(
|
|
215
|
+
/*handle*/ uint64_t handle);
|
|
216
|
+
double ffi_zkap_uniffi_bindings_rust_future_complete_f64(
|
|
217
|
+
/*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
|
|
218
|
+
void ffi_zkap_uniffi_bindings_rust_future_poll_rust_buffer(
|
|
219
|
+
/*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
|
|
220
|
+
/*handle*/ uint64_t callback_data);
|
|
221
|
+
void ffi_zkap_uniffi_bindings_rust_future_cancel_rust_buffer(
|
|
222
|
+
/*handle*/ uint64_t handle);
|
|
223
|
+
void ffi_zkap_uniffi_bindings_rust_future_free_rust_buffer(
|
|
224
|
+
/*handle*/ uint64_t handle);
|
|
225
|
+
RustBuffer ffi_zkap_uniffi_bindings_rust_future_complete_rust_buffer(
|
|
226
|
+
/*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
|
|
227
|
+
void ffi_zkap_uniffi_bindings_rust_future_poll_void(
|
|
228
|
+
/*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
|
|
229
|
+
/*handle*/ uint64_t callback_data);
|
|
230
|
+
void ffi_zkap_uniffi_bindings_rust_future_cancel_void(
|
|
231
|
+
/*handle*/ uint64_t handle);
|
|
232
|
+
void ffi_zkap_uniffi_bindings_rust_future_free_void(
|
|
233
|
+
/*handle*/ uint64_t handle);
|
|
234
|
+
void ffi_zkap_uniffi_bindings_rust_future_complete_void(
|
|
235
|
+
/*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
|
|
236
|
+
uint16_t uniffi_zkap_uniffi_bindings_checksum_func_generate_anchor();
|
|
237
|
+
uint16_t uniffi_zkap_uniffi_bindings_checksum_func_generate_aud_hash();
|
|
238
|
+
uint16_t uniffi_zkap_uniffi_bindings_checksum_func_generate_hash();
|
|
239
|
+
uint16_t uniffi_zkap_uniffi_bindings_checksum_func_generate_leaf_hash();
|
|
240
|
+
uint16_t uniffi_zkap_uniffi_bindings_checksum_func_prepare_witness_inputs();
|
|
241
|
+
uint16_t uniffi_zkap_uniffi_bindings_checksum_func_prove();
|
|
242
|
+
uint16_t
|
|
243
|
+
uniffi_zkap_uniffi_bindings_checksum_func_prove_from_witness_bundle_file();
|
|
244
|
+
uint16_t uniffi_zkap_uniffi_bindings_checksum_func_prove_from_witness_bundles();
|
|
245
|
+
uint32_t ffi_zkap_uniffi_bindings_uniffi_contract_version();
|
|
389
246
|
}
|
|
390
247
|
|
|
391
|
-
|
|
392
248
|
namespace uniffi::zkap_uniffi_bindings {
|
|
393
249
|
template <typename T> struct Bridging;
|
|
394
250
|
|
|
@@ -405,12 +261,12 @@ template <typename T> struct Bridging<ReferenceHolder<T>> {
|
|
|
405
261
|
auto obj = value.asObject(rt);
|
|
406
262
|
if (obj.hasProperty(rt, "pointee")) {
|
|
407
263
|
auto pointee = obj.getProperty(rt, "pointee");
|
|
408
|
-
return uniffi::zkap_uniffi_bindings::Bridging<T>::fromJs(rt, callInvoker,
|
|
264
|
+
return uniffi::zkap_uniffi_bindings::Bridging<T>::fromJs(rt, callInvoker,
|
|
265
|
+
pointee);
|
|
409
266
|
}
|
|
410
|
-
throw jsi::JSError(
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
);
|
|
267
|
+
throw jsi::JSError(rt,
|
|
268
|
+
"Expected ReferenceHolder to have a pointee property. "
|
|
269
|
+
"This is likely a bug in uniffi-bindgen-react-native");
|
|
414
270
|
}
|
|
415
271
|
};
|
|
416
272
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
@@ -420,33 +276,26 @@ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
|
420
276
|
|
|
421
277
|
template <> struct Bridging<RustBuffer> {
|
|
422
278
|
static RustBuffer rustbuffer_alloc(int32_t size) {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
size,
|
|
426
|
-
&status
|
|
427
|
-
);
|
|
279
|
+
RustCallStatus status = {UNIFFI_CALL_STATUS_OK};
|
|
280
|
+
return ffi_zkap_uniffi_bindings_rustbuffer_alloc(size, &status);
|
|
428
281
|
}
|
|
429
282
|
|
|
430
283
|
static void rustbuffer_free(RustBuffer buf) {
|
|
431
|
-
RustCallStatus status = {
|
|
432
|
-
ffi_zkap_uniffi_bindings_rustbuffer_free(
|
|
433
|
-
buf,
|
|
434
|
-
&status
|
|
435
|
-
);
|
|
284
|
+
RustCallStatus status = {UNIFFI_CALL_STATUS_OK};
|
|
285
|
+
ffi_zkap_uniffi_bindings_rustbuffer_free(buf, &status);
|
|
436
286
|
}
|
|
437
287
|
|
|
438
288
|
static RustBuffer rustbuffer_from_bytes(ForeignBytes bytes) {
|
|
439
|
-
RustCallStatus status = {
|
|
440
|
-
return ffi_zkap_uniffi_bindings_rustbuffer_from_bytes(
|
|
441
|
-
bytes,
|
|
442
|
-
&status
|
|
443
|
-
);
|
|
289
|
+
RustCallStatus status = {UNIFFI_CALL_STATUS_OK};
|
|
290
|
+
return ffi_zkap_uniffi_bindings_rustbuffer_from_bytes(bytes, &status);
|
|
444
291
|
}
|
|
445
292
|
|
|
446
293
|
static RustBuffer fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker>,
|
|
447
294
|
const jsi::Value &value) {
|
|
448
295
|
try {
|
|
449
|
-
auto buffer =
|
|
296
|
+
auto buffer =
|
|
297
|
+
uniffi_jsi::Bridging<jsi::ArrayBuffer>::value_to_arraybuffer(rt,
|
|
298
|
+
value);
|
|
450
299
|
auto bytes = ForeignBytes{
|
|
451
300
|
.len = static_cast<int32_t>(buffer.length(rt)),
|
|
452
301
|
.data = buffer.data(rt),
|
|
@@ -483,7 +332,9 @@ template <> struct Bridging<RustBuffer> {
|
|
|
483
332
|
rustbuffer_free(buf);
|
|
484
333
|
|
|
485
334
|
// Finally, return the ArrayBuffer.
|
|
486
|
-
return uniffi_jsi::Bridging<jsi::ArrayBuffer>::arraybuffer_to_value(
|
|
335
|
+
return uniffi_jsi::Bridging<jsi::ArrayBuffer>::arraybuffer_to_value(
|
|
336
|
+
rt, arrayBuffer);
|
|
337
|
+
;
|
|
487
338
|
}
|
|
488
339
|
};
|
|
489
340
|
|
|
@@ -508,8 +359,7 @@ template <> struct Bridging<RustCallStatus> {
|
|
|
508
359
|
const jsi::Value &jsStatus) {
|
|
509
360
|
auto statusObject = jsStatus.asObject(rt);
|
|
510
361
|
if (status.error_buf.data != nullptr) {
|
|
511
|
-
auto rbuf = Bridging<RustBuffer>::toJs(rt, callInvoker,
|
|
512
|
-
status.error_buf);
|
|
362
|
+
auto rbuf = Bridging<RustBuffer>::toJs(rt, callInvoker, status.error_buf);
|
|
513
363
|
statusObject.setProperty(rt, "errorBuf", rbuf);
|
|
514
364
|
}
|
|
515
365
|
if (status.code != UNIFFI_CALL_STATUS_OK) {
|
|
@@ -526,8 +376,7 @@ template <> struct Bridging<RustCallStatus> {
|
|
|
526
376
|
auto statusObject = jsStatus.asObject(rt);
|
|
527
377
|
if (statusObject.hasProperty(rt, "errorBuf")) {
|
|
528
378
|
auto rbuf = statusObject.getProperty(rt, "errorBuf");
|
|
529
|
-
status.error_buf =
|
|
530
|
-
Bridging<RustBuffer>::fromJs(rt, invoker, rbuf);
|
|
379
|
+
status.error_buf = Bridging<RustBuffer>::fromJs(rt, invoker, rbuf);
|
|
531
380
|
}
|
|
532
381
|
if (statusObject.hasProperty(rt, "code")) {
|
|
533
382
|
auto code = statusObject.getProperty(rt, "code");
|
|
@@ -541,8 +390,7 @@ template <> struct Bridging<RustCallStatus> {
|
|
|
541
390
|
auto statusObject = jsStatus.asObject(rt);
|
|
542
391
|
if (statusObject.hasProperty(rt, "errorBuf")) {
|
|
543
392
|
auto rbuf = statusObject.getProperty(rt, "errorBuf");
|
|
544
|
-
status->error_buf =
|
|
545
|
-
Bridging<RustBuffer>::fromJs(rt, invoker, rbuf);
|
|
393
|
+
status->error_buf = Bridging<RustBuffer>::fromJs(rt, invoker, rbuf);
|
|
546
394
|
}
|
|
547
395
|
if (statusObject.hasProperty(rt, "code")) {
|
|
548
396
|
auto code = statusObject.getProperty(rt, "code");
|
|
@@ -557,304 +405,294 @@ template <> struct Bridging<RustCallStatus> {
|
|
|
557
405
|
// Here, we need to hold on to them, but also be able to clear them at just the
|
|
558
406
|
// right time so we can support hot-reloading.
|
|
559
407
|
namespace uniffi::zkap_uniffi_bindings::registry {
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
};
|
|
566
|
-
|
|
567
|
-
// Mutex to bind the storage and setting of vtable together.
|
|
568
|
-
// We declare it here, but the lock is taken by callers of the putTable
|
|
569
|
-
// method who are also sending a pointer to Rust.
|
|
570
|
-
static std::mutex vtableMutex;
|
|
571
|
-
|
|
572
|
-
// Registry to hold all vtables so they persist even when JS objects are GC'd.
|
|
573
|
-
// The only reason this exists is to prevent a dangling pointer in the
|
|
574
|
-
// Rust machinery: i.e. we don't need to access or write to this registry
|
|
575
|
-
// after startup.
|
|
576
|
-
// Registry to hold all vtables so they persist even when JS objects are GC'd.
|
|
577
|
-
// Maps string identifiers to vtable holders using type erasure
|
|
578
|
-
static std::unordered_map<std::string, std::shared_ptr<void>> vtableRegistry;
|
|
579
|
-
|
|
580
|
-
// Add a vtable to the registry with an identifier
|
|
581
|
-
template <typename T>
|
|
582
|
-
static T* putTable(std::string_view identifier, T vtable) {
|
|
583
|
-
auto holder = std::make_shared<VTableHolder<T>>(vtable);
|
|
584
|
-
// Store the raw pointer to the vtable before type erasure
|
|
585
|
-
T* rawPtr = &(holder->vtable);
|
|
586
|
-
// Store the holder using type erasure with the string identifier
|
|
587
|
-
vtableRegistry[std::string(identifier)] = std::shared_ptr<void>(holder);
|
|
588
|
-
return rawPtr;
|
|
589
|
-
}
|
|
408
|
+
template <typename T> class VTableHolder {
|
|
409
|
+
public:
|
|
410
|
+
T vtable;
|
|
411
|
+
VTableHolder(T v) : vtable(v) {}
|
|
412
|
+
};
|
|
590
413
|
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
414
|
+
// Mutex to bind the storage and setting of vtable together.
|
|
415
|
+
// We declare it here, but the lock is taken by callers of the putTable
|
|
416
|
+
// method who are also sending a pointer to Rust.
|
|
417
|
+
static std::mutex vtableMutex;
|
|
418
|
+
|
|
419
|
+
// Registry to hold all vtables so they persist even when JS objects are GC'd.
|
|
420
|
+
// The only reason this exists is to prevent a dangling pointer in the
|
|
421
|
+
// Rust machinery: i.e. we don't need to access or write to this registry
|
|
422
|
+
// after startup.
|
|
423
|
+
// Registry to hold all vtables so they persist even when JS objects are GC'd.
|
|
424
|
+
// Maps string identifiers to vtable holders using type erasure
|
|
425
|
+
static std::unordered_map<std::string, std::shared_ptr<void>> vtableRegistry;
|
|
426
|
+
|
|
427
|
+
// Add a vtable to the registry with an identifier
|
|
428
|
+
template <typename T>
|
|
429
|
+
static T *putTable(std::string_view identifier, T vtable) {
|
|
430
|
+
auto holder = std::make_shared<VTableHolder<T>>(vtable);
|
|
431
|
+
// Store the raw pointer to the vtable before type erasure
|
|
432
|
+
T *rawPtr = &(holder->vtable);
|
|
433
|
+
// Store the holder using type erasure with the string identifier
|
|
434
|
+
vtableRegistry[std::string(identifier)] = std::shared_ptr<void>(holder);
|
|
435
|
+
return rawPtr;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
// Clear the registry.
|
|
439
|
+
//
|
|
440
|
+
// Conceptually, this is called after teardown of the module (i.e. after
|
|
441
|
+
// teardown of the jsi::Runtime). However, because Rust is dropping callbacks
|
|
442
|
+
// because the Runtime is being torn down, we must keep the registry intact
|
|
443
|
+
// until after the runtime goes away.
|
|
444
|
+
//
|
|
445
|
+
// Therefore, in practice we should call this when the next runtime is
|
|
446
|
+
// being stood up.
|
|
447
|
+
static void clearRegistry() {
|
|
448
|
+
std::lock_guard<std::mutex> lock(vtableMutex);
|
|
449
|
+
vtableRegistry.clear();
|
|
450
|
+
}
|
|
604
451
|
} // namespace uniffi::zkap_uniffi_bindings::registry
|
|
605
452
|
|
|
606
453
|
// This calls into Rust.
|
|
607
|
-
|
|
454
|
+
// Implementation of callback function calling from Rust to JS
|
|
455
|
+
// RustFutureContinuationCallback
|
|
608
456
|
|
|
609
|
-
// Callback function:
|
|
457
|
+
// Callback function:
|
|
458
|
+
// uniffi::zkap_uniffi_bindings::cb::rustfuturecontinuationcallback::UniffiRustFutureContinuationCallback
|
|
610
459
|
//
|
|
611
460
|
// We have the following constraints:
|
|
612
461
|
// - we need to pass a function pointer to Rust.
|
|
613
462
|
// - we need a jsi::Runtime and jsi::Function to call into JS.
|
|
614
463
|
// - function pointers can't store state, so we can't use a lamda.
|
|
615
464
|
//
|
|
616
|
-
// For this, we store a lambda as a global, as `rsLambda`. The `callback`
|
|
617
|
-
// the lambda, which itself calls the `body` which then calls
|
|
465
|
+
// For this, we store a lambda as a global, as `rsLambda`. The `callback`
|
|
466
|
+
// function calls the lambda, which itself calls the `body` which then calls
|
|
467
|
+
// into JS.
|
|
618
468
|
//
|
|
619
|
-
// We then give the `callback` function pointer to Rust which will call the
|
|
620
|
-
// future.
|
|
469
|
+
// We then give the `callback` function pointer to Rust which will call the
|
|
470
|
+
// lambda sometime in the future.
|
|
621
471
|
namespace uniffi::zkap_uniffi_bindings::cb::rustfuturecontinuationcallback {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
// We need to store a lambda in a global so we can call it from
|
|
625
|
-
// a function pointer. The function pointer is passed to Rust.
|
|
626
|
-
static std::function<void(uint64_t, int8_t)> rsLambda = nullptr;
|
|
627
|
-
|
|
628
|
-
// This is the main body of the callback. It's called from the lambda,
|
|
629
|
-
// which itself is called from the callback function which is passed to Rust.
|
|
630
|
-
static void body(jsi::Runtime &rt,
|
|
631
|
-
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
|
|
632
|
-
std::shared_ptr<jsi::Value> callbackValue
|
|
633
|
-
,uint64_t rs_data
|
|
634
|
-
,int8_t rs_pollResult) {
|
|
635
|
-
|
|
636
|
-
// Convert the arguments from Rust, into jsi::Values.
|
|
637
|
-
// We'll use the Bridging class to do this…
|
|
638
|
-
auto js_data = uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_data);
|
|
639
|
-
auto js_pollResult = uniffi_jsi::Bridging<int8_t>::toJs(rt, callInvoker, rs_pollResult);
|
|
640
|
-
|
|
641
|
-
// Now we are ready to call the callback.
|
|
642
|
-
// We are already on the JS thread, because this `body` function was
|
|
643
|
-
// invoked from the CallInvoker.
|
|
644
|
-
try {
|
|
645
|
-
// Getting the callback function
|
|
646
|
-
auto cb = callbackValue->asObject(rt).asFunction(rt);
|
|
647
|
-
auto uniffiResult = cb.call(rt, js_data, js_pollResult
|
|
648
|
-
);
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
} catch (const jsi::JSError &error) {
|
|
654
|
-
std::cout << "Error in callback UniffiRustFutureContinuationCallback: "
|
|
655
|
-
<< error.what() << std::endl;
|
|
656
|
-
throw error;
|
|
657
|
-
}
|
|
658
|
-
}
|
|
472
|
+
using namespace facebook;
|
|
659
473
|
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
474
|
+
// We need to store a lambda in a global so we can call it from
|
|
475
|
+
// a function pointer. The function pointer is passed to Rust.
|
|
476
|
+
static std::function<void(uint64_t, int8_t)> rsLambda = nullptr;
|
|
477
|
+
|
|
478
|
+
// This is the main body of the callback. It's called from the lambda,
|
|
479
|
+
// which itself is called from the callback function which is passed to Rust.
|
|
480
|
+
static void body(jsi::Runtime &rt,
|
|
481
|
+
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
|
|
482
|
+
std::shared_ptr<jsi::Value> callbackValue, uint64_t rs_data,
|
|
483
|
+
int8_t rs_pollResult) {
|
|
484
|
+
|
|
485
|
+
// Convert the arguments from Rust, into jsi::Values.
|
|
486
|
+
// We'll use the Bridging class to do this…
|
|
487
|
+
auto js_data = uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_data);
|
|
488
|
+
auto js_pollResult =
|
|
489
|
+
uniffi_jsi::Bridging<int8_t>::toJs(rt, callInvoker, rs_pollResult);
|
|
490
|
+
|
|
491
|
+
// Now we are ready to call the callback.
|
|
492
|
+
// We are already on the JS thread, because this `body` function was
|
|
493
|
+
// invoked from the CallInvoker.
|
|
494
|
+
try {
|
|
495
|
+
// Getting the callback function
|
|
496
|
+
auto cb = callbackValue->asObject(rt).asFunction(rt);
|
|
497
|
+
auto uniffiResult = cb.call(rt, js_data, js_pollResult);
|
|
498
|
+
|
|
499
|
+
} catch (const jsi::JSError &error) {
|
|
500
|
+
std::cout << "Error in callback UniffiRustFutureContinuationCallback: "
|
|
501
|
+
<< error.what() << std::endl;
|
|
502
|
+
throw error;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
static void callback(uint64_t rs_data, int8_t rs_pollResult) {
|
|
507
|
+
// If the runtime has shutdown, then there is no point in trying to
|
|
508
|
+
// call into Javascript. BUT how do we tell if the runtime has shutdown?
|
|
509
|
+
//
|
|
510
|
+
// Answer: the module destructor calls into callback `cleanup` method,
|
|
511
|
+
// which nulls out the rsLamda.
|
|
512
|
+
//
|
|
513
|
+
// If rsLamda is null, then there is no runtime to call into.
|
|
514
|
+
if (rsLambda == nullptr) {
|
|
515
|
+
// This only occurs when destructors are calling into Rust free/drop,
|
|
516
|
+
// which causes the JS callback to be dropped.
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
// The runtime, the actual callback jsi::funtion, and the callInvoker
|
|
521
|
+
// are all in the lambda.
|
|
522
|
+
rsLambda(rs_data, rs_pollResult);
|
|
523
|
+
}
|
|
680
524
|
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
body(rt, callInvoker, callbackValue
|
|
709
|
-
, rs_data
|
|
710
|
-
, rs_pollResult);
|
|
711
|
-
};
|
|
712
|
-
// We'll then call that lambda from the callInvoker which will
|
|
713
|
-
// look after calling it on the correct thread.
|
|
714
|
-
|
|
715
|
-
callInvoker->invokeNonBlocking(rt, jsLambda);
|
|
525
|
+
[[maybe_unused]] static UniffiRustFutureContinuationCallback
|
|
526
|
+
makeCallbackFunction( // uniffi::zkap_uniffi_bindings::cb::rustfuturecontinuationcallback
|
|
527
|
+
jsi::Runtime &rt,
|
|
528
|
+
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
|
|
529
|
+
const jsi::Value &value) {
|
|
530
|
+
if (rsLambda != nullptr) {
|
|
531
|
+
// `makeCallbackFunction` is called in two circumstances:
|
|
532
|
+
//
|
|
533
|
+
// 1. at startup, when initializing callback interface vtables.
|
|
534
|
+
// 2. when polling futures. This happens at least once per future that is
|
|
535
|
+
// exposed to Javascript. We know that this is always the same function,
|
|
536
|
+
// `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
|
|
537
|
+
//
|
|
538
|
+
// We can therefore return the callback function without making anything
|
|
539
|
+
// new if we've been initialized already.
|
|
540
|
+
return callback;
|
|
541
|
+
}
|
|
542
|
+
auto callbackFunction = value.asObject(rt).asFunction(rt);
|
|
543
|
+
auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
|
|
544
|
+
rsLambda = [&rt, callInvoker, callbackValue](uint64_t rs_data,
|
|
545
|
+
int8_t rs_pollResult) {
|
|
546
|
+
// We immediately make a lambda which will do the work of transforming the
|
|
547
|
+
// arguments into JSI values and calling the callback.
|
|
548
|
+
uniffi_runtime::UniffiCallFunc jsLambda =
|
|
549
|
+
[callInvoker, callbackValue, rs_data,
|
|
550
|
+
rs_pollResult](jsi::Runtime &rt) mutable {
|
|
551
|
+
body(rt, callInvoker, callbackValue, rs_data, rs_pollResult);
|
|
716
552
|
};
|
|
717
|
-
|
|
718
|
-
|
|
553
|
+
// We'll then call that lambda from the callInvoker which will
|
|
554
|
+
// look after calling it on the correct thread.
|
|
719
555
|
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
556
|
+
callInvoker->invokeNonBlocking(rt, jsLambda);
|
|
557
|
+
};
|
|
558
|
+
return callback;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
// This method is called from the destructor of NativeZkapUniffiBindings, which
|
|
562
|
+
// only happens when the jsi::Runtime is being destroyed.
|
|
563
|
+
static void cleanup() {
|
|
564
|
+
// The lambda holds a reference to the the Runtime, so when this is nulled
|
|
565
|
+
// out, then the pointer will no longer be left dangling.
|
|
566
|
+
rsLambda = nullptr;
|
|
567
|
+
}
|
|
727
568
|
} // namespace uniffi::zkap_uniffi_bindings::cb::rustfuturecontinuationcallback
|
|
728
|
-
|
|
569
|
+
// Implementation of callback function calling from Rust to JS
|
|
570
|
+
// ForeignFutureDroppedCallback
|
|
729
571
|
|
|
730
|
-
// Callback function:
|
|
572
|
+
// Callback function:
|
|
573
|
+
// uniffi::zkap_uniffi_bindings::cb::foreignfuturedroppedcallback::UniffiForeignFutureDroppedCallback
|
|
731
574
|
//
|
|
732
575
|
// We have the following constraints:
|
|
733
576
|
// - we need to pass a function pointer to Rust.
|
|
734
577
|
// - we need a jsi::Runtime and jsi::Function to call into JS.
|
|
735
578
|
// - function pointers can't store state, so we can't use a lamda.
|
|
736
579
|
//
|
|
737
|
-
// For this, we store a lambda as a global, as `rsLambda`. The `callback`
|
|
738
|
-
// the lambda, which itself calls the `body` which then calls
|
|
580
|
+
// For this, we store a lambda as a global, as `rsLambda`. The `callback`
|
|
581
|
+
// function calls the lambda, which itself calls the `body` which then calls
|
|
582
|
+
// into JS.
|
|
739
583
|
//
|
|
740
|
-
// We then give the `callback` function pointer to Rust which will call the
|
|
741
|
-
// future.
|
|
584
|
+
// We then give the `callback` function pointer to Rust which will call the
|
|
585
|
+
// lambda sometime in the future.
|
|
742
586
|
namespace uniffi::zkap_uniffi_bindings::cb::foreignfuturedroppedcallback {
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
// We need to store a lambda in a global so we can call it from
|
|
746
|
-
// a function pointer. The function pointer is passed to Rust.
|
|
747
|
-
static std::function<void(uint64_t)> rsLambda = nullptr;
|
|
748
|
-
|
|
749
|
-
// This is the main body of the callback. It's called from the lambda,
|
|
750
|
-
// which itself is called from the callback function which is passed to Rust.
|
|
751
|
-
static void body(jsi::Runtime &rt,
|
|
752
|
-
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
|
|
753
|
-
std::shared_ptr<jsi::Value> callbackValue
|
|
754
|
-
,uint64_t rs_handle) {
|
|
755
|
-
|
|
756
|
-
// Convert the arguments from Rust, into jsi::Values.
|
|
757
|
-
// We'll use the Bridging class to do this…
|
|
758
|
-
auto js_handle = uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_handle);
|
|
759
|
-
|
|
760
|
-
// Now we are ready to call the callback.
|
|
761
|
-
// We are already on the JS thread, because this `body` function was
|
|
762
|
-
// invoked from the CallInvoker.
|
|
763
|
-
try {
|
|
764
|
-
// Getting the callback function
|
|
765
|
-
auto cb = callbackValue->asObject(rt).asFunction(rt);
|
|
766
|
-
auto uniffiResult = cb.call(rt, js_handle
|
|
767
|
-
);
|
|
768
|
-
|
|
769
|
-
|
|
587
|
+
using namespace facebook;
|
|
770
588
|
|
|
589
|
+
// We need to store a lambda in a global so we can call it from
|
|
590
|
+
// a function pointer. The function pointer is passed to Rust.
|
|
591
|
+
static std::function<void(uint64_t)> rsLambda = nullptr;
|
|
592
|
+
|
|
593
|
+
// This is the main body of the callback. It's called from the lambda,
|
|
594
|
+
// which itself is called from the callback function which is passed to Rust.
|
|
595
|
+
static void body(jsi::Runtime &rt,
|
|
596
|
+
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
|
|
597
|
+
std::shared_ptr<jsi::Value> callbackValue,
|
|
598
|
+
uint64_t rs_handle) {
|
|
599
|
+
|
|
600
|
+
// Convert the arguments from Rust, into jsi::Values.
|
|
601
|
+
// We'll use the Bridging class to do this…
|
|
602
|
+
auto js_handle =
|
|
603
|
+
uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_handle);
|
|
604
|
+
|
|
605
|
+
// Now we are ready to call the callback.
|
|
606
|
+
// We are already on the JS thread, because this `body` function was
|
|
607
|
+
// invoked from the CallInvoker.
|
|
608
|
+
try {
|
|
609
|
+
// Getting the callback function
|
|
610
|
+
auto cb = callbackValue->asObject(rt).asFunction(rt);
|
|
611
|
+
auto uniffiResult = cb.call(rt, js_handle);
|
|
612
|
+
|
|
613
|
+
} catch (const jsi::JSError &error) {
|
|
614
|
+
std::cout << "Error in callback UniffiForeignFutureDroppedCallback: "
|
|
615
|
+
<< error.what() << std::endl;
|
|
616
|
+
throw error;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
771
619
|
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
620
|
+
static void callback(uint64_t rs_handle) {
|
|
621
|
+
// If the runtime has shutdown, then there is no point in trying to
|
|
622
|
+
// call into Javascript. BUT how do we tell if the runtime has shutdown?
|
|
623
|
+
//
|
|
624
|
+
// Answer: the module destructor calls into callback `cleanup` method,
|
|
625
|
+
// which nulls out the rsLamda.
|
|
626
|
+
//
|
|
627
|
+
// If rsLamda is null, then there is no runtime to call into.
|
|
628
|
+
if (rsLambda == nullptr) {
|
|
629
|
+
// This only occurs when destructors are calling into Rust free/drop,
|
|
630
|
+
// which causes the JS callback to be dropped.
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
778
633
|
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
// Answer: the module destructor calls into callback `cleanup` method,
|
|
784
|
-
// which nulls out the rsLamda.
|
|
785
|
-
//
|
|
786
|
-
// If rsLamda is null, then there is no runtime to call into.
|
|
787
|
-
if (rsLambda == nullptr) {
|
|
788
|
-
// This only occurs when destructors are calling into Rust free/drop,
|
|
789
|
-
// which causes the JS callback to be dropped.
|
|
790
|
-
return;
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
// The runtime, the actual callback jsi::funtion, and the callInvoker
|
|
794
|
-
// are all in the lambda.
|
|
795
|
-
rsLambda(
|
|
796
|
-
rs_handle);
|
|
797
|
-
}
|
|
634
|
+
// The runtime, the actual callback jsi::funtion, and the callInvoker
|
|
635
|
+
// are all in the lambda.
|
|
636
|
+
rsLambda(rs_handle);
|
|
637
|
+
}
|
|
798
638
|
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
, rs_handle](jsi::Runtime &rt) mutable {
|
|
825
|
-
body(rt, callInvoker, callbackValue
|
|
826
|
-
, rs_handle);
|
|
827
|
-
};
|
|
828
|
-
// We'll then call that lambda from the callInvoker which will
|
|
829
|
-
// look after calling it on the correct thread.
|
|
830
|
-
|
|
831
|
-
callInvoker->invokeNonBlocking(rt, jsLambda);
|
|
639
|
+
[[maybe_unused]] static UniffiForeignFutureDroppedCallback
|
|
640
|
+
makeCallbackFunction( // uniffi::zkap_uniffi_bindings::cb::foreignfuturedroppedcallback
|
|
641
|
+
jsi::Runtime &rt,
|
|
642
|
+
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
|
|
643
|
+
const jsi::Value &value) {
|
|
644
|
+
if (rsLambda != nullptr) {
|
|
645
|
+
// `makeCallbackFunction` is called in two circumstances:
|
|
646
|
+
//
|
|
647
|
+
// 1. at startup, when initializing callback interface vtables.
|
|
648
|
+
// 2. when polling futures. This happens at least once per future that is
|
|
649
|
+
// exposed to Javascript. We know that this is always the same function,
|
|
650
|
+
// `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
|
|
651
|
+
//
|
|
652
|
+
// We can therefore return the callback function without making anything
|
|
653
|
+
// new if we've been initialized already.
|
|
654
|
+
return callback;
|
|
655
|
+
}
|
|
656
|
+
auto callbackFunction = value.asObject(rt).asFunction(rt);
|
|
657
|
+
auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
|
|
658
|
+
rsLambda = [&rt, callInvoker, callbackValue](uint64_t rs_handle) {
|
|
659
|
+
// We immediately make a lambda which will do the work of transforming the
|
|
660
|
+
// arguments into JSI values and calling the callback.
|
|
661
|
+
uniffi_runtime::UniffiCallFunc jsLambda =
|
|
662
|
+
[callInvoker, callbackValue, rs_handle](jsi::Runtime &rt) mutable {
|
|
663
|
+
body(rt, callInvoker, callbackValue, rs_handle);
|
|
832
664
|
};
|
|
833
|
-
|
|
834
|
-
|
|
665
|
+
// We'll then call that lambda from the callInvoker which will
|
|
666
|
+
// look after calling it on the correct thread.
|
|
835
667
|
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
668
|
+
callInvoker->invokeNonBlocking(rt, jsLambda);
|
|
669
|
+
};
|
|
670
|
+
return callback;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// This method is called from the destructor of NativeZkapUniffiBindings, which
|
|
674
|
+
// only happens when the jsi::Runtime is being destroyed.
|
|
675
|
+
static void cleanup() {
|
|
676
|
+
// The lambda holds a reference to the the Runtime, so when this is nulled
|
|
677
|
+
// out, then the pointer will no longer be left dangling.
|
|
678
|
+
rsLambda = nullptr;
|
|
679
|
+
}
|
|
843
680
|
} // namespace uniffi::zkap_uniffi_bindings::cb::foreignfuturedroppedcallback
|
|
844
|
-
|
|
681
|
+
// Implementation of free callback function CallbackInterfaceFree
|
|
845
682
|
|
|
846
683
|
namespace uniffi::zkap_uniffi_bindings {
|
|
847
684
|
using namespace facebook;
|
|
848
685
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
849
686
|
|
|
850
687
|
template <> struct Bridging<UniffiForeignFutureDroppedCallbackStruct> {
|
|
851
|
-
static UniffiForeignFutureDroppedCallbackStruct
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
) {
|
|
688
|
+
static UniffiForeignFutureDroppedCallbackStruct
|
|
689
|
+
fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
|
|
690
|
+
const jsi::Value &jsValue) {
|
|
855
691
|
// Check if the input is an object
|
|
856
692
|
if (!jsValue.isObject()) {
|
|
857
|
-
throw jsi::JSError(
|
|
693
|
+
throw jsi::JSError(
|
|
694
|
+
rt,
|
|
695
|
+
"Expected an object for UniffiForeignFutureDroppedCallbackStruct");
|
|
858
696
|
}
|
|
859
697
|
|
|
860
698
|
// Get the object from the jsi::Value
|
|
@@ -865,12 +703,10 @@ template <> struct Bridging<UniffiForeignFutureDroppedCallbackStruct> {
|
|
|
865
703
|
|
|
866
704
|
// Create the vtable from the js callbacks.
|
|
867
705
|
rsObject.handle = uniffi_jsi::Bridging<uint64_t>::fromJs(
|
|
868
|
-
rt, callInvoker,
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
rt, callInvoker, jsObject.getProperty(rt, "free")
|
|
873
|
-
);
|
|
706
|
+
rt, callInvoker, jsObject.getProperty(rt, "handle"));
|
|
707
|
+
rsObject.free = uniffi::zkap_uniffi_bindings::cb::
|
|
708
|
+
foreignfuturedroppedcallback::makeCallbackFunction(
|
|
709
|
+
rt, callInvoker, jsObject.getProperty(rt, "free"));
|
|
874
710
|
|
|
875
711
|
return rsObject;
|
|
876
712
|
}
|
|
@@ -882,13 +718,13 @@ using namespace facebook;
|
|
|
882
718
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
883
719
|
|
|
884
720
|
template <> struct Bridging<UniffiForeignFutureResultU8> {
|
|
885
|
-
static UniffiForeignFutureResultU8
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
) {
|
|
721
|
+
static UniffiForeignFutureResultU8
|
|
722
|
+
fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
|
|
723
|
+
const jsi::Value &jsValue) {
|
|
889
724
|
// Check if the input is an object
|
|
890
725
|
if (!jsValue.isObject()) {
|
|
891
|
-
throw jsi::JSError(rt,
|
|
726
|
+
throw jsi::JSError(rt,
|
|
727
|
+
"Expected an object for UniffiForeignFutureResultU8");
|
|
892
728
|
}
|
|
893
729
|
|
|
894
730
|
// Get the object from the jsi::Value
|
|
@@ -899,55 +735,47 @@ template <> struct Bridging<UniffiForeignFutureResultU8> {
|
|
|
899
735
|
|
|
900
736
|
// Create the vtable from the js callbacks.
|
|
901
737
|
rsObject.return_value = uniffi_jsi::Bridging<uint8_t>::fromJs(
|
|
902
|
-
rt, callInvoker,
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
rt, callInvoker,
|
|
907
|
-
jsObject.getProperty(rt, "callStatus")
|
|
908
|
-
);
|
|
738
|
+
rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
|
|
739
|
+
rsObject.call_status =
|
|
740
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::fromJs(
|
|
741
|
+
rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
|
|
909
742
|
|
|
910
743
|
return rsObject;
|
|
911
744
|
}
|
|
912
745
|
};
|
|
913
746
|
|
|
914
747
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
915
|
-
|
|
916
|
-
|
|
748
|
+
// Implementation of callback function calling from JS to Rust
|
|
749
|
+
// ForeignFutureCompleteU8, passed from Rust to JS as part of async callbacks.
|
|
917
750
|
namespace uniffi::zkap_uniffi_bindings {
|
|
918
751
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
919
752
|
|
|
920
753
|
template <> struct Bridging<UniffiForeignFutureCompleteU8> {
|
|
921
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
754
|
+
static jsi::Value toJs(jsi::Runtime &rt,
|
|
755
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
756
|
+
UniffiForeignFutureCompleteU8 rsCallback) {
|
|
922
757
|
return jsi::Function::createFromHostFunction(
|
|
923
|
-
rt,
|
|
924
|
-
jsi::
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
size_t count) -> jsi::Value
|
|
931
|
-
{
|
|
932
|
-
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
933
|
-
}
|
|
934
|
-
);
|
|
758
|
+
rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU8"), 2,
|
|
759
|
+
[rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
|
|
760
|
+
const jsi::Value *arguments,
|
|
761
|
+
size_t count) -> jsi::Value {
|
|
762
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count,
|
|
763
|
+
rsCallback);
|
|
764
|
+
});
|
|
935
765
|
}
|
|
936
766
|
|
|
937
|
-
static jsi::Value intoRust(
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
size_t count,
|
|
943
|
-
UniffiForeignFutureCompleteU8 func) {
|
|
767
|
+
static jsi::Value intoRust(jsi::Runtime &rt,
|
|
768
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
769
|
+
const jsi::Value &thisValue,
|
|
770
|
+
const jsi::Value *args, size_t count,
|
|
771
|
+
UniffiForeignFutureCompleteU8 func) {
|
|
944
772
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
945
773
|
// then call the rs_callback with those arguments.
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
774
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
|
|
775
|
+
uniffi::zkap_uniffi_bindings::Bridging<
|
|
776
|
+
UniffiForeignFutureResultU8>::fromJs(rt, callInvoker, args[1]));
|
|
949
777
|
|
|
950
|
-
|
|
778
|
+
return jsi::Value::undefined();
|
|
951
779
|
}
|
|
952
780
|
};
|
|
953
781
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
@@ -956,13 +784,13 @@ using namespace facebook;
|
|
|
956
784
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
957
785
|
|
|
958
786
|
template <> struct Bridging<UniffiForeignFutureResultI8> {
|
|
959
|
-
static UniffiForeignFutureResultI8
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
) {
|
|
787
|
+
static UniffiForeignFutureResultI8
|
|
788
|
+
fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
|
|
789
|
+
const jsi::Value &jsValue) {
|
|
963
790
|
// Check if the input is an object
|
|
964
791
|
if (!jsValue.isObject()) {
|
|
965
|
-
throw jsi::JSError(rt,
|
|
792
|
+
throw jsi::JSError(rt,
|
|
793
|
+
"Expected an object for UniffiForeignFutureResultI8");
|
|
966
794
|
}
|
|
967
795
|
|
|
968
796
|
// Get the object from the jsi::Value
|
|
@@ -973,55 +801,47 @@ template <> struct Bridging<UniffiForeignFutureResultI8> {
|
|
|
973
801
|
|
|
974
802
|
// Create the vtable from the js callbacks.
|
|
975
803
|
rsObject.return_value = uniffi_jsi::Bridging<int8_t>::fromJs(
|
|
976
|
-
rt, callInvoker,
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
rt, callInvoker,
|
|
981
|
-
jsObject.getProperty(rt, "callStatus")
|
|
982
|
-
);
|
|
804
|
+
rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
|
|
805
|
+
rsObject.call_status =
|
|
806
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::fromJs(
|
|
807
|
+
rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
|
|
983
808
|
|
|
984
809
|
return rsObject;
|
|
985
810
|
}
|
|
986
811
|
};
|
|
987
812
|
|
|
988
813
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
989
|
-
|
|
990
|
-
|
|
814
|
+
// Implementation of callback function calling from JS to Rust
|
|
815
|
+
// ForeignFutureCompleteI8, passed from Rust to JS as part of async callbacks.
|
|
991
816
|
namespace uniffi::zkap_uniffi_bindings {
|
|
992
817
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
993
818
|
|
|
994
819
|
template <> struct Bridging<UniffiForeignFutureCompleteI8> {
|
|
995
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
820
|
+
static jsi::Value toJs(jsi::Runtime &rt,
|
|
821
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
822
|
+
UniffiForeignFutureCompleteI8 rsCallback) {
|
|
996
823
|
return jsi::Function::createFromHostFunction(
|
|
997
|
-
rt,
|
|
998
|
-
jsi::
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
size_t count) -> jsi::Value
|
|
1005
|
-
{
|
|
1006
|
-
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1007
|
-
}
|
|
1008
|
-
);
|
|
824
|
+
rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI8"), 2,
|
|
825
|
+
[rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
|
|
826
|
+
const jsi::Value *arguments,
|
|
827
|
+
size_t count) -> jsi::Value {
|
|
828
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count,
|
|
829
|
+
rsCallback);
|
|
830
|
+
});
|
|
1009
831
|
}
|
|
1010
832
|
|
|
1011
|
-
static jsi::Value intoRust(
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
size_t count,
|
|
1017
|
-
UniffiForeignFutureCompleteI8 func) {
|
|
833
|
+
static jsi::Value intoRust(jsi::Runtime &rt,
|
|
834
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
835
|
+
const jsi::Value &thisValue,
|
|
836
|
+
const jsi::Value *args, size_t count,
|
|
837
|
+
UniffiForeignFutureCompleteI8 func) {
|
|
1018
838
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
1019
839
|
// then call the rs_callback with those arguments.
|
|
1020
|
-
|
|
1021
|
-
|
|
840
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
|
|
841
|
+
uniffi::zkap_uniffi_bindings::Bridging<
|
|
842
|
+
UniffiForeignFutureResultI8>::fromJs(rt, callInvoker, args[1]));
|
|
1022
843
|
|
|
1023
|
-
|
|
1024
|
-
return jsi::Value::undefined();
|
|
844
|
+
return jsi::Value::undefined();
|
|
1025
845
|
}
|
|
1026
846
|
};
|
|
1027
847
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
@@ -1030,13 +850,13 @@ using namespace facebook;
|
|
|
1030
850
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1031
851
|
|
|
1032
852
|
template <> struct Bridging<UniffiForeignFutureResultU16> {
|
|
1033
|
-
static UniffiForeignFutureResultU16
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
) {
|
|
853
|
+
static UniffiForeignFutureResultU16
|
|
854
|
+
fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
|
|
855
|
+
const jsi::Value &jsValue) {
|
|
1037
856
|
// Check if the input is an object
|
|
1038
857
|
if (!jsValue.isObject()) {
|
|
1039
|
-
throw jsi::JSError(rt,
|
|
858
|
+
throw jsi::JSError(rt,
|
|
859
|
+
"Expected an object for UniffiForeignFutureResultU16");
|
|
1040
860
|
}
|
|
1041
861
|
|
|
1042
862
|
// Get the object from the jsi::Value
|
|
@@ -1047,55 +867,48 @@ template <> struct Bridging<UniffiForeignFutureResultU16> {
|
|
|
1047
867
|
|
|
1048
868
|
// Create the vtable from the js callbacks.
|
|
1049
869
|
rsObject.return_value = uniffi_jsi::Bridging<uint16_t>::fromJs(
|
|
1050
|
-
rt, callInvoker,
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
rt, callInvoker,
|
|
1055
|
-
jsObject.getProperty(rt, "callStatus")
|
|
1056
|
-
);
|
|
870
|
+
rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
|
|
871
|
+
rsObject.call_status =
|
|
872
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::fromJs(
|
|
873
|
+
rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
|
|
1057
874
|
|
|
1058
875
|
return rsObject;
|
|
1059
876
|
}
|
|
1060
877
|
};
|
|
1061
878
|
|
|
1062
879
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
1063
|
-
|
|
1064
|
-
|
|
880
|
+
// Implementation of callback function calling from JS to Rust
|
|
881
|
+
// ForeignFutureCompleteU16, passed from Rust to JS as part of async
|
|
882
|
+
// callbacks.
|
|
1065
883
|
namespace uniffi::zkap_uniffi_bindings {
|
|
1066
884
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1067
885
|
|
|
1068
886
|
template <> struct Bridging<UniffiForeignFutureCompleteU16> {
|
|
1069
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
887
|
+
static jsi::Value toJs(jsi::Runtime &rt,
|
|
888
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
889
|
+
UniffiForeignFutureCompleteU16 rsCallback) {
|
|
1070
890
|
return jsi::Function::createFromHostFunction(
|
|
1071
|
-
rt,
|
|
1072
|
-
jsi::
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
size_t count) -> jsi::Value
|
|
1079
|
-
{
|
|
1080
|
-
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1081
|
-
}
|
|
1082
|
-
);
|
|
891
|
+
rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU16"), 2,
|
|
892
|
+
[rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
|
|
893
|
+
const jsi::Value *arguments,
|
|
894
|
+
size_t count) -> jsi::Value {
|
|
895
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count,
|
|
896
|
+
rsCallback);
|
|
897
|
+
});
|
|
1083
898
|
}
|
|
1084
899
|
|
|
1085
|
-
static jsi::Value intoRust(
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
size_t count,
|
|
1091
|
-
UniffiForeignFutureCompleteU16 func) {
|
|
900
|
+
static jsi::Value intoRust(jsi::Runtime &rt,
|
|
901
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
902
|
+
const jsi::Value &thisValue,
|
|
903
|
+
const jsi::Value *args, size_t count,
|
|
904
|
+
UniffiForeignFutureCompleteU16 func) {
|
|
1092
905
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
1093
906
|
// then call the rs_callback with those arguments.
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
907
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
|
|
908
|
+
uniffi::zkap_uniffi_bindings::Bridging<
|
|
909
|
+
UniffiForeignFutureResultU16>::fromJs(rt, callInvoker, args[1]));
|
|
1097
910
|
|
|
1098
|
-
|
|
911
|
+
return jsi::Value::undefined();
|
|
1099
912
|
}
|
|
1100
913
|
};
|
|
1101
914
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
@@ -1104,13 +917,13 @@ using namespace facebook;
|
|
|
1104
917
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1105
918
|
|
|
1106
919
|
template <> struct Bridging<UniffiForeignFutureResultI16> {
|
|
1107
|
-
static UniffiForeignFutureResultI16
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
) {
|
|
920
|
+
static UniffiForeignFutureResultI16
|
|
921
|
+
fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
|
|
922
|
+
const jsi::Value &jsValue) {
|
|
1111
923
|
// Check if the input is an object
|
|
1112
924
|
if (!jsValue.isObject()) {
|
|
1113
|
-
throw jsi::JSError(rt,
|
|
925
|
+
throw jsi::JSError(rt,
|
|
926
|
+
"Expected an object for UniffiForeignFutureResultI16");
|
|
1114
927
|
}
|
|
1115
928
|
|
|
1116
929
|
// Get the object from the jsi::Value
|
|
@@ -1121,55 +934,48 @@ template <> struct Bridging<UniffiForeignFutureResultI16> {
|
|
|
1121
934
|
|
|
1122
935
|
// Create the vtable from the js callbacks.
|
|
1123
936
|
rsObject.return_value = uniffi_jsi::Bridging<int16_t>::fromJs(
|
|
1124
|
-
rt, callInvoker,
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
rt, callInvoker,
|
|
1129
|
-
jsObject.getProperty(rt, "callStatus")
|
|
1130
|
-
);
|
|
937
|
+
rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
|
|
938
|
+
rsObject.call_status =
|
|
939
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::fromJs(
|
|
940
|
+
rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
|
|
1131
941
|
|
|
1132
942
|
return rsObject;
|
|
1133
943
|
}
|
|
1134
944
|
};
|
|
1135
945
|
|
|
1136
946
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
1137
|
-
|
|
1138
|
-
|
|
947
|
+
// Implementation of callback function calling from JS to Rust
|
|
948
|
+
// ForeignFutureCompleteI16, passed from Rust to JS as part of async
|
|
949
|
+
// callbacks.
|
|
1139
950
|
namespace uniffi::zkap_uniffi_bindings {
|
|
1140
951
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1141
952
|
|
|
1142
953
|
template <> struct Bridging<UniffiForeignFutureCompleteI16> {
|
|
1143
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
954
|
+
static jsi::Value toJs(jsi::Runtime &rt,
|
|
955
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
956
|
+
UniffiForeignFutureCompleteI16 rsCallback) {
|
|
1144
957
|
return jsi::Function::createFromHostFunction(
|
|
1145
|
-
rt,
|
|
1146
|
-
jsi::
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
size_t count) -> jsi::Value
|
|
1153
|
-
{
|
|
1154
|
-
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1155
|
-
}
|
|
1156
|
-
);
|
|
958
|
+
rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI16"), 2,
|
|
959
|
+
[rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
|
|
960
|
+
const jsi::Value *arguments,
|
|
961
|
+
size_t count) -> jsi::Value {
|
|
962
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count,
|
|
963
|
+
rsCallback);
|
|
964
|
+
});
|
|
1157
965
|
}
|
|
1158
966
|
|
|
1159
|
-
static jsi::Value intoRust(
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
size_t count,
|
|
1165
|
-
UniffiForeignFutureCompleteI16 func) {
|
|
967
|
+
static jsi::Value intoRust(jsi::Runtime &rt,
|
|
968
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
969
|
+
const jsi::Value &thisValue,
|
|
970
|
+
const jsi::Value *args, size_t count,
|
|
971
|
+
UniffiForeignFutureCompleteI16 func) {
|
|
1166
972
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
1167
973
|
// then call the rs_callback with those arguments.
|
|
1168
|
-
|
|
1169
|
-
|
|
974
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
|
|
975
|
+
uniffi::zkap_uniffi_bindings::Bridging<
|
|
976
|
+
UniffiForeignFutureResultI16>::fromJs(rt, callInvoker, args[1]));
|
|
1170
977
|
|
|
1171
|
-
|
|
1172
|
-
return jsi::Value::undefined();
|
|
978
|
+
return jsi::Value::undefined();
|
|
1173
979
|
}
|
|
1174
980
|
};
|
|
1175
981
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
@@ -1178,13 +984,13 @@ using namespace facebook;
|
|
|
1178
984
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1179
985
|
|
|
1180
986
|
template <> struct Bridging<UniffiForeignFutureResultU32> {
|
|
1181
|
-
static UniffiForeignFutureResultU32
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
) {
|
|
987
|
+
static UniffiForeignFutureResultU32
|
|
988
|
+
fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
|
|
989
|
+
const jsi::Value &jsValue) {
|
|
1185
990
|
// Check if the input is an object
|
|
1186
991
|
if (!jsValue.isObject()) {
|
|
1187
|
-
throw jsi::JSError(rt,
|
|
992
|
+
throw jsi::JSError(rt,
|
|
993
|
+
"Expected an object for UniffiForeignFutureResultU32");
|
|
1188
994
|
}
|
|
1189
995
|
|
|
1190
996
|
// Get the object from the jsi::Value
|
|
@@ -1195,55 +1001,48 @@ template <> struct Bridging<UniffiForeignFutureResultU32> {
|
|
|
1195
1001
|
|
|
1196
1002
|
// Create the vtable from the js callbacks.
|
|
1197
1003
|
rsObject.return_value = uniffi_jsi::Bridging<uint32_t>::fromJs(
|
|
1198
|
-
rt, callInvoker,
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
rt, callInvoker,
|
|
1203
|
-
jsObject.getProperty(rt, "callStatus")
|
|
1204
|
-
);
|
|
1004
|
+
rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
|
|
1005
|
+
rsObject.call_status =
|
|
1006
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::fromJs(
|
|
1007
|
+
rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
|
|
1205
1008
|
|
|
1206
1009
|
return rsObject;
|
|
1207
1010
|
}
|
|
1208
1011
|
};
|
|
1209
1012
|
|
|
1210
1013
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
1211
|
-
|
|
1212
|
-
|
|
1014
|
+
// Implementation of callback function calling from JS to Rust
|
|
1015
|
+
// ForeignFutureCompleteU32, passed from Rust to JS as part of async
|
|
1016
|
+
// callbacks.
|
|
1213
1017
|
namespace uniffi::zkap_uniffi_bindings {
|
|
1214
1018
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1215
1019
|
|
|
1216
1020
|
template <> struct Bridging<UniffiForeignFutureCompleteU32> {
|
|
1217
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1021
|
+
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1022
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1023
|
+
UniffiForeignFutureCompleteU32 rsCallback) {
|
|
1218
1024
|
return jsi::Function::createFromHostFunction(
|
|
1219
|
-
rt,
|
|
1220
|
-
jsi::
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
size_t count) -> jsi::Value
|
|
1227
|
-
{
|
|
1228
|
-
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1229
|
-
}
|
|
1230
|
-
);
|
|
1025
|
+
rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU32"), 2,
|
|
1026
|
+
[rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
|
|
1027
|
+
const jsi::Value *arguments,
|
|
1028
|
+
size_t count) -> jsi::Value {
|
|
1029
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count,
|
|
1030
|
+
rsCallback);
|
|
1031
|
+
});
|
|
1231
1032
|
}
|
|
1232
1033
|
|
|
1233
|
-
static jsi::Value intoRust(
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
size_t count,
|
|
1239
|
-
UniffiForeignFutureCompleteU32 func) {
|
|
1034
|
+
static jsi::Value intoRust(jsi::Runtime &rt,
|
|
1035
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1036
|
+
const jsi::Value &thisValue,
|
|
1037
|
+
const jsi::Value *args, size_t count,
|
|
1038
|
+
UniffiForeignFutureCompleteU32 func) {
|
|
1240
1039
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
1241
1040
|
// then call the rs_callback with those arguments.
|
|
1242
|
-
|
|
1243
|
-
|
|
1041
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
|
|
1042
|
+
uniffi::zkap_uniffi_bindings::Bridging<
|
|
1043
|
+
UniffiForeignFutureResultU32>::fromJs(rt, callInvoker, args[1]));
|
|
1244
1044
|
|
|
1245
|
-
|
|
1246
|
-
return jsi::Value::undefined();
|
|
1045
|
+
return jsi::Value::undefined();
|
|
1247
1046
|
}
|
|
1248
1047
|
};
|
|
1249
1048
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
@@ -1252,13 +1051,13 @@ using namespace facebook;
|
|
|
1252
1051
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1253
1052
|
|
|
1254
1053
|
template <> struct Bridging<UniffiForeignFutureResultI32> {
|
|
1255
|
-
static UniffiForeignFutureResultI32
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
) {
|
|
1054
|
+
static UniffiForeignFutureResultI32
|
|
1055
|
+
fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
|
|
1056
|
+
const jsi::Value &jsValue) {
|
|
1259
1057
|
// Check if the input is an object
|
|
1260
1058
|
if (!jsValue.isObject()) {
|
|
1261
|
-
throw jsi::JSError(rt,
|
|
1059
|
+
throw jsi::JSError(rt,
|
|
1060
|
+
"Expected an object for UniffiForeignFutureResultI32");
|
|
1262
1061
|
}
|
|
1263
1062
|
|
|
1264
1063
|
// Get the object from the jsi::Value
|
|
@@ -1269,55 +1068,48 @@ template <> struct Bridging<UniffiForeignFutureResultI32> {
|
|
|
1269
1068
|
|
|
1270
1069
|
// Create the vtable from the js callbacks.
|
|
1271
1070
|
rsObject.return_value = uniffi_jsi::Bridging<int32_t>::fromJs(
|
|
1272
|
-
rt, callInvoker,
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
rt, callInvoker,
|
|
1277
|
-
jsObject.getProperty(rt, "callStatus")
|
|
1278
|
-
);
|
|
1071
|
+
rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
|
|
1072
|
+
rsObject.call_status =
|
|
1073
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::fromJs(
|
|
1074
|
+
rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
|
|
1279
1075
|
|
|
1280
1076
|
return rsObject;
|
|
1281
1077
|
}
|
|
1282
1078
|
};
|
|
1283
1079
|
|
|
1284
1080
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
1285
|
-
|
|
1286
|
-
|
|
1081
|
+
// Implementation of callback function calling from JS to Rust
|
|
1082
|
+
// ForeignFutureCompleteI32, passed from Rust to JS as part of async
|
|
1083
|
+
// callbacks.
|
|
1287
1084
|
namespace uniffi::zkap_uniffi_bindings {
|
|
1288
1085
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1289
1086
|
|
|
1290
1087
|
template <> struct Bridging<UniffiForeignFutureCompleteI32> {
|
|
1291
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1088
|
+
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1089
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1090
|
+
UniffiForeignFutureCompleteI32 rsCallback) {
|
|
1292
1091
|
return jsi::Function::createFromHostFunction(
|
|
1293
|
-
rt,
|
|
1294
|
-
jsi::
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
size_t count) -> jsi::Value
|
|
1301
|
-
{
|
|
1302
|
-
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1303
|
-
}
|
|
1304
|
-
);
|
|
1092
|
+
rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI32"), 2,
|
|
1093
|
+
[rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
|
|
1094
|
+
const jsi::Value *arguments,
|
|
1095
|
+
size_t count) -> jsi::Value {
|
|
1096
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count,
|
|
1097
|
+
rsCallback);
|
|
1098
|
+
});
|
|
1305
1099
|
}
|
|
1306
1100
|
|
|
1307
|
-
static jsi::Value intoRust(
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
size_t count,
|
|
1313
|
-
UniffiForeignFutureCompleteI32 func) {
|
|
1101
|
+
static jsi::Value intoRust(jsi::Runtime &rt,
|
|
1102
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1103
|
+
const jsi::Value &thisValue,
|
|
1104
|
+
const jsi::Value *args, size_t count,
|
|
1105
|
+
UniffiForeignFutureCompleteI32 func) {
|
|
1314
1106
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
1315
1107
|
// then call the rs_callback with those arguments.
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1108
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
|
|
1109
|
+
uniffi::zkap_uniffi_bindings::Bridging<
|
|
1110
|
+
UniffiForeignFutureResultI32>::fromJs(rt, callInvoker, args[1]));
|
|
1319
1111
|
|
|
1320
|
-
|
|
1112
|
+
return jsi::Value::undefined();
|
|
1321
1113
|
}
|
|
1322
1114
|
};
|
|
1323
1115
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
@@ -1326,13 +1118,13 @@ using namespace facebook;
|
|
|
1326
1118
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1327
1119
|
|
|
1328
1120
|
template <> struct Bridging<UniffiForeignFutureResultU64> {
|
|
1329
|
-
static UniffiForeignFutureResultU64
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
) {
|
|
1121
|
+
static UniffiForeignFutureResultU64
|
|
1122
|
+
fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
|
|
1123
|
+
const jsi::Value &jsValue) {
|
|
1333
1124
|
// Check if the input is an object
|
|
1334
1125
|
if (!jsValue.isObject()) {
|
|
1335
|
-
throw jsi::JSError(rt,
|
|
1126
|
+
throw jsi::JSError(rt,
|
|
1127
|
+
"Expected an object for UniffiForeignFutureResultU64");
|
|
1336
1128
|
}
|
|
1337
1129
|
|
|
1338
1130
|
// Get the object from the jsi::Value
|
|
@@ -1343,55 +1135,48 @@ template <> struct Bridging<UniffiForeignFutureResultU64> {
|
|
|
1343
1135
|
|
|
1344
1136
|
// Create the vtable from the js callbacks.
|
|
1345
1137
|
rsObject.return_value = uniffi_jsi::Bridging<uint64_t>::fromJs(
|
|
1346
|
-
rt, callInvoker,
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
rt, callInvoker,
|
|
1351
|
-
jsObject.getProperty(rt, "callStatus")
|
|
1352
|
-
);
|
|
1138
|
+
rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
|
|
1139
|
+
rsObject.call_status =
|
|
1140
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::fromJs(
|
|
1141
|
+
rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
|
|
1353
1142
|
|
|
1354
1143
|
return rsObject;
|
|
1355
1144
|
}
|
|
1356
1145
|
};
|
|
1357
1146
|
|
|
1358
1147
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
1359
|
-
|
|
1360
|
-
|
|
1148
|
+
// Implementation of callback function calling from JS to Rust
|
|
1149
|
+
// ForeignFutureCompleteU64, passed from Rust to JS as part of async
|
|
1150
|
+
// callbacks.
|
|
1361
1151
|
namespace uniffi::zkap_uniffi_bindings {
|
|
1362
1152
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1363
1153
|
|
|
1364
1154
|
template <> struct Bridging<UniffiForeignFutureCompleteU64> {
|
|
1365
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1155
|
+
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1156
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1157
|
+
UniffiForeignFutureCompleteU64 rsCallback) {
|
|
1366
1158
|
return jsi::Function::createFromHostFunction(
|
|
1367
|
-
rt,
|
|
1368
|
-
jsi::
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
size_t count) -> jsi::Value
|
|
1375
|
-
{
|
|
1376
|
-
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1377
|
-
}
|
|
1378
|
-
);
|
|
1159
|
+
rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU64"), 2,
|
|
1160
|
+
[rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
|
|
1161
|
+
const jsi::Value *arguments,
|
|
1162
|
+
size_t count) -> jsi::Value {
|
|
1163
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count,
|
|
1164
|
+
rsCallback);
|
|
1165
|
+
});
|
|
1379
1166
|
}
|
|
1380
1167
|
|
|
1381
|
-
static jsi::Value intoRust(
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
size_t count,
|
|
1387
|
-
UniffiForeignFutureCompleteU64 func) {
|
|
1168
|
+
static jsi::Value intoRust(jsi::Runtime &rt,
|
|
1169
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1170
|
+
const jsi::Value &thisValue,
|
|
1171
|
+
const jsi::Value *args, size_t count,
|
|
1172
|
+
UniffiForeignFutureCompleteU64 func) {
|
|
1388
1173
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
1389
1174
|
// then call the rs_callback with those arguments.
|
|
1390
|
-
|
|
1391
|
-
|
|
1175
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
|
|
1176
|
+
uniffi::zkap_uniffi_bindings::Bridging<
|
|
1177
|
+
UniffiForeignFutureResultU64>::fromJs(rt, callInvoker, args[1]));
|
|
1392
1178
|
|
|
1393
|
-
|
|
1394
|
-
return jsi::Value::undefined();
|
|
1179
|
+
return jsi::Value::undefined();
|
|
1395
1180
|
}
|
|
1396
1181
|
};
|
|
1397
1182
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
@@ -1400,13 +1185,13 @@ using namespace facebook;
|
|
|
1400
1185
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1401
1186
|
|
|
1402
1187
|
template <> struct Bridging<UniffiForeignFutureResultI64> {
|
|
1403
|
-
static UniffiForeignFutureResultI64
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
) {
|
|
1188
|
+
static UniffiForeignFutureResultI64
|
|
1189
|
+
fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
|
|
1190
|
+
const jsi::Value &jsValue) {
|
|
1407
1191
|
// Check if the input is an object
|
|
1408
1192
|
if (!jsValue.isObject()) {
|
|
1409
|
-
throw jsi::JSError(rt,
|
|
1193
|
+
throw jsi::JSError(rt,
|
|
1194
|
+
"Expected an object for UniffiForeignFutureResultI64");
|
|
1410
1195
|
}
|
|
1411
1196
|
|
|
1412
1197
|
// Get the object from the jsi::Value
|
|
@@ -1417,55 +1202,48 @@ template <> struct Bridging<UniffiForeignFutureResultI64> {
|
|
|
1417
1202
|
|
|
1418
1203
|
// Create the vtable from the js callbacks.
|
|
1419
1204
|
rsObject.return_value = uniffi_jsi::Bridging<int64_t>::fromJs(
|
|
1420
|
-
rt, callInvoker,
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
rt, callInvoker,
|
|
1425
|
-
jsObject.getProperty(rt, "callStatus")
|
|
1426
|
-
);
|
|
1205
|
+
rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
|
|
1206
|
+
rsObject.call_status =
|
|
1207
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::fromJs(
|
|
1208
|
+
rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
|
|
1427
1209
|
|
|
1428
1210
|
return rsObject;
|
|
1429
1211
|
}
|
|
1430
1212
|
};
|
|
1431
1213
|
|
|
1432
1214
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
1433
|
-
|
|
1434
|
-
|
|
1215
|
+
// Implementation of callback function calling from JS to Rust
|
|
1216
|
+
// ForeignFutureCompleteI64, passed from Rust to JS as part of async
|
|
1217
|
+
// callbacks.
|
|
1435
1218
|
namespace uniffi::zkap_uniffi_bindings {
|
|
1436
1219
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1437
1220
|
|
|
1438
1221
|
template <> struct Bridging<UniffiForeignFutureCompleteI64> {
|
|
1439
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1222
|
+
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1223
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1224
|
+
UniffiForeignFutureCompleteI64 rsCallback) {
|
|
1440
1225
|
return jsi::Function::createFromHostFunction(
|
|
1441
|
-
rt,
|
|
1442
|
-
jsi::
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
size_t count) -> jsi::Value
|
|
1449
|
-
{
|
|
1450
|
-
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1451
|
-
}
|
|
1452
|
-
);
|
|
1226
|
+
rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI64"), 2,
|
|
1227
|
+
[rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
|
|
1228
|
+
const jsi::Value *arguments,
|
|
1229
|
+
size_t count) -> jsi::Value {
|
|
1230
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count,
|
|
1231
|
+
rsCallback);
|
|
1232
|
+
});
|
|
1453
1233
|
}
|
|
1454
1234
|
|
|
1455
|
-
static jsi::Value intoRust(
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
size_t count,
|
|
1461
|
-
UniffiForeignFutureCompleteI64 func) {
|
|
1235
|
+
static jsi::Value intoRust(jsi::Runtime &rt,
|
|
1236
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1237
|
+
const jsi::Value &thisValue,
|
|
1238
|
+
const jsi::Value *args, size_t count,
|
|
1239
|
+
UniffiForeignFutureCompleteI64 func) {
|
|
1462
1240
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
1463
1241
|
// then call the rs_callback with those arguments.
|
|
1464
|
-
|
|
1465
|
-
|
|
1242
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
|
|
1243
|
+
uniffi::zkap_uniffi_bindings::Bridging<
|
|
1244
|
+
UniffiForeignFutureResultI64>::fromJs(rt, callInvoker, args[1]));
|
|
1466
1245
|
|
|
1467
|
-
|
|
1468
|
-
return jsi::Value::undefined();
|
|
1246
|
+
return jsi::Value::undefined();
|
|
1469
1247
|
}
|
|
1470
1248
|
};
|
|
1471
1249
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
@@ -1474,13 +1252,13 @@ using namespace facebook;
|
|
|
1474
1252
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1475
1253
|
|
|
1476
1254
|
template <> struct Bridging<UniffiForeignFutureResultF32> {
|
|
1477
|
-
static UniffiForeignFutureResultF32
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
) {
|
|
1255
|
+
static UniffiForeignFutureResultF32
|
|
1256
|
+
fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
|
|
1257
|
+
const jsi::Value &jsValue) {
|
|
1481
1258
|
// Check if the input is an object
|
|
1482
1259
|
if (!jsValue.isObject()) {
|
|
1483
|
-
throw jsi::JSError(rt,
|
|
1260
|
+
throw jsi::JSError(rt,
|
|
1261
|
+
"Expected an object for UniffiForeignFutureResultF32");
|
|
1484
1262
|
}
|
|
1485
1263
|
|
|
1486
1264
|
// Get the object from the jsi::Value
|
|
@@ -1491,55 +1269,48 @@ template <> struct Bridging<UniffiForeignFutureResultF32> {
|
|
|
1491
1269
|
|
|
1492
1270
|
// Create the vtable from the js callbacks.
|
|
1493
1271
|
rsObject.return_value = uniffi_jsi::Bridging<float>::fromJs(
|
|
1494
|
-
rt, callInvoker,
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
rt, callInvoker,
|
|
1499
|
-
jsObject.getProperty(rt, "callStatus")
|
|
1500
|
-
);
|
|
1272
|
+
rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
|
|
1273
|
+
rsObject.call_status =
|
|
1274
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::fromJs(
|
|
1275
|
+
rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
|
|
1501
1276
|
|
|
1502
1277
|
return rsObject;
|
|
1503
1278
|
}
|
|
1504
1279
|
};
|
|
1505
1280
|
|
|
1506
1281
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
1507
|
-
|
|
1508
|
-
|
|
1282
|
+
// Implementation of callback function calling from JS to Rust
|
|
1283
|
+
// ForeignFutureCompleteF32, passed from Rust to JS as part of async
|
|
1284
|
+
// callbacks.
|
|
1509
1285
|
namespace uniffi::zkap_uniffi_bindings {
|
|
1510
1286
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1511
1287
|
|
|
1512
1288
|
template <> struct Bridging<UniffiForeignFutureCompleteF32> {
|
|
1513
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1289
|
+
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1290
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1291
|
+
UniffiForeignFutureCompleteF32 rsCallback) {
|
|
1514
1292
|
return jsi::Function::createFromHostFunction(
|
|
1515
|
-
rt,
|
|
1516
|
-
jsi::
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
size_t count) -> jsi::Value
|
|
1523
|
-
{
|
|
1524
|
-
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1525
|
-
}
|
|
1526
|
-
);
|
|
1293
|
+
rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteF32"), 2,
|
|
1294
|
+
[rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
|
|
1295
|
+
const jsi::Value *arguments,
|
|
1296
|
+
size_t count) -> jsi::Value {
|
|
1297
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count,
|
|
1298
|
+
rsCallback);
|
|
1299
|
+
});
|
|
1527
1300
|
}
|
|
1528
1301
|
|
|
1529
|
-
static jsi::Value intoRust(
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
size_t count,
|
|
1535
|
-
UniffiForeignFutureCompleteF32 func) {
|
|
1302
|
+
static jsi::Value intoRust(jsi::Runtime &rt,
|
|
1303
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1304
|
+
const jsi::Value &thisValue,
|
|
1305
|
+
const jsi::Value *args, size_t count,
|
|
1306
|
+
UniffiForeignFutureCompleteF32 func) {
|
|
1536
1307
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
1537
1308
|
// then call the rs_callback with those arguments.
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1309
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
|
|
1310
|
+
uniffi::zkap_uniffi_bindings::Bridging<
|
|
1311
|
+
UniffiForeignFutureResultF32>::fromJs(rt, callInvoker, args[1]));
|
|
1541
1312
|
|
|
1542
|
-
|
|
1313
|
+
return jsi::Value::undefined();
|
|
1543
1314
|
}
|
|
1544
1315
|
};
|
|
1545
1316
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
@@ -1548,13 +1319,13 @@ using namespace facebook;
|
|
|
1548
1319
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1549
1320
|
|
|
1550
1321
|
template <> struct Bridging<UniffiForeignFutureResultF64> {
|
|
1551
|
-
static UniffiForeignFutureResultF64
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
) {
|
|
1322
|
+
static UniffiForeignFutureResultF64
|
|
1323
|
+
fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
|
|
1324
|
+
const jsi::Value &jsValue) {
|
|
1555
1325
|
// Check if the input is an object
|
|
1556
1326
|
if (!jsValue.isObject()) {
|
|
1557
|
-
throw jsi::JSError(rt,
|
|
1327
|
+
throw jsi::JSError(rt,
|
|
1328
|
+
"Expected an object for UniffiForeignFutureResultF64");
|
|
1558
1329
|
}
|
|
1559
1330
|
|
|
1560
1331
|
// Get the object from the jsi::Value
|
|
@@ -1565,55 +1336,48 @@ template <> struct Bridging<UniffiForeignFutureResultF64> {
|
|
|
1565
1336
|
|
|
1566
1337
|
// Create the vtable from the js callbacks.
|
|
1567
1338
|
rsObject.return_value = uniffi_jsi::Bridging<double>::fromJs(
|
|
1568
|
-
rt, callInvoker,
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
rt, callInvoker,
|
|
1573
|
-
jsObject.getProperty(rt, "callStatus")
|
|
1574
|
-
);
|
|
1339
|
+
rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
|
|
1340
|
+
rsObject.call_status =
|
|
1341
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::fromJs(
|
|
1342
|
+
rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
|
|
1575
1343
|
|
|
1576
1344
|
return rsObject;
|
|
1577
1345
|
}
|
|
1578
1346
|
};
|
|
1579
1347
|
|
|
1580
1348
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
1581
|
-
|
|
1582
|
-
|
|
1349
|
+
// Implementation of callback function calling from JS to Rust
|
|
1350
|
+
// ForeignFutureCompleteF64, passed from Rust to JS as part of async
|
|
1351
|
+
// callbacks.
|
|
1583
1352
|
namespace uniffi::zkap_uniffi_bindings {
|
|
1584
1353
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1585
1354
|
|
|
1586
1355
|
template <> struct Bridging<UniffiForeignFutureCompleteF64> {
|
|
1587
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1356
|
+
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1357
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1358
|
+
UniffiForeignFutureCompleteF64 rsCallback) {
|
|
1588
1359
|
return jsi::Function::createFromHostFunction(
|
|
1589
|
-
rt,
|
|
1590
|
-
jsi::
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
size_t count) -> jsi::Value
|
|
1597
|
-
{
|
|
1598
|
-
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1599
|
-
}
|
|
1600
|
-
);
|
|
1360
|
+
rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteF64"), 2,
|
|
1361
|
+
[rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
|
|
1362
|
+
const jsi::Value *arguments,
|
|
1363
|
+
size_t count) -> jsi::Value {
|
|
1364
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count,
|
|
1365
|
+
rsCallback);
|
|
1366
|
+
});
|
|
1601
1367
|
}
|
|
1602
1368
|
|
|
1603
|
-
static jsi::Value intoRust(
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
size_t count,
|
|
1609
|
-
UniffiForeignFutureCompleteF64 func) {
|
|
1369
|
+
static jsi::Value intoRust(jsi::Runtime &rt,
|
|
1370
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1371
|
+
const jsi::Value &thisValue,
|
|
1372
|
+
const jsi::Value *args, size_t count,
|
|
1373
|
+
UniffiForeignFutureCompleteF64 func) {
|
|
1610
1374
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
1611
1375
|
// then call the rs_callback with those arguments.
|
|
1612
|
-
|
|
1613
|
-
|
|
1376
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
|
|
1377
|
+
uniffi::zkap_uniffi_bindings::Bridging<
|
|
1378
|
+
UniffiForeignFutureResultF64>::fromJs(rt, callInvoker, args[1]));
|
|
1614
1379
|
|
|
1615
|
-
|
|
1616
|
-
return jsi::Value::undefined();
|
|
1380
|
+
return jsi::Value::undefined();
|
|
1617
1381
|
}
|
|
1618
1382
|
};
|
|
1619
1383
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
@@ -1622,13 +1386,13 @@ using namespace facebook;
|
|
|
1622
1386
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1623
1387
|
|
|
1624
1388
|
template <> struct Bridging<UniffiForeignFutureResultRustBuffer> {
|
|
1625
|
-
static UniffiForeignFutureResultRustBuffer
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
) {
|
|
1389
|
+
static UniffiForeignFutureResultRustBuffer
|
|
1390
|
+
fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
|
|
1391
|
+
const jsi::Value &jsValue) {
|
|
1629
1392
|
// Check if the input is an object
|
|
1630
1393
|
if (!jsValue.isObject()) {
|
|
1631
|
-
throw jsi::JSError(
|
|
1394
|
+
throw jsi::JSError(
|
|
1395
|
+
rt, "Expected an object for UniffiForeignFutureResultRustBuffer");
|
|
1632
1396
|
}
|
|
1633
1397
|
|
|
1634
1398
|
// Get the object from the jsi::Value
|
|
@@ -1638,56 +1402,52 @@ template <> struct Bridging<UniffiForeignFutureResultRustBuffer> {
|
|
|
1638
1402
|
UniffiForeignFutureResultRustBuffer rsObject;
|
|
1639
1403
|
|
|
1640
1404
|
// Create the vtable from the js callbacks.
|
|
1641
|
-
rsObject.return_value =
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
jsObject.getProperty(rt, "callStatus")
|
|
1648
|
-
);
|
|
1405
|
+
rsObject.return_value =
|
|
1406
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::fromJs(
|
|
1407
|
+
rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
|
|
1408
|
+
rsObject.call_status =
|
|
1409
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::fromJs(
|
|
1410
|
+
rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
|
|
1649
1411
|
|
|
1650
1412
|
return rsObject;
|
|
1651
1413
|
}
|
|
1652
1414
|
};
|
|
1653
1415
|
|
|
1654
1416
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
1655
|
-
|
|
1656
|
-
|
|
1417
|
+
// Implementation of callback function calling from JS to Rust
|
|
1418
|
+
// ForeignFutureCompleteRustBuffer, passed from Rust to JS as part of async
|
|
1419
|
+
// callbacks.
|
|
1657
1420
|
namespace uniffi::zkap_uniffi_bindings {
|
|
1658
1421
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1659
1422
|
|
|
1660
1423
|
template <> struct Bridging<UniffiForeignFutureCompleteRustBuffer> {
|
|
1661
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1424
|
+
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1425
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1426
|
+
UniffiForeignFutureCompleteRustBuffer rsCallback) {
|
|
1662
1427
|
return jsi::Function::createFromHostFunction(
|
|
1663
|
-
rt,
|
|
1664
|
-
jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteRustBuffer"),
|
|
1428
|
+
rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteRustBuffer"),
|
|
1665
1429
|
2,
|
|
1666
|
-
[rsCallback, callInvoker](
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1673
|
-
}
|
|
1674
|
-
);
|
|
1430
|
+
[rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
|
|
1431
|
+
const jsi::Value *arguments,
|
|
1432
|
+
size_t count) -> jsi::Value {
|
|
1433
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count,
|
|
1434
|
+
rsCallback);
|
|
1435
|
+
});
|
|
1675
1436
|
}
|
|
1676
1437
|
|
|
1677
|
-
static jsi::Value intoRust(
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
size_t count,
|
|
1683
|
-
UniffiForeignFutureCompleteRustBuffer func) {
|
|
1438
|
+
static jsi::Value intoRust(jsi::Runtime &rt,
|
|
1439
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1440
|
+
const jsi::Value &thisValue,
|
|
1441
|
+
const jsi::Value *args, size_t count,
|
|
1442
|
+
UniffiForeignFutureCompleteRustBuffer func) {
|
|
1684
1443
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
1685
1444
|
// then call the rs_callback with those arguments.
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1445
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
|
|
1446
|
+
uniffi::zkap_uniffi_bindings::Bridging<
|
|
1447
|
+
UniffiForeignFutureResultRustBuffer>::fromJs(rt, callInvoker,
|
|
1448
|
+
args[1]));
|
|
1689
1449
|
|
|
1690
|
-
|
|
1450
|
+
return jsi::Value::undefined();
|
|
1691
1451
|
}
|
|
1692
1452
|
};
|
|
1693
1453
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
@@ -1696,13 +1456,13 @@ using namespace facebook;
|
|
|
1696
1456
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1697
1457
|
|
|
1698
1458
|
template <> struct Bridging<UniffiForeignFutureResultVoid> {
|
|
1699
|
-
static UniffiForeignFutureResultVoid
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
) {
|
|
1459
|
+
static UniffiForeignFutureResultVoid
|
|
1460
|
+
fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
|
|
1461
|
+
const jsi::Value &jsValue) {
|
|
1703
1462
|
// Check if the input is an object
|
|
1704
1463
|
if (!jsValue.isObject()) {
|
|
1705
|
-
throw jsi::JSError(
|
|
1464
|
+
throw jsi::JSError(
|
|
1465
|
+
rt, "Expected an object for UniffiForeignFutureResultVoid");
|
|
1706
1466
|
}
|
|
1707
1467
|
|
|
1708
1468
|
// Get the object from the jsi::Value
|
|
@@ -1712,73 +1472,62 @@ template <> struct Bridging<UniffiForeignFutureResultVoid> {
|
|
|
1712
1472
|
UniffiForeignFutureResultVoid rsObject;
|
|
1713
1473
|
|
|
1714
1474
|
// Create the vtable from the js callbacks.
|
|
1715
|
-
rsObject.call_status =
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
);
|
|
1475
|
+
rsObject.call_status =
|
|
1476
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::fromJs(
|
|
1477
|
+
rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
|
|
1719
1478
|
|
|
1720
1479
|
return rsObject;
|
|
1721
1480
|
}
|
|
1722
1481
|
};
|
|
1723
1482
|
|
|
1724
1483
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
1725
|
-
|
|
1726
|
-
|
|
1484
|
+
// Implementation of callback function calling from JS to Rust
|
|
1485
|
+
// ForeignFutureCompleteVoid, passed from Rust to JS as part of async
|
|
1486
|
+
// callbacks.
|
|
1727
1487
|
namespace uniffi::zkap_uniffi_bindings {
|
|
1728
1488
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1729
1489
|
|
|
1730
1490
|
template <> struct Bridging<UniffiForeignFutureCompleteVoid> {
|
|
1731
|
-
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1491
|
+
static jsi::Value toJs(jsi::Runtime &rt,
|
|
1492
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1493
|
+
UniffiForeignFutureCompleteVoid rsCallback) {
|
|
1732
1494
|
return jsi::Function::createFromHostFunction(
|
|
1733
|
-
rt,
|
|
1734
|
-
jsi::
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
size_t count) -> jsi::Value
|
|
1741
|
-
{
|
|
1742
|
-
return intoRust(rt, callInvoker, thisValue, arguments, count, rsCallback);
|
|
1743
|
-
}
|
|
1744
|
-
);
|
|
1495
|
+
rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteVoid"), 2,
|
|
1496
|
+
[rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
|
|
1497
|
+
const jsi::Value *arguments,
|
|
1498
|
+
size_t count) -> jsi::Value {
|
|
1499
|
+
return intoRust(rt, callInvoker, thisValue, arguments, count,
|
|
1500
|
+
rsCallback);
|
|
1501
|
+
});
|
|
1745
1502
|
}
|
|
1746
1503
|
|
|
1747
|
-
static jsi::Value intoRust(
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
size_t count,
|
|
1753
|
-
UniffiForeignFutureCompleteVoid func) {
|
|
1504
|
+
static jsi::Value intoRust(jsi::Runtime &rt,
|
|
1505
|
+
std::shared_ptr<CallInvoker> callInvoker,
|
|
1506
|
+
const jsi::Value &thisValue,
|
|
1507
|
+
const jsi::Value *args, size_t count,
|
|
1508
|
+
UniffiForeignFutureCompleteVoid func) {
|
|
1754
1509
|
// Convert the arguments into the Rust, with Bridging<T>::fromJs,
|
|
1755
1510
|
// then call the rs_callback with those arguments.
|
|
1756
|
-
|
|
1757
|
-
|
|
1511
|
+
func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
|
|
1512
|
+
uniffi::zkap_uniffi_bindings::Bridging<
|
|
1513
|
+
UniffiForeignFutureResultVoid>::fromJs(rt, callInvoker, args[1]));
|
|
1758
1514
|
|
|
1759
|
-
|
|
1760
|
-
return jsi::Value::undefined();
|
|
1515
|
+
return jsi::Value::undefined();
|
|
1761
1516
|
}
|
|
1762
1517
|
};
|
|
1763
1518
|
} // namespace uniffi::zkap_uniffi_bindings
|
|
1764
1519
|
|
|
1765
|
-
|
|
1766
1520
|
namespace uniffi::zkap_uniffi_bindings {
|
|
1767
1521
|
using namespace facebook;
|
|
1768
1522
|
using CallInvoker = uniffi_runtime::UniffiCallInvoker;
|
|
1769
1523
|
|
|
1770
1524
|
template <> struct Bridging<UniffiRustFutureContinuationCallback> {
|
|
1771
|
-
static UniffiRustFutureContinuationCallback
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
const jsi::Value &value
|
|
1775
|
-
) {
|
|
1525
|
+
static UniffiRustFutureContinuationCallback
|
|
1526
|
+
fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
|
|
1527
|
+
const jsi::Value &value) {
|
|
1776
1528
|
try {
|
|
1777
|
-
return uniffi::zkap_uniffi_bindings::cb::rustfuturecontinuationcallback::
|
|
1778
|
-
|
|
1779
|
-
callInvoker,
|
|
1780
|
-
value
|
|
1781
|
-
);
|
|
1529
|
+
return uniffi::zkap_uniffi_bindings::cb::rustfuturecontinuationcallback::
|
|
1530
|
+
makeCallbackFunction(rt, callInvoker, value);
|
|
1782
1531
|
} catch (const std::logic_error &e) {
|
|
1783
1532
|
throw jsi::JSError(rt, e.what());
|
|
1784
1533
|
}
|
|
@@ -1789,366 +1538,536 @@ template <> struct Bridging<UniffiRustFutureContinuationCallback> {
|
|
|
1789
1538
|
|
|
1790
1539
|
NativeZkapUniffiBindings::NativeZkapUniffiBindings(
|
|
1791
1540
|
jsi::Runtime &rt,
|
|
1792
|
-
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> invoker
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
return this
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
return this
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
return this->
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
return this
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1541
|
+
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> invoker)
|
|
1542
|
+
: callInvoker(invoker), props() {
|
|
1543
|
+
// Map from Javascript names to the cpp names
|
|
1544
|
+
props["ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length"] =
|
|
1545
|
+
jsi::Function::createFromHostFunction(
|
|
1546
|
+
rt,
|
|
1547
|
+
jsi::PropNameID::forAscii(
|
|
1548
|
+
rt, "ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length"),
|
|
1549
|
+
1,
|
|
1550
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1551
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1552
|
+
return this->cpp_uniffi_internal_fn_func_ffi__string_to_byte_length(
|
|
1553
|
+
rt, thisVal, args, count);
|
|
1554
|
+
});
|
|
1555
|
+
props["ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer"] =
|
|
1556
|
+
jsi::Function::createFromHostFunction(
|
|
1557
|
+
rt,
|
|
1558
|
+
jsi::PropNameID::forAscii(
|
|
1559
|
+
rt, "ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer"),
|
|
1560
|
+
1,
|
|
1561
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1562
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1563
|
+
return this->cpp_uniffi_internal_fn_func_ffi__string_to_arraybuffer(
|
|
1564
|
+
rt, thisVal, args, count);
|
|
1565
|
+
});
|
|
1566
|
+
props["ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string"] =
|
|
1567
|
+
jsi::Function::createFromHostFunction(
|
|
1568
|
+
rt,
|
|
1569
|
+
jsi::PropNameID::forAscii(
|
|
1570
|
+
rt, "ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string"),
|
|
1571
|
+
1,
|
|
1572
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1573
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1574
|
+
return this->cpp_uniffi_internal_fn_func_ffi__arraybuffer_to_string(
|
|
1575
|
+
rt, thisVal, args, count);
|
|
1576
|
+
});
|
|
1577
|
+
props["ubrn_uniffi_zkap_uniffi_bindings_fn_func_generate_anchor"] =
|
|
1578
|
+
jsi::Function::createFromHostFunction(
|
|
1579
|
+
rt,
|
|
1580
|
+
jsi::PropNameID::forAscii(
|
|
1581
|
+
rt, "ubrn_uniffi_zkap_uniffi_bindings_fn_func_generate_anchor"),
|
|
1582
|
+
2,
|
|
1583
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1584
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1585
|
+
return this
|
|
1586
|
+
->cpp_uniffi_zkap_uniffi_bindings_fn_func_generate_anchor(
|
|
1587
|
+
rt, thisVal, args, count);
|
|
1588
|
+
});
|
|
1589
|
+
props["ubrn_uniffi_zkap_uniffi_bindings_fn_func_generate_aud_hash"] =
|
|
1590
|
+
jsi::Function::createFromHostFunction(
|
|
1591
|
+
rt,
|
|
1592
|
+
jsi::PropNameID::forAscii(
|
|
1593
|
+
rt, "ubrn_uniffi_zkap_uniffi_bindings_fn_func_generate_aud_hash"),
|
|
1594
|
+
2,
|
|
1595
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1596
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1597
|
+
return this
|
|
1598
|
+
->cpp_uniffi_zkap_uniffi_bindings_fn_func_generate_aud_hash(
|
|
1599
|
+
rt, thisVal, args, count);
|
|
1600
|
+
});
|
|
1601
|
+
props["ubrn_uniffi_zkap_uniffi_bindings_fn_func_generate_hash"] =
|
|
1602
|
+
jsi::Function::createFromHostFunction(
|
|
1603
|
+
rt,
|
|
1604
|
+
jsi::PropNameID::forAscii(
|
|
1605
|
+
rt, "ubrn_uniffi_zkap_uniffi_bindings_fn_func_generate_hash"),
|
|
1606
|
+
1,
|
|
1607
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1608
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1609
|
+
return this->cpp_uniffi_zkap_uniffi_bindings_fn_func_generate_hash(
|
|
1610
|
+
rt, thisVal, args, count);
|
|
1611
|
+
});
|
|
1612
|
+
props["ubrn_uniffi_zkap_uniffi_bindings_fn_func_generate_leaf_hash"] =
|
|
1613
|
+
jsi::Function::createFromHostFunction(
|
|
1614
|
+
rt,
|
|
1615
|
+
jsi::PropNameID::forAscii(
|
|
1616
|
+
rt,
|
|
1617
|
+
"ubrn_uniffi_zkap_uniffi_bindings_fn_func_generate_leaf_hash"),
|
|
1618
|
+
3,
|
|
1619
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1620
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1621
|
+
return this
|
|
1622
|
+
->cpp_uniffi_zkap_uniffi_bindings_fn_func_generate_leaf_hash(
|
|
1623
|
+
rt, thisVal, args, count);
|
|
1624
|
+
});
|
|
1625
|
+
props["ubrn_uniffi_zkap_uniffi_bindings_fn_func_prepare_witness_inputs"] =
|
|
1626
|
+
jsi::Function::createFromHostFunction(
|
|
1627
|
+
rt,
|
|
1628
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_zkap_uniffi_bindings_fn_"
|
|
1629
|
+
"func_prepare_witness_inputs"),
|
|
1630
|
+
2,
|
|
1631
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1632
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1633
|
+
return this
|
|
1634
|
+
->cpp_uniffi_zkap_uniffi_bindings_fn_func_prepare_witness_inputs(
|
|
1635
|
+
rt, thisVal, args, count);
|
|
1636
|
+
});
|
|
1637
|
+
props["ubrn_uniffi_zkap_uniffi_bindings_fn_func_prove"] =
|
|
1638
|
+
jsi::Function::createFromHostFunction(
|
|
1639
|
+
rt,
|
|
1640
|
+
jsi::PropNameID::forAscii(
|
|
1641
|
+
rt, "ubrn_uniffi_zkap_uniffi_bindings_fn_func_prove"),
|
|
1642
|
+
2,
|
|
1643
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1644
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1645
|
+
return this->cpp_uniffi_zkap_uniffi_bindings_fn_func_prove(
|
|
1646
|
+
rt, thisVal, args, count);
|
|
1647
|
+
});
|
|
1648
|
+
props["ubrn_uniffi_zkap_uniffi_bindings_fn_func_prove_from_witness_bundle_"
|
|
1649
|
+
"file"] = jsi::Function::createFromHostFunction(
|
|
1650
|
+
rt,
|
|
1651
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_zkap_uniffi_bindings_fn_func_"
|
|
1652
|
+
"prove_from_witness_bundle_file"),
|
|
1653
|
+
3,
|
|
1654
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1655
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1656
|
+
return this
|
|
1657
|
+
->cpp_uniffi_zkap_uniffi_bindings_fn_func_prove_from_witness_bundle_file(
|
|
1658
|
+
rt, thisVal, args, count);
|
|
1659
|
+
});
|
|
1660
|
+
props["ubrn_uniffi_zkap_uniffi_bindings_fn_func_prove_from_witness_bundles"] =
|
|
1661
|
+
jsi::Function::createFromHostFunction(
|
|
1662
|
+
rt,
|
|
1663
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_zkap_uniffi_bindings_fn_"
|
|
1664
|
+
"func_prove_from_witness_bundles"),
|
|
1665
|
+
3,
|
|
1666
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1667
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1668
|
+
return this
|
|
1669
|
+
->cpp_uniffi_zkap_uniffi_bindings_fn_func_prove_from_witness_bundles(
|
|
1670
|
+
rt, thisVal, args, count);
|
|
1671
|
+
});
|
|
1672
|
+
props["ubrn_uniffi_zkap_uniffi_bindings_checksum_func_generate_anchor"] =
|
|
1673
|
+
jsi::Function::createFromHostFunction(
|
|
1674
|
+
rt,
|
|
1675
|
+
jsi::PropNameID::forAscii(
|
|
1676
|
+
rt,
|
|
1677
|
+
"ubrn_uniffi_zkap_uniffi_bindings_checksum_func_generate_anchor"),
|
|
1678
|
+
0,
|
|
1679
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1680
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1681
|
+
return this
|
|
1682
|
+
->cpp_uniffi_zkap_uniffi_bindings_checksum_func_generate_anchor(
|
|
1683
|
+
rt, thisVal, args, count);
|
|
1684
|
+
});
|
|
1685
|
+
props["ubrn_uniffi_zkap_uniffi_bindings_checksum_func_generate_aud_hash"] =
|
|
1686
|
+
jsi::Function::createFromHostFunction(
|
|
1687
|
+
rt,
|
|
1688
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_zkap_uniffi_bindings_"
|
|
1689
|
+
"checksum_func_generate_aud_hash"),
|
|
1690
|
+
0,
|
|
1691
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1692
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1693
|
+
return this
|
|
1694
|
+
->cpp_uniffi_zkap_uniffi_bindings_checksum_func_generate_aud_hash(
|
|
1695
|
+
rt, thisVal, args, count);
|
|
1696
|
+
});
|
|
1697
|
+
props["ubrn_uniffi_zkap_uniffi_bindings_checksum_func_generate_hash"] =
|
|
1698
|
+
jsi::Function::createFromHostFunction(
|
|
1699
|
+
rt,
|
|
1700
|
+
jsi::PropNameID::forAscii(
|
|
1701
|
+
rt,
|
|
1702
|
+
"ubrn_uniffi_zkap_uniffi_bindings_checksum_func_generate_hash"),
|
|
1703
|
+
0,
|
|
1704
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1705
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1706
|
+
return this
|
|
1707
|
+
->cpp_uniffi_zkap_uniffi_bindings_checksum_func_generate_hash(
|
|
1708
|
+
rt, thisVal, args, count);
|
|
1709
|
+
});
|
|
1710
|
+
props["ubrn_uniffi_zkap_uniffi_bindings_checksum_func_generate_leaf_hash"] =
|
|
1711
|
+
jsi::Function::createFromHostFunction(
|
|
1712
|
+
rt,
|
|
1713
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_zkap_uniffi_bindings_"
|
|
1714
|
+
"checksum_func_generate_leaf_hash"),
|
|
1715
|
+
0,
|
|
1716
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1717
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1718
|
+
return this
|
|
1719
|
+
->cpp_uniffi_zkap_uniffi_bindings_checksum_func_generate_leaf_hash(
|
|
1720
|
+
rt, thisVal, args, count);
|
|
1721
|
+
});
|
|
1722
|
+
props["ubrn_uniffi_zkap_uniffi_bindings_checksum_func_prepare_witness_"
|
|
1723
|
+
"inputs"] = jsi::Function::createFromHostFunction(
|
|
1724
|
+
rt,
|
|
1725
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_zkap_uniffi_bindings_checksum_"
|
|
1726
|
+
"func_prepare_witness_inputs"),
|
|
1727
|
+
0,
|
|
1728
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1729
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1730
|
+
return this
|
|
1731
|
+
->cpp_uniffi_zkap_uniffi_bindings_checksum_func_prepare_witness_inputs(
|
|
1732
|
+
rt, thisVal, args, count);
|
|
1733
|
+
});
|
|
1734
|
+
props["ubrn_uniffi_zkap_uniffi_bindings_checksum_func_prove"] =
|
|
1735
|
+
jsi::Function::createFromHostFunction(
|
|
1736
|
+
rt,
|
|
1737
|
+
jsi::PropNameID::forAscii(
|
|
1738
|
+
rt, "ubrn_uniffi_zkap_uniffi_bindings_checksum_func_prove"),
|
|
1739
|
+
0,
|
|
1740
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1741
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1742
|
+
return this->cpp_uniffi_zkap_uniffi_bindings_checksum_func_prove(
|
|
1743
|
+
rt, thisVal, args, count);
|
|
1744
|
+
});
|
|
1745
|
+
props["ubrn_uniffi_zkap_uniffi_bindings_checksum_func_prove_from_witness_"
|
|
1746
|
+
"bundle_file"] = jsi::Function::createFromHostFunction(
|
|
1747
|
+
rt,
|
|
1748
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_zkap_uniffi_bindings_checksum_"
|
|
1749
|
+
"func_prove_from_witness_bundle_file"),
|
|
1750
|
+
0,
|
|
1751
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1752
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1753
|
+
return this
|
|
1754
|
+
->cpp_uniffi_zkap_uniffi_bindings_checksum_func_prove_from_witness_bundle_file(
|
|
1755
|
+
rt, thisVal, args, count);
|
|
1756
|
+
});
|
|
1757
|
+
props["ubrn_uniffi_zkap_uniffi_bindings_checksum_func_prove_from_witness_"
|
|
1758
|
+
"bundles"] = jsi::Function::createFromHostFunction(
|
|
1759
|
+
rt,
|
|
1760
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_zkap_uniffi_bindings_checksum_"
|
|
1761
|
+
"func_prove_from_witness_bundles"),
|
|
1762
|
+
0,
|
|
1763
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1764
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1765
|
+
return this
|
|
1766
|
+
->cpp_uniffi_zkap_uniffi_bindings_checksum_func_prove_from_witness_bundles(
|
|
1767
|
+
rt, thisVal, args, count);
|
|
1768
|
+
});
|
|
1769
|
+
props["ubrn_ffi_zkap_uniffi_bindings_uniffi_contract_version"] =
|
|
1770
|
+
jsi::Function::createFromHostFunction(
|
|
1771
|
+
rt,
|
|
1772
|
+
jsi::PropNameID::forAscii(
|
|
1773
|
+
rt, "ubrn_ffi_zkap_uniffi_bindings_uniffi_contract_version"),
|
|
1774
|
+
0,
|
|
1775
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal,
|
|
1776
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
1777
|
+
return this->cpp_ffi_zkap_uniffi_bindings_uniffi_contract_version(
|
|
1778
|
+
rt, thisVal, args, count);
|
|
1779
|
+
});
|
|
1955
1780
|
}
|
|
1956
1781
|
|
|
1957
|
-
void NativeZkapUniffiBindings::registerModule(
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1782
|
+
void NativeZkapUniffiBindings::registerModule(
|
|
1783
|
+
jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> callInvoker) {
|
|
1784
|
+
auto invoker =
|
|
1785
|
+
std::make_shared<uniffi_runtime::UniffiCallInvoker>(callInvoker);
|
|
1786
|
+
auto tm = std::make_shared<NativeZkapUniffiBindings>(rt, invoker);
|
|
1787
|
+
auto obj = rt.global().createFromHostObject(rt, tm);
|
|
1788
|
+
rt.global().setProperty(rt, "NativeZkapUniffiBindings", obj);
|
|
1962
1789
|
}
|
|
1963
1790
|
|
|
1964
1791
|
void NativeZkapUniffiBindings::unregisterModule(jsi::Runtime &rt) {
|
|
1965
|
-
|
|
1792
|
+
uniffi::zkap_uniffi_bindings::registry::clearRegistry();
|
|
1966
1793
|
}
|
|
1967
1794
|
|
|
1968
|
-
jsi::Value NativeZkapUniffiBindings::get(jsi::Runtime&
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1795
|
+
jsi::Value NativeZkapUniffiBindings::get(jsi::Runtime &rt,
|
|
1796
|
+
const jsi::PropNameID &name) {
|
|
1797
|
+
try {
|
|
1798
|
+
return jsi::Value(rt, props.at(name.utf8(rt)));
|
|
1799
|
+
} catch (std::out_of_range &e) {
|
|
1800
|
+
return jsi::Value::undefined();
|
|
1801
|
+
}
|
|
1975
1802
|
}
|
|
1976
1803
|
|
|
1977
|
-
std::vector<jsi::PropNameID>
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1804
|
+
std::vector<jsi::PropNameID>
|
|
1805
|
+
NativeZkapUniffiBindings::getPropertyNames(jsi::Runtime &rt) {
|
|
1806
|
+
std::vector<jsi::PropNameID> rval;
|
|
1807
|
+
for (auto &[key, value] : props) {
|
|
1808
|
+
rval.push_back(jsi::PropNameID::forUtf8(rt, key));
|
|
1809
|
+
}
|
|
1810
|
+
return rval;
|
|
1983
1811
|
}
|
|
1984
1812
|
|
|
1985
|
-
void NativeZkapUniffiBindings::set(jsi::Runtime&
|
|
1986
|
-
|
|
1813
|
+
void NativeZkapUniffiBindings::set(jsi::Runtime &rt,
|
|
1814
|
+
const jsi::PropNameID &name,
|
|
1815
|
+
const jsi::Value &value) {
|
|
1816
|
+
props.insert_or_assign(name.utf8(rt), &value);
|
|
1987
1817
|
}
|
|
1988
1818
|
|
|
1989
1819
|
NativeZkapUniffiBindings::~NativeZkapUniffiBindings() {
|
|
1990
|
-
|
|
1991
|
-
uniffi::zkap_uniffi_bindings::cb::rustfuturecontinuationcallback::cleanup();
|
|
1992
|
-
|
|
1993
|
-
uniffi::zkap_uniffi_bindings::cb::foreignfuturedroppedcallback::cleanup();
|
|
1994
|
-
|
|
1995
|
-
|
|
1820
|
+
// Cleanup for callback function RustFutureContinuationCallback
|
|
1821
|
+
uniffi::zkap_uniffi_bindings::cb::rustfuturecontinuationcallback::cleanup();
|
|
1822
|
+
// Cleanup for callback function ForeignFutureDroppedCallback
|
|
1823
|
+
uniffi::zkap_uniffi_bindings::cb::foreignfuturedroppedcallback::cleanup();
|
|
1824
|
+
// Cleanup for "free" callback function CallbackInterfaceFree
|
|
1996
1825
|
}
|
|
1997
1826
|
|
|
1998
1827
|
// Utility functions for serialization/deserialization of strings.
|
|
1999
|
-
jsi::Value NativeZkapUniffiBindings::
|
|
2000
|
-
|
|
1828
|
+
jsi::Value NativeZkapUniffiBindings::
|
|
1829
|
+
cpp_uniffi_internal_fn_func_ffi__string_to_byte_length(
|
|
1830
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1831
|
+
size_t count) {
|
|
1832
|
+
return uniffi_jsi::Bridging<std::string>::string_to_bytelength(rt, args[0]);
|
|
2001
1833
|
}
|
|
2002
1834
|
|
|
2003
|
-
jsi::Value NativeZkapUniffiBindings::
|
|
2004
|
-
|
|
1835
|
+
jsi::Value NativeZkapUniffiBindings::
|
|
1836
|
+
cpp_uniffi_internal_fn_func_ffi__string_to_arraybuffer(
|
|
1837
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1838
|
+
size_t count) {
|
|
1839
|
+
return uniffi_jsi::Bridging<std::string>::string_to_arraybuffer(rt, args[0]);
|
|
2005
1840
|
}
|
|
2006
1841
|
|
|
2007
|
-
jsi::Value NativeZkapUniffiBindings::
|
|
2008
|
-
|
|
1842
|
+
jsi::Value NativeZkapUniffiBindings::
|
|
1843
|
+
cpp_uniffi_internal_fn_func_ffi__arraybuffer_to_string(
|
|
1844
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1845
|
+
size_t count) {
|
|
1846
|
+
return uniffi_jsi::Bridging<std::string>::arraybuffer_to_string(rt, args[0]);
|
|
2009
1847
|
}
|
|
2010
1848
|
|
|
2011
1849
|
// Methods calling directly into the uniffi generated C API of the Rust crate.
|
|
2012
|
-
jsi::Value NativeZkapUniffiBindings::
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
1850
|
+
jsi::Value NativeZkapUniffiBindings::
|
|
1851
|
+
cpp_uniffi_zkap_uniffi_bindings_fn_func_generate_anchor(
|
|
1852
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1853
|
+
size_t count) {
|
|
1854
|
+
RustCallStatus status =
|
|
1855
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::rustSuccess(rt);
|
|
1856
|
+
auto value = uniffi_zkap_uniffi_bindings_fn_func_generate_anchor(
|
|
1857
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::fromJs(
|
|
1858
|
+
rt, callInvoker, args[0]),
|
|
1859
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::fromJs(
|
|
1860
|
+
rt, callInvoker, args[1]),
|
|
1861
|
+
&status);
|
|
1862
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::copyIntoJs(
|
|
1863
|
+
rt, callInvoker, status, args[count - 1]);
|
|
1864
|
+
|
|
1865
|
+
return uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::toJs(
|
|
1866
|
+
rt, callInvoker, value);
|
|
2021
1867
|
}
|
|
2022
|
-
jsi::Value NativeZkapUniffiBindings::
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
1868
|
+
jsi::Value NativeZkapUniffiBindings::
|
|
1869
|
+
cpp_uniffi_zkap_uniffi_bindings_fn_func_generate_aud_hash(
|
|
1870
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1871
|
+
size_t count) {
|
|
1872
|
+
RustCallStatus status =
|
|
1873
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::rustSuccess(rt);
|
|
1874
|
+
auto value = uniffi_zkap_uniffi_bindings_fn_func_generate_aud_hash(
|
|
1875
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::fromJs(
|
|
1876
|
+
rt, callInvoker, args[0]),
|
|
1877
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::fromJs(
|
|
1878
|
+
rt, callInvoker, args[1]),
|
|
1879
|
+
&status);
|
|
1880
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::copyIntoJs(
|
|
1881
|
+
rt, callInvoker, status, args[count - 1]);
|
|
1882
|
+
|
|
1883
|
+
return uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::toJs(
|
|
1884
|
+
rt, callInvoker, value);
|
|
2031
1885
|
}
|
|
2032
|
-
jsi::Value
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
1886
|
+
jsi::Value
|
|
1887
|
+
NativeZkapUniffiBindings::cpp_uniffi_zkap_uniffi_bindings_fn_func_generate_hash(
|
|
1888
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1889
|
+
size_t count) {
|
|
1890
|
+
RustCallStatus status =
|
|
1891
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::rustSuccess(rt);
|
|
1892
|
+
auto value = uniffi_zkap_uniffi_bindings_fn_func_generate_hash(
|
|
1893
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::fromJs(
|
|
1894
|
+
rt, callInvoker, args[0]),
|
|
1895
|
+
&status);
|
|
1896
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::copyIntoJs(
|
|
1897
|
+
rt, callInvoker, status, args[count - 1]);
|
|
1898
|
+
|
|
1899
|
+
return uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::toJs(
|
|
1900
|
+
rt, callInvoker, value);
|
|
2041
1901
|
}
|
|
2042
|
-
jsi::Value NativeZkapUniffiBindings::
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
1902
|
+
jsi::Value NativeZkapUniffiBindings::
|
|
1903
|
+
cpp_uniffi_zkap_uniffi_bindings_fn_func_generate_leaf_hash(
|
|
1904
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1905
|
+
size_t count) {
|
|
1906
|
+
RustCallStatus status =
|
|
1907
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::rustSuccess(rt);
|
|
1908
|
+
auto value = uniffi_zkap_uniffi_bindings_fn_func_generate_leaf_hash(
|
|
1909
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::fromJs(
|
|
1910
|
+
rt, callInvoker, args[0]),
|
|
1911
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::fromJs(
|
|
1912
|
+
rt, callInvoker, args[1]),
|
|
1913
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::fromJs(
|
|
1914
|
+
rt, callInvoker, args[2]),
|
|
1915
|
+
&status);
|
|
1916
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::copyIntoJs(
|
|
1917
|
+
rt, callInvoker, status, args[count - 1]);
|
|
1918
|
+
|
|
1919
|
+
return uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::toJs(
|
|
1920
|
+
rt, callInvoker, value);
|
|
2051
1921
|
}
|
|
2052
|
-
jsi::Value NativeZkapUniffiBindings::
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
1922
|
+
jsi::Value NativeZkapUniffiBindings::
|
|
1923
|
+
cpp_uniffi_zkap_uniffi_bindings_fn_func_prepare_witness_inputs(
|
|
1924
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1925
|
+
size_t count) {
|
|
1926
|
+
RustCallStatus status =
|
|
1927
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::rustSuccess(rt);
|
|
1928
|
+
auto value = uniffi_zkap_uniffi_bindings_fn_func_prepare_witness_inputs(
|
|
1929
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::fromJs(
|
|
1930
|
+
rt, callInvoker, args[0]),
|
|
1931
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::fromJs(
|
|
1932
|
+
rt, callInvoker, args[1]),
|
|
1933
|
+
&status);
|
|
1934
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::copyIntoJs(
|
|
1935
|
+
rt, callInvoker, status, args[count - 1]);
|
|
1936
|
+
|
|
1937
|
+
return uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::toJs(
|
|
1938
|
+
rt, callInvoker, value);
|
|
2061
1939
|
}
|
|
2062
|
-
jsi::Value
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
1940
|
+
jsi::Value
|
|
1941
|
+
NativeZkapUniffiBindings::cpp_uniffi_zkap_uniffi_bindings_fn_func_prove(
|
|
1942
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1943
|
+
size_t count) {
|
|
1944
|
+
RustCallStatus status =
|
|
1945
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::rustSuccess(rt);
|
|
1946
|
+
auto value = uniffi_zkap_uniffi_bindings_fn_func_prove(
|
|
1947
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::fromJs(
|
|
1948
|
+
rt, callInvoker, args[0]),
|
|
1949
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::fromJs(
|
|
1950
|
+
rt, callInvoker, args[1]),
|
|
1951
|
+
&status);
|
|
1952
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::copyIntoJs(
|
|
1953
|
+
rt, callInvoker, status, args[count - 1]);
|
|
1954
|
+
|
|
1955
|
+
return uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::toJs(
|
|
1956
|
+
rt, callInvoker, value);
|
|
2071
1957
|
}
|
|
2072
|
-
jsi::Value NativeZkapUniffiBindings::
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
1958
|
+
jsi::Value NativeZkapUniffiBindings::
|
|
1959
|
+
cpp_uniffi_zkap_uniffi_bindings_fn_func_prove_from_witness_bundle_file(
|
|
1960
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1961
|
+
size_t count) {
|
|
1962
|
+
RustCallStatus status =
|
|
1963
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::rustSuccess(rt);
|
|
1964
|
+
auto value =
|
|
1965
|
+
uniffi_zkap_uniffi_bindings_fn_func_prove_from_witness_bundle_file(
|
|
1966
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::fromJs(
|
|
1967
|
+
rt, callInvoker, args[0]),
|
|
1968
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::fromJs(
|
|
1969
|
+
rt, callInvoker, args[1]),
|
|
1970
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::fromJs(
|
|
1971
|
+
rt, callInvoker, args[2]),
|
|
1972
|
+
&status);
|
|
1973
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::copyIntoJs(
|
|
1974
|
+
rt, callInvoker, status, args[count - 1]);
|
|
1975
|
+
|
|
1976
|
+
return uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::toJs(
|
|
1977
|
+
rt, callInvoker, value);
|
|
2081
1978
|
}
|
|
2082
|
-
jsi::Value NativeZkapUniffiBindings::
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
1979
|
+
jsi::Value NativeZkapUniffiBindings::
|
|
1980
|
+
cpp_uniffi_zkap_uniffi_bindings_fn_func_prove_from_witness_bundles(
|
|
1981
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
1982
|
+
size_t count) {
|
|
1983
|
+
RustCallStatus status =
|
|
1984
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::rustSuccess(rt);
|
|
1985
|
+
auto value = uniffi_zkap_uniffi_bindings_fn_func_prove_from_witness_bundles(
|
|
1986
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::fromJs(
|
|
1987
|
+
rt, callInvoker, args[0]),
|
|
1988
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::fromJs(
|
|
1989
|
+
rt, callInvoker, args[1]),
|
|
1990
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::fromJs(
|
|
1991
|
+
rt, callInvoker, args[2]),
|
|
1992
|
+
&status);
|
|
1993
|
+
uniffi::zkap_uniffi_bindings::Bridging<RustCallStatus>::copyIntoJs(
|
|
1994
|
+
rt, callInvoker, status, args[count - 1]);
|
|
1995
|
+
|
|
1996
|
+
return uniffi::zkap_uniffi_bindings::Bridging<RustBuffer>::toJs(
|
|
1997
|
+
rt, callInvoker, value);
|
|
2091
1998
|
}
|
|
2092
|
-
jsi::Value NativeZkapUniffiBindings::
|
|
2093
|
-
|
|
2094
|
-
|
|
1999
|
+
jsi::Value NativeZkapUniffiBindings::
|
|
2000
|
+
cpp_uniffi_zkap_uniffi_bindings_checksum_func_generate_anchor(
|
|
2001
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
2002
|
+
size_t count) {
|
|
2003
|
+
auto value = uniffi_zkap_uniffi_bindings_checksum_func_generate_anchor();
|
|
2095
2004
|
|
|
2096
|
-
|
|
2097
|
-
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
2005
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
2098
2006
|
}
|
|
2099
|
-
jsi::Value NativeZkapUniffiBindings::
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2007
|
+
jsi::Value NativeZkapUniffiBindings::
|
|
2008
|
+
cpp_uniffi_zkap_uniffi_bindings_checksum_func_generate_aud_hash(
|
|
2009
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
2010
|
+
size_t count) {
|
|
2011
|
+
auto value = uniffi_zkap_uniffi_bindings_checksum_func_generate_aud_hash();
|
|
2103
2012
|
|
|
2104
|
-
|
|
2013
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
2105
2014
|
}
|
|
2106
|
-
jsi::Value NativeZkapUniffiBindings::
|
|
2107
|
-
|
|
2108
|
-
|
|
2015
|
+
jsi::Value NativeZkapUniffiBindings::
|
|
2016
|
+
cpp_uniffi_zkap_uniffi_bindings_checksum_func_generate_hash(
|
|
2017
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
2018
|
+
size_t count) {
|
|
2019
|
+
auto value = uniffi_zkap_uniffi_bindings_checksum_func_generate_hash();
|
|
2109
2020
|
|
|
2110
|
-
|
|
2111
|
-
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
2021
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
2112
2022
|
}
|
|
2113
|
-
jsi::Value NativeZkapUniffiBindings::
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2023
|
+
jsi::Value NativeZkapUniffiBindings::
|
|
2024
|
+
cpp_uniffi_zkap_uniffi_bindings_checksum_func_generate_leaf_hash(
|
|
2025
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
2026
|
+
size_t count) {
|
|
2027
|
+
auto value = uniffi_zkap_uniffi_bindings_checksum_func_generate_leaf_hash();
|
|
2117
2028
|
|
|
2118
|
-
|
|
2029
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
2119
2030
|
}
|
|
2120
|
-
jsi::Value NativeZkapUniffiBindings::
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2031
|
+
jsi::Value NativeZkapUniffiBindings::
|
|
2032
|
+
cpp_uniffi_zkap_uniffi_bindings_checksum_func_prepare_witness_inputs(
|
|
2033
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
2034
|
+
size_t count) {
|
|
2035
|
+
auto value =
|
|
2036
|
+
uniffi_zkap_uniffi_bindings_checksum_func_prepare_witness_inputs();
|
|
2037
|
+
|
|
2038
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
2126
2039
|
}
|
|
2127
|
-
jsi::Value
|
|
2128
|
-
|
|
2129
|
-
|
|
2040
|
+
jsi::Value
|
|
2041
|
+
NativeZkapUniffiBindings::cpp_uniffi_zkap_uniffi_bindings_checksum_func_prove(
|
|
2042
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
2043
|
+
size_t count) {
|
|
2044
|
+
auto value = uniffi_zkap_uniffi_bindings_checksum_func_prove();
|
|
2130
2045
|
|
|
2131
|
-
|
|
2132
|
-
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
2046
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
2133
2047
|
}
|
|
2134
|
-
jsi::Value NativeZkapUniffiBindings::
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2048
|
+
jsi::Value NativeZkapUniffiBindings::
|
|
2049
|
+
cpp_uniffi_zkap_uniffi_bindings_checksum_func_prove_from_witness_bundle_file(
|
|
2050
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
2051
|
+
size_t count) {
|
|
2052
|
+
auto value =
|
|
2053
|
+
uniffi_zkap_uniffi_bindings_checksum_func_prove_from_witness_bundle_file();
|
|
2054
|
+
|
|
2055
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
2140
2056
|
}
|
|
2141
|
-
jsi::Value NativeZkapUniffiBindings::
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2057
|
+
jsi::Value NativeZkapUniffiBindings::
|
|
2058
|
+
cpp_uniffi_zkap_uniffi_bindings_checksum_func_prove_from_witness_bundles(
|
|
2059
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
2060
|
+
size_t count) {
|
|
2061
|
+
auto value =
|
|
2062
|
+
uniffi_zkap_uniffi_bindings_checksum_func_prove_from_witness_bundles();
|
|
2063
|
+
|
|
2064
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
2147
2065
|
}
|
|
2148
|
-
jsi::Value
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2066
|
+
jsi::Value
|
|
2067
|
+
NativeZkapUniffiBindings::cpp_ffi_zkap_uniffi_bindings_uniffi_contract_version(
|
|
2068
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
|
|
2069
|
+
size_t count) {
|
|
2070
|
+
auto value = ffi_zkap_uniffi_bindings_uniffi_contract_version();
|
|
2152
2071
|
|
|
2153
|
-
|
|
2072
|
+
return uniffi_jsi::Bridging<uint32_t>::toJs(rt, callInvoker, value);
|
|
2154
2073
|
}
|