1 #include <rust_types.h>
5 // These should be provided...somehow...
6 void *memset(void *s, int c, size_t n);
7 void *memcpy(void *dest, const void *src, size_t n);
8 int memcmp(const void *s1, const void *s2, size_t n);
10 void __attribute__((noreturn)) abort(void);
11 void assert(bool expression);
13 // Always run a, then assert it is true:
14 #define DO_ASSERT(a) do { bool _assert_val = (a); assert(_assert_val); } while(0)
15 // Assert a is true or do nothing
16 #define CHECK(a) DO_ASSERT(a)
18 // Running a leak check across all the allocations and frees of the JDK is a mess,
19 // so instead we implement our own naive leak checker here, relying on the -wrap
20 // linker option to wrap malloc/calloc/realloc/free, tracking everyhing allocated
21 // and free'd in Rust or C across the generated bindings shared library.
24 typedef struct allocation {
25 struct allocation* next;
27 const char* struct_name;
29 static allocation* allocation_ll = NULL;
31 void* __real_malloc(size_t len);
32 void* __real_calloc(size_t nmemb, size_t len);
33 static void new_allocation(void* res, const char* struct_name) {
34 allocation* new_alloc = __real_malloc(sizeof(allocation));
36 new_alloc->struct_name = struct_name;
37 new_alloc->next = allocation_ll;
38 allocation_ll = new_alloc;
40 static void* MALLOC(size_t len, const char* struct_name) {
41 void* res = __real_malloc(len);
42 new_allocation(res, struct_name);
45 void __real_free(void* ptr);
46 static void alloc_freed(void* ptr) {
48 allocation* it = allocation_ll;
49 while (it->ptr != ptr) {
50 p = it; it = it->next;
52 //XXX: fprintf(stderr, "Tried to free unknown pointer %p\n", ptr);
53 return; // addrsan should catch malloc-unknown and print more info than we have
56 if (p) { p->next = it->next; } else { allocation_ll = it->next; }
57 DO_ASSERT(it->ptr == ptr);
60 static void FREE(void* ptr) {
61 if ((long)ptr < 1024) return; // Rust loves to create pointers to the NULL page for dummys
66 void* __wrap_malloc(size_t len) {
67 void* res = __real_malloc(len);
68 new_allocation(res, "malloc call");
71 void* __wrap_calloc(size_t nmemb, size_t len) {
72 void* res = __real_calloc(nmemb, len);
73 new_allocation(res, "calloc call");
76 void __wrap_free(void* ptr) {
77 if (ptr == NULL) return;
82 void* __real_realloc(void* ptr, size_t newlen);
83 void* __wrap_realloc(void* ptr, size_t len) {
84 if (ptr != NULL) alloc_freed(ptr);
85 void* res = __real_realloc(ptr, len);
86 new_allocation(res, "realloc call");
89 void __wrap_reallocarray(void* ptr, size_t new_sz) {
90 // Rust doesn't seem to use reallocarray currently
94 void __attribute__((destructor)) check_leaks() {
95 for (allocation* a = allocation_ll; a != NULL; a = a->next) {
96 //XXX: fprintf(stderr, "%s %p remains\n", a->struct_name, a->ptr);
98 DO_ASSERT(allocation_ll == NULL);
101 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
102 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
103 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
104 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
106 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
108 typedef struct int64_tArray {uint32_t len;int64_t *ptr;} int64_tArray;
109 typedef struct uint32_tArray {uint32_t len;int32_t *ptr;} uint32_tArray;
110 typedef struct ptrArray {uint32_t len;int32_t *ptr;} ptrArray;
111 typedef struct int8_tArray {uint32_t len;int8_t *ptr;} int8_tArray;
112 typedef struct jstring {} jstring;
114 jstring conv_owned_string(const char* _src) { jstring a; return a; }
116 typedef bool jboolean;
118 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
119 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
121 case 0: return LDKAccessError_UnknownChain;
122 case 1: return LDKAccessError_UnknownTx;
126 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
128 case LDKAccessError_UnknownChain: return 0;
129 case LDKAccessError_UnknownTx: return 1;
133 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
135 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
136 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
140 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
142 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
143 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
147 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
149 case 0: return LDKConfirmationTarget_Background;
150 case 1: return LDKConfirmationTarget_Normal;
151 case 2: return LDKConfirmationTarget_HighPriority;
155 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
157 case LDKConfirmationTarget_Background: return 0;
158 case LDKConfirmationTarget_Normal: return 1;
159 case LDKConfirmationTarget_HighPriority: return 2;
163 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
165 case 0: return LDKLevel_Off;
166 case 1: return LDKLevel_Error;
167 case 2: return LDKLevel_Warn;
168 case 3: return LDKLevel_Info;
169 case 4: return LDKLevel_Debug;
170 case 5: return LDKLevel_Trace;
174 static inline int32_t LDKLevel_to_js(LDKLevel val) {
176 case LDKLevel_Off: return 0;
177 case LDKLevel_Error: return 1;
178 case LDKLevel_Warn: return 2;
179 case LDKLevel_Info: return 3;
180 case LDKLevel_Debug: return 4;
181 case LDKLevel_Trace: return 5;
185 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
187 case 0: return LDKNetwork_Bitcoin;
188 case 1: return LDKNetwork_Testnet;
189 case 2: return LDKNetwork_Regtest;
193 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
195 case LDKNetwork_Bitcoin: return 0;
196 case LDKNetwork_Testnet: return 1;
197 case LDKNetwork_Regtest: return 2;
201 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
203 case 0: return LDKSecp256k1Error_IncorrectSignature;
204 case 1: return LDKSecp256k1Error_InvalidMessage;
205 case 2: return LDKSecp256k1Error_InvalidPublicKey;
206 case 3: return LDKSecp256k1Error_InvalidSignature;
207 case 4: return LDKSecp256k1Error_InvalidSecretKey;
208 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
209 case 6: return LDKSecp256k1Error_InvalidTweak;
210 case 7: return LDKSecp256k1Error_NotEnoughMemory;
211 case 8: return LDKSecp256k1Error_CallbackPanicked;
215 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
217 case LDKSecp256k1Error_IncorrectSignature: return 0;
218 case LDKSecp256k1Error_InvalidMessage: return 1;
219 case LDKSecp256k1Error_InvalidPublicKey: return 2;
220 case LDKSecp256k1Error_InvalidSignature: return 3;
221 case LDKSecp256k1Error_InvalidSecretKey: return 4;
222 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
223 case LDKSecp256k1Error_InvalidTweak: return 6;
224 case LDKSecp256k1Error_NotEnoughMemory: return 7;
225 case LDKSecp256k1Error_CallbackPanicked: return 8;
229 uint32_t LDKCVec_1u8Z_1new(void* ctx_TODO, int8_tArray elems) {
230 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
231 ret->datalen = elems.len;
232 if (ret->datalen == 0) {
235 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
236 int8_t *java_elems = (int8_t*)elems.ptr;
237 for (size_t i = 0; i < ret->datalen; i++) {
238 ret->data[i] = java_elems[i];
243 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
244 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
245 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
248 uint32_t LDKC2Tuple_1u64u64Z_1new(void* ctx_TODO, int64_t a, int64_t b) {
249 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
254 static inline LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const LDKC2Tuple_u64u64Z *orig) {
255 LDKC2Tuple_u64u64Z ret = {
261 int64_t LDKC2Tuple_1u64u64Z_1get_1a(void* ctx_TODO, uint32_t ptr) {
262 LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)ptr;
265 int64_t LDKC2Tuple_1u64u64Z_1get_1b(void* ctx_TODO, uint32_t ptr) {
266 LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)ptr;
269 uint32_t LDKSpendableOutputDescriptor_1ref_1from_1ptr (void* ctx_TODO, uint32_t ptr) {
270 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
272 case LDKSpendableOutputDescriptor_StaticOutput: {
273 LDKOutPoint outpoint_var = obj->static_output.outpoint;
274 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
275 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
276 long outpoint_ref = (long)outpoint_var.inner & ~1;
277 long output_ref = (long)&obj->static_output.output;
278 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (long)output_ref;
280 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
281 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
282 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
283 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
284 long outpoint_ref = (long)outpoint_var.inner & ~1;
285 int8_tArray per_commitment_point_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
286 memcpy(per_commitment_point_arr.ptr, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form, 33);
287 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
288 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
289 int8_tArray revocation_pubkey_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
290 memcpy(revocation_pubkey_arr.ptr, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form, 33);
291 return 0 /* LDKSpendableOutputDescriptor - DynamicOutputP2WSH */; (void) outpoint_ref; (void) per_commitment_point_arr; (void) obj->dynamic_output_p2wsh.to_self_delay; (void) (long)output_ref; (void) key_derivation_params_ref; (void) revocation_pubkey_arr;
293 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
294 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
295 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
296 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
297 long outpoint_ref = (long)outpoint_var.inner & ~1;
298 long output_ref = (long)&obj->static_output_counterparty_payment.output;
299 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
300 return 0 /* LDKSpendableOutputDescriptor - StaticOutputCounterpartyPayment */; (void) outpoint_ref; (void) (long)output_ref; (void) key_derivation_params_ref;
305 uint32_t LDKCVec_1SpendableOutputDescriptorZ_1new(void* ctx_TODO, uint32_tArray elems) {
306 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
307 ret->datalen = elems.len;
308 if (ret->datalen == 0) {
311 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
312 uint32_t *java_elems = (uint32_t*)elems.ptr;
313 for (size_t i = 0; i < ret->datalen; i++) {
314 uint32_t arr_elem = java_elems[i];
315 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
316 FREE((void*)arr_elem);
317 ret->data[i] = arr_elem_conv;
322 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
323 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
324 for (size_t i = 0; i < ret.datalen; i++) {
325 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
329 uint32_t LDKErrorAction_1ref_1from_1ptr (void* ctx_TODO, uint32_t ptr) {
330 LDKErrorAction *obj = (LDKErrorAction*)ptr;
332 case LDKErrorAction_DisconnectPeer: {
333 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
334 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
335 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
336 long msg_ref = (long)msg_var.inner & ~1;
337 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
339 case LDKErrorAction_IgnoreError: {
340 return 0 /* LDKErrorAction - IgnoreError */;
342 case LDKErrorAction_SendErrorMessage: {
343 LDKErrorMessage msg_var = obj->send_error_message.msg;
344 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
345 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
346 long msg_ref = (long)msg_var.inner & ~1;
347 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
352 uint32_t LDKHTLCFailChannelUpdate_1ref_1from_1ptr (void* ctx_TODO, uint32_t ptr) {
353 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
355 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
356 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
357 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
358 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
359 long msg_ref = (long)msg_var.inner & ~1;
360 return 0 /* LDKHTLCFailChannelUpdate - ChannelUpdateMessage */; (void) msg_ref;
362 case LDKHTLCFailChannelUpdate_ChannelClosed: {
363 return 0 /* LDKHTLCFailChannelUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
365 case LDKHTLCFailChannelUpdate_NodeFailure: {
366 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
367 memcpy(node_id_arr.ptr, obj->node_failure.node_id.compressed_form, 33);
368 return 0 /* LDKHTLCFailChannelUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
373 uint32_t LDKMessageSendEvent_1ref_1from_1ptr (void* ctx_TODO, uint32_t ptr) {
374 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
376 case LDKMessageSendEvent_SendAcceptChannel: {
377 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
378 memcpy(node_id_arr.ptr, obj->send_accept_channel.node_id.compressed_form, 33);
379 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
380 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
381 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
382 long msg_ref = (long)msg_var.inner & ~1;
383 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
385 case LDKMessageSendEvent_SendOpenChannel: {
386 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
387 memcpy(node_id_arr.ptr, obj->send_open_channel.node_id.compressed_form, 33);
388 LDKOpenChannel msg_var = obj->send_open_channel.msg;
389 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
390 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
391 long msg_ref = (long)msg_var.inner & ~1;
392 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
394 case LDKMessageSendEvent_SendFundingCreated: {
395 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
396 memcpy(node_id_arr.ptr, obj->send_funding_created.node_id.compressed_form, 33);
397 LDKFundingCreated msg_var = obj->send_funding_created.msg;
398 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
399 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
400 long msg_ref = (long)msg_var.inner & ~1;
401 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
403 case LDKMessageSendEvent_SendFundingSigned: {
404 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
405 memcpy(node_id_arr.ptr, obj->send_funding_signed.node_id.compressed_form, 33);
406 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
407 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
408 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
409 long msg_ref = (long)msg_var.inner & ~1;
410 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
412 case LDKMessageSendEvent_SendFundingLocked: {
413 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
414 memcpy(node_id_arr.ptr, obj->send_funding_locked.node_id.compressed_form, 33);
415 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
416 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
417 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
418 long msg_ref = (long)msg_var.inner & ~1;
419 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
421 case LDKMessageSendEvent_SendAnnouncementSignatures: {
422 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
423 memcpy(node_id_arr.ptr, obj->send_announcement_signatures.node_id.compressed_form, 33);
424 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
425 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
426 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
427 long msg_ref = (long)msg_var.inner & ~1;
428 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
430 case LDKMessageSendEvent_UpdateHTLCs: {
431 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
432 memcpy(node_id_arr.ptr, obj->update_htl_cs.node_id.compressed_form, 33);
433 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
434 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
435 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
436 long updates_ref = (long)updates_var.inner & ~1;
437 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
439 case LDKMessageSendEvent_SendRevokeAndACK: {
440 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
441 memcpy(node_id_arr.ptr, obj->send_revoke_and_ack.node_id.compressed_form, 33);
442 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
443 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
444 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
445 long msg_ref = (long)msg_var.inner & ~1;
446 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
448 case LDKMessageSendEvent_SendClosingSigned: {
449 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
450 memcpy(node_id_arr.ptr, obj->send_closing_signed.node_id.compressed_form, 33);
451 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
452 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
453 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
454 long msg_ref = (long)msg_var.inner & ~1;
455 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
457 case LDKMessageSendEvent_SendShutdown: {
458 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
459 memcpy(node_id_arr.ptr, obj->send_shutdown.node_id.compressed_form, 33);
460 LDKShutdown msg_var = obj->send_shutdown.msg;
461 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
462 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
463 long msg_ref = (long)msg_var.inner & ~1;
464 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
466 case LDKMessageSendEvent_SendChannelReestablish: {
467 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
468 memcpy(node_id_arr.ptr, obj->send_channel_reestablish.node_id.compressed_form, 33);
469 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
470 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
471 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
472 long msg_ref = (long)msg_var.inner & ~1;
473 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
475 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
476 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
477 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
478 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
479 long msg_ref = (long)msg_var.inner & ~1;
480 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
481 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
482 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
483 long update_msg_ref = (long)update_msg_var.inner & ~1;
484 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
486 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
487 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
488 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
489 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
490 long msg_ref = (long)msg_var.inner & ~1;
491 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
493 case LDKMessageSendEvent_BroadcastChannelUpdate: {
494 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
495 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
496 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
497 long msg_ref = (long)msg_var.inner & ~1;
498 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
500 case LDKMessageSendEvent_HandleError: {
501 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
502 memcpy(node_id_arr.ptr, obj->handle_error.node_id.compressed_form, 33);
503 long action_ref = (long)&obj->handle_error.action;
504 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
506 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
507 long update_ref = (long)&obj->payment_failure_network_update.update;
508 return 0 /* LDKMessageSendEvent - PaymentFailureNetworkUpdate */; (void) update_ref;
510 case LDKMessageSendEvent_SendChannelRangeQuery: {
511 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
512 memcpy(node_id_arr.ptr, obj->send_channel_range_query.node_id.compressed_form, 33);
513 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
514 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
515 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
516 long msg_ref = (long)msg_var.inner & ~1;
517 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
519 case LDKMessageSendEvent_SendShortIdsQuery: {
520 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
521 memcpy(node_id_arr.ptr, obj->send_short_ids_query.node_id.compressed_form, 33);
522 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
523 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
524 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
525 long msg_ref = (long)msg_var.inner & ~1;
526 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
531 uint32_t LDKCVec_1MessageSendEventZ_1new(void* ctx_TODO, uint32_tArray elems) {
532 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
533 ret->datalen = elems.len;
534 if (ret->datalen == 0) {
537 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
538 uint32_t *java_elems = (uint32_t*)elems.ptr;
539 for (size_t i = 0; i < ret->datalen; i++) {
540 uint32_t arr_elem = java_elems[i];
541 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
542 FREE((void*)arr_elem);
543 ret->data[i] = arr_elem_conv;
548 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
549 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
550 for (size_t i = 0; i < ret.datalen; i++) {
551 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
555 uint32_t LDKEvent_1ref_1from_1ptr (void* ctx_TODO, uint32_t ptr) {
556 LDKEvent *obj = (LDKEvent*)ptr;
558 case LDKEvent_FundingGenerationReady: {
559 int8_tArray temporary_channel_id_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
560 memcpy(temporary_channel_id_arr.ptr, obj->funding_generation_ready.temporary_channel_id.data, 32);
561 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
562 int8_tArray output_script_arr = { .len = output_script_var.datalen, .ptr = MALLOC(output_script_var.datalen, "Native int8_tArray Bytes") };
563 memcpy(output_script_arr.ptr, output_script_var.data, output_script_var.datalen);
564 return 0 /* LDKEvent - FundingGenerationReady */; (void) temporary_channel_id_arr; (void) obj->funding_generation_ready.channel_value_satoshis; (void) output_script_arr; (void) obj->funding_generation_ready.user_channel_id;
566 case LDKEvent_FundingBroadcastSafe: {
567 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
568 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
569 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
570 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
571 return 0 /* LDKEvent - FundingBroadcastSafe */; (void) funding_txo_ref; (void) obj->funding_broadcast_safe.user_channel_id;
573 case LDKEvent_PaymentReceived: {
574 int8_tArray payment_hash_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
575 memcpy(payment_hash_arr.ptr, obj->payment_received.payment_hash.data, 32);
576 int8_tArray payment_secret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
577 memcpy(payment_secret_arr.ptr, obj->payment_received.payment_secret.data, 32);
578 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) payment_secret_arr; (void) obj->payment_received.amt;
580 case LDKEvent_PaymentSent: {
581 int8_tArray payment_preimage_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
582 memcpy(payment_preimage_arr.ptr, obj->payment_sent.payment_preimage.data, 32);
583 return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr;
585 case LDKEvent_PaymentFailed: {
586 int8_tArray payment_hash_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
587 memcpy(payment_hash_arr.ptr, obj->payment_failed.payment_hash.data, 32);
588 return 0 /* LDKEvent - PaymentFailed */; (void) payment_hash_arr; (void) obj->payment_failed.rejected_by_dest;
590 case LDKEvent_PendingHTLCsForwardable: {
591 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
593 case LDKEvent_SpendableOutputs: {
594 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
595 uint32_tArray outputs_arr = { .len = outputs_var.datalen, .ptr = MALLOC(outputs_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
596 uint32_t *outputs_arr_ptr = (uint32_t*)outputs_arr.ptr;
597 for (size_t b = 0; b < outputs_var.datalen; b++) {
598 long arr_conv_27_ref = (long)&outputs_var.data[b];
599 outputs_arr_ptr[b] = arr_conv_27_ref;
601 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
606 uint32_t LDKCVec_1EventZ_1new(void* ctx_TODO, uint32_tArray elems) {
607 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
608 ret->datalen = elems.len;
609 if (ret->datalen == 0) {
612 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
613 uint32_t *java_elems = (uint32_t*)elems.ptr;
614 for (size_t i = 0; i < ret->datalen; i++) {
615 uint32_t arr_elem = java_elems[i];
616 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
617 FREE((void*)arr_elem);
618 ret->data[i] = arr_elem_conv;
623 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
624 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
625 for (size_t i = 0; i < ret.datalen; i++) {
626 ret.data[i] = Event_clone(&orig->data[i]);
630 uint32_t LDKC2Tuple_1usizeTransactionZ_1new(void* ctx_TODO, intptr_t a, int8_tArray b) {
631 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
633 LDKTransaction b_ref;
634 b_ref.datalen = b.len;
635 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
636 memcpy(b_ref.data, b.ptr, b_ref.datalen);
637 b_ref.data_is_owned = false;
641 intptr_t LDKC2Tuple_1usizeTransactionZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
642 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)ptr;
645 int8_tArray LDKC2Tuple_1usizeTransactionZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
646 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)ptr;
647 LDKTransaction b_var = tuple->b;
648 int8_tArray b_arr = { .len = b_var.datalen, .ptr = MALLOC(b_var.datalen, "Native int8_tArray Bytes") };
649 memcpy(b_arr.ptr, b_var.data, b_var.datalen);
652 uint32_t LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(void* ctx_TODO, uint32_tArray elems) {
653 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
654 ret->datalen = elems.len;
655 if (ret->datalen == 0) {
658 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
659 uint32_t *java_elems = (uint32_t*)elems.ptr;
660 for (size_t i = 0; i < ret->datalen; i++) {
661 uint32_t arr_elem = java_elems[i];
662 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_elem;
663 FREE((void*)arr_elem);
664 ret->data[i] = arr_elem_conv;
669 jboolean LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
670 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
672 void LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
673 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
674 CHECK(val->result_ok);
675 return *val->contents.result;
677 uint32_t LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err (void* ctx_TODO, uint32_t arg) {
678 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
679 CHECK(!val->result_ok);
680 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
683 static inline LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const LDKCResult_NoneChannelMonitorUpdateErrZ *orig) {
684 LDKCResult_NoneChannelMonitorUpdateErrZ res = { .result_ok = orig->result_ok };
685 if (orig->result_ok) {
686 res.contents.result = NULL;
688 LDKChannelMonitorUpdateErr* contents = MALLOC(sizeof(LDKChannelMonitorUpdateErr), "LDKChannelMonitorUpdateErr result Err clone");
689 *contents = ChannelMonitorUpdateErr_clone(orig->contents.err);
690 res.contents.err = contents;
694 uint32_t LDKCVec_1MonitorEventZ_1new(void* ctx_TODO, uint32_tArray elems) {
695 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
696 ret->datalen = elems.len;
697 if (ret->datalen == 0) {
700 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
701 uint32_t *java_elems = (uint32_t*)elems.ptr;
702 for (size_t i = 0; i < ret->datalen; i++) {
703 uint32_t arr_elem = java_elems[i];
704 LDKMonitorEvent arr_elem_conv;
705 arr_elem_conv.inner = (void*)(arr_elem & (~1));
706 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
707 if (arr_elem_conv.inner != NULL)
708 arr_elem_conv = MonitorEvent_clone(&arr_elem_conv);
709 ret->data[i] = arr_elem_conv;
714 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
715 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
716 for (size_t i = 0; i < ret.datalen; i++) {
717 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
721 jboolean LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
722 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
724 uint32_t LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
725 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg;
726 CHECK(val->result_ok);
727 LDKChannelMonitorUpdate res_var = (*val->contents.result);
728 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
729 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
730 long res_ref = (long)res_var.inner & ~1;
733 uint32_t LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
734 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg;
735 CHECK(!val->result_ok);
736 LDKDecodeError err_var = (*val->contents.err);
737 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
738 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
739 long err_ref = (long)err_var.inner & ~1;
742 jboolean LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
743 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
745 void LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
746 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
747 CHECK(val->result_ok);
748 return *val->contents.result;
750 uint32_t LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
751 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
752 CHECK(!val->result_ok);
753 LDKMonitorUpdateError err_var = (*val->contents.err);
754 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
755 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
756 long err_ref = (long)err_var.inner & ~1;
759 uint32_t LDKC2Tuple_1OutPointScriptZ_1new(void* ctx_TODO, uint32_t a, int8_tArray b) {
760 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
762 a_conv.inner = (void*)(a & (~1));
763 a_conv.is_owned = (a & 1) || (a == 0);
764 if (a_conv.inner != NULL)
765 a_conv = OutPoint_clone(&a_conv);
768 b_ref.datalen = b.len;
769 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
770 memcpy(b_ref.data, b.ptr, b_ref.datalen);
774 static inline LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const LDKC2Tuple_OutPointScriptZ *orig) {
775 LDKC2Tuple_OutPointScriptZ ret = {
776 .a = OutPoint_clone(&orig->a),
777 .b = CVec_u8Z_clone(&orig->b),
781 uint32_t LDKC2Tuple_1OutPointScriptZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
782 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)ptr;
783 LDKOutPoint a_var = tuple->a;
784 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
785 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
786 long a_ref = (long)a_var.inner & ~1;
789 int8_tArray LDKC2Tuple_1OutPointScriptZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
790 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)ptr;
791 LDKCVec_u8Z b_var = tuple->b;
792 int8_tArray b_arr = { .len = b_var.datalen, .ptr = MALLOC(b_var.datalen, "Native int8_tArray Bytes") };
793 memcpy(b_arr.ptr, b_var.data, b_var.datalen);
796 uint32_t LDKC2Tuple_1u32TxOutZ_1new(void* ctx_TODO, int32_t a, uint32_t b) {
797 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
799 LDKTxOut b_conv = *(LDKTxOut*)b;
804 int32_t LDKC2Tuple_1u32TxOutZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
805 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)ptr;
808 uint32_t LDKC2Tuple_1u32TxOutZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
809 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)ptr;
810 long b_ref = (long)&tuple->b;
813 uint32_t LDKCVec_1C2Tuple_1u32TxOutZZ_1new(void* ctx_TODO, uint32_tArray elems) {
814 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
815 ret->datalen = elems.len;
816 if (ret->datalen == 0) {
819 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
820 uint32_t *java_elems = (uint32_t*)elems.ptr;
821 for (size_t i = 0; i < ret->datalen; i++) {
822 uint32_t arr_elem = java_elems[i];
823 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)arr_elem;
824 FREE((void*)arr_elem);
825 ret->data[i] = arr_elem_conv;
830 uint32_t LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(void* ctx_TODO, int8_tArray a, uint32_tArray b) {
831 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
832 LDKThirtyTwoBytes a_ref;
834 memcpy(a_ref.data, a.ptr, 32);
836 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
837 b_constr.datalen = b.len;
838 if (b_constr.datalen > 0)
839 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
841 b_constr.data = NULL;
842 uint32_t* b_vals = (uint32_t*) b.ptr;
843 for (size_t z = 0; z < b_constr.datalen; z++) {
844 uint32_t arr_conv_25 = b_vals[z];
845 LDKC2Tuple_u32TxOutZ arr_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)arr_conv_25;
846 FREE((void*)arr_conv_25);
847 b_constr.data[z] = arr_conv_25_conv;
852 int8_tArray LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
853 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)ptr;
854 int8_tArray a_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
855 memcpy(a_arr.ptr, tuple->a.data, 32);
858 uint32_tArray LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
859 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)ptr;
860 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
861 uint32_tArray b_arr = { .len = b_var.datalen, .ptr = MALLOC(b_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
862 uint32_t *b_arr_ptr = (uint32_t*)b_arr.ptr;
863 for (size_t z = 0; z < b_var.datalen; z++) {
864 long arr_conv_25_ref = (long)&b_var.data[z];
865 b_arr_ptr[z] = arr_conv_25_ref;
869 uint32_t LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(void* ctx_TODO, uint32_tArray elems) {
870 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
871 ret->datalen = elems.len;
872 if (ret->datalen == 0) {
875 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
876 uint32_t *java_elems = (uint32_t*)elems.ptr;
877 for (size_t i = 0; i < ret->datalen; i++) {
878 uint32_t arr_elem = java_elems[i];
879 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)arr_elem;
880 FREE((void*)arr_elem);
881 ret->data[i] = arr_elem_conv;
886 uint32_t LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(void* ctx_TODO, int8_tArray a, ptrArray b) {
887 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
890 memcpy(a_ref.compact_form, a.ptr, 64);
892 LDKCVec_SignatureZ b_constr;
893 b_constr.datalen = b.len;
894 if (b_constr.datalen > 0)
895 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
897 b_constr.data = NULL;
898 int8_tArray* b_vals = (int8_tArray*) b.ptr;
899 for (size_t m = 0; m < b_constr.datalen; m++) {
900 int8_tArray arr_conv_12 = b_vals[m];
901 LDKSignature arr_conv_12_ref;
902 CHECK(arr_conv_12.len == 64);
903 memcpy(arr_conv_12_ref.compact_form, arr_conv_12.ptr, 64);
904 b_constr.data[m] = arr_conv_12_ref;
909 int8_tArray LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
910 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)ptr;
911 int8_tArray a_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
912 memcpy(a_arr.ptr, tuple->a.compact_form, 64);
915 ptrArray LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
916 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)ptr;
917 LDKCVec_SignatureZ b_var = tuple->b;
918 ptrArray b_arr = { .len = b_var.datalen, .ptr = MALLOC(b_var.datalen * sizeof(int32_t), "Native Object Bytes") };
919 int8_tArray *b_arr_ptr = (int8_tArray*)b_arr.ptr;
920 for (size_t m = 0; m < b_var.datalen; m++) {
921 int8_tArray arr_conv_12_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
922 memcpy(arr_conv_12_arr.ptr, b_var.data[m].compact_form, 64);
923 b_arr_ptr[m] = arr_conv_12_arr;
927 jboolean LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
928 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
930 uint32_t LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
931 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
932 CHECK(val->result_ok);
933 long res_ref = (long)&(*val->contents.result);
936 void LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err (void* ctx_TODO, uint32_t arg) {
937 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
938 CHECK(!val->result_ok);
939 return *val->contents.err;
941 jboolean LDKCResult_1SignatureNoneZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
942 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
944 int8_tArray LDKCResult_1SignatureNoneZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
945 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
946 CHECK(val->result_ok);
947 int8_tArray res_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
948 memcpy(res_arr.ptr, (*val->contents.result).compact_form, 64);
951 void LDKCResult_1SignatureNoneZ_1get_1err (void* ctx_TODO, uint32_t arg) {
952 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
953 CHECK(!val->result_ok);
954 return *val->contents.err;
956 jboolean LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
957 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
959 ptrArray LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
960 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
961 CHECK(val->result_ok);
962 LDKCVec_SignatureZ res_var = (*val->contents.result);
963 ptrArray res_arr = { .len = res_var.datalen, .ptr = MALLOC(res_var.datalen * sizeof(int32_t), "Native Object Bytes") };
964 int8_tArray *res_arr_ptr = (int8_tArray*)res_arr.ptr;
965 for (size_t m = 0; m < res_var.datalen; m++) {
966 int8_tArray arr_conv_12_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
967 memcpy(arr_conv_12_arr.ptr, res_var.data[m].compact_form, 64);
968 res_arr_ptr[m] = arr_conv_12_arr;
972 void LDKCResult_1CVec_1SignatureZNoneZ_1get_1err (void* ctx_TODO, uint32_t arg) {
973 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
974 CHECK(!val->result_ok);
975 return *val->contents.err;
977 typedef struct LDKChannelKeys_JCalls {
978 atomic_size_t refcnt;
979 // TODO: Object pointer o;
980 // TODO: Some kind of method pointer get_per_commitment_point_meth;
981 // TODO: Some kind of method pointer release_commitment_secret_meth;
982 // TODO: Some kind of method pointer key_derivation_params_meth;
983 // TODO: Some kind of method pointer sign_counterparty_commitment_meth;
984 // TODO: Some kind of method pointer sign_holder_commitment_meth;
985 // TODO: Some kind of method pointer sign_holder_commitment_htlc_transactions_meth;
986 // TODO: Some kind of method pointer sign_justice_transaction_meth;
987 // TODO: Some kind of method pointer sign_counterparty_htlc_transaction_meth;
988 // TODO: Some kind of method pointer sign_closing_transaction_meth;
989 // TODO: Some kind of method pointer sign_channel_announcement_meth;
990 // TODO: Some kind of method pointer ready_channel_meth;
991 // TODO: Some kind of method pointer write_meth;
992 } LDKChannelKeys_JCalls;
993 static void LDKChannelKeys_JCalls_free(void* this_arg) {
994 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
995 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
996 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
1000 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1001 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1002 //TODO: jobject obj = get object we can call against on j_calls->o
1003 int8_tArray arg; // TODO: Call get_per_commitment_point on j_calls with instance obj, returning an object, idx);
1004 LDKPublicKey arg_ref;
1005 CHECK(arg.len == 33);
1006 memcpy(arg_ref.compressed_form, arg.ptr, 33);
1009 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1010 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1011 //TODO: jobject obj = get object we can call against on j_calls->o
1012 int8_tArray arg; // TODO: Call release_commitment_secret on j_calls with instance obj, returning an object, idx);
1013 LDKThirtyTwoBytes arg_ref;
1014 CHECK(arg.len == 32);
1015 memcpy(arg_ref.data, arg.ptr, 32);
1018 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1019 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1020 //TODO: jobject obj = get object we can call against on j_calls->o
1021 LDKC2Tuple_u64u64Z* ret; // TODO: Call key_derivation_params on j_calls with instance obj, returning a pointer);
1022 LDKC2Tuple_u64u64Z ret_conv = *(LDKC2Tuple_u64u64Z*)ret;
1026 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1027 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1028 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1029 if (commitment_tx->inner != NULL)
1030 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1031 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1032 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1033 long commitment_tx_ref = (long)commitment_tx_var.inner;
1034 if (commitment_tx_var.is_owned) {
1035 commitment_tx_ref |= 1;
1037 //TODO: jobject obj = get object we can call against on j_calls->o
1038 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret; // TODO: Call sign_counterparty_commitment on j_calls with instance obj, returning a pointer, commitment_tx_ref);
1039 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret;
1043 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1044 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1045 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1046 if (commitment_tx->inner != NULL)
1047 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1048 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1049 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1050 long commitment_tx_ref = (long)commitment_tx_var.inner;
1051 if (commitment_tx_var.is_owned) {
1052 commitment_tx_ref |= 1;
1054 //TODO: jobject obj = get object we can call against on j_calls->o
1055 LDKCResult_SignatureNoneZ* ret; // TODO: Call sign_holder_commitment on j_calls with instance obj, returning a pointer, commitment_tx_ref);
1056 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1060 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1061 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1062 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1063 if (commitment_tx->inner != NULL)
1064 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1065 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1066 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1067 long commitment_tx_ref = (long)commitment_tx_var.inner;
1068 if (commitment_tx_var.is_owned) {
1069 commitment_tx_ref |= 1;
1071 //TODO: jobject obj = get object we can call against on j_calls->o
1072 LDKCResult_CVec_SignatureZNoneZ* ret; // TODO: Call sign_holder_commitment_htlc_transactions on j_calls with instance obj, returning a pointer, commitment_tx_ref);
1073 LDKCResult_CVec_SignatureZNoneZ ret_conv = *(LDKCResult_CVec_SignatureZNoneZ*)ret;
1077 LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
1078 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1079 LDKTransaction justice_tx_var = justice_tx;
1080 int8_tArray justice_tx_arr = { .len = justice_tx_var.datalen, .ptr = MALLOC(justice_tx_var.datalen, "Native int8_tArray Bytes") };
1081 memcpy(justice_tx_arr.ptr, justice_tx_var.data, justice_tx_var.datalen);
1082 Transaction_free(justice_tx_var);
1083 int8_tArray per_commitment_key_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
1084 memcpy(per_commitment_key_arr.ptr, *per_commitment_key, 32);
1085 LDKHTLCOutputInCommitment htlc_var = *htlc;
1086 if (htlc->inner != NULL)
1087 htlc_var = HTLCOutputInCommitment_clone(htlc);
1088 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1089 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1090 long htlc_ref = (long)htlc_var.inner;
1091 if (htlc_var.is_owned) {
1094 //TODO: jobject obj = get object we can call against on j_calls->o
1095 LDKCResult_SignatureNoneZ* ret; // TODO: Call sign_justice_transaction on j_calls with instance obj, returning a pointer, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
1096 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1100 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
1101 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1102 LDKTransaction htlc_tx_var = htlc_tx;
1103 int8_tArray htlc_tx_arr = { .len = htlc_tx_var.datalen, .ptr = MALLOC(htlc_tx_var.datalen, "Native int8_tArray Bytes") };
1104 memcpy(htlc_tx_arr.ptr, htlc_tx_var.data, htlc_tx_var.datalen);
1105 Transaction_free(htlc_tx_var);
1106 int8_tArray per_commitment_point_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
1107 memcpy(per_commitment_point_arr.ptr, per_commitment_point.compressed_form, 33);
1108 LDKHTLCOutputInCommitment htlc_var = *htlc;
1109 if (htlc->inner != NULL)
1110 htlc_var = HTLCOutputInCommitment_clone(htlc);
1111 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1112 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1113 long htlc_ref = (long)htlc_var.inner;
1114 if (htlc_var.is_owned) {
1117 //TODO: jobject obj = get object we can call against on j_calls->o
1118 LDKCResult_SignatureNoneZ* ret; // TODO: Call sign_counterparty_htlc_transaction on j_calls with instance obj, returning a pointer, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
1119 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1123 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1124 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1125 LDKTransaction closing_tx_var = closing_tx;
1126 int8_tArray closing_tx_arr = { .len = closing_tx_var.datalen, .ptr = MALLOC(closing_tx_var.datalen, "Native int8_tArray Bytes") };
1127 memcpy(closing_tx_arr.ptr, closing_tx_var.data, closing_tx_var.datalen);
1128 Transaction_free(closing_tx_var);
1129 //TODO: jobject obj = get object we can call against on j_calls->o
1130 LDKCResult_SignatureNoneZ* ret; // TODO: Call sign_closing_transaction on j_calls with instance obj, returning a pointer, closing_tx_arr);
1131 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1135 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1136 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1137 LDKUnsignedChannelAnnouncement msg_var = *msg;
1138 if (msg->inner != NULL)
1139 msg_var = UnsignedChannelAnnouncement_clone(msg);
1140 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1141 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1142 long msg_ref = (long)msg_var.inner;
1143 if (msg_var.is_owned) {
1146 //TODO: jobject obj = get object we can call against on j_calls->o
1147 LDKCResult_SignatureNoneZ* ret; // TODO: Call sign_channel_announcement on j_calls with instance obj, returning a pointer, msg_ref);
1148 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1152 void ready_channel_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1153 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1154 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1155 if (channel_parameters->inner != NULL)
1156 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1157 CHECK((((long)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1158 CHECK((((long)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1159 long channel_parameters_ref = (long)channel_parameters_var.inner;
1160 if (channel_parameters_var.is_owned) {
1161 channel_parameters_ref |= 1;
1163 //TODO: jobject obj = get object we can call against on j_calls->o
1164 return; //TODO: Call ready_channel on j_calls with instance obj, channel_parameters_ref);
1166 LDKCVec_u8Z write_jcall(const void* this_arg) {
1167 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1168 //TODO: jobject obj = get object we can call against on j_calls->o
1169 int8_tArray arg; // TODO: Call write on j_calls with instance obj, returning an object);
1170 LDKCVec_u8Z arg_ref;
1171 arg_ref.datalen = arg.len;
1172 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
1173 memcpy(arg_ref.data, arg.ptr, arg_ref.datalen);
1176 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1177 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1178 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1179 return (void*) this_arg;
1181 static inline LDKChannelKeys LDKChannelKeys_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1182 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1183 atomic_init(&calls->refcnt, 1);
1184 //TODO: Assign calls->o from o
1186 LDKChannelPublicKeys pubkeys_conv;
1187 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1188 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1189 if (pubkeys_conv.inner != NULL)
1190 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1192 LDKChannelKeys ret = {
1193 .this_arg = (void*) calls,
1194 .get_per_commitment_point = get_per_commitment_point_jcall,
1195 .release_commitment_secret = release_commitment_secret_jcall,
1196 .key_derivation_params = key_derivation_params_jcall,
1197 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1198 .sign_holder_commitment = sign_holder_commitment_jcall,
1199 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
1200 .sign_justice_transaction = sign_justice_transaction_jcall,
1201 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1202 .sign_closing_transaction = sign_closing_transaction_jcall,
1203 .sign_channel_announcement = sign_channel_announcement_jcall,
1204 .ready_channel = ready_channel_jcall,
1205 .clone = LDKChannelKeys_JCalls_clone,
1206 .write = write_jcall,
1207 .free = LDKChannelKeys_JCalls_free,
1208 .pubkeys = pubkeys_conv,
1209 .set_pubkeys = NULL,
1213 long LDKChannelKeys_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1214 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1215 *res_ptr = LDKChannelKeys_init(NULL, o, pubkeys);
1216 return (long)res_ptr;
1218 int8_tArray ChannelKeys_1get_1per_1commitment_1point(void* ctx_TODO, uint32_t this_arg, int64_t idx) {
1219 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1220 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
1221 memcpy(arg_arr.ptr, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1225 int8_tArray ChannelKeys_1release_1commitment_1secret(void* ctx_TODO, uint32_t this_arg, int64_t idx) {
1226 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1227 int8_tArray arg_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
1228 memcpy(arg_arr.ptr, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1232 uint32_t ChannelKeys_1key_1derivation_1params(void* ctx_TODO, uint32_t this_arg) {
1233 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1234 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1235 *ret_ref = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
1236 return (long)ret_ref;
1239 uint32_t ChannelKeys_1sign_1counterparty_1commitment(void* ctx_TODO, uint32_t this_arg, uint32_t commitment_tx) {
1240 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1241 LDKCommitmentTransaction commitment_tx_conv;
1242 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1243 commitment_tx_conv.is_owned = false;
1244 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1245 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1246 return (long)ret_conv;
1249 uint32_t ChannelKeys_1sign_1holder_1commitment(void* ctx_TODO, uint32_t this_arg, uint32_t commitment_tx) {
1250 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1251 LDKHolderCommitmentTransaction commitment_tx_conv;
1252 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1253 commitment_tx_conv.is_owned = false;
1254 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1255 *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1256 return (long)ret_conv;
1259 uint32_t ChannelKeys_1sign_1holder_1commitment_1htlc_1transactions(void* ctx_TODO, uint32_t this_arg, uint32_t commitment_tx) {
1260 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1261 LDKHolderCommitmentTransaction commitment_tx_conv;
1262 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1263 commitment_tx_conv.is_owned = false;
1264 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
1265 *ret_conv = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &commitment_tx_conv);
1266 return (long)ret_conv;
1269 uint32_t ChannelKeys_1sign_1justice_1transaction(void* ctx_TODO, uint32_t this_arg, int8_tArray justice_tx, intptr_t input, int64_t amount, int8_tArray per_commitment_key, uint32_t htlc) {
1270 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1271 LDKTransaction justice_tx_ref;
1272 justice_tx_ref.datalen = justice_tx.len;
1273 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1274 memcpy(justice_tx_ref.data, justice_tx.ptr, justice_tx_ref.datalen);
1275 justice_tx_ref.data_is_owned = true;
1276 unsigned char per_commitment_key_arr[32];
1277 CHECK(per_commitment_key.len == 32);
1278 memcpy(per_commitment_key_arr, per_commitment_key.ptr, 32);
1279 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1280 LDKHTLCOutputInCommitment htlc_conv;
1281 htlc_conv.inner = (void*)(htlc & (~1));
1282 htlc_conv.is_owned = false;
1283 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1284 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
1285 return (long)ret_conv;
1288 uint32_t ChannelKeys_1sign_1counterparty_1htlc_1transaction(void* ctx_TODO, uint32_t this_arg, int8_tArray htlc_tx, intptr_t input, int64_t amount, int8_tArray per_commitment_point, uint32_t htlc) {
1289 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1290 LDKTransaction htlc_tx_ref;
1291 htlc_tx_ref.datalen = htlc_tx.len;
1292 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1293 memcpy(htlc_tx_ref.data, htlc_tx.ptr, htlc_tx_ref.datalen);
1294 htlc_tx_ref.data_is_owned = true;
1295 LDKPublicKey per_commitment_point_ref;
1296 CHECK(per_commitment_point.len == 33);
1297 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.ptr, 33);
1298 LDKHTLCOutputInCommitment htlc_conv;
1299 htlc_conv.inner = (void*)(htlc & (~1));
1300 htlc_conv.is_owned = false;
1301 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1302 *ret_conv = (this_arg_conv->sign_counterparty_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, amount, per_commitment_point_ref, &htlc_conv);
1303 return (long)ret_conv;
1306 uint32_t ChannelKeys_1sign_1closing_1transaction(void* ctx_TODO, uint32_t this_arg, int8_tArray closing_tx) {
1307 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1308 LDKTransaction closing_tx_ref;
1309 closing_tx_ref.datalen = closing_tx.len;
1310 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
1311 memcpy(closing_tx_ref.data, closing_tx.ptr, closing_tx_ref.datalen);
1312 closing_tx_ref.data_is_owned = true;
1313 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1314 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
1315 return (long)ret_conv;
1318 uint32_t ChannelKeys_1sign_1channel_1announcement(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
1319 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1320 LDKUnsignedChannelAnnouncement msg_conv;
1321 msg_conv.inner = (void*)(msg & (~1));
1322 msg_conv.is_owned = false;
1323 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1324 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1325 return (long)ret_conv;
1328 void ChannelKeys_1ready_1channel(void* ctx_TODO, uint32_t this_arg, uint32_t channel_parameters) {
1329 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1330 LDKChannelTransactionParameters channel_parameters_conv;
1331 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
1332 channel_parameters_conv.is_owned = false;
1333 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
1336 int8_tArray ChannelKeys_1write(void* ctx_TODO, uint32_t this_arg) {
1337 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1338 LDKCVec_u8Z arg_var = (this_arg_conv->write)(this_arg_conv->this_arg);
1339 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
1340 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
1341 CVec_u8Z_free(arg_var);
1345 LDKChannelPublicKeys LDKChannelKeys_set_get_pubkeys(LDKChannelKeys* this_arg) {
1346 if (this_arg->set_pubkeys != NULL)
1347 this_arg->set_pubkeys(this_arg);
1348 return this_arg->pubkeys;
1350 uint32_t ChannelKeys_1get_1pubkeys(void* ctx_TODO, uint32_t this_arg) {
1351 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1352 LDKChannelPublicKeys ret_var = LDKChannelKeys_set_get_pubkeys(this_arg_conv);
1353 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1354 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1355 long ret_ref = (long)ret_var.inner;
1356 if (ret_var.is_owned) {
1362 uint32_t LDKC2Tuple_1BlockHashChannelMonitorZ_1new(void* ctx_TODO, int8_tArray a, uint32_t b) {
1363 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
1364 LDKThirtyTwoBytes a_ref;
1366 memcpy(a_ref.data, a.ptr, 32);
1368 LDKChannelMonitor b_conv;
1369 b_conv.inner = (void*)(b & (~1));
1370 b_conv.is_owned = (b & 1) || (b == 0);
1371 // Warning: we may need a move here but can't clone!
1375 int8_tArray LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
1376 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)ptr;
1377 int8_tArray a_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
1378 memcpy(a_arr.ptr, tuple->a.data, 32);
1381 uint32_t LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
1382 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)ptr;
1383 LDKChannelMonitor b_var = tuple->b;
1384 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1385 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1386 long b_ref = (long)b_var.inner & ~1;
1389 jboolean LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1390 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
1392 uint32_t LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1393 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg;
1394 CHECK(val->result_ok);
1395 long res_ref = (long)&(*val->contents.result);
1398 uint32_t LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1399 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg;
1400 CHECK(!val->result_ok);
1401 LDKDecodeError err_var = (*val->contents.err);
1402 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1403 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1404 long err_ref = (long)err_var.inner & ~1;
1407 jboolean LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1408 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1410 uint32_t LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1411 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg;
1412 CHECK(val->result_ok);
1413 long res_ref = (long)&(*val->contents.result);
1416 uint32_t LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1417 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg;
1418 CHECK(!val->result_ok);
1419 LDKDecodeError err_var = (*val->contents.err);
1420 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1421 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1422 long err_ref = (long)err_var.inner & ~1;
1425 jboolean LDKCResult_1ChanKeySignerDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1426 return ((LDKCResult_ChanKeySignerDecodeErrorZ*)arg)->result_ok;
1428 uint32_t LDKCResult_1ChanKeySignerDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1429 LDKCResult_ChanKeySignerDecodeErrorZ *val = (LDKCResult_ChanKeySignerDecodeErrorZ*)arg;
1430 CHECK(val->result_ok);
1431 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1432 *ret = (*val->contents.result);
1435 uint32_t LDKCResult_1ChanKeySignerDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1436 LDKCResult_ChanKeySignerDecodeErrorZ *val = (LDKCResult_ChanKeySignerDecodeErrorZ*)arg;
1437 CHECK(!val->result_ok);
1438 LDKDecodeError err_var = (*val->contents.err);
1439 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1440 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1441 long err_ref = (long)err_var.inner & ~1;
1444 jboolean LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1445 return ((LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg)->result_ok;
1447 uint32_t LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1448 LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg;
1449 CHECK(val->result_ok);
1450 LDKInMemoryChannelKeys res_var = (*val->contents.result);
1451 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1452 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1453 long res_ref = (long)res_var.inner & ~1;
1456 uint32_t LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1457 LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg;
1458 CHECK(!val->result_ok);
1459 LDKDecodeError err_var = (*val->contents.err);
1460 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1461 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1462 long err_ref = (long)err_var.inner & ~1;
1465 jboolean LDKCResult_1TxOutAccessErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1466 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1468 uint32_t LDKCResult_1TxOutAccessErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1469 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1470 CHECK(val->result_ok);
1471 long res_ref = (long)&(*val->contents.result);
1472 return (long)res_ref;
1474 uint32_t LDKCResult_1TxOutAccessErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1475 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1476 CHECK(!val->result_ok);
1477 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
1480 uint32_t LDKAPIError_1ref_1from_1ptr (void* ctx_TODO, uint32_t ptr) {
1481 LDKAPIError *obj = (LDKAPIError*)ptr;
1483 case LDKAPIError_APIMisuseError: {
1484 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
1485 int8_tArray err_arr = { .len = err_var.datalen, .ptr = MALLOC(err_var.datalen, "Native int8_tArray Bytes") };
1486 memcpy(err_arr.ptr, err_var.data, err_var.datalen);
1487 return 0 /* LDKAPIError - APIMisuseError */; (void) err_arr;
1489 case LDKAPIError_FeeRateTooHigh: {
1490 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
1491 int8_tArray err_arr = { .len = err_var.datalen, .ptr = MALLOC(err_var.datalen, "Native int8_tArray Bytes") };
1492 memcpy(err_arr.ptr, err_var.data, err_var.datalen);
1493 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_arr; (void) obj->fee_rate_too_high.feerate;
1495 case LDKAPIError_RouteError: {
1496 LDKStr err_str = obj->route_error.err;
1497 char* err_buf = MALLOC(err_str.len + 1, "str conv buf");
1498 memcpy(err_buf, err_str.chars, err_str.len);
1499 err_buf[err_str.len] = 0;
1500 jstring err_conv = conv_owned_string(err_str.chars);
1502 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
1504 case LDKAPIError_ChannelUnavailable: {
1505 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
1506 int8_tArray err_arr = { .len = err_var.datalen, .ptr = MALLOC(err_var.datalen, "Native int8_tArray Bytes") };
1507 memcpy(err_arr.ptr, err_var.data, err_var.datalen);
1508 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_arr;
1510 case LDKAPIError_MonitorUpdateFailed: {
1511 return 0 /* LDKAPIError - MonitorUpdateFailed */;
1516 jboolean LDKCResult_1NoneAPIErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1517 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
1519 void LDKCResult_1NoneAPIErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1520 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
1521 CHECK(val->result_ok);
1522 return *val->contents.result;
1524 uint32_t LDKCResult_1NoneAPIErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1525 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
1526 CHECK(!val->result_ok);
1527 long err_ref = (long)&(*val->contents.err);
1530 static inline LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const LDKCResult_NoneAPIErrorZ *orig) {
1531 LDKCResult_NoneAPIErrorZ res = { .result_ok = orig->result_ok };
1532 if (orig->result_ok) {
1533 res.contents.result = NULL;
1535 LDKAPIError* contents = MALLOC(sizeof(LDKAPIError), "LDKAPIError result Err clone");
1536 *contents = APIError_clone(orig->contents.err);
1537 res.contents.err = contents;
1541 uint32_t LDKCVec_1ChannelDetailsZ_1new(void* ctx_TODO, uint32_tArray elems) {
1542 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
1543 ret->datalen = elems.len;
1544 if (ret->datalen == 0) {
1547 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
1548 uint32_t *java_elems = (uint32_t*)elems.ptr;
1549 for (size_t i = 0; i < ret->datalen; i++) {
1550 uint32_t arr_elem = java_elems[i];
1551 LDKChannelDetails arr_elem_conv;
1552 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1553 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1554 if (arr_elem_conv.inner != NULL)
1555 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
1556 ret->data[i] = arr_elem_conv;
1561 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1562 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1563 for (size_t i = 0; i < ret.datalen; i++) {
1564 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1568 jboolean LDKCResult_1NonePaymentSendFailureZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1569 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
1571 void LDKCResult_1NonePaymentSendFailureZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1572 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
1573 CHECK(val->result_ok);
1574 return *val->contents.result;
1576 uint32_t LDKCResult_1NonePaymentSendFailureZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1577 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
1578 CHECK(!val->result_ok);
1579 LDKPaymentSendFailure err_var = (*val->contents.err);
1580 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1581 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1582 long err_ref = (long)err_var.inner & ~1;
1585 uint32_t LDKNetAddress_1ref_1from_1ptr (void* ctx_TODO, uint32_t ptr) {
1586 LDKNetAddress *obj = (LDKNetAddress*)ptr;
1588 case LDKNetAddress_IPv4: {
1589 int8_tArray addr_arr = { .len = 4, .ptr = MALLOC(4, "Native int8_tArray Bytes") };
1590 memcpy(addr_arr.ptr, obj->i_pv4.addr.data, 4);
1591 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
1593 case LDKNetAddress_IPv6: {
1594 int8_tArray addr_arr = { .len = 16, .ptr = MALLOC(16, "Native int8_tArray Bytes") };
1595 memcpy(addr_arr.ptr, obj->i_pv6.addr.data, 16);
1596 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
1598 case LDKNetAddress_OnionV2: {
1599 int8_tArray addr_arr = { .len = 10, .ptr = MALLOC(10, "Native int8_tArray Bytes") };
1600 memcpy(addr_arr.ptr, obj->onion_v2.addr.data, 10);
1601 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
1603 case LDKNetAddress_OnionV3: {
1604 int8_tArray ed25519_pubkey_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
1605 memcpy(ed25519_pubkey_arr.ptr, obj->onion_v3.ed25519_pubkey.data, 32);
1606 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
1611 uint32_t LDKCVec_1NetAddressZ_1new(void* ctx_TODO, uint32_tArray elems) {
1612 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
1613 ret->datalen = elems.len;
1614 if (ret->datalen == 0) {
1617 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
1618 uint32_t *java_elems = (uint32_t*)elems.ptr;
1619 for (size_t i = 0; i < ret->datalen; i++) {
1620 uint32_t arr_elem = java_elems[i];
1621 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
1622 FREE((void*)arr_elem);
1623 ret->data[i] = arr_elem_conv;
1628 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
1629 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
1630 for (size_t i = 0; i < ret.datalen; i++) {
1631 ret.data[i] = NetAddress_clone(&orig->data[i]);
1635 uint32_t LDKCVec_1ChannelMonitorZ_1new(void* ctx_TODO, uint32_tArray elems) {
1636 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
1637 ret->datalen = elems.len;
1638 if (ret->datalen == 0) {
1641 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
1642 uint32_t *java_elems = (uint32_t*)elems.ptr;
1643 for (size_t i = 0; i < ret->datalen; i++) {
1644 uint32_t arr_elem = java_elems[i];
1645 LDKChannelMonitor arr_elem_conv;
1646 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1647 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1648 // Warning: we may need a move here but can't clone!
1649 ret->data[i] = arr_elem_conv;
1654 typedef struct LDKWatch_JCalls {
1655 atomic_size_t refcnt;
1656 // TODO: Object pointer o;
1657 // TODO: Some kind of method pointer watch_channel_meth;
1658 // TODO: Some kind of method pointer update_channel_meth;
1659 // TODO: Some kind of method pointer release_pending_monitor_events_meth;
1661 static void LDKWatch_JCalls_free(void* this_arg) {
1662 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
1663 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1664 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
1668 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
1669 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
1670 LDKOutPoint funding_txo_var = funding_txo;
1671 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1672 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1673 long funding_txo_ref = (long)funding_txo_var.inner;
1674 if (funding_txo_var.is_owned) {
1675 funding_txo_ref |= 1;
1677 LDKChannelMonitor monitor_var = monitor;
1678 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1679 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1680 long monitor_ref = (long)monitor_var.inner;
1681 if (monitor_var.is_owned) {
1684 //TODO: jobject obj = get object we can call against on j_calls->o
1685 LDKCResult_NoneChannelMonitorUpdateErrZ* ret; // TODO: Call watch_channel on j_calls with instance obj, returning a pointer, funding_txo_ref, monitor_ref);
1686 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
1690 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
1691 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
1692 LDKOutPoint funding_txo_var = funding_txo;
1693 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1694 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1695 long funding_txo_ref = (long)funding_txo_var.inner;
1696 if (funding_txo_var.is_owned) {
1697 funding_txo_ref |= 1;
1699 LDKChannelMonitorUpdate update_var = update;
1700 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1701 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1702 long update_ref = (long)update_var.inner;
1703 if (update_var.is_owned) {
1706 //TODO: jobject obj = get object we can call against on j_calls->o
1707 LDKCResult_NoneChannelMonitorUpdateErrZ* ret; // TODO: Call update_channel on j_calls with instance obj, returning a pointer, funding_txo_ref, update_ref);
1708 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
1712 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
1713 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
1714 //TODO: jobject obj = get object we can call against on j_calls->o
1715 uint32_tArray arg; // TODO: Call release_pending_monitor_events on j_calls with instance obj, returning an object);
1716 LDKCVec_MonitorEventZ arg_constr;
1717 arg_constr.datalen = arg.len;
1718 if (arg_constr.datalen > 0)
1719 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
1721 arg_constr.data = NULL;
1722 uint32_t* arg_vals = (uint32_t*) arg.ptr;
1723 for (size_t o = 0; o < arg_constr.datalen; o++) {
1724 uint32_t arr_conv_14 = arg_vals[o];
1725 LDKMonitorEvent arr_conv_14_conv;
1726 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
1727 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
1728 if (arr_conv_14_conv.inner != NULL)
1729 arr_conv_14_conv = MonitorEvent_clone(&arr_conv_14_conv);
1730 arg_constr.data[o] = arr_conv_14_conv;
1734 static void* LDKWatch_JCalls_clone(const void* this_arg) {
1735 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
1736 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1737 return (void*) this_arg;
1739 static inline LDKWatch LDKWatch_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
1740 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
1741 atomic_init(&calls->refcnt, 1);
1742 //TODO: Assign calls->o from o
1745 .this_arg = (void*) calls,
1746 .watch_channel = watch_channel_jcall,
1747 .update_channel = update_channel_jcall,
1748 .release_pending_monitor_events = release_pending_monitor_events_jcall,
1749 .free = LDKWatch_JCalls_free,
1753 long LDKWatch_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
1754 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
1755 *res_ptr = LDKWatch_init(NULL, o);
1756 return (long)res_ptr;
1758 uint32_t Watch_1watch_1channel(void* ctx_TODO, uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
1759 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
1760 LDKOutPoint funding_txo_conv;
1761 funding_txo_conv.inner = (void*)(funding_txo & (~1));
1762 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
1763 if (funding_txo_conv.inner != NULL)
1764 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
1765 LDKChannelMonitor monitor_conv;
1766 monitor_conv.inner = (void*)(monitor & (~1));
1767 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
1768 // Warning: we may need a move here but can't clone!
1769 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
1770 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
1771 return (long)ret_conv;
1774 uint32_t Watch_1update_1channel(void* ctx_TODO, uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
1775 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
1776 LDKOutPoint funding_txo_conv;
1777 funding_txo_conv.inner = (void*)(funding_txo & (~1));
1778 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
1779 if (funding_txo_conv.inner != NULL)
1780 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
1781 LDKChannelMonitorUpdate update_conv;
1782 update_conv.inner = (void*)(update & (~1));
1783 update_conv.is_owned = (update & 1) || (update == 0);
1784 if (update_conv.inner != NULL)
1785 update_conv = ChannelMonitorUpdate_clone(&update_conv);
1786 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
1787 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
1788 return (long)ret_conv;
1791 uint32_tArray Watch_1release_1pending_1monitor_1events(void* ctx_TODO, uint32_t this_arg) {
1792 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
1793 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
1794 uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
1795 uint32_t *ret_arr_ptr = (uint32_t*)ret_arr.ptr;
1796 for (size_t o = 0; o < ret_var.datalen; o++) {
1797 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
1798 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1799 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1800 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
1801 if (arr_conv_14_var.is_owned) {
1802 arr_conv_14_ref |= 1;
1804 ret_arr_ptr[o] = arr_conv_14_ref;
1810 typedef struct LDKBroadcasterInterface_JCalls {
1811 atomic_size_t refcnt;
1812 // TODO: Object pointer o;
1813 // TODO: Some kind of method pointer broadcast_transaction_meth;
1814 } LDKBroadcasterInterface_JCalls;
1815 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
1816 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
1817 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1818 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
1822 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
1823 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
1824 LDKTransaction tx_var = tx;
1825 int8_tArray tx_arr = { .len = tx_var.datalen, .ptr = MALLOC(tx_var.datalen, "Native int8_tArray Bytes") };
1826 memcpy(tx_arr.ptr, tx_var.data, tx_var.datalen);
1827 Transaction_free(tx_var);
1828 //TODO: jobject obj = get object we can call against on j_calls->o
1829 return; //TODO: Call broadcast_transaction on j_calls with instance obj, tx_arr);
1831 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
1832 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
1833 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1834 return (void*) this_arg;
1836 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
1837 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
1838 atomic_init(&calls->refcnt, 1);
1839 //TODO: Assign calls->o from o
1841 LDKBroadcasterInterface ret = {
1842 .this_arg = (void*) calls,
1843 .broadcast_transaction = broadcast_transaction_jcall,
1844 .free = LDKBroadcasterInterface_JCalls_free,
1848 long LDKBroadcasterInterface_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
1849 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
1850 *res_ptr = LDKBroadcasterInterface_init(NULL, o);
1851 return (long)res_ptr;
1853 void BroadcasterInterface_1broadcast_1transaction(void* ctx_TODO, uint32_t this_arg, int8_tArray tx) {
1854 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
1855 LDKTransaction tx_ref;
1856 tx_ref.datalen = tx.len;
1857 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
1858 memcpy(tx_ref.data, tx.ptr, tx_ref.datalen);
1859 tx_ref.data_is_owned = true;
1860 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
1863 typedef struct LDKKeysInterface_JCalls {
1864 atomic_size_t refcnt;
1865 // TODO: Object pointer o;
1866 // TODO: Some kind of method pointer get_node_secret_meth;
1867 // TODO: Some kind of method pointer get_destination_script_meth;
1868 // TODO: Some kind of method pointer get_shutdown_pubkey_meth;
1869 // TODO: Some kind of method pointer get_channel_keys_meth;
1870 // TODO: Some kind of method pointer get_secure_random_bytes_meth;
1871 // TODO: Some kind of method pointer read_chan_signer_meth;
1872 } LDKKeysInterface_JCalls;
1873 static void LDKKeysInterface_JCalls_free(void* this_arg) {
1874 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1875 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1876 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
1880 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
1881 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1882 //TODO: jobject obj = get object we can call against on j_calls->o
1883 int8_tArray arg; // TODO: Call get_node_secret on j_calls with instance obj, returning an object);
1884 LDKSecretKey arg_ref;
1885 CHECK(arg.len == 32);
1886 memcpy(arg_ref.bytes, arg.ptr, 32);
1889 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
1890 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1891 //TODO: jobject obj = get object we can call against on j_calls->o
1892 int8_tArray arg; // TODO: Call get_destination_script on j_calls with instance obj, returning an object);
1893 LDKCVec_u8Z arg_ref;
1894 arg_ref.datalen = arg.len;
1895 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
1896 memcpy(arg_ref.data, arg.ptr, arg_ref.datalen);
1899 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
1900 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1901 //TODO: jobject obj = get object we can call against on j_calls->o
1902 int8_tArray arg; // TODO: Call get_shutdown_pubkey on j_calls with instance obj, returning an object);
1903 LDKPublicKey arg_ref;
1904 CHECK(arg.len == 33);
1905 memcpy(arg_ref.compressed_form, arg.ptr, 33);
1908 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
1909 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1910 //TODO: jobject obj = get object we can call against on j_calls->o
1911 LDKChannelKeys* ret; // TODO: Call get_channel_keys on j_calls with instance obj, returning a pointer, inbound, channel_value_satoshis);
1912 LDKChannelKeys ret_conv = *(LDKChannelKeys*)ret;
1913 ret_conv = ChannelKeys_clone(ret);
1916 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
1917 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1918 //TODO: jobject obj = get object we can call against on j_calls->o
1919 int8_tArray arg; // TODO: Call get_secure_random_bytes on j_calls with instance obj, returning an object);
1920 LDKThirtyTwoBytes arg_ref;
1921 CHECK(arg.len == 32);
1922 memcpy(arg_ref.data, arg.ptr, 32);
1925 LDKCResult_ChanKeySignerDecodeErrorZ read_chan_signer_jcall(const void* this_arg, LDKu8slice reader) {
1926 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1927 LDKu8slice reader_var = reader;
1928 int8_tArray reader_arr = { .len = reader_var.datalen, .ptr = MALLOC(reader_var.datalen, "Native int8_tArray Bytes") };
1929 memcpy(reader_arr.ptr, reader_var.data, reader_var.datalen);
1930 //TODO: jobject obj = get object we can call against on j_calls->o
1931 LDKCResult_ChanKeySignerDecodeErrorZ* ret; // TODO: Call read_chan_signer on j_calls with instance obj, returning a pointer, reader_arr);
1932 LDKCResult_ChanKeySignerDecodeErrorZ ret_conv = *(LDKCResult_ChanKeySignerDecodeErrorZ*)ret;
1936 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
1937 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1938 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1939 return (void*) this_arg;
1941 static inline LDKKeysInterface LDKKeysInterface_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
1942 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
1943 atomic_init(&calls->refcnt, 1);
1944 //TODO: Assign calls->o from o
1946 LDKKeysInterface ret = {
1947 .this_arg = (void*) calls,
1948 .get_node_secret = get_node_secret_jcall,
1949 .get_destination_script = get_destination_script_jcall,
1950 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
1951 .get_channel_keys = get_channel_keys_jcall,
1952 .get_secure_random_bytes = get_secure_random_bytes_jcall,
1953 .read_chan_signer = read_chan_signer_jcall,
1954 .free = LDKKeysInterface_JCalls_free,
1958 long LDKKeysInterface_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
1959 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
1960 *res_ptr = LDKKeysInterface_init(NULL, o);
1961 return (long)res_ptr;
1963 int8_tArray KeysInterface_1get_1node_1secret(void* ctx_TODO, uint32_t this_arg) {
1964 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
1965 int8_tArray arg_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
1966 memcpy(arg_arr.ptr, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
1970 int8_tArray KeysInterface_1get_1destination_1script(void* ctx_TODO, uint32_t this_arg) {
1971 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
1972 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
1973 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
1974 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
1975 CVec_u8Z_free(arg_var);
1979 int8_tArray KeysInterface_1get_1shutdown_1pubkey(void* ctx_TODO, uint32_t this_arg) {
1980 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
1981 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
1982 memcpy(arg_arr.ptr, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form, 33);
1986 uint32_t KeysInterface_1get_1channel_1keys(void* ctx_TODO, uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
1987 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
1988 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1989 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
1993 int8_tArray KeysInterface_1get_1secure_1random_1bytes(void* ctx_TODO, uint32_t this_arg) {
1994 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
1995 int8_tArray arg_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
1996 memcpy(arg_arr.ptr, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
2000 uint32_t KeysInterface_1read_1chan_1signer(void* ctx_TODO, uint32_t this_arg, int8_tArray reader) {
2001 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2002 LDKu8slice reader_ref;
2003 reader_ref.datalen = reader.len;
2004 reader_ref.data = reader.ptr;
2005 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
2006 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
2007 return (long)ret_conv;
2010 typedef struct LDKFeeEstimator_JCalls {
2011 atomic_size_t refcnt;
2012 // TODO: Object pointer o;
2013 // TODO: Some kind of method pointer get_est_sat_per_1000_weight_meth;
2014 } LDKFeeEstimator_JCalls;
2015 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2016 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2017 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2018 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
2022 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2023 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2024 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
2025 //TODO: jobject obj = get object we can call against on j_calls->o
2026 return 0; //TODO: Call get_est_sat_per_1000_weight on j_calls with instance obj, returning number, confirmation_target_conv);
2028 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2029 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2030 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2031 return (void*) this_arg;
2033 static inline LDKFeeEstimator LDKFeeEstimator_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
2034 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2035 atomic_init(&calls->refcnt, 1);
2036 //TODO: Assign calls->o from o
2038 LDKFeeEstimator ret = {
2039 .this_arg = (void*) calls,
2040 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2041 .free = LDKFeeEstimator_JCalls_free,
2045 long LDKFeeEstimator_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
2046 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2047 *res_ptr = LDKFeeEstimator_init(NULL, o);
2048 return (long)res_ptr;
2050 int32_t FeeEstimator_1get_1est_1sat_1per_11000_1weight(void* ctx_TODO, uint32_t this_arg, uint32_t confirmation_target) {
2051 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2052 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
2053 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2057 typedef struct LDKLogger_JCalls {
2058 atomic_size_t refcnt;
2059 // TODO: Object pointer o;
2060 // TODO: Some kind of method pointer log_meth;
2062 static void LDKLogger_JCalls_free(void* this_arg) {
2063 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2064 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2065 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
2069 void log_jcall(const void* this_arg, const char* record) {
2070 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2071 jstring record_conv = conv_owned_string(record);
2072 //TODO: jobject obj = get object we can call against on j_calls->o
2073 return; //TODO: Call log on j_calls with instance obj, record_conv);
2075 static void* LDKLogger_JCalls_clone(const void* this_arg) {
2076 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2077 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2078 return (void*) this_arg;
2080 static inline LDKLogger LDKLogger_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
2081 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2082 atomic_init(&calls->refcnt, 1);
2083 //TODO: Assign calls->o from o
2086 .this_arg = (void*) calls,
2088 .free = LDKLogger_JCalls_free,
2092 long LDKLogger_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
2093 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2094 *res_ptr = LDKLogger_init(NULL, o);
2095 return (long)res_ptr;
2097 uint32_t LDKC2Tuple_1BlockHashChannelManagerZ_1new(void* ctx_TODO, int8_tArray a, uint32_t b) {
2098 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
2099 LDKThirtyTwoBytes a_ref;
2101 memcpy(a_ref.data, a.ptr, 32);
2103 LDKChannelManager b_conv;
2104 b_conv.inner = (void*)(b & (~1));
2105 b_conv.is_owned = (b & 1) || (b == 0);
2106 // Warning: we may need a move here but can't clone!
2110 int8_tArray LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
2111 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)ptr;
2112 int8_tArray a_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
2113 memcpy(a_arr.ptr, tuple->a.data, 32);
2116 uint32_t LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
2117 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)ptr;
2118 LDKChannelManager b_var = tuple->b;
2119 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2120 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2121 long b_ref = (long)b_var.inner & ~1;
2124 jboolean LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2125 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
2127 uint32_t LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2128 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg;
2129 CHECK(val->result_ok);
2130 long res_ref = (long)&(*val->contents.result);
2133 uint32_t LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2134 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg;
2135 CHECK(!val->result_ok);
2136 LDKDecodeError err_var = (*val->contents.err);
2137 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2138 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2139 long err_ref = (long)err_var.inner & ~1;
2142 jboolean LDKCResult_1NetAddressu8Z_1result_1ok (void* ctx_TODO, uint32_t arg) {
2143 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
2145 uint32_t LDKCResult_1NetAddressu8Z_1get_1ok (void* ctx_TODO, uint32_t arg) {
2146 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)arg;
2147 CHECK(val->result_ok);
2148 long res_ref = (long)&(*val->contents.result);
2151 int8_t LDKCResult_1NetAddressu8Z_1get_1err (void* ctx_TODO, uint32_t arg) {
2152 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)arg;
2153 CHECK(!val->result_ok);
2154 return *val->contents.err;
2156 static inline LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const LDKCResult_NetAddressu8Z *orig) {
2157 LDKCResult_NetAddressu8Z res = { .result_ok = orig->result_ok };
2158 if (orig->result_ok) {
2159 LDKNetAddress* contents = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress result OK clone");
2160 *contents = NetAddress_clone(orig->contents.result);
2161 res.contents.result = contents;
2163 int8_t* contents = MALLOC(sizeof(int8_t), "int8_t result Err clone");
2164 *contents = *orig->contents.err;
2165 res.contents.err = contents;
2169 jboolean LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2170 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
2172 uint32_t LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2173 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg;
2174 CHECK(val->result_ok);
2175 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
2176 *res_conv = (*val->contents.result);
2177 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
2178 return (long)res_conv;
2180 uint32_t LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2181 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg;
2182 CHECK(!val->result_ok);
2183 LDKDecodeError err_var = (*val->contents.err);
2184 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2185 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2186 long err_ref = (long)err_var.inner & ~1;
2189 uint32_t LDKCVec_1u64Z_1new(void* ctx_TODO, int64_tArray elems) {
2190 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
2191 ret->datalen = elems.len;
2192 if (ret->datalen == 0) {
2195 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
2196 int64_t *java_elems = (int64_t*)elems.ptr;
2197 for (size_t i = 0; i < ret->datalen; i++) {
2198 ret->data[i] = java_elems[i];
2203 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
2204 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
2205 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
2208 uint32_t LDKCVec_1UpdateAddHTLCZ_1new(void* ctx_TODO, uint32_tArray elems) {
2209 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
2210 ret->datalen = elems.len;
2211 if (ret->datalen == 0) {
2214 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
2215 uint32_t *java_elems = (uint32_t*)elems.ptr;
2216 for (size_t i = 0; i < ret->datalen; i++) {
2217 uint32_t arr_elem = java_elems[i];
2218 LDKUpdateAddHTLC arr_elem_conv;
2219 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2220 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2221 if (arr_elem_conv.inner != NULL)
2222 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
2223 ret->data[i] = arr_elem_conv;
2228 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
2229 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
2230 for (size_t i = 0; i < ret.datalen; i++) {
2231 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
2235 uint32_t LDKCVec_1UpdateFulfillHTLCZ_1new(void* ctx_TODO, uint32_tArray elems) {
2236 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
2237 ret->datalen = elems.len;
2238 if (ret->datalen == 0) {
2241 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
2242 uint32_t *java_elems = (uint32_t*)elems.ptr;
2243 for (size_t i = 0; i < ret->datalen; i++) {
2244 uint32_t arr_elem = java_elems[i];
2245 LDKUpdateFulfillHTLC arr_elem_conv;
2246 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2247 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2248 if (arr_elem_conv.inner != NULL)
2249 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
2250 ret->data[i] = arr_elem_conv;
2255 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
2256 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
2257 for (size_t i = 0; i < ret.datalen; i++) {
2258 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
2262 uint32_t LDKCVec_1UpdateFailHTLCZ_1new(void* ctx_TODO, uint32_tArray elems) {
2263 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
2264 ret->datalen = elems.len;
2265 if (ret->datalen == 0) {
2268 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
2269 uint32_t *java_elems = (uint32_t*)elems.ptr;
2270 for (size_t i = 0; i < ret->datalen; i++) {
2271 uint32_t arr_elem = java_elems[i];
2272 LDKUpdateFailHTLC arr_elem_conv;
2273 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2274 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2275 if (arr_elem_conv.inner != NULL)
2276 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
2277 ret->data[i] = arr_elem_conv;
2282 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
2283 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
2284 for (size_t i = 0; i < ret.datalen; i++) {
2285 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
2289 uint32_t LDKCVec_1UpdateFailMalformedHTLCZ_1new(void* ctx_TODO, uint32_tArray elems) {
2290 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
2291 ret->datalen = elems.len;
2292 if (ret->datalen == 0) {
2295 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
2296 uint32_t *java_elems = (uint32_t*)elems.ptr;
2297 for (size_t i = 0; i < ret->datalen; i++) {
2298 uint32_t arr_elem = java_elems[i];
2299 LDKUpdateFailMalformedHTLC arr_elem_conv;
2300 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2301 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2302 if (arr_elem_conv.inner != NULL)
2303 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
2304 ret->data[i] = arr_elem_conv;
2309 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
2310 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
2311 for (size_t i = 0; i < ret.datalen; i++) {
2312 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
2316 jboolean LDKCResult_1boolLightningErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2317 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
2319 jboolean LDKCResult_1boolLightningErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2320 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
2321 CHECK(val->result_ok);
2322 return *val->contents.result;
2324 uint32_t LDKCResult_1boolLightningErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2325 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
2326 CHECK(!val->result_ok);
2327 LDKLightningError err_var = (*val->contents.err);
2328 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2329 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2330 long err_ref = (long)err_var.inner & ~1;
2333 uint32_t LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(void* ctx_TODO, uint32_t a, uint32_t b, uint32_t c) {
2334 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
2335 LDKChannelAnnouncement a_conv;
2336 a_conv.inner = (void*)(a & (~1));
2337 a_conv.is_owned = (a & 1) || (a == 0);
2338 if (a_conv.inner != NULL)
2339 a_conv = ChannelAnnouncement_clone(&a_conv);
2341 LDKChannelUpdate b_conv;
2342 b_conv.inner = (void*)(b & (~1));
2343 b_conv.is_owned = (b & 1) || (b == 0);
2344 if (b_conv.inner != NULL)
2345 b_conv = ChannelUpdate_clone(&b_conv);
2347 LDKChannelUpdate c_conv;
2348 c_conv.inner = (void*)(c & (~1));
2349 c_conv.is_owned = (c & 1) || (c == 0);
2350 if (c_conv.inner != NULL)
2351 c_conv = ChannelUpdate_clone(&c_conv);
2355 static inline LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *orig) {
2356 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret = {
2357 .a = ChannelAnnouncement_clone(&orig->a),
2358 .b = ChannelUpdate_clone(&orig->b),
2359 .c = ChannelUpdate_clone(&orig->c),
2363 uint32_t LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
2364 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ptr;
2365 LDKChannelAnnouncement a_var = tuple->a;
2366 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2367 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2368 long a_ref = (long)a_var.inner & ~1;
2371 uint32_t LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
2372 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ptr;
2373 LDKChannelUpdate b_var = tuple->b;
2374 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2375 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2376 long b_ref = (long)b_var.inner & ~1;
2379 uint32_t LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(void* ctx_TODO, uint32_t ptr) {
2380 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ptr;
2381 LDKChannelUpdate c_var = tuple->c;
2382 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2383 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2384 long c_ref = (long)c_var.inner & ~1;
2387 uint32_t LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(void* ctx_TODO, uint32_tArray elems) {
2388 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
2389 ret->datalen = elems.len;
2390 if (ret->datalen == 0) {
2393 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
2394 uint32_t *java_elems = (uint32_t*)elems.ptr;
2395 for (size_t i = 0; i < ret->datalen; i++) {
2396 uint32_t arr_elem = java_elems[i];
2397 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_elem;
2398 FREE((void*)arr_elem);
2399 ret->data[i] = arr_elem_conv;
2404 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
2405 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
2406 for (size_t i = 0; i < ret.datalen; i++) {
2407 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
2411 uint32_t LDKCVec_1NodeAnnouncementZ_1new(void* ctx_TODO, uint32_tArray elems) {
2412 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
2413 ret->datalen = elems.len;
2414 if (ret->datalen == 0) {
2417 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
2418 uint32_t *java_elems = (uint32_t*)elems.ptr;
2419 for (size_t i = 0; i < ret->datalen; i++) {
2420 uint32_t arr_elem = java_elems[i];
2421 LDKNodeAnnouncement arr_elem_conv;
2422 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2423 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2424 if (arr_elem_conv.inner != NULL)
2425 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
2426 ret->data[i] = arr_elem_conv;
2431 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
2432 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
2433 for (size_t i = 0; i < ret.datalen; i++) {
2434 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
2438 jboolean LDKCResult_1NoneLightningErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2439 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
2441 void LDKCResult_1NoneLightningErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2442 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)arg;
2443 CHECK(val->result_ok);
2444 return *val->contents.result;
2446 uint32_t LDKCResult_1NoneLightningErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2447 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)arg;
2448 CHECK(!val->result_ok);
2449 LDKLightningError err_var = (*val->contents.err);
2450 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2451 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2452 long err_ref = (long)err_var.inner & ~1;
2455 jboolean LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2456 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
2458 uint32_t LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2459 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)arg;
2460 CHECK(val->result_ok);
2461 LDKChannelReestablish res_var = (*val->contents.result);
2462 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2463 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2464 long res_ref = (long)res_var.inner & ~1;
2467 uint32_t LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2468 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)arg;
2469 CHECK(!val->result_ok);
2470 LDKDecodeError err_var = (*val->contents.err);
2471 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2472 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2473 long err_ref = (long)err_var.inner & ~1;
2476 jboolean LDKCResult_1InitDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2477 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
2479 uint32_t LDKCResult_1InitDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2480 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)arg;
2481 CHECK(val->result_ok);
2482 LDKInit res_var = (*val->contents.result);
2483 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2484 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2485 long res_ref = (long)res_var.inner & ~1;
2488 uint32_t LDKCResult_1InitDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2489 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)arg;
2490 CHECK(!val->result_ok);
2491 LDKDecodeError err_var = (*val->contents.err);
2492 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2493 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2494 long err_ref = (long)err_var.inner & ~1;
2497 jboolean LDKCResult_1PingDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2498 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
2500 uint32_t LDKCResult_1PingDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2501 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)arg;
2502 CHECK(val->result_ok);
2503 LDKPing res_var = (*val->contents.result);
2504 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2505 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2506 long res_ref = (long)res_var.inner & ~1;
2509 uint32_t LDKCResult_1PingDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2510 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)arg;
2511 CHECK(!val->result_ok);
2512 LDKDecodeError err_var = (*val->contents.err);
2513 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2514 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2515 long err_ref = (long)err_var.inner & ~1;
2518 jboolean LDKCResult_1PongDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2519 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
2521 uint32_t LDKCResult_1PongDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2522 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)arg;
2523 CHECK(val->result_ok);
2524 LDKPong res_var = (*val->contents.result);
2525 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2526 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2527 long res_ref = (long)res_var.inner & ~1;
2530 uint32_t LDKCResult_1PongDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2531 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)arg;
2532 CHECK(!val->result_ok);
2533 LDKDecodeError err_var = (*val->contents.err);
2534 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2535 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2536 long err_ref = (long)err_var.inner & ~1;
2539 jboolean LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2540 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
2542 uint32_t LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2543 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg;
2544 CHECK(val->result_ok);
2545 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
2546 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2547 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2548 long res_ref = (long)res_var.inner & ~1;
2551 uint32_t LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2552 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg;
2553 CHECK(!val->result_ok);
2554 LDKDecodeError err_var = (*val->contents.err);
2555 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2556 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2557 long err_ref = (long)err_var.inner & ~1;
2560 jboolean LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2561 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
2563 uint32_t LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2564 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg;
2565 CHECK(val->result_ok);
2566 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
2567 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2568 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2569 long res_ref = (long)res_var.inner & ~1;
2572 uint32_t LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2573 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg;
2574 CHECK(!val->result_ok);
2575 LDKDecodeError err_var = (*val->contents.err);
2576 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2577 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2578 long err_ref = (long)err_var.inner & ~1;
2581 jboolean LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2582 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
2584 uint32_t LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2585 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)arg;
2586 CHECK(val->result_ok);
2587 LDKErrorMessage res_var = (*val->contents.result);
2588 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2589 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2590 long res_ref = (long)res_var.inner & ~1;
2593 uint32_t LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2594 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)arg;
2595 CHECK(!val->result_ok);
2596 LDKDecodeError err_var = (*val->contents.err);
2597 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2598 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2599 long err_ref = (long)err_var.inner & ~1;
2602 jboolean LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2603 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
2605 uint32_t LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2606 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg;
2607 CHECK(val->result_ok);
2608 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
2609 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2610 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2611 long res_ref = (long)res_var.inner & ~1;
2614 uint32_t LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2615 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg;
2616 CHECK(!val->result_ok);
2617 LDKDecodeError err_var = (*val->contents.err);
2618 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2619 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2620 long err_ref = (long)err_var.inner & ~1;
2623 jboolean LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2624 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
2626 uint32_t LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2627 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg;
2628 CHECK(val->result_ok);
2629 LDKQueryShortChannelIds res_var = (*val->contents.result);
2630 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2631 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2632 long res_ref = (long)res_var.inner & ~1;
2635 uint32_t LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2636 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg;
2637 CHECK(!val->result_ok);
2638 LDKDecodeError err_var = (*val->contents.err);
2639 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2640 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2641 long err_ref = (long)err_var.inner & ~1;
2644 jboolean LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2645 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
2647 uint32_t LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2648 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg;
2649 CHECK(val->result_ok);
2650 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
2651 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2652 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2653 long res_ref = (long)res_var.inner & ~1;
2656 uint32_t LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2657 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg;
2658 CHECK(!val->result_ok);
2659 LDKDecodeError err_var = (*val->contents.err);
2660 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2661 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2662 long err_ref = (long)err_var.inner & ~1;
2665 jboolean LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2666 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
2668 uint32_t LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2669 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)arg;
2670 CHECK(val->result_ok);
2671 LDKQueryChannelRange res_var = (*val->contents.result);
2672 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2673 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2674 long res_ref = (long)res_var.inner & ~1;
2677 uint32_t LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2678 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)arg;
2679 CHECK(!val->result_ok);
2680 LDKDecodeError err_var = (*val->contents.err);
2681 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2682 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2683 long err_ref = (long)err_var.inner & ~1;
2686 jboolean LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2687 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
2689 uint32_t LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2690 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg;
2691 CHECK(val->result_ok);
2692 LDKReplyChannelRange res_var = (*val->contents.result);
2693 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2694 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2695 long res_ref = (long)res_var.inner & ~1;
2698 uint32_t LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2699 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg;
2700 CHECK(!val->result_ok);
2701 LDKDecodeError err_var = (*val->contents.err);
2702 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2703 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2704 long err_ref = (long)err_var.inner & ~1;
2707 jboolean LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2708 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
2710 uint32_t LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2711 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg;
2712 CHECK(val->result_ok);
2713 LDKGossipTimestampFilter res_var = (*val->contents.result);
2714 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2715 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2716 long res_ref = (long)res_var.inner & ~1;
2719 uint32_t LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2720 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg;
2721 CHECK(!val->result_ok);
2722 LDKDecodeError err_var = (*val->contents.err);
2723 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2724 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2725 long err_ref = (long)err_var.inner & ~1;
2728 jboolean LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2729 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
2731 int8_tArray LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2732 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
2733 CHECK(val->result_ok);
2734 LDKCVec_u8Z res_var = (*val->contents.result);
2735 int8_tArray res_arr = { .len = res_var.datalen, .ptr = MALLOC(res_var.datalen, "Native int8_tArray Bytes") };
2736 memcpy(res_arr.ptr, res_var.data, res_var.datalen);
2739 uint32_t LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2740 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
2741 CHECK(!val->result_ok);
2742 LDKPeerHandleError err_var = (*val->contents.err);
2743 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2744 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2745 long err_ref = (long)err_var.inner & ~1;
2748 jboolean LDKCResult_1NonePeerHandleErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2749 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
2751 void LDKCResult_1NonePeerHandleErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2752 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
2753 CHECK(val->result_ok);
2754 return *val->contents.result;
2756 uint32_t LDKCResult_1NonePeerHandleErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2757 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
2758 CHECK(!val->result_ok);
2759 LDKPeerHandleError err_var = (*val->contents.err);
2760 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2761 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2762 long err_ref = (long)err_var.inner & ~1;
2765 jboolean LDKCResult_1boolPeerHandleErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2766 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
2768 jboolean LDKCResult_1boolPeerHandleErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2769 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
2770 CHECK(val->result_ok);
2771 return *val->contents.result;
2773 uint32_t LDKCResult_1boolPeerHandleErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2774 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
2775 CHECK(!val->result_ok);
2776 LDKPeerHandleError err_var = (*val->contents.err);
2777 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2778 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2779 long err_ref = (long)err_var.inner & ~1;
2782 jboolean LDKCResult_1SecretKeySecpErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2783 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
2785 int8_tArray LDKCResult_1SecretKeySecpErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2786 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
2787 CHECK(val->result_ok);
2788 int8_tArray res_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
2789 memcpy(res_arr.ptr, (*val->contents.result).bytes, 32);
2792 uint32_t LDKCResult_1SecretKeySecpErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2793 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
2794 CHECK(!val->result_ok);
2795 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
2798 jboolean LDKCResult_1PublicKeySecpErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2799 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
2801 int8_tArray LDKCResult_1PublicKeySecpErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2802 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
2803 CHECK(val->result_ok);
2804 int8_tArray res_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
2805 memcpy(res_arr.ptr, (*val->contents.result).compressed_form, 33);
2808 uint32_t LDKCResult_1PublicKeySecpErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2809 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
2810 CHECK(!val->result_ok);
2811 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
2814 jboolean LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2815 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
2817 uint32_t LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2818 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
2819 CHECK(val->result_ok);
2820 LDKTxCreationKeys res_var = (*val->contents.result);
2821 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2822 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2823 long res_ref = (long)res_var.inner & ~1;
2826 uint32_t LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2827 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
2828 CHECK(!val->result_ok);
2829 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
2832 jboolean LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2833 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
2835 uint32_t LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2836 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)arg;
2837 CHECK(val->result_ok);
2838 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
2839 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2840 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2841 long res_ref = (long)res_var.inner & ~1;
2844 void LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2845 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)arg;
2846 CHECK(!val->result_ok);
2847 return *val->contents.err;
2849 uint32_t LDKCVec_1RouteHopZ_1new(void* ctx_TODO, uint32_tArray elems) {
2850 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
2851 ret->datalen = elems.len;
2852 if (ret->datalen == 0) {
2855 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
2856 uint32_t *java_elems = (uint32_t*)elems.ptr;
2857 for (size_t i = 0; i < ret->datalen; i++) {
2858 uint32_t arr_elem = java_elems[i];
2859 LDKRouteHop arr_elem_conv;
2860 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2861 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2862 if (arr_elem_conv.inner != NULL)
2863 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
2864 ret->data[i] = arr_elem_conv;
2869 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
2870 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
2871 for (size_t i = 0; i < ret.datalen; i++) {
2872 ret.data[i] = RouteHop_clone(&orig->data[i]);
2876 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
2877 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
2878 for (size_t i = 0; i < ret.datalen; i++) {
2879 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
2883 jboolean LDKCResult_1RouteDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2884 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
2886 uint32_t LDKCResult_1RouteDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2887 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)arg;
2888 CHECK(val->result_ok);
2889 LDKRoute res_var = (*val->contents.result);
2890 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2891 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2892 long res_ref = (long)res_var.inner & ~1;
2895 uint32_t LDKCResult_1RouteDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2896 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)arg;
2897 CHECK(!val->result_ok);
2898 LDKDecodeError err_var = (*val->contents.err);
2899 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2900 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2901 long err_ref = (long)err_var.inner & ~1;
2904 uint32_t LDKCVec_1RouteHintZ_1new(void* ctx_TODO, uint32_tArray elems) {
2905 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
2906 ret->datalen = elems.len;
2907 if (ret->datalen == 0) {
2910 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
2911 uint32_t *java_elems = (uint32_t*)elems.ptr;
2912 for (size_t i = 0; i < ret->datalen; i++) {
2913 uint32_t arr_elem = java_elems[i];
2914 LDKRouteHint arr_elem_conv;
2915 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2916 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2917 if (arr_elem_conv.inner != NULL)
2918 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
2919 ret->data[i] = arr_elem_conv;
2924 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2925 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2926 for (size_t i = 0; i < ret.datalen; i++) {
2927 ret.data[i] = RouteHint_clone(&orig->data[i]);
2931 jboolean LDKCResult_1RouteLightningErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2932 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
2934 uint32_t LDKCResult_1RouteLightningErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2935 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
2936 CHECK(val->result_ok);
2937 LDKRoute res_var = (*val->contents.result);
2938 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2939 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2940 long res_ref = (long)res_var.inner & ~1;
2943 uint32_t LDKCResult_1RouteLightningErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2944 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
2945 CHECK(!val->result_ok);
2946 LDKLightningError err_var = (*val->contents.err);
2947 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2948 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2949 long err_ref = (long)err_var.inner & ~1;
2952 jboolean LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2953 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
2955 uint32_t LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2956 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)arg;
2957 CHECK(val->result_ok);
2958 LDKRoutingFees res_var = (*val->contents.result);
2959 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2960 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2961 long res_ref = (long)res_var.inner & ~1;
2964 uint32_t LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2965 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)arg;
2966 CHECK(!val->result_ok);
2967 LDKDecodeError err_var = (*val->contents.err);
2968 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2969 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2970 long err_ref = (long)err_var.inner & ~1;
2973 jboolean LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2974 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
2976 uint32_t LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2977 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg;
2978 CHECK(val->result_ok);
2979 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
2980 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2981 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2982 long res_ref = (long)res_var.inner & ~1;
2985 uint32_t LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2986 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg;
2987 CHECK(!val->result_ok);
2988 LDKDecodeError err_var = (*val->contents.err);
2989 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2990 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2991 long err_ref = (long)err_var.inner & ~1;
2994 jboolean LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2995 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
2997 uint32_t LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2998 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)arg;
2999 CHECK(val->result_ok);
3000 LDKNodeInfo res_var = (*val->contents.result);
3001 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3002 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3003 long res_ref = (long)res_var.inner & ~1;
3006 uint32_t LDKCResult_1NodeInfoDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
3007 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)arg;
3008 CHECK(!val->result_ok);
3009 LDKDecodeError err_var = (*val->contents.err);
3010 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3011 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3012 long err_ref = (long)err_var.inner & ~1;
3015 jboolean LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
3016 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
3018 uint32_t LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
3019 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)arg;
3020 CHECK(val->result_ok);
3021 LDKNetworkGraph res_var = (*val->contents.result);
3022 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3023 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3024 long res_ref = (long)res_var.inner & ~1;
3027 uint32_t LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
3028 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)arg;
3029 CHECK(!val->result_ok);
3030 LDKDecodeError err_var = (*val->contents.err);
3031 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3032 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3033 long err_ref = (long)err_var.inner & ~1;
3036 typedef struct LDKMessageSendEventsProvider_JCalls {
3037 atomic_size_t refcnt;
3038 // TODO: Object pointer o;
3039 // TODO: Some kind of method pointer get_and_clear_pending_msg_events_meth;
3040 } LDKMessageSendEventsProvider_JCalls;
3041 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
3042 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3043 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3044 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
3048 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
3049 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3050 //TODO: jobject obj = get object we can call against on j_calls->o
3051 uint32_tArray arg; // TODO: Call get_and_clear_pending_msg_events on j_calls with instance obj, returning an object);
3052 LDKCVec_MessageSendEventZ arg_constr;
3053 arg_constr.datalen = arg.len;
3054 if (arg_constr.datalen > 0)
3055 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
3057 arg_constr.data = NULL;
3058 uint32_t* arg_vals = (uint32_t*) arg.ptr;
3059 for (size_t s = 0; s < arg_constr.datalen; s++) {
3060 uint32_t arr_conv_18 = arg_vals[s];
3061 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
3062 FREE((void*)arr_conv_18);
3063 arg_constr.data[s] = arr_conv_18_conv;
3067 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
3068 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3069 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3070 return (void*) this_arg;
3072 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
3073 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
3074 atomic_init(&calls->refcnt, 1);
3075 //TODO: Assign calls->o from o
3077 LDKMessageSendEventsProvider ret = {
3078 .this_arg = (void*) calls,
3079 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
3080 .free = LDKMessageSendEventsProvider_JCalls_free,
3084 long LDKMessageSendEventsProvider_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
3085 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
3086 *res_ptr = LDKMessageSendEventsProvider_init(NULL, o);
3087 return (long)res_ptr;
3089 uint32_tArray MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(void* ctx_TODO, uint32_t this_arg) {
3090 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
3091 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
3092 uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
3093 uint32_t *ret_arr_ptr = (uint32_t*)ret_arr.ptr;
3094 for (size_t s = 0; s < ret_var.datalen; s++) {
3095 LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
3096 *arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
3097 long arr_conv_18_ref = (long)arr_conv_18_copy;
3098 ret_arr_ptr[s] = arr_conv_18_ref;
3104 typedef struct LDKEventsProvider_JCalls {
3105 atomic_size_t refcnt;
3106 // TODO: Object pointer o;
3107 // TODO: Some kind of method pointer get_and_clear_pending_events_meth;
3108 } LDKEventsProvider_JCalls;
3109 static void LDKEventsProvider_JCalls_free(void* this_arg) {
3110 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3111 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3112 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
3116 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
3117 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3118 //TODO: jobject obj = get object we can call against on j_calls->o
3119 uint32_tArray arg; // TODO: Call get_and_clear_pending_events on j_calls with instance obj, returning an object);
3120 LDKCVec_EventZ arg_constr;
3121 arg_constr.datalen = arg.len;
3122 if (arg_constr.datalen > 0)
3123 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
3125 arg_constr.data = NULL;
3126 uint32_t* arg_vals = (uint32_t*) arg.ptr;
3127 for (size_t h = 0; h < arg_constr.datalen; h++) {
3128 uint32_t arr_conv_7 = arg_vals[h];
3129 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
3130 FREE((void*)arr_conv_7);
3131 arg_constr.data[h] = arr_conv_7_conv;
3135 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
3136 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3137 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3138 return (void*) this_arg;
3140 static inline LDKEventsProvider LDKEventsProvider_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
3141 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
3142 atomic_init(&calls->refcnt, 1);
3143 //TODO: Assign calls->o from o
3145 LDKEventsProvider ret = {
3146 .this_arg = (void*) calls,
3147 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
3148 .free = LDKEventsProvider_JCalls_free,
3152 long LDKEventsProvider_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
3153 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
3154 *res_ptr = LDKEventsProvider_init(NULL, o);
3155 return (long)res_ptr;
3157 uint32_tArray EventsProvider_1get_1and_1clear_1pending_1events(void* ctx_TODO, uint32_t this_arg) {
3158 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
3159 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
3160 uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
3161 uint32_t *ret_arr_ptr = (uint32_t*)ret_arr.ptr;
3162 for (size_t h = 0; h < ret_var.datalen; h++) {
3163 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
3164 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
3165 long arr_conv_7_ref = (long)arr_conv_7_copy;
3166 ret_arr_ptr[h] = arr_conv_7_ref;
3172 typedef struct LDKAccess_JCalls {
3173 atomic_size_t refcnt;
3174 // TODO: Object pointer o;
3175 // TODO: Some kind of method pointer get_utxo_meth;
3177 static void LDKAccess_JCalls_free(void* this_arg) {
3178 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3179 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3180 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
3184 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3185 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3186 int8_tArray genesis_hash_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
3187 memcpy(genesis_hash_arr.ptr, *genesis_hash, 32);
3188 //TODO: jobject obj = get object we can call against on j_calls->o
3189 LDKCResult_TxOutAccessErrorZ* ret; // TODO: Call get_utxo on j_calls with instance obj, returning a pointer, genesis_hash_arr, short_channel_id);
3190 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)ret;
3194 static void* LDKAccess_JCalls_clone(const void* this_arg) {
3195 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3196 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3197 return (void*) this_arg;
3199 static inline LDKAccess LDKAccess_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
3200 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3201 atomic_init(&calls->refcnt, 1);
3202 //TODO: Assign calls->o from o
3205 .this_arg = (void*) calls,
3206 .get_utxo = get_utxo_jcall,
3207 .free = LDKAccess_JCalls_free,
3211 long LDKAccess_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
3212 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3213 *res_ptr = LDKAccess_init(NULL, o);
3214 return (long)res_ptr;
3216 uint32_t Access_1get_1utxo(void* ctx_TODO, uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
3217 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
3218 unsigned char genesis_hash_arr[32];
3219 CHECK(genesis_hash.len == 32);
3220 memcpy(genesis_hash_arr, genesis_hash.ptr, 32);
3221 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3222 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3223 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3224 return (long)ret_conv;
3227 typedef struct LDKFilter_JCalls {
3228 atomic_size_t refcnt;
3229 // TODO: Object pointer o;
3230 // TODO: Some kind of method pointer register_tx_meth;
3231 // TODO: Some kind of method pointer register_output_meth;
3233 static void LDKFilter_JCalls_free(void* this_arg) {
3234 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3235 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3236 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
3240 void register_tx_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
3241 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3242 int8_tArray txid_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
3243 memcpy(txid_arr.ptr, *txid, 32);
3244 LDKu8slice script_pubkey_var = script_pubkey;
3245 int8_tArray script_pubkey_arr = { .len = script_pubkey_var.datalen, .ptr = MALLOC(script_pubkey_var.datalen, "Native int8_tArray Bytes") };
3246 memcpy(script_pubkey_arr.ptr, script_pubkey_var.data, script_pubkey_var.datalen);
3247 //TODO: jobject obj = get object we can call against on j_calls->o
3248 return; //TODO: Call register_tx on j_calls with instance obj, txid_arr, script_pubkey_arr);
3250 void register_output_jcall(const void* this_arg, const LDKOutPoint * outpoint, LDKu8slice script_pubkey) {
3251 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3252 LDKOutPoint outpoint_var = *outpoint;
3253 if (outpoint->inner != NULL)
3254 outpoint_var = OutPoint_clone(outpoint);
3255 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3256 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3257 long outpoint_ref = (long)outpoint_var.inner;
3258 if (outpoint_var.is_owned) {
3261 LDKu8slice script_pubkey_var = script_pubkey;
3262 int8_tArray script_pubkey_arr = { .len = script_pubkey_var.datalen, .ptr = MALLOC(script_pubkey_var.datalen, "Native int8_tArray Bytes") };
3263 memcpy(script_pubkey_arr.ptr, script_pubkey_var.data, script_pubkey_var.datalen);
3264 //TODO: jobject obj = get object we can call against on j_calls->o
3265 return; //TODO: Call register_output on j_calls with instance obj, outpoint_ref, script_pubkey_arr);
3267 static void* LDKFilter_JCalls_clone(const void* this_arg) {
3268 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3269 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3270 return (void*) this_arg;
3272 static inline LDKFilter LDKFilter_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
3273 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
3274 atomic_init(&calls->refcnt, 1);
3275 //TODO: Assign calls->o from o
3278 .this_arg = (void*) calls,
3279 .register_tx = register_tx_jcall,
3280 .register_output = register_output_jcall,
3281 .free = LDKFilter_JCalls_free,
3285 long LDKFilter_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
3286 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
3287 *res_ptr = LDKFilter_init(NULL, o);
3288 return (long)res_ptr;
3290 void Filter_1register_1tx(void* ctx_TODO, uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
3291 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
3292 unsigned char txid_arr[32];
3293 CHECK(txid.len == 32);
3294 memcpy(txid_arr, txid.ptr, 32);
3295 unsigned char (*txid_ref)[32] = &txid_arr;
3296 LDKu8slice script_pubkey_ref;
3297 script_pubkey_ref.datalen = script_pubkey.len;
3298 script_pubkey_ref.data = script_pubkey.ptr;
3299 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
3302 void Filter_1register_1output(void* ctx_TODO, uint32_t this_arg, uint32_t outpoint, int8_tArray script_pubkey) {
3303 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
3304 LDKOutPoint outpoint_conv;
3305 outpoint_conv.inner = (void*)(outpoint & (~1));
3306 outpoint_conv.is_owned = false;
3307 LDKu8slice script_pubkey_ref;
3308 script_pubkey_ref.datalen = script_pubkey.len;
3309 script_pubkey_ref.data = script_pubkey.ptr;
3310 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
3313 typedef struct LDKPersist_JCalls {
3314 atomic_size_t refcnt;
3315 // TODO: Object pointer o;
3316 // TODO: Some kind of method pointer persist_new_channel_meth;
3317 // TODO: Some kind of method pointer update_persisted_channel_meth;
3318 } LDKPersist_JCalls;
3319 static void LDKPersist_JCalls_free(void* this_arg) {
3320 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
3321 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3322 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
3326 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
3327 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
3328 LDKOutPoint id_var = id;
3329 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3330 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3331 long id_ref = (long)id_var.inner;
3332 if (id_var.is_owned) {
3335 LDKChannelMonitor data_var = *data;
3336 // Warning: we may need a move here but can't clone!
3337 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3338 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3339 long data_ref = (long)data_var.inner;
3340 if (data_var.is_owned) {
3343 //TODO: jobject obj = get object we can call against on j_calls->o
3344 LDKCResult_NoneChannelMonitorUpdateErrZ* ret; // TODO: Call persist_new_channel on j_calls with instance obj, returning a pointer, id_ref, data_ref);
3345 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
3349 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
3350 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
3351 LDKOutPoint id_var = id;
3352 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3353 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3354 long id_ref = (long)id_var.inner;
3355 if (id_var.is_owned) {
3358 LDKChannelMonitorUpdate update_var = *update;
3359 if (update->inner != NULL)
3360 update_var = ChannelMonitorUpdate_clone(update);
3361 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3362 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3363 long update_ref = (long)update_var.inner;
3364 if (update_var.is_owned) {
3367 LDKChannelMonitor data_var = *data;
3368 // Warning: we may need a move here but can't clone!
3369 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3370 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3371 long data_ref = (long)data_var.inner;
3372 if (data_var.is_owned) {
3375 //TODO: jobject obj = get object we can call against on j_calls->o
3376 LDKCResult_NoneChannelMonitorUpdateErrZ* ret; // TODO: Call update_persisted_channel on j_calls with instance obj, returning a pointer, id_ref, update_ref, data_ref);
3377 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
3381 static void* LDKPersist_JCalls_clone(const void* this_arg) {
3382 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
3383 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3384 return (void*) this_arg;
3386 static inline LDKPersist LDKPersist_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
3387 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
3388 atomic_init(&calls->refcnt, 1);
3389 //TODO: Assign calls->o from o
3392 .this_arg = (void*) calls,
3393 .persist_new_channel = persist_new_channel_jcall,
3394 .update_persisted_channel = update_persisted_channel_jcall,
3395 .free = LDKPersist_JCalls_free,
3399 long LDKPersist_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
3400 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
3401 *res_ptr = LDKPersist_init(NULL, o);
3402 return (long)res_ptr;
3404 uint32_t Persist_1persist_1new_1channel(void* ctx_TODO, uint32_t this_arg, uint32_t id, uint32_t data) {
3405 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
3406 LDKOutPoint id_conv;
3407 id_conv.inner = (void*)(id & (~1));
3408 id_conv.is_owned = (id & 1) || (id == 0);
3409 if (id_conv.inner != NULL)
3410 id_conv = OutPoint_clone(&id_conv);
3411 LDKChannelMonitor data_conv;
3412 data_conv.inner = (void*)(data & (~1));
3413 data_conv.is_owned = false;
3414 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3415 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
3416 return (long)ret_conv;
3419 uint32_t Persist_1update_1persisted_1channel(void* ctx_TODO, uint32_t this_arg, uint32_t id, uint32_t update, uint32_t data) {
3420 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
3421 LDKOutPoint id_conv;
3422 id_conv.inner = (void*)(id & (~1));
3423 id_conv.is_owned = (id & 1) || (id == 0);
3424 if (id_conv.inner != NULL)
3425 id_conv = OutPoint_clone(&id_conv);
3426 LDKChannelMonitorUpdate update_conv;
3427 update_conv.inner = (void*)(update & (~1));
3428 update_conv.is_owned = false;
3429 LDKChannelMonitor data_conv;
3430 data_conv.inner = (void*)(data & (~1));
3431 data_conv.is_owned = false;
3432 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3433 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
3434 return (long)ret_conv;
3437 typedef struct LDKChannelMessageHandler_JCalls {
3438 atomic_size_t refcnt;
3439 // TODO: Object pointer o;
3440 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
3441 // TODO: Some kind of method pointer handle_open_channel_meth;
3442 // TODO: Some kind of method pointer handle_accept_channel_meth;
3443 // TODO: Some kind of method pointer handle_funding_created_meth;
3444 // TODO: Some kind of method pointer handle_funding_signed_meth;
3445 // TODO: Some kind of method pointer handle_funding_locked_meth;
3446 // TODO: Some kind of method pointer handle_shutdown_meth;
3447 // TODO: Some kind of method pointer handle_closing_signed_meth;
3448 // TODO: Some kind of method pointer handle_update_add_htlc_meth;
3449 // TODO: Some kind of method pointer handle_update_fulfill_htlc_meth;
3450 // TODO: Some kind of method pointer handle_update_fail_htlc_meth;
3451 // TODO: Some kind of method pointer handle_update_fail_malformed_htlc_meth;
3452 // TODO: Some kind of method pointer handle_commitment_signed_meth;
3453 // TODO: Some kind of method pointer handle_revoke_and_ack_meth;
3454 // TODO: Some kind of method pointer handle_update_fee_meth;
3455 // TODO: Some kind of method pointer handle_announcement_signatures_meth;
3456 // TODO: Some kind of method pointer peer_disconnected_meth;
3457 // TODO: Some kind of method pointer peer_connected_meth;
3458 // TODO: Some kind of method pointer handle_channel_reestablish_meth;
3459 // TODO: Some kind of method pointer handle_error_meth;
3460 } LDKChannelMessageHandler_JCalls;
3461 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
3462 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3463 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3464 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
3468 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
3469 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3470 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
3471 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
3472 LDKInitFeatures their_features_var = their_features;
3473 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3474 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3475 long their_features_ref = (long)their_features_var.inner;
3476 if (their_features_var.is_owned) {
3477 their_features_ref |= 1;
3479 LDKOpenChannel msg_var = *msg;
3480 if (msg->inner != NULL)
3481 msg_var = OpenChannel_clone(msg);
3482 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3483 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3484 long msg_ref = (long)msg_var.inner;
3485 if (msg_var.is_owned) {
3488 //TODO: jobject obj = get object we can call against on j_calls->o
3489 return; //TODO: Call handle_open_channel on j_calls with instance obj, their_node_id_arr, their_features_ref, msg_ref);
3491 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
3492 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3493 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
3494 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
3495 LDKInitFeatures their_features_var = their_features;
3496 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3497 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3498 long their_features_ref = (long)their_features_var.inner;
3499 if (their_features_var.is_owned) {
3500 their_features_ref |= 1;
3502 LDKAcceptChannel msg_var = *msg;
3503 if (msg->inner != NULL)
3504 msg_var = AcceptChannel_clone(msg);
3505 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3506 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3507 long msg_ref = (long)msg_var.inner;
3508 if (msg_var.is_owned) {
3511 //TODO: jobject obj = get object we can call against on j_calls->o
3512 return; //TODO: Call handle_accept_channel on j_calls with instance obj, their_node_id_arr, their_features_ref, msg_ref);
3514 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
3515 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3516 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
3517 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
3518 LDKFundingCreated msg_var = *msg;
3519 if (msg->inner != NULL)
3520 msg_var = FundingCreated_clone(msg);
3521 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3522 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3523 long msg_ref = (long)msg_var.inner;
3524 if (msg_var.is_owned) {
3527 //TODO: jobject obj = get object we can call against on j_calls->o
3528 return; //TODO: Call handle_funding_created on j_calls with instance obj, their_node_id_arr, msg_ref);
3530 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
3531 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3532 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
3533 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
3534 LDKFundingSigned msg_var = *msg;
3535 if (msg->inner != NULL)
3536 msg_var = FundingSigned_clone(msg);
3537 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3538 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3539 long msg_ref = (long)msg_var.inner;
3540 if (msg_var.is_owned) {
3543 //TODO: jobject obj = get object we can call against on j_calls->o
3544 return; //TODO: Call handle_funding_signed on j_calls with instance obj, their_node_id_arr, msg_ref);
3546 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
3547 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3548 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
3549 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
3550 LDKFundingLocked msg_var = *msg;
3551 if (msg->inner != NULL)
3552 msg_var = FundingLocked_clone(msg);
3553 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3554 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3555 long msg_ref = (long)msg_var.inner;
3556 if (msg_var.is_owned) {
3559 //TODO: jobject obj = get object we can call against on j_calls->o
3560 return; //TODO: Call handle_funding_locked on j_calls with instance obj, their_node_id_arr, msg_ref);
3562 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
3563 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3564 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
3565 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
3566 LDKShutdown msg_var = *msg;
3567 if (msg->inner != NULL)
3568 msg_var = Shutdown_clone(msg);
3569 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3570 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3571 long msg_ref = (long)msg_var.inner;
3572 if (msg_var.is_owned) {
3575 //TODO: jobject obj = get object we can call against on j_calls->o
3576 return; //TODO: Call handle_shutdown on j_calls with instance obj, their_node_id_arr, msg_ref);
3578 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
3579 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3580 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
3581 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
3582 LDKClosingSigned msg_var = *msg;
3583 if (msg->inner != NULL)
3584 msg_var = ClosingSigned_clone(msg);
3585 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3586 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3587 long msg_ref = (long)msg_var.inner;
3588 if (msg_var.is_owned) {
3591 //TODO: jobject obj = get object we can call against on j_calls->o
3592 return; //TODO: Call handle_closing_signed on j_calls with instance obj, their_node_id_arr, msg_ref);
3594 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
3595 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3596 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
3597 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
3598 LDKUpdateAddHTLC msg_var = *msg;
3599 if (msg->inner != NULL)
3600 msg_var = UpdateAddHTLC_clone(msg);
3601 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3602 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3603 long msg_ref = (long)msg_var.inner;
3604 if (msg_var.is_owned) {
3607 //TODO: jobject obj = get object we can call against on j_calls->o
3608 return; //TODO: Call handle_update_add_htlc on j_calls with instance obj, their_node_id_arr, msg_ref);
3610 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
3611 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3612 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
3613 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
3614 LDKUpdateFulfillHTLC msg_var = *msg;
3615 if (msg->inner != NULL)
3616 msg_var = UpdateFulfillHTLC_clone(msg);
3617 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3618 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3619 long msg_ref = (long)msg_var.inner;
3620 if (msg_var.is_owned) {
3623 //TODO: jobject obj = get object we can call against on j_calls->o
3624 return; //TODO: Call handle_update_fulfill_htlc on j_calls with instance obj, their_node_id_arr, msg_ref);
3626 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
3627 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3628 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
3629 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
3630 LDKUpdateFailHTLC msg_var = *msg;
3631 if (msg->inner != NULL)
3632 msg_var = UpdateFailHTLC_clone(msg);
3633 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3634 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3635 long msg_ref = (long)msg_var.inner;
3636 if (msg_var.is_owned) {
3639 //TODO: jobject obj = get object we can call against on j_calls->o
3640 return; //TODO: Call handle_update_fail_htlc on j_calls with instance obj, their_node_id_arr, msg_ref);
3642 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
3643 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3644 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
3645 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
3646 LDKUpdateFailMalformedHTLC msg_var = *msg;
3647 if (msg->inner != NULL)
3648 msg_var = UpdateFailMalformedHTLC_clone(msg);
3649 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3650 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3651 long msg_ref = (long)msg_var.inner;
3652 if (msg_var.is_owned) {
3655 //TODO: jobject obj = get object we can call against on j_calls->o
3656 return; //TODO: Call handle_update_fail_malformed_htlc on j_calls with instance obj, their_node_id_arr, msg_ref);
3658 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
3659 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3660 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
3661 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
3662 LDKCommitmentSigned msg_var = *msg;
3663 if (msg->inner != NULL)
3664 msg_var = CommitmentSigned_clone(msg);
3665 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3666 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3667 long msg_ref = (long)msg_var.inner;
3668 if (msg_var.is_owned) {
3671 //TODO: jobject obj = get object we can call against on j_calls->o
3672 return; //TODO: Call handle_commitment_signed on j_calls with instance obj, their_node_id_arr, msg_ref);
3674 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
3675 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3676 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
3677 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
3678 LDKRevokeAndACK msg_var = *msg;
3679 if (msg->inner != NULL)
3680 msg_var = RevokeAndACK_clone(msg);
3681 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3682 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3683 long msg_ref = (long)msg_var.inner;
3684 if (msg_var.is_owned) {
3687 //TODO: jobject obj = get object we can call against on j_calls->o
3688 return; //TODO: Call handle_revoke_and_ack on j_calls with instance obj, their_node_id_arr, msg_ref);
3690 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
3691 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3692 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
3693 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
3694 LDKUpdateFee msg_var = *msg;
3695 if (msg->inner != NULL)
3696 msg_var = UpdateFee_clone(msg);
3697 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3698 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3699 long msg_ref = (long)msg_var.inner;
3700 if (msg_var.is_owned) {
3703 //TODO: jobject obj = get object we can call against on j_calls->o
3704 return; //TODO: Call handle_update_fee on j_calls with instance obj, their_node_id_arr, msg_ref);
3706 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
3707 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3708 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
3709 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
3710 LDKAnnouncementSignatures msg_var = *msg;
3711 if (msg->inner != NULL)
3712 msg_var = AnnouncementSignatures_clone(msg);
3713 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3714 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3715 long msg_ref = (long)msg_var.inner;
3716 if (msg_var.is_owned) {
3719 //TODO: jobject obj = get object we can call against on j_calls->o
3720 return; //TODO: Call handle_announcement_signatures on j_calls with instance obj, their_node_id_arr, msg_ref);
3722 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
3723 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3724 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
3725 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
3726 //TODO: jobject obj = get object we can call against on j_calls->o
3727 return; //TODO: Call peer_disconnected on j_calls with instance obj, their_node_id_arr, no_connection_possible);
3729 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
3730 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3731 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
3732 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
3733 LDKInit msg_var = *msg;
3734 if (msg->inner != NULL)
3735 msg_var = Init_clone(msg);
3736 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3737 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3738 long msg_ref = (long)msg_var.inner;
3739 if (msg_var.is_owned) {
3742 //TODO: jobject obj = get object we can call against on j_calls->o
3743 return; //TODO: Call peer_connected on j_calls with instance obj, their_node_id_arr, msg_ref);
3745 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
3746 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3747 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
3748 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
3749 LDKChannelReestablish msg_var = *msg;
3750 if (msg->inner != NULL)
3751 msg_var = ChannelReestablish_clone(msg);
3752 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3753 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3754 long msg_ref = (long)msg_var.inner;
3755 if (msg_var.is_owned) {
3758 //TODO: jobject obj = get object we can call against on j_calls->o
3759 return; //TODO: Call handle_channel_reestablish on j_calls with instance obj, their_node_id_arr, msg_ref);
3761 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
3762 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3763 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
3764 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
3765 LDKErrorMessage msg_var = *msg;
3766 if (msg->inner != NULL)
3767 msg_var = ErrorMessage_clone(msg);
3768 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3769 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3770 long msg_ref = (long)msg_var.inner;
3771 if (msg_var.is_owned) {
3774 //TODO: jobject obj = get object we can call against on j_calls->o
3775 return; //TODO: Call handle_error on j_calls with instance obj, their_node_id_arr, msg_ref);
3777 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
3778 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3779 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3780 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
3781 return (void*) this_arg;
3783 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
3784 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
3785 atomic_init(&calls->refcnt, 1);
3786 //TODO: Assign calls->o from o
3788 LDKChannelMessageHandler ret = {
3789 .this_arg = (void*) calls,
3790 .handle_open_channel = handle_open_channel_jcall,
3791 .handle_accept_channel = handle_accept_channel_jcall,
3792 .handle_funding_created = handle_funding_created_jcall,
3793 .handle_funding_signed = handle_funding_signed_jcall,
3794 .handle_funding_locked = handle_funding_locked_jcall,
3795 .handle_shutdown = handle_shutdown_jcall,
3796 .handle_closing_signed = handle_closing_signed_jcall,
3797 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3798 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3799 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3800 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3801 .handle_commitment_signed = handle_commitment_signed_jcall,
3802 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3803 .handle_update_fee = handle_update_fee_jcall,
3804 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3805 .peer_disconnected = peer_disconnected_jcall,
3806 .peer_connected = peer_connected_jcall,
3807 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3808 .handle_error = handle_error_jcall,
3809 .free = LDKChannelMessageHandler_JCalls_free,
3810 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(NULL, MessageSendEventsProvider),
3812 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3815 long LDKChannelMessageHandler_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
3816 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3817 *res_ptr = LDKChannelMessageHandler_init(NULL, o, MessageSendEventsProvider);
3818 return (long)res_ptr;
3820 void ChannelMessageHandler_1handle_1open_1channel(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
3821 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3822 LDKPublicKey their_node_id_ref;
3823 CHECK(their_node_id.len == 33);
3824 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
3825 LDKInitFeatures their_features_conv;
3826 their_features_conv.inner = (void*)(their_features & (~1));
3827 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3828 // Warning: we may need a move here but can't clone!
3829 LDKOpenChannel msg_conv;
3830 msg_conv.inner = (void*)(msg & (~1));
3831 msg_conv.is_owned = false;
3832 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3835 void ChannelMessageHandler_1handle_1accept_1channel(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
3836 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3837 LDKPublicKey their_node_id_ref;
3838 CHECK(their_node_id.len == 33);
3839 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
3840 LDKInitFeatures their_features_conv;
3841 their_features_conv.inner = (void*)(their_features & (~1));
3842 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3843 // Warning: we may need a move here but can't clone!
3844 LDKAcceptChannel msg_conv;
3845 msg_conv.inner = (void*)(msg & (~1));
3846 msg_conv.is_owned = false;
3847 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3850 void ChannelMessageHandler_1handle_1funding_1created(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3851 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3852 LDKPublicKey their_node_id_ref;
3853 CHECK(their_node_id.len == 33);
3854 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
3855 LDKFundingCreated msg_conv;
3856 msg_conv.inner = (void*)(msg & (~1));
3857 msg_conv.is_owned = false;
3858 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3861 void ChannelMessageHandler_1handle_1funding_1signed(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3862 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3863 LDKPublicKey their_node_id_ref;
3864 CHECK(their_node_id.len == 33);
3865 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
3866 LDKFundingSigned msg_conv;
3867 msg_conv.inner = (void*)(msg & (~1));
3868 msg_conv.is_owned = false;
3869 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3872 void ChannelMessageHandler_1handle_1funding_1locked(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3873 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3874 LDKPublicKey their_node_id_ref;
3875 CHECK(their_node_id.len == 33);
3876 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
3877 LDKFundingLocked msg_conv;
3878 msg_conv.inner = (void*)(msg & (~1));
3879 msg_conv.is_owned = false;
3880 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3883 void ChannelMessageHandler_1handle_1shutdown(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3884 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3885 LDKPublicKey their_node_id_ref;
3886 CHECK(their_node_id.len == 33);
3887 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
3888 LDKShutdown msg_conv;
3889 msg_conv.inner = (void*)(msg & (~1));
3890 msg_conv.is_owned = false;
3891 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3894 void ChannelMessageHandler_1handle_1closing_1signed(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3895 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3896 LDKPublicKey their_node_id_ref;
3897 CHECK(their_node_id.len == 33);
3898 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
3899 LDKClosingSigned msg_conv;
3900 msg_conv.inner = (void*)(msg & (~1));
3901 msg_conv.is_owned = false;
3902 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3905 void ChannelMessageHandler_1handle_1update_1add_1htlc(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3906 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3907 LDKPublicKey their_node_id_ref;
3908 CHECK(their_node_id.len == 33);
3909 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
3910 LDKUpdateAddHTLC msg_conv;
3911 msg_conv.inner = (void*)(msg & (~1));
3912 msg_conv.is_owned = false;
3913 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3916 void ChannelMessageHandler_1handle_1update_1fulfill_1htlc(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3917 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3918 LDKPublicKey their_node_id_ref;
3919 CHECK(their_node_id.len == 33);
3920 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
3921 LDKUpdateFulfillHTLC msg_conv;
3922 msg_conv.inner = (void*)(msg & (~1));
3923 msg_conv.is_owned = false;
3924 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3927 void ChannelMessageHandler_1handle_1update_1fail_1htlc(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3928 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3929 LDKPublicKey their_node_id_ref;
3930 CHECK(their_node_id.len == 33);
3931 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
3932 LDKUpdateFailHTLC msg_conv;
3933 msg_conv.inner = (void*)(msg & (~1));
3934 msg_conv.is_owned = false;
3935 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3938 void ChannelMessageHandler_1handle_1update_1fail_1malformed_1htlc(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3939 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3940 LDKPublicKey their_node_id_ref;
3941 CHECK(their_node_id.len == 33);
3942 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
3943 LDKUpdateFailMalformedHTLC msg_conv;
3944 msg_conv.inner = (void*)(msg & (~1));
3945 msg_conv.is_owned = false;
3946 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3949 void ChannelMessageHandler_1handle_1commitment_1signed(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3950 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3951 LDKPublicKey their_node_id_ref;
3952 CHECK(their_node_id.len == 33);
3953 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
3954 LDKCommitmentSigned msg_conv;
3955 msg_conv.inner = (void*)(msg & (~1));
3956 msg_conv.is_owned = false;
3957 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3960 void ChannelMessageHandler_1handle_1revoke_1and_1ack(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3961 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3962 LDKPublicKey their_node_id_ref;
3963 CHECK(their_node_id.len == 33);
3964 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
3965 LDKRevokeAndACK msg_conv;
3966 msg_conv.inner = (void*)(msg & (~1));
3967 msg_conv.is_owned = false;
3968 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3971 void ChannelMessageHandler_1handle_1update_1fee(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3972 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3973 LDKPublicKey their_node_id_ref;
3974 CHECK(their_node_id.len == 33);
3975 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
3976 LDKUpdateFee msg_conv;
3977 msg_conv.inner = (void*)(msg & (~1));
3978 msg_conv.is_owned = false;
3979 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3982 void ChannelMessageHandler_1handle_1announcement_1signatures(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3983 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3984 LDKPublicKey their_node_id_ref;
3985 CHECK(their_node_id.len == 33);
3986 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
3987 LDKAnnouncementSignatures msg_conv;
3988 msg_conv.inner = (void*)(msg & (~1));
3989 msg_conv.is_owned = false;
3990 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3993 void ChannelMessageHandler_1peer_1disconnected(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
3994 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3995 LDKPublicKey their_node_id_ref;
3996 CHECK(their_node_id.len == 33);
3997 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
3998 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
4001 void ChannelMessageHandler_1peer_1connected(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4002 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4003 LDKPublicKey their_node_id_ref;
4004 CHECK(their_node_id.len == 33);
4005 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
4007 msg_conv.inner = (void*)(msg & (~1));
4008 msg_conv.is_owned = false;
4009 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4012 void ChannelMessageHandler_1handle_1channel_1reestablish(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4013 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4014 LDKPublicKey their_node_id_ref;
4015 CHECK(their_node_id.len == 33);
4016 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
4017 LDKChannelReestablish msg_conv;
4018 msg_conv.inner = (void*)(msg & (~1));
4019 msg_conv.is_owned = false;
4020 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4023 void ChannelMessageHandler_1handle_1error(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4024 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4025 LDKPublicKey their_node_id_ref;
4026 CHECK(their_node_id.len == 33);
4027 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
4028 LDKErrorMessage msg_conv;
4029 msg_conv.inner = (void*)(msg & (~1));
4030 msg_conv.is_owned = false;
4031 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4034 typedef struct LDKRoutingMessageHandler_JCalls {
4035 atomic_size_t refcnt;
4036 // TODO: Object pointer o;
4037 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4038 // TODO: Some kind of method pointer handle_node_announcement_meth;
4039 // TODO: Some kind of method pointer handle_channel_announcement_meth;
4040 // TODO: Some kind of method pointer handle_channel_update_meth;
4041 // TODO: Some kind of method pointer handle_htlc_fail_channel_update_meth;
4042 // TODO: Some kind of method pointer get_next_channel_announcements_meth;
4043 // TODO: Some kind of method pointer get_next_node_announcements_meth;
4044 // TODO: Some kind of method pointer sync_routing_table_meth;
4045 // TODO: Some kind of method pointer handle_reply_channel_range_meth;
4046 // TODO: Some kind of method pointer handle_reply_short_channel_ids_end_meth;
4047 // TODO: Some kind of method pointer handle_query_channel_range_meth;
4048 // TODO: Some kind of method pointer handle_query_short_channel_ids_meth;
4049 } LDKRoutingMessageHandler_JCalls;
4050 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
4051 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4052 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4053 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
4057 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
4058 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4059 LDKNodeAnnouncement msg_var = *msg;
4060 if (msg->inner != NULL)
4061 msg_var = NodeAnnouncement_clone(msg);
4062 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4063 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4064 long msg_ref = (long)msg_var.inner;
4065 if (msg_var.is_owned) {
4068 //TODO: jobject obj = get object we can call against on j_calls->o
4069 LDKCResult_boolLightningErrorZ* ret; // TODO: Call handle_node_announcement on j_calls with instance obj, returning a pointer, msg_ref);
4070 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
4074 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
4075 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4076 LDKChannelAnnouncement msg_var = *msg;
4077 if (msg->inner != NULL)
4078 msg_var = ChannelAnnouncement_clone(msg);
4079 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4080 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4081 long msg_ref = (long)msg_var.inner;
4082 if (msg_var.is_owned) {
4085 //TODO: jobject obj = get object we can call against on j_calls->o
4086 LDKCResult_boolLightningErrorZ* ret; // TODO: Call handle_channel_announcement on j_calls with instance obj, returning a pointer, msg_ref);
4087 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
4091 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
4092 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4093 LDKChannelUpdate msg_var = *msg;
4094 if (msg->inner != NULL)
4095 msg_var = ChannelUpdate_clone(msg);
4096 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4097 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4098 long msg_ref = (long)msg_var.inner;
4099 if (msg_var.is_owned) {
4102 //TODO: jobject obj = get object we can call against on j_calls->o
4103 LDKCResult_boolLightningErrorZ* ret; // TODO: Call handle_channel_update on j_calls with instance obj, returning a pointer, msg_ref);
4104 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
4108 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
4109 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4110 long ret_update = (long)update;
4111 //TODO: jobject obj = get object we can call against on j_calls->o
4112 return; //TODO: Call handle_htlc_fail_channel_update on j_calls with instance obj, ret_update);
4114 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
4115 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4116 //TODO: jobject obj = get object we can call against on j_calls->o
4117 uint32_tArray arg; // TODO: Call get_next_channel_announcements on j_calls with instance obj, returning an object, starting_point, batch_amount);
4118 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
4119 arg_constr.datalen = arg.len;
4120 if (arg_constr.datalen > 0)
4121 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4123 arg_constr.data = NULL;
4124 uint32_t* arg_vals = (uint32_t*) arg.ptr;
4125 for (size_t l = 0; l < arg_constr.datalen; l++) {
4126 uint32_t arr_conv_63 = arg_vals[l];
4127 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
4128 FREE((void*)arr_conv_63);
4129 arg_constr.data[l] = arr_conv_63_conv;
4133 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
4134 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4135 int8_tArray starting_point_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
4136 memcpy(starting_point_arr.ptr, starting_point.compressed_form, 33);
4137 //TODO: jobject obj = get object we can call against on j_calls->o
4138 uint32_tArray arg; // TODO: Call get_next_node_announcements on j_calls with instance obj, returning an object, starting_point_arr, batch_amount);
4139 LDKCVec_NodeAnnouncementZ arg_constr;
4140 arg_constr.datalen = arg.len;
4141 if (arg_constr.datalen > 0)
4142 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
4144 arg_constr.data = NULL;
4145 uint32_t* arg_vals = (uint32_t*) arg.ptr;
4146 for (size_t s = 0; s < arg_constr.datalen; s++) {
4147 uint32_t arr_conv_18 = arg_vals[s];
4148 LDKNodeAnnouncement arr_conv_18_conv;
4149 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
4150 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
4151 if (arr_conv_18_conv.inner != NULL)
4152 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
4153 arg_constr.data[s] = arr_conv_18_conv;
4157 void sync_routing_table_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
4158 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4159 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
4160 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
4161 LDKInit init_var = *init;
4162 if (init->inner != NULL)
4163 init_var = Init_clone(init);
4164 CHECK((((long)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4165 CHECK((((long)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4166 long init_ref = (long)init_var.inner;
4167 if (init_var.is_owned) {
4170 //TODO: jobject obj = get object we can call against on j_calls->o
4171 return; //TODO: Call sync_routing_table on j_calls with instance obj, their_node_id_arr, init_ref);
4173 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
4174 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4175 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
4176 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
4177 LDKReplyChannelRange msg_var = msg;
4178 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4179 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4180 long msg_ref = (long)msg_var.inner;
4181 if (msg_var.is_owned) {
4184 //TODO: jobject obj = get object we can call against on j_calls->o
4185 LDKCResult_NoneLightningErrorZ* ret; // TODO: Call handle_reply_channel_range on j_calls with instance obj, returning a pointer, their_node_id_arr, msg_ref);
4186 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)ret;
4190 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
4191 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4192 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
4193 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
4194 LDKReplyShortChannelIdsEnd msg_var = msg;
4195 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4196 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4197 long msg_ref = (long)msg_var.inner;
4198 if (msg_var.is_owned) {
4201 //TODO: jobject obj = get object we can call against on j_calls->o
4202 LDKCResult_NoneLightningErrorZ* ret; // TODO: Call handle_reply_short_channel_ids_end on j_calls with instance obj, returning a pointer, their_node_id_arr, msg_ref);
4203 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)ret;
4207 LDKCResult_NoneLightningErrorZ handle_query_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
4208 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4209 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
4210 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
4211 LDKQueryChannelRange msg_var = msg;
4212 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4213 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4214 long msg_ref = (long)msg_var.inner;
4215 if (msg_var.is_owned) {
4218 //TODO: jobject obj = get object we can call against on j_calls->o
4219 LDKCResult_NoneLightningErrorZ* ret; // TODO: Call handle_query_channel_range on j_calls with instance obj, returning a pointer, their_node_id_arr, msg_ref);
4220 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)ret;
4224 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
4225 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4226 int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
4227 memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
4228 LDKQueryShortChannelIds msg_var = msg;
4229 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4230 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4231 long msg_ref = (long)msg_var.inner;
4232 if (msg_var.is_owned) {
4235 //TODO: jobject obj = get object we can call against on j_calls->o
4236 LDKCResult_NoneLightningErrorZ* ret; // TODO: Call handle_query_short_channel_ids on j_calls with instance obj, returning a pointer, their_node_id_arr, msg_ref);
4237 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)ret;
4241 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
4242 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4243 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4244 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
4245 return (void*) this_arg;
4247 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
4248 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
4249 atomic_init(&calls->refcnt, 1);
4250 //TODO: Assign calls->o from o
4252 LDKRoutingMessageHandler ret = {
4253 .this_arg = (void*) calls,
4254 .handle_node_announcement = handle_node_announcement_jcall,
4255 .handle_channel_announcement = handle_channel_announcement_jcall,
4256 .handle_channel_update = handle_channel_update_jcall,
4257 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
4258 .get_next_channel_announcements = get_next_channel_announcements_jcall,
4259 .get_next_node_announcements = get_next_node_announcements_jcall,
4260 .sync_routing_table = sync_routing_table_jcall,
4261 .handle_reply_channel_range = handle_reply_channel_range_jcall,
4262 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_jcall,
4263 .handle_query_channel_range = handle_query_channel_range_jcall,
4264 .handle_query_short_channel_ids = handle_query_short_channel_ids_jcall,
4265 .free = LDKRoutingMessageHandler_JCalls_free,
4266 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(NULL, MessageSendEventsProvider),
4268 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
4271 long LDKRoutingMessageHandler_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
4272 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
4273 *res_ptr = LDKRoutingMessageHandler_init(NULL, o, MessageSendEventsProvider);
4274 return (long)res_ptr;
4276 uint32_t RoutingMessageHandler_1handle_1node_1announcement(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
4277 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4278 LDKNodeAnnouncement msg_conv;
4279 msg_conv.inner = (void*)(msg & (~1));
4280 msg_conv.is_owned = false;
4281 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4282 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
4283 return (long)ret_conv;
4286 uint32_t RoutingMessageHandler_1handle_1channel_1announcement(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
4287 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4288 LDKChannelAnnouncement msg_conv;
4289 msg_conv.inner = (void*)(msg & (~1));
4290 msg_conv.is_owned = false;
4291 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4292 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4293 return (long)ret_conv;
4296 uint32_t RoutingMessageHandler_1handle_1channel_1update(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
4297 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4298 LDKChannelUpdate msg_conv;
4299 msg_conv.inner = (void*)(msg & (~1));
4300 msg_conv.is_owned = false;
4301 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4302 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
4303 return (long)ret_conv;
4306 void RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(void* ctx_TODO, uint32_t this_arg, uint32_t update) {
4307 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4308 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
4309 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
4312 uint32_tArray RoutingMessageHandler_1get_1next_1channel_1announcements(void* ctx_TODO, uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
4313 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4314 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
4315 uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
4316 uint32_t *ret_arr_ptr = (uint32_t*)ret_arr.ptr;
4317 for (size_t l = 0; l < ret_var.datalen; l++) {
4318 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arr_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4319 *arr_conv_63_ref = ret_var.data[l];
4320 arr_conv_63_ref->a = ChannelAnnouncement_clone(&arr_conv_63_ref->a);
4321 arr_conv_63_ref->b = ChannelUpdate_clone(&arr_conv_63_ref->b);
4322 arr_conv_63_ref->c = ChannelUpdate_clone(&arr_conv_63_ref->c);
4323 ret_arr_ptr[l] = (long)arr_conv_63_ref;
4329 uint32_tArray RoutingMessageHandler_1get_1next_1node_1announcements(void* ctx_TODO, uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
4330 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4331 LDKPublicKey starting_point_ref;
4332 CHECK(starting_point.len == 33);
4333 memcpy(starting_point_ref.compressed_form, starting_point.ptr, 33);
4334 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
4335 uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
4336 uint32_t *ret_arr_ptr = (uint32_t*)ret_arr.ptr;
4337 for (size_t s = 0; s < ret_var.datalen; s++) {
4338 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
4339 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4340 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4341 long arr_conv_18_ref = (long)arr_conv_18_var.inner;
4342 if (arr_conv_18_var.is_owned) {
4343 arr_conv_18_ref |= 1;
4345 ret_arr_ptr[s] = arr_conv_18_ref;
4351 void RoutingMessageHandler_1sync_1routing_1table(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
4352 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4353 LDKPublicKey their_node_id_ref;
4354 CHECK(their_node_id.len == 33);
4355 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
4357 init_conv.inner = (void*)(init & (~1));
4358 init_conv.is_owned = false;
4359 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
4362 uint32_t RoutingMessageHandler_1handle_1reply_1channel_1range(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4363 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4364 LDKPublicKey their_node_id_ref;
4365 CHECK(their_node_id.len == 33);
4366 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
4367 LDKReplyChannelRange msg_conv;
4368 msg_conv.inner = (void*)(msg & (~1));
4369 msg_conv.is_owned = (msg & 1) || (msg == 0);
4370 if (msg_conv.inner != NULL)
4371 msg_conv = ReplyChannelRange_clone(&msg_conv);
4372 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
4373 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
4374 return (long)ret_conv;
4377 uint32_t RoutingMessageHandler_1handle_1reply_1short_1channel_1ids_1end(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4378 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4379 LDKPublicKey their_node_id_ref;
4380 CHECK(their_node_id.len == 33);
4381 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
4382 LDKReplyShortChannelIdsEnd msg_conv;
4383 msg_conv.inner = (void*)(msg & (~1));
4384 msg_conv.is_owned = (msg & 1) || (msg == 0);
4385 if (msg_conv.inner != NULL)
4386 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
4387 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
4388 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
4389 return (long)ret_conv;
4392 uint32_t RoutingMessageHandler_1handle_1query_1channel_1range(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4393 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4394 LDKPublicKey their_node_id_ref;
4395 CHECK(their_node_id.len == 33);
4396 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
4397 LDKQueryChannelRange msg_conv;
4398 msg_conv.inner = (void*)(msg & (~1));
4399 msg_conv.is_owned = (msg & 1) || (msg == 0);
4400 if (msg_conv.inner != NULL)
4401 msg_conv = QueryChannelRange_clone(&msg_conv);
4402 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
4403 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
4404 return (long)ret_conv;
4407 uint32_t RoutingMessageHandler_1handle_1query_1short_1channel_1ids(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4408 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4409 LDKPublicKey their_node_id_ref;
4410 CHECK(their_node_id.len == 33);
4411 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
4412 LDKQueryShortChannelIds msg_conv;
4413 msg_conv.inner = (void*)(msg & (~1));
4414 msg_conv.is_owned = (msg & 1) || (msg == 0);
4415 if (msg_conv.inner != NULL)
4416 msg_conv = QueryShortChannelIds_clone(&msg_conv);
4417 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
4418 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
4419 return (long)ret_conv;
4422 typedef struct LDKSocketDescriptor_JCalls {
4423 atomic_size_t refcnt;
4424 // TODO: Object pointer o;
4425 // TODO: Some kind of method pointer send_data_meth;
4426 // TODO: Some kind of method pointer disconnect_socket_meth;
4427 // TODO: Some kind of method pointer eq_meth;
4428 // TODO: Some kind of method pointer hash_meth;
4429 } LDKSocketDescriptor_JCalls;
4430 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
4431 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4432 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4433 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
4437 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
4438 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4439 LDKu8slice data_var = data;
4440 int8_tArray data_arr = { .len = data_var.datalen, .ptr = MALLOC(data_var.datalen, "Native int8_tArray Bytes") };
4441 memcpy(data_arr.ptr, data_var.data, data_var.datalen);
4442 //TODO: jobject obj = get object we can call against on j_calls->o
4443 return 0; //TODO: Call send_data on j_calls with instance obj, returning number, data_arr, resume_read);
4445 void disconnect_socket_jcall(void* this_arg) {
4446 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4447 //TODO: jobject obj = get object we can call against on j_calls->o
4448 return; //TODO: Call disconnect_socket on j_calls with instance obj);
4450 bool eq_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
4451 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4452 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
4453 *other_arg_clone = SocketDescriptor_clone(other_arg);
4454 //TODO: jobject obj = get object we can call against on j_calls->o
4455 return 0; //TODO: Call eq on j_calls with instance obj, returning boolean, (long)other_arg_clone);
4457 uint64_t hash_jcall(const void* this_arg) {
4458 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4459 //TODO: jobject obj = get object we can call against on j_calls->o
4460 return 0; //TODO: Call hash on j_calls with instance obj, returning number);
4462 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
4463 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4464 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4465 return (void*) this_arg;
4467 static inline LDKSocketDescriptor LDKSocketDescriptor_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
4468 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
4469 atomic_init(&calls->refcnt, 1);
4470 //TODO: Assign calls->o from o
4472 LDKSocketDescriptor ret = {
4473 .this_arg = (void*) calls,
4474 .send_data = send_data_jcall,
4475 .disconnect_socket = disconnect_socket_jcall,
4478 .clone = LDKSocketDescriptor_JCalls_clone,
4479 .free = LDKSocketDescriptor_JCalls_free,
4483 long LDKSocketDescriptor_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
4484 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
4485 *res_ptr = LDKSocketDescriptor_init(NULL, o);
4486 return (long)res_ptr;
4488 intptr_t SocketDescriptor_1send_1data(void* ctx_TODO, uint32_t this_arg, int8_tArray data, jboolean resume_read) {
4489 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4490 LDKu8slice data_ref;
4491 data_ref.datalen = data.len;
4492 data_ref.data = data.ptr;
4493 intptr_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
4497 void SocketDescriptor_1disconnect_1socket(void* ctx_TODO, uint32_t this_arg) {
4498 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4499 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
4502 int64_t SocketDescriptor_1hash(void* ctx_TODO, uint32_t this_arg) {
4503 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4504 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
4508 void Transaction_1free(void* ctx_TODO, int8_tArray _res) {
4509 LDKTransaction _res_ref;
4510 _res_ref.datalen = _res.len;
4511 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
4512 memcpy(_res_ref.data, _res.ptr, _res_ref.datalen);
4513 _res_ref.data_is_owned = true;
4514 Transaction_free(_res_ref);
4517 void TxOut_1free(void* ctx_TODO, uint32_t _res) {
4518 LDKTxOut _res_conv = *(LDKTxOut*)_res;
4520 TxOut_free(_res_conv);
4523 void CVec_1SpendableOutputDescriptorZ_1free(void* ctx_TODO, uint32_tArray _res) {
4524 LDKCVec_SpendableOutputDescriptorZ _res_constr;
4525 _res_constr.datalen = _res.len;
4526 if (_res_constr.datalen > 0)
4527 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
4529 _res_constr.data = NULL;
4530 uint32_t* _res_vals = (uint32_t*) _res.ptr;
4531 for (size_t b = 0; b < _res_constr.datalen; b++) {
4532 uint32_t arr_conv_27 = _res_vals[b];
4533 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)arr_conv_27;
4534 FREE((void*)arr_conv_27);
4535 _res_constr.data[b] = arr_conv_27_conv;
4537 CVec_SpendableOutputDescriptorZ_free(_res_constr);
4540 void CVec_1MessageSendEventZ_1free(void* ctx_TODO, uint32_tArray _res) {
4541 LDKCVec_MessageSendEventZ _res_constr;
4542 _res_constr.datalen = _res.len;
4543 if (_res_constr.datalen > 0)
4544 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
4546 _res_constr.data = NULL;
4547 uint32_t* _res_vals = (uint32_t*) _res.ptr;
4548 for (size_t s = 0; s < _res_constr.datalen; s++) {
4549 uint32_t arr_conv_18 = _res_vals[s];
4550 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
4551 FREE((void*)arr_conv_18);
4552 _res_constr.data[s] = arr_conv_18_conv;
4554 CVec_MessageSendEventZ_free(_res_constr);
4557 void CVec_1EventZ_1free(void* ctx_TODO, uint32_tArray _res) {
4558 LDKCVec_EventZ _res_constr;
4559 _res_constr.datalen = _res.len;
4560 if (_res_constr.datalen > 0)
4561 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
4563 _res_constr.data = NULL;
4564 uint32_t* _res_vals = (uint32_t*) _res.ptr;
4565 for (size_t h = 0; h < _res_constr.datalen; h++) {
4566 uint32_t arr_conv_7 = _res_vals[h];
4567 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
4568 FREE((void*)arr_conv_7);
4569 _res_constr.data[h] = arr_conv_7_conv;
4571 CVec_EventZ_free(_res_constr);
4574 void C2Tuple_1usizeTransactionZ_1free(void* ctx_TODO, uint32_t _res) {
4575 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)_res;
4577 C2Tuple_usizeTransactionZ_free(_res_conv);
4580 uint32_t C2Tuple_1usizeTransactionZ_1new(void* ctx_TODO, intptr_t a, int8_tArray b) {
4581 LDKTransaction b_ref;
4582 b_ref.datalen = b.len;
4583 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
4584 memcpy(b_ref.data, b.ptr, b_ref.datalen);
4585 b_ref.data_is_owned = true;
4586 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
4587 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
4588 // XXX: We likely need to clone here, but no _clone fn is available for Uint8Array
4589 return (long)ret_ref;
4592 void CVec_1C2Tuple_1usizeTransactionZZ_1free(void* ctx_TODO, uint32_tArray _res) {
4593 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
4594 _res_constr.datalen = _res.len;
4595 if (_res_constr.datalen > 0)
4596 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
4598 _res_constr.data = NULL;
4599 uint32_t* _res_vals = (uint32_t*) _res.ptr;
4600 for (size_t e = 0; e < _res_constr.datalen; e++) {
4601 uint32_t arr_conv_30 = _res_vals[e];
4602 LDKC2Tuple_usizeTransactionZ arr_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_30;
4603 FREE((void*)arr_conv_30);
4604 _res_constr.data[e] = arr_conv_30_conv;
4606 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
4609 uint32_t CResult_1NoneChannelMonitorUpdateErrZ_1ok(void* ctx_TODO) {
4610 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4611 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
4612 return (long)ret_conv;
4615 uint32_t CResult_1NoneChannelMonitorUpdateErrZ_1err(void* ctx_TODO, uint32_t e) {
4616 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
4617 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4618 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
4619 return (long)ret_conv;
4622 void CResult_1NoneChannelMonitorUpdateErrZ_1free(void* ctx_TODO, uint32_t _res) {
4623 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)_res;
4625 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
4628 void CVec_1MonitorEventZ_1free(void* ctx_TODO, uint32_tArray _res) {
4629 LDKCVec_MonitorEventZ _res_constr;
4630 _res_constr.datalen = _res.len;
4631 if (_res_constr.datalen > 0)
4632 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
4634 _res_constr.data = NULL;
4635 uint32_t* _res_vals = (uint32_t*) _res.ptr;
4636 for (size_t o = 0; o < _res_constr.datalen; o++) {
4637 uint32_t arr_conv_14 = _res_vals[o];
4638 LDKMonitorEvent arr_conv_14_conv;
4639 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
4640 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
4641 _res_constr.data[o] = arr_conv_14_conv;
4643 CVec_MonitorEventZ_free(_res_constr);
4646 uint32_t CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4647 LDKChannelMonitorUpdate o_conv;
4648 o_conv.inner = (void*)(o & (~1));
4649 o_conv.is_owned = (o & 1) || (o == 0);
4650 if (o_conv.inner != NULL)
4651 o_conv = ChannelMonitorUpdate_clone(&o_conv);
4652 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
4653 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
4654 return (long)ret_conv;
4657 uint32_t CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
4658 LDKDecodeError e_conv;
4659 e_conv.inner = (void*)(e & (~1));
4660 e_conv.is_owned = (e & 1) || (e == 0);
4661 // Warning: we may need a move here but can't clone!
4662 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
4663 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
4664 return (long)ret_conv;
4667 void CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4668 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)_res;
4670 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
4673 uint32_t CResult_1NoneMonitorUpdateErrorZ_1ok(void* ctx_TODO) {
4674 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4675 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
4676 return (long)ret_conv;
4679 uint32_t CResult_1NoneMonitorUpdateErrorZ_1err(void* ctx_TODO, uint32_t e) {
4680 LDKMonitorUpdateError e_conv;
4681 e_conv.inner = (void*)(e & (~1));
4682 e_conv.is_owned = (e & 1) || (e == 0);
4683 // Warning: we may need a move here but can't clone!
4684 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4685 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
4686 return (long)ret_conv;
4689 void CResult_1NoneMonitorUpdateErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4690 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)_res;
4692 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
4695 void C2Tuple_1OutPointScriptZ_1free(void* ctx_TODO, uint32_t _res) {
4696 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)_res;
4698 C2Tuple_OutPointScriptZ_free(_res_conv);
4701 uint32_t C2Tuple_1OutPointScriptZ_1new(void* ctx_TODO, uint32_t a, int8_tArray b) {
4703 a_conv.inner = (void*)(a & (~1));
4704 a_conv.is_owned = (a & 1) || (a == 0);
4705 if (a_conv.inner != NULL)
4706 a_conv = OutPoint_clone(&a_conv);
4708 b_ref.datalen = b.len;
4709 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4710 memcpy(b_ref.data, b.ptr, b_ref.datalen);
4711 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4712 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
4713 ret_ref->a = OutPoint_clone(&ret_ref->a);
4714 ret_ref->b = CVec_u8Z_clone(&ret_ref->b);
4715 return (long)ret_ref;
4718 void CVec_1TransactionZ_1free(void* ctx_TODO, ptrArray _res) {
4719 LDKCVec_TransactionZ _res_constr;
4720 _res_constr.datalen = _res.len;
4721 if (_res_constr.datalen > 0)
4722 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
4724 _res_constr.data = NULL;
4725 int8_tArray* _res_vals = (int8_tArray*) _res.ptr;
4726 for (size_t m = 0; m < _res_constr.datalen; m++) {
4727 int8_tArray arr_conv_12 = _res_vals[m];
4728 LDKTransaction arr_conv_12_ref;
4729 arr_conv_12_ref.datalen = arr_conv_12.len;
4730 arr_conv_12_ref.data = MALLOC(arr_conv_12_ref.datalen, "LDKTransaction Bytes");
4731 memcpy(arr_conv_12_ref.data, arr_conv_12.ptr, arr_conv_12_ref.datalen);
4732 arr_conv_12_ref.data_is_owned = true;
4733 _res_constr.data[m] = arr_conv_12_ref;
4735 CVec_TransactionZ_free(_res_constr);
4738 void C2Tuple_1u32TxOutZ_1free(void* ctx_TODO, uint32_t _res) {
4739 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)_res;
4741 C2Tuple_u32TxOutZ_free(_res_conv);
4744 uint32_t C2Tuple_1u32TxOutZ_1new(void* ctx_TODO, int32_t a, uint32_t b) {
4745 LDKTxOut b_conv = *(LDKTxOut*)b;
4747 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
4748 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
4749 // XXX: We likely need to clone here, but no _clone fn is available for TxOut
4750 return (long)ret_ref;
4753 void CVec_1C2Tuple_1u32TxOutZZ_1free(void* ctx_TODO, uint32_tArray _res) {
4754 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
4755 _res_constr.datalen = _res.len;
4756 if (_res_constr.datalen > 0)
4757 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
4759 _res_constr.data = NULL;
4760 uint32_t* _res_vals = (uint32_t*) _res.ptr;
4761 for (size_t z = 0; z < _res_constr.datalen; z++) {
4762 uint32_t arr_conv_25 = _res_vals[z];
4763 LDKC2Tuple_u32TxOutZ arr_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)arr_conv_25;
4764 FREE((void*)arr_conv_25);
4765 _res_constr.data[z] = arr_conv_25_conv;
4767 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
4770 void C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(void* ctx_TODO, uint32_t _res) {
4771 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)_res;
4773 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
4776 uint32_t C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(void* ctx_TODO, int8_tArray a, uint32_tArray b) {
4777 LDKThirtyTwoBytes a_ref;
4779 memcpy(a_ref.data, a.ptr, 32);
4780 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
4781 b_constr.datalen = b.len;
4782 if (b_constr.datalen > 0)
4783 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
4785 b_constr.data = NULL;
4786 uint32_t* b_vals = (uint32_t*) b.ptr;
4787 for (size_t z = 0; z < b_constr.datalen; z++) {
4788 uint32_t arr_conv_25 = b_vals[z];
4789 LDKC2Tuple_u32TxOutZ arr_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)arr_conv_25;
4790 FREE((void*)arr_conv_25);
4791 b_constr.data[z] = arr_conv_25_conv;
4793 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
4794 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
4795 ret_ref->a = ThirtyTwoBytes_clone(&ret_ref->a);
4796 // XXX: We likely need to clone here, but no _clone fn is available for TwoTuple<Number, TxOut>[]
4797 return (long)ret_ref;
4800 void CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(void* ctx_TODO, uint32_tArray _res) {
4801 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
4802 _res_constr.datalen = _res.len;
4803 if (_res_constr.datalen > 0)
4804 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
4806 _res_constr.data = NULL;
4807 uint32_t* _res_vals = (uint32_t*) _res.ptr;
4808 for (size_t x = 0; x < _res_constr.datalen; x++) {
4809 uint32_t arr_conv_49 = _res_vals[x];
4810 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_conv_49_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)arr_conv_49;
4811 FREE((void*)arr_conv_49);
4812 _res_constr.data[x] = arr_conv_49_conv;
4814 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
4817 void C2Tuple_1BlockHashChannelMonitorZ_1free(void* ctx_TODO, uint32_t _res) {
4818 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)_res;
4820 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
4823 uint32_t C2Tuple_1BlockHashChannelMonitorZ_1new(void* ctx_TODO, int8_tArray a, uint32_t b) {
4824 LDKThirtyTwoBytes a_ref;
4826 memcpy(a_ref.data, a.ptr, 32);
4827 LDKChannelMonitor b_conv;
4828 b_conv.inner = (void*)(b & (~1));
4829 b_conv.is_owned = (b & 1) || (b == 0);
4830 // Warning: we may need a move here but can't clone!
4831 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
4832 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
4833 ret_ref->a = ThirtyTwoBytes_clone(&ret_ref->a);
4834 // XXX: We likely need to clone here, but no _clone fn is available for ChannelMonitor
4835 return (long)ret_ref;
4838 uint32_t CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4839 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)o;
4841 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
4842 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
4843 return (long)ret_conv;
4846 uint32_t CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
4847 LDKDecodeError e_conv;
4848 e_conv.inner = (void*)(e & (~1));
4849 e_conv.is_owned = (e & 1) || (e == 0);
4850 // Warning: we may need a move here but can't clone!
4851 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
4852 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
4853 return (long)ret_conv;
4856 void CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4857 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)_res;
4859 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
4862 void C2Tuple_1u64u64Z_1free(void* ctx_TODO, uint32_t _res) {
4863 LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)_res;
4865 C2Tuple_u64u64Z_free(_res_conv);
4868 uint32_t C2Tuple_1u64u64Z_1new(void* ctx_TODO, int64_t a, int64_t b) {
4869 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
4870 *ret_ref = C2Tuple_u64u64Z_new(a, b);
4871 return (long)ret_ref;
4874 uint32_t CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4875 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)o;
4877 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
4878 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
4879 return (long)ret_conv;
4882 uint32_t CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
4883 LDKDecodeError e_conv;
4884 e_conv.inner = (void*)(e & (~1));
4885 e_conv.is_owned = (e & 1) || (e == 0);
4886 // Warning: we may need a move here but can't clone!
4887 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
4888 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
4889 return (long)ret_conv;
4892 void CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4893 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)_res;
4895 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
4898 void CVec_1SignatureZ_1free(void* ctx_TODO, ptrArray _res) {
4899 LDKCVec_SignatureZ _res_constr;
4900 _res_constr.datalen = _res.len;
4901 if (_res_constr.datalen > 0)
4902 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4904 _res_constr.data = NULL;
4905 int8_tArray* _res_vals = (int8_tArray*) _res.ptr;
4906 for (size_t m = 0; m < _res_constr.datalen; m++) {
4907 int8_tArray arr_conv_12 = _res_vals[m];
4908 LDKSignature arr_conv_12_ref;
4909 CHECK(arr_conv_12.len == 64);
4910 memcpy(arr_conv_12_ref.compact_form, arr_conv_12.ptr, 64);
4911 _res_constr.data[m] = arr_conv_12_ref;
4913 CVec_SignatureZ_free(_res_constr);
4916 void C2Tuple_1SignatureCVec_1SignatureZZ_1free(void* ctx_TODO, uint32_t _res) {
4917 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)_res;
4919 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
4922 uint32_t C2Tuple_1SignatureCVec_1SignatureZZ_1new(void* ctx_TODO, int8_tArray a, ptrArray b) {
4925 memcpy(a_ref.compact_form, a.ptr, 64);
4926 LDKCVec_SignatureZ b_constr;
4927 b_constr.datalen = b.len;
4928 if (b_constr.datalen > 0)
4929 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4931 b_constr.data = NULL;
4932 int8_tArray* b_vals = (int8_tArray*) b.ptr;
4933 for (size_t m = 0; m < b_constr.datalen; m++) {
4934 int8_tArray arr_conv_12 = b_vals[m];
4935 LDKSignature arr_conv_12_ref;
4936 CHECK(arr_conv_12.len == 64);
4937 memcpy(arr_conv_12_ref.compact_form, arr_conv_12.ptr, 64);
4938 b_constr.data[m] = arr_conv_12_ref;
4940 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
4941 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
4942 // XXX: We likely need to clone here, but no _clone fn is available for Uint8Array
4943 // XXX: We likely need to clone here, but no _clone fn is available for Uint8Array[]
4944 return (long)ret_ref;
4947 uint32_t CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(void* ctx_TODO, uint32_t o) {
4948 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)o;
4950 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4951 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
4952 return (long)ret_conv;
4955 uint32_t CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(void* ctx_TODO) {
4956 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4957 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
4958 return (long)ret_conv;
4961 void CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(void* ctx_TODO, uint32_t _res) {
4962 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)_res;
4964 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
4967 uint32_t CResult_1SignatureNoneZ_1ok(void* ctx_TODO, int8_tArray o) {
4970 memcpy(o_ref.compact_form, o.ptr, 64);
4971 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4972 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
4973 return (long)ret_conv;
4976 uint32_t CResult_1SignatureNoneZ_1err(void* ctx_TODO) {
4977 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4978 *ret_conv = CResult_SignatureNoneZ_err();
4979 return (long)ret_conv;
4982 void CResult_1SignatureNoneZ_1free(void* ctx_TODO, uint32_t _res) {
4983 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)_res;
4985 CResult_SignatureNoneZ_free(_res_conv);
4988 uint32_t CResult_1CVec_1SignatureZNoneZ_1ok(void* ctx_TODO, ptrArray o) {
4989 LDKCVec_SignatureZ o_constr;
4990 o_constr.datalen = o.len;
4991 if (o_constr.datalen > 0)
4992 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4994 o_constr.data = NULL;
4995 int8_tArray* o_vals = (int8_tArray*) o.ptr;
4996 for (size_t m = 0; m < o_constr.datalen; m++) {
4997 int8_tArray arr_conv_12 = o_vals[m];
4998 LDKSignature arr_conv_12_ref;
4999 CHECK(arr_conv_12.len == 64);
5000 memcpy(arr_conv_12_ref.compact_form, arr_conv_12.ptr, 64);
5001 o_constr.data[m] = arr_conv_12_ref;
5003 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5004 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
5005 return (long)ret_conv;
5008 uint32_t CResult_1CVec_1SignatureZNoneZ_1err(void* ctx_TODO) {
5009 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5010 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
5011 return (long)ret_conv;
5014 void CResult_1CVec_1SignatureZNoneZ_1free(void* ctx_TODO, uint32_t _res) {
5015 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)_res;
5017 CResult_CVec_SignatureZNoneZ_free(_res_conv);
5020 uint32_t CResult_1ChanKeySignerDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5021 LDKChannelKeys o_conv = *(LDKChannelKeys*)o;
5022 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
5023 *ret_conv = CResult_ChanKeySignerDecodeErrorZ_ok(o_conv);
5024 return (long)ret_conv;
5027 uint32_t CResult_1ChanKeySignerDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5028 LDKDecodeError e_conv;
5029 e_conv.inner = (void*)(e & (~1));
5030 e_conv.is_owned = (e & 1) || (e == 0);
5031 // Warning: we may need a move here but can't clone!
5032 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
5033 *ret_conv = CResult_ChanKeySignerDecodeErrorZ_err(e_conv);
5034 return (long)ret_conv;
5037 void CResult_1ChanKeySignerDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5038 LDKCResult_ChanKeySignerDecodeErrorZ _res_conv = *(LDKCResult_ChanKeySignerDecodeErrorZ*)_res;
5040 CResult_ChanKeySignerDecodeErrorZ_free(_res_conv);
5043 uint32_t CResult_1InMemoryChannelKeysDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5044 LDKInMemoryChannelKeys o_conv;
5045 o_conv.inner = (void*)(o & (~1));
5046 o_conv.is_owned = (o & 1) || (o == 0);
5047 if (o_conv.inner != NULL)
5048 o_conv = InMemoryChannelKeys_clone(&o_conv);
5049 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
5050 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_ok(o_conv);
5051 return (long)ret_conv;
5054 uint32_t CResult_1InMemoryChannelKeysDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5055 LDKDecodeError e_conv;
5056 e_conv.inner = (void*)(e & (~1));
5057 e_conv.is_owned = (e & 1) || (e == 0);
5058 // Warning: we may need a move here but can't clone!
5059 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
5060 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_err(e_conv);
5061 return (long)ret_conv;
5064 void CResult_1InMemoryChannelKeysDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5065 LDKCResult_InMemoryChannelKeysDecodeErrorZ _res_conv = *(LDKCResult_InMemoryChannelKeysDecodeErrorZ*)_res;
5067 CResult_InMemoryChannelKeysDecodeErrorZ_free(_res_conv);
5070 uint32_t CResult_1TxOutAccessErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5071 LDKTxOut o_conv = *(LDKTxOut*)o;
5073 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
5074 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
5075 return (long)ret_conv;
5078 uint32_t CResult_1TxOutAccessErrorZ_1err(void* ctx_TODO, uint32_t e) {
5079 LDKAccessError e_conv = LDKAccessError_from_js(e);
5080 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
5081 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
5082 return (long)ret_conv;
5085 void CResult_1TxOutAccessErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5086 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)_res;
5088 CResult_TxOutAccessErrorZ_free(_res_conv);
5091 uint32_t CResult_1NoneAPIErrorZ_1ok(void* ctx_TODO) {
5092 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5093 *ret_conv = CResult_NoneAPIErrorZ_ok();
5094 return (long)ret_conv;
5097 uint32_t CResult_1NoneAPIErrorZ_1err(void* ctx_TODO, uint32_t e) {
5098 LDKAPIError e_conv = *(LDKAPIError*)e;
5100 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5101 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
5102 return (long)ret_conv;
5105 void CResult_1NoneAPIErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5106 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)_res;
5108 CResult_NoneAPIErrorZ_free(_res_conv);
5111 void CVec_1ChannelDetailsZ_1free(void* ctx_TODO, uint32_tArray _res) {
5112 LDKCVec_ChannelDetailsZ _res_constr;
5113 _res_constr.datalen = _res.len;
5114 if (_res_constr.datalen > 0)
5115 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
5117 _res_constr.data = NULL;
5118 uint32_t* _res_vals = (uint32_t*) _res.ptr;
5119 for (size_t q = 0; q < _res_constr.datalen; q++) {
5120 uint32_t arr_conv_16 = _res_vals[q];
5121 LDKChannelDetails arr_conv_16_conv;
5122 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5123 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5124 _res_constr.data[q] = arr_conv_16_conv;
5126 CVec_ChannelDetailsZ_free(_res_constr);
5129 uint32_t CResult_1NonePaymentSendFailureZ_1ok(void* ctx_TODO) {
5130 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5131 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
5132 return (long)ret_conv;
5135 uint32_t CResult_1NonePaymentSendFailureZ_1err(void* ctx_TODO, uint32_t e) {
5136 LDKPaymentSendFailure e_conv;
5137 e_conv.inner = (void*)(e & (~1));
5138 e_conv.is_owned = (e & 1) || (e == 0);
5139 // Warning: we may need a move here but can't clone!
5140 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5141 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
5142 return (long)ret_conv;
5145 void CResult_1NonePaymentSendFailureZ_1free(void* ctx_TODO, uint32_t _res) {
5146 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)_res;
5148 CResult_NonePaymentSendFailureZ_free(_res_conv);
5151 void CVec_1NetAddressZ_1free(void* ctx_TODO, uint32_tArray _res) {
5152 LDKCVec_NetAddressZ _res_constr;
5153 _res_constr.datalen = _res.len;
5154 if (_res_constr.datalen > 0)
5155 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
5157 _res_constr.data = NULL;
5158 uint32_t* _res_vals = (uint32_t*) _res.ptr;
5159 for (size_t m = 0; m < _res_constr.datalen; m++) {
5160 uint32_t arr_conv_12 = _res_vals[m];
5161 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
5162 FREE((void*)arr_conv_12);
5163 _res_constr.data[m] = arr_conv_12_conv;
5165 CVec_NetAddressZ_free(_res_constr);
5168 void CVec_1ChannelMonitorZ_1free(void* ctx_TODO, uint32_tArray _res) {
5169 LDKCVec_ChannelMonitorZ _res_constr;
5170 _res_constr.datalen = _res.len;
5171 if (_res_constr.datalen > 0)
5172 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
5174 _res_constr.data = NULL;
5175 uint32_t* _res_vals = (uint32_t*) _res.ptr;
5176 for (size_t q = 0; q < _res_constr.datalen; q++) {
5177 uint32_t arr_conv_16 = _res_vals[q];
5178 LDKChannelMonitor arr_conv_16_conv;
5179 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5180 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5181 _res_constr.data[q] = arr_conv_16_conv;
5183 CVec_ChannelMonitorZ_free(_res_constr);
5186 void C2Tuple_1BlockHashChannelManagerZ_1free(void* ctx_TODO, uint32_t _res) {
5187 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)_res;
5189 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
5192 uint32_t C2Tuple_1BlockHashChannelManagerZ_1new(void* ctx_TODO, int8_tArray a, uint32_t b) {
5193 LDKThirtyTwoBytes a_ref;
5195 memcpy(a_ref.data, a.ptr, 32);
5196 LDKChannelManager b_conv;
5197 b_conv.inner = (void*)(b & (~1));
5198 b_conv.is_owned = (b & 1) || (b == 0);
5199 // Warning: we may need a move here but can't clone!
5200 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
5201 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
5202 ret_ref->a = ThirtyTwoBytes_clone(&ret_ref->a);
5203 // XXX: We likely need to clone here, but no _clone fn is available for ChannelManager
5204 return (long)ret_ref;
5207 uint32_t CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5208 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)o;
5210 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
5211 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
5212 return (long)ret_conv;
5215 uint32_t CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5216 LDKDecodeError e_conv;
5217 e_conv.inner = (void*)(e & (~1));
5218 e_conv.is_owned = (e & 1) || (e == 0);
5219 // Warning: we may need a move here but can't clone!
5220 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
5221 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
5222 return (long)ret_conv;
5225 void CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5226 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)_res;
5228 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
5231 uint32_t CResult_1NetAddressu8Z_1ok(void* ctx_TODO, uint32_t o) {
5232 LDKNetAddress o_conv = *(LDKNetAddress*)o;
5234 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
5235 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
5236 return (long)ret_conv;
5239 uint32_t CResult_1NetAddressu8Z_1err(void* ctx_TODO, int8_t e) {
5240 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
5241 *ret_conv = CResult_NetAddressu8Z_err(e);
5242 return (long)ret_conv;
5245 void CResult_1NetAddressu8Z_1free(void* ctx_TODO, uint32_t _res) {
5246 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)_res;
5248 CResult_NetAddressu8Z_free(_res_conv);
5251 uint32_t CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5252 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)o;
5254 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
5255 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
5256 return (long)ret_conv;
5259 uint32_t CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5260 LDKDecodeError e_conv;
5261 e_conv.inner = (void*)(e & (~1));
5262 e_conv.is_owned = (e & 1) || (e == 0);
5263 // Warning: we may need a move here but can't clone!
5264 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
5265 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
5266 return (long)ret_conv;
5269 void CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5270 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)_res;
5272 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
5275 void CVec_1u64Z_1free(void* ctx_TODO, int64_tArray _res) {
5276 LDKCVec_u64Z _res_constr;
5277 _res_constr.datalen = _res.len;
5278 if (_res_constr.datalen > 0)
5279 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
5281 _res_constr.data = NULL;
5282 int64_t* _res_vals = (int64_t*) _res.ptr;
5283 for (size_t i = 0; i < _res_constr.datalen; i++) {
5284 int64_t arr_conv_8 = _res_vals[i];
5285 _res_constr.data[i] = arr_conv_8;
5287 CVec_u64Z_free(_res_constr);
5290 void CVec_1UpdateAddHTLCZ_1free(void* ctx_TODO, uint32_tArray _res) {
5291 LDKCVec_UpdateAddHTLCZ _res_constr;
5292 _res_constr.datalen = _res.len;
5293 if (_res_constr.datalen > 0)
5294 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
5296 _res_constr.data = NULL;
5297 uint32_t* _res_vals = (uint32_t*) _res.ptr;
5298 for (size_t p = 0; p < _res_constr.datalen; p++) {
5299 uint32_t arr_conv_15 = _res_vals[p];
5300 LDKUpdateAddHTLC arr_conv_15_conv;
5301 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
5302 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
5303 _res_constr.data[p] = arr_conv_15_conv;
5305 CVec_UpdateAddHTLCZ_free(_res_constr);
5308 void CVec_1UpdateFulfillHTLCZ_1free(void* ctx_TODO, uint32_tArray _res) {
5309 LDKCVec_UpdateFulfillHTLCZ _res_constr;
5310 _res_constr.datalen = _res.len;
5311 if (_res_constr.datalen > 0)
5312 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
5314 _res_constr.data = NULL;
5315 uint32_t* _res_vals = (uint32_t*) _res.ptr;
5316 for (size_t t = 0; t < _res_constr.datalen; t++) {
5317 uint32_t arr_conv_19 = _res_vals[t];
5318 LDKUpdateFulfillHTLC arr_conv_19_conv;
5319 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
5320 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
5321 _res_constr.data[t] = arr_conv_19_conv;
5323 CVec_UpdateFulfillHTLCZ_free(_res_constr);
5326 void CVec_1UpdateFailHTLCZ_1free(void* ctx_TODO, uint32_tArray _res) {
5327 LDKCVec_UpdateFailHTLCZ _res_constr;
5328 _res_constr.datalen = _res.len;
5329 if (_res_constr.datalen > 0)
5330 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
5332 _res_constr.data = NULL;
5333 uint32_t* _res_vals = (uint32_t*) _res.ptr;
5334 for (size_t q = 0; q < _res_constr.datalen; q++) {
5335 uint32_t arr_conv_16 = _res_vals[q];
5336 LDKUpdateFailHTLC arr_conv_16_conv;
5337 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5338 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5339 _res_constr.data[q] = arr_conv_16_conv;
5341 CVec_UpdateFailHTLCZ_free(_res_constr);
5344 void CVec_1UpdateFailMalformedHTLCZ_1free(void* ctx_TODO, uint32_tArray _res) {
5345 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
5346 _res_constr.datalen = _res.len;
5347 if (_res_constr.datalen > 0)
5348 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
5350 _res_constr.data = NULL;
5351 uint32_t* _res_vals = (uint32_t*) _res.ptr;
5352 for (size_t z = 0; z < _res_constr.datalen; z++) {
5353 uint32_t arr_conv_25 = _res_vals[z];
5354 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
5355 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
5356 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
5357 _res_constr.data[z] = arr_conv_25_conv;
5359 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
5362 uint32_t CResult_1boolLightningErrorZ_1ok(void* ctx_TODO, jboolean o) {
5363 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5364 *ret_conv = CResult_boolLightningErrorZ_ok(o);
5365 return (long)ret_conv;
5368 uint32_t CResult_1boolLightningErrorZ_1err(void* ctx_TODO, uint32_t e) {
5369 LDKLightningError e_conv;
5370 e_conv.inner = (void*)(e & (~1));
5371 e_conv.is_owned = (e & 1) || (e == 0);
5372 // Warning: we may need a move here but can't clone!
5373 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5374 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
5375 return (long)ret_conv;
5378 void CResult_1boolLightningErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5379 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)_res;
5381 CResult_boolLightningErrorZ_free(_res_conv);
5384 void C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(void* ctx_TODO, uint32_t _res) {
5385 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)_res;
5387 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
5390 uint32_t C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(void* ctx_TODO, uint32_t a, uint32_t b, uint32_t c) {
5391 LDKChannelAnnouncement a_conv;
5392 a_conv.inner = (void*)(a & (~1));
5393 a_conv.is_owned = (a & 1) || (a == 0);
5394 if (a_conv.inner != NULL)
5395 a_conv = ChannelAnnouncement_clone(&a_conv);
5396 LDKChannelUpdate b_conv;
5397 b_conv.inner = (void*)(b & (~1));
5398 b_conv.is_owned = (b & 1) || (b == 0);
5399 if (b_conv.inner != NULL)
5400 b_conv = ChannelUpdate_clone(&b_conv);
5401 LDKChannelUpdate c_conv;
5402 c_conv.inner = (void*)(c & (~1));
5403 c_conv.is_owned = (c & 1) || (c == 0);
5404 if (c_conv.inner != NULL)
5405 c_conv = ChannelUpdate_clone(&c_conv);
5406 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5407 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
5408 ret_ref->a = ChannelAnnouncement_clone(&ret_ref->a);
5409 ret_ref->b = ChannelUpdate_clone(&ret_ref->b);
5410 ret_ref->c = ChannelUpdate_clone(&ret_ref->c);
5411 return (long)ret_ref;
5414 void CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(void* ctx_TODO, uint32_tArray _res) {
5415 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
5416 _res_constr.datalen = _res.len;
5417 if (_res_constr.datalen > 0)
5418 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
5420 _res_constr.data = NULL;
5421 uint32_t* _res_vals = (uint32_t*) _res.ptr;
5422 for (size_t l = 0; l < _res_constr.datalen; l++) {
5423 uint32_t arr_conv_63 = _res_vals[l];
5424 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
5425 FREE((void*)arr_conv_63);
5426 _res_constr.data[l] = arr_conv_63_conv;
5428 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
5431 void CVec_1NodeAnnouncementZ_1free(void* ctx_TODO, uint32_tArray _res) {
5432 LDKCVec_NodeAnnouncementZ _res_constr;
5433 _res_constr.datalen = _res.len;
5434 if (_res_constr.datalen > 0)
5435 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5437 _res_constr.data = NULL;
5438 uint32_t* _res_vals = (uint32_t*) _res.ptr;
5439 for (size_t s = 0; s < _res_constr.datalen; s++) {
5440 uint32_t arr_conv_18 = _res_vals[s];
5441 LDKNodeAnnouncement arr_conv_18_conv;
5442 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
5443 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
5444 _res_constr.data[s] = arr_conv_18_conv;
5446 CVec_NodeAnnouncementZ_free(_res_constr);
5449 uint32_t CResult_1NoneLightningErrorZ_1ok(void* ctx_TODO) {
5450 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5451 *ret_conv = CResult_NoneLightningErrorZ_ok();
5452 return (long)ret_conv;
5455 uint32_t CResult_1NoneLightningErrorZ_1err(void* ctx_TODO, uint32_t e) {
5456 LDKLightningError e_conv;
5457 e_conv.inner = (void*)(e & (~1));
5458 e_conv.is_owned = (e & 1) || (e == 0);
5459 // Warning: we may need a move here but can't clone!
5460 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5461 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
5462 return (long)ret_conv;
5465 void CResult_1NoneLightningErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5466 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)_res;
5468 CResult_NoneLightningErrorZ_free(_res_conv);
5471 uint32_t CResult_1ChannelReestablishDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5472 LDKChannelReestablish o_conv;
5473 o_conv.inner = (void*)(o & (~1));
5474 o_conv.is_owned = (o & 1) || (o == 0);
5475 if (o_conv.inner != NULL)
5476 o_conv = ChannelReestablish_clone(&o_conv);
5477 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
5478 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
5479 return (long)ret_conv;
5482 uint32_t CResult_1ChannelReestablishDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5483 LDKDecodeError e_conv;
5484 e_conv.inner = (void*)(e & (~1));
5485 e_conv.is_owned = (e & 1) || (e == 0);
5486 // Warning: we may need a move here but can't clone!
5487 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
5488 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
5489 return (long)ret_conv;
5492 void CResult_1ChannelReestablishDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5493 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)_res;
5495 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
5498 uint32_t CResult_1InitDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5500 o_conv.inner = (void*)(o & (~1));
5501 o_conv.is_owned = (o & 1) || (o == 0);
5502 if (o_conv.inner != NULL)
5503 o_conv = Init_clone(&o_conv);
5504 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
5505 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
5506 return (long)ret_conv;
5509 uint32_t CResult_1InitDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5510 LDKDecodeError e_conv;
5511 e_conv.inner = (void*)(e & (~1));
5512 e_conv.is_owned = (e & 1) || (e == 0);
5513 // Warning: we may need a move here but can't clone!
5514 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
5515 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
5516 return (long)ret_conv;
5519 void CResult_1InitDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5520 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)_res;
5522 CResult_InitDecodeErrorZ_free(_res_conv);
5525 uint32_t CResult_1PingDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5527 o_conv.inner = (void*)(o & (~1));
5528 o_conv.is_owned = (o & 1) || (o == 0);
5529 if (o_conv.inner != NULL)
5530 o_conv = Ping_clone(&o_conv);
5531 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
5532 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
5533 return (long)ret_conv;
5536 uint32_t CResult_1PingDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5537 LDKDecodeError e_conv;
5538 e_conv.inner = (void*)(e & (~1));
5539 e_conv.is_owned = (e & 1) || (e == 0);
5540 // Warning: we may need a move here but can't clone!
5541 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
5542 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
5543 return (long)ret_conv;
5546 void CResult_1PingDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5547 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)_res;
5549 CResult_PingDecodeErrorZ_free(_res_conv);
5552 uint32_t CResult_1PongDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5554 o_conv.inner = (void*)(o & (~1));
5555 o_conv.is_owned = (o & 1) || (o == 0);
5556 if (o_conv.inner != NULL)
5557 o_conv = Pong_clone(&o_conv);
5558 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
5559 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
5560 return (long)ret_conv;
5563 uint32_t CResult_1PongDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5564 LDKDecodeError e_conv;
5565 e_conv.inner = (void*)(e & (~1));
5566 e_conv.is_owned = (e & 1) || (e == 0);
5567 // Warning: we may need a move here but can't clone!
5568 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
5569 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
5570 return (long)ret_conv;
5573 void CResult_1PongDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5574 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)_res;
5576 CResult_PongDecodeErrorZ_free(_res_conv);
5579 uint32_t CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5580 LDKUnsignedChannelAnnouncement o_conv;
5581 o_conv.inner = (void*)(o & (~1));
5582 o_conv.is_owned = (o & 1) || (o == 0);
5583 if (o_conv.inner != NULL)
5584 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
5585 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
5586 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
5587 return (long)ret_conv;
5590 uint32_t CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5591 LDKDecodeError e_conv;
5592 e_conv.inner = (void*)(e & (~1));
5593 e_conv.is_owned = (e & 1) || (e == 0);
5594 // Warning: we may need a move here but can't clone!
5595 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
5596 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
5597 return (long)ret_conv;
5600 void CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5601 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)_res;
5603 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
5606 uint32_t CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5607 LDKUnsignedChannelUpdate o_conv;
5608 o_conv.inner = (void*)(o & (~1));
5609 o_conv.is_owned = (o & 1) || (o == 0);
5610 if (o_conv.inner != NULL)
5611 o_conv = UnsignedChannelUpdate_clone(&o_conv);
5612 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
5613 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
5614 return (long)ret_conv;
5617 uint32_t CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5618 LDKDecodeError e_conv;
5619 e_conv.inner = (void*)(e & (~1));
5620 e_conv.is_owned = (e & 1) || (e == 0);
5621 // Warning: we may need a move here but can't clone!
5622 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
5623 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
5624 return (long)ret_conv;
5627 void CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5628 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)_res;
5630 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
5633 uint32_t CResult_1ErrorMessageDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5634 LDKErrorMessage o_conv;
5635 o_conv.inner = (void*)(o & (~1));
5636 o_conv.is_owned = (o & 1) || (o == 0);
5637 if (o_conv.inner != NULL)
5638 o_conv = ErrorMessage_clone(&o_conv);
5639 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
5640 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
5641 return (long)ret_conv;
5644 uint32_t CResult_1ErrorMessageDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5645 LDKDecodeError e_conv;
5646 e_conv.inner = (void*)(e & (~1));
5647 e_conv.is_owned = (e & 1) || (e == 0);
5648 // Warning: we may need a move here but can't clone!
5649 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
5650 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
5651 return (long)ret_conv;
5654 void CResult_1ErrorMessageDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5655 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)_res;
5657 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
5660 uint32_t CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5661 LDKUnsignedNodeAnnouncement o_conv;
5662 o_conv.inner = (void*)(o & (~1));
5663 o_conv.is_owned = (o & 1) || (o == 0);
5664 if (o_conv.inner != NULL)
5665 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
5666 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
5667 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
5668 return (long)ret_conv;
5671 uint32_t CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5672 LDKDecodeError e_conv;
5673 e_conv.inner = (void*)(e & (~1));
5674 e_conv.is_owned = (e & 1) || (e == 0);
5675 // Warning: we may need a move here but can't clone!
5676 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
5677 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
5678 return (long)ret_conv;
5681 void CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5682 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)_res;
5684 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
5687 uint32_t CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5688 LDKQueryShortChannelIds o_conv;
5689 o_conv.inner = (void*)(o & (~1));
5690 o_conv.is_owned = (o & 1) || (o == 0);
5691 if (o_conv.inner != NULL)
5692 o_conv = QueryShortChannelIds_clone(&o_conv);
5693 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
5694 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
5695 return (long)ret_conv;
5698 uint32_t CResult_1QueryShortChannelIdsDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5699 LDKDecodeError e_conv;
5700 e_conv.inner = (void*)(e & (~1));
5701 e_conv.is_owned = (e & 1) || (e == 0);
5702 // Warning: we may need a move here but can't clone!
5703 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
5704 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
5705 return (long)ret_conv;
5708 void CResult_1QueryShortChannelIdsDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5709 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)_res;
5711 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
5714 uint32_t CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5715 LDKReplyShortChannelIdsEnd o_conv;
5716 o_conv.inner = (void*)(o & (~1));
5717 o_conv.is_owned = (o & 1) || (o == 0);
5718 if (o_conv.inner != NULL)
5719 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
5720 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
5721 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
5722 return (long)ret_conv;
5725 uint32_t CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5726 LDKDecodeError e_conv;
5727 e_conv.inner = (void*)(e & (~1));
5728 e_conv.is_owned = (e & 1) || (e == 0);
5729 // Warning: we may need a move here but can't clone!
5730 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
5731 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
5732 return (long)ret_conv;
5735 void CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5736 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)_res;
5738 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
5741 uint32_t CResult_1QueryChannelRangeDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5742 LDKQueryChannelRange o_conv;
5743 o_conv.inner = (void*)(o & (~1));
5744 o_conv.is_owned = (o & 1) || (o == 0);
5745 if (o_conv.inner != NULL)
5746 o_conv = QueryChannelRange_clone(&o_conv);
5747 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
5748 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
5749 return (long)ret_conv;
5752 uint32_t CResult_1QueryChannelRangeDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5753 LDKDecodeError e_conv;
5754 e_conv.inner = (void*)(e & (~1));
5755 e_conv.is_owned = (e & 1) || (e == 0);
5756 // Warning: we may need a move here but can't clone!
5757 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
5758 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
5759 return (long)ret_conv;
5762 void CResult_1QueryChannelRangeDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5763 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)_res;
5765 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
5768 uint32_t CResult_1ReplyChannelRangeDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5769 LDKReplyChannelRange o_conv;
5770 o_conv.inner = (void*)(o & (~1));
5771 o_conv.is_owned = (o & 1) || (o == 0);
5772 if (o_conv.inner != NULL)
5773 o_conv = ReplyChannelRange_clone(&o_conv);
5774 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
5775 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
5776 return (long)ret_conv;
5779 uint32_t CResult_1ReplyChannelRangeDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5780 LDKDecodeError e_conv;
5781 e_conv.inner = (void*)(e & (~1));
5782 e_conv.is_owned = (e & 1) || (e == 0);
5783 // Warning: we may need a move here but can't clone!
5784 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
5785 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
5786 return (long)ret_conv;
5789 void CResult_1ReplyChannelRangeDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5790 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)_res;
5792 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
5795 uint32_t CResult_1GossipTimestampFilterDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5796 LDKGossipTimestampFilter o_conv;
5797 o_conv.inner = (void*)(o & (~1));
5798 o_conv.is_owned = (o & 1) || (o == 0);
5799 if (o_conv.inner != NULL)
5800 o_conv = GossipTimestampFilter_clone(&o_conv);
5801 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
5802 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
5803 return (long)ret_conv;
5806 uint32_t CResult_1GossipTimestampFilterDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5807 LDKDecodeError e_conv;
5808 e_conv.inner = (void*)(e & (~1));
5809 e_conv.is_owned = (e & 1) || (e == 0);
5810 // Warning: we may need a move here but can't clone!
5811 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
5812 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
5813 return (long)ret_conv;
5816 void CResult_1GossipTimestampFilterDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5817 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)_res;
5819 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
5822 void CVec_1PublicKeyZ_1free(void* ctx_TODO, ptrArray _res) {
5823 LDKCVec_PublicKeyZ _res_constr;
5824 _res_constr.datalen = _res.len;
5825 if (_res_constr.datalen > 0)
5826 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
5828 _res_constr.data = NULL;
5829 int8_tArray* _res_vals = (int8_tArray*) _res.ptr;
5830 for (size_t m = 0; m < _res_constr.datalen; m++) {
5831 int8_tArray arr_conv_12 = _res_vals[m];
5832 LDKPublicKey arr_conv_12_ref;
5833 CHECK(arr_conv_12.len == 33);
5834 memcpy(arr_conv_12_ref.compressed_form, arr_conv_12.ptr, 33);
5835 _res_constr.data[m] = arr_conv_12_ref;
5837 CVec_PublicKeyZ_free(_res_constr);
5840 void CVec_1u8Z_1free(void* ctx_TODO, int8_tArray _res) {
5841 LDKCVec_u8Z _res_ref;
5842 _res_ref.datalen = _res.len;
5843 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
5844 memcpy(_res_ref.data, _res.ptr, _res_ref.datalen);
5845 CVec_u8Z_free(_res_ref);
5848 uint32_t CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(void* ctx_TODO, int8_tArray o) {
5850 o_ref.datalen = o.len;
5851 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
5852 memcpy(o_ref.data, o.ptr, o_ref.datalen);
5853 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
5854 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
5855 return (long)ret_conv;
5858 uint32_t CResult_1CVec_1u8ZPeerHandleErrorZ_1err(void* ctx_TODO, uint32_t e) {
5859 LDKPeerHandleError e_conv;
5860 e_conv.inner = (void*)(e & (~1));
5861 e_conv.is_owned = (e & 1) || (e == 0);
5862 // Warning: we may need a move here but can't clone!
5863 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
5864 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
5865 return (long)ret_conv;
5868 void CResult_1CVec_1u8ZPeerHandleErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5869 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)_res;
5871 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
5874 uint32_t CResult_1NonePeerHandleErrorZ_1ok(void* ctx_TODO) {
5875 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5876 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
5877 return (long)ret_conv;
5880 uint32_t CResult_1NonePeerHandleErrorZ_1err(void* ctx_TODO, uint32_t e) {
5881 LDKPeerHandleError e_conv;
5882 e_conv.inner = (void*)(e & (~1));
5883 e_conv.is_owned = (e & 1) || (e == 0);
5884 // Warning: we may need a move here but can't clone!
5885 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5886 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
5887 return (long)ret_conv;
5890 void CResult_1NonePeerHandleErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5891 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)_res;
5893 CResult_NonePeerHandleErrorZ_free(_res_conv);
5896 uint32_t CResult_1boolPeerHandleErrorZ_1ok(void* ctx_TODO, jboolean o) {
5897 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
5898 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
5899 return (long)ret_conv;
5902 uint32_t CResult_1boolPeerHandleErrorZ_1err(void* ctx_TODO, uint32_t e) {
5903 LDKPeerHandleError e_conv;
5904 e_conv.inner = (void*)(e & (~1));
5905 e_conv.is_owned = (e & 1) || (e == 0);
5906 // Warning: we may need a move here but can't clone!
5907 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
5908 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
5909 return (long)ret_conv;
5912 void CResult_1boolPeerHandleErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5913 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)_res;
5915 CResult_boolPeerHandleErrorZ_free(_res_conv);
5918 uint32_t CResult_1SecretKeySecpErrorZ_1ok(void* ctx_TODO, int8_tArray o) {
5921 memcpy(o_ref.bytes, o.ptr, 32);
5922 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
5923 *ret_conv = CResult_SecretKeySecpErrorZ_ok(o_ref);
5924 return (long)ret_conv;
5927 uint32_t CResult_1SecretKeySecpErrorZ_1err(void* ctx_TODO, uint32_t e) {
5928 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5929 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
5930 *ret_conv = CResult_SecretKeySecpErrorZ_err(e_conv);
5931 return (long)ret_conv;
5934 void CResult_1SecretKeySecpErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5935 LDKCResult_SecretKeySecpErrorZ _res_conv = *(LDKCResult_SecretKeySecpErrorZ*)_res;
5937 CResult_SecretKeySecpErrorZ_free(_res_conv);
5940 uint32_t CResult_1PublicKeySecpErrorZ_1ok(void* ctx_TODO, int8_tArray o) {
5943 memcpy(o_ref.compressed_form, o.ptr, 33);
5944 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
5945 *ret_conv = CResult_PublicKeySecpErrorZ_ok(o_ref);
5946 return (long)ret_conv;
5949 uint32_t CResult_1PublicKeySecpErrorZ_1err(void* ctx_TODO, uint32_t e) {
5950 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5951 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
5952 *ret_conv = CResult_PublicKeySecpErrorZ_err(e_conv);
5953 return (long)ret_conv;
5956 void CResult_1PublicKeySecpErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5957 LDKCResult_PublicKeySecpErrorZ _res_conv = *(LDKCResult_PublicKeySecpErrorZ*)_res;
5959 CResult_PublicKeySecpErrorZ_free(_res_conv);
5962 uint32_t CResult_1TxCreationKeysSecpErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5963 LDKTxCreationKeys o_conv;
5964 o_conv.inner = (void*)(o & (~1));
5965 o_conv.is_owned = (o & 1) || (o == 0);
5966 if (o_conv.inner != NULL)
5967 o_conv = TxCreationKeys_clone(&o_conv);
5968 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
5969 *ret_conv = CResult_TxCreationKeysSecpErrorZ_ok(o_conv);
5970 return (long)ret_conv;
5973 uint32_t CResult_1TxCreationKeysSecpErrorZ_1err(void* ctx_TODO, uint32_t e) {
5974 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5975 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
5976 *ret_conv = CResult_TxCreationKeysSecpErrorZ_err(e_conv);
5977 return (long)ret_conv;
5980 void CResult_1TxCreationKeysSecpErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5981 LDKCResult_TxCreationKeysSecpErrorZ _res_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)_res;
5983 CResult_TxCreationKeysSecpErrorZ_free(_res_conv);
5986 uint32_t CResult_1TrustedCommitmentTransactionNoneZ_1ok(void* ctx_TODO, uint32_t o) {
5987 LDKTrustedCommitmentTransaction o_conv;
5988 o_conv.inner = (void*)(o & (~1));
5989 o_conv.is_owned = (o & 1) || (o == 0);
5990 // Warning: we may need a move here but can't clone!
5991 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
5992 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
5993 return (long)ret_conv;
5996 uint32_t CResult_1TrustedCommitmentTransactionNoneZ_1err(void* ctx_TODO) {
5997 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
5998 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
5999 return (long)ret_conv;
6002 void CResult_1TrustedCommitmentTransactionNoneZ_1free(void* ctx_TODO, uint32_t _res) {
6003 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)_res;
6005 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
6008 void CVec_1RouteHopZ_1free(void* ctx_TODO, uint32_tArray _res) {
6009 LDKCVec_RouteHopZ _res_constr;
6010 _res_constr.datalen = _res.len;
6011 if (_res_constr.datalen > 0)
6012 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
6014 _res_constr.data = NULL;
6015 uint32_t* _res_vals = (uint32_t*) _res.ptr;
6016 for (size_t k = 0; k < _res_constr.datalen; k++) {
6017 uint32_t arr_conv_10 = _res_vals[k];
6018 LDKRouteHop arr_conv_10_conv;
6019 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
6020 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
6021 _res_constr.data[k] = arr_conv_10_conv;
6023 CVec_RouteHopZ_free(_res_constr);
6026 void CVec_1CVec_1RouteHopZZ_1free(void* ctx_TODO, ptrArray _res) {
6027 LDKCVec_CVec_RouteHopZZ _res_constr;
6028 _res_constr.datalen = _res.len;
6029 if (_res_constr.datalen > 0)
6030 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
6032 _res_constr.data = NULL;
6033 uint32_tArray* _res_vals = (uint32_tArray*) _res.ptr;
6034 for (size_t m = 0; m < _res_constr.datalen; m++) {
6035 uint32_tArray arr_conv_12 = _res_vals[m];
6036 LDKCVec_RouteHopZ arr_conv_12_constr;
6037 arr_conv_12_constr.datalen = arr_conv_12.len;
6038 if (arr_conv_12_constr.datalen > 0)
6039 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
6041 arr_conv_12_constr.data = NULL;
6042 uint32_t* arr_conv_12_vals = (uint32_t*) arr_conv_12.ptr;
6043 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
6044 uint32_t arr_conv_10 = arr_conv_12_vals[k];
6045 LDKRouteHop arr_conv_10_conv;
6046 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
6047 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
6048 arr_conv_12_constr.data[k] = arr_conv_10_conv;
6050 _res_constr.data[m] = arr_conv_12_constr;
6052 CVec_CVec_RouteHopZZ_free(_res_constr);
6055 uint32_t CResult_1RouteDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
6057 o_conv.inner = (void*)(o & (~1));
6058 o_conv.is_owned = (o & 1) || (o == 0);
6059 if (o_conv.inner != NULL)
6060 o_conv = Route_clone(&o_conv);
6061 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
6062 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
6063 return (long)ret_conv;
6066 uint32_t CResult_1RouteDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
6067 LDKDecodeError e_conv;
6068 e_conv.inner = (void*)(e & (~1));
6069 e_conv.is_owned = (e & 1) || (e == 0);
6070 // Warning: we may need a move here but can't clone!
6071 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
6072 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
6073 return (long)ret_conv;
6076 void CResult_1RouteDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
6077 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)_res;
6079 CResult_RouteDecodeErrorZ_free(_res_conv);
6082 void CVec_1RouteHintZ_1free(void* ctx_TODO, uint32_tArray _res) {
6083 LDKCVec_RouteHintZ _res_constr;
6084 _res_constr.datalen = _res.len;
6085 if (_res_constr.datalen > 0)
6086 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
6088 _res_constr.data = NULL;
6089 uint32_t* _res_vals = (uint32_t*) _res.ptr;
6090 for (size_t l = 0; l < _res_constr.datalen; l++) {
6091 uint32_t arr_conv_11 = _res_vals[l];
6092 LDKRouteHint arr_conv_11_conv;
6093 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
6094 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
6095 _res_constr.data[l] = arr_conv_11_conv;
6097 CVec_RouteHintZ_free(_res_constr);
6100 uint32_t CResult_1RouteLightningErrorZ_1ok(void* ctx_TODO, uint32_t o) {
6102 o_conv.inner = (void*)(o & (~1));
6103 o_conv.is_owned = (o & 1) || (o == 0);
6104 if (o_conv.inner != NULL)
6105 o_conv = Route_clone(&o_conv);
6106 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6107 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
6108 return (long)ret_conv;
6111 uint32_t CResult_1RouteLightningErrorZ_1err(void* ctx_TODO, uint32_t e) {
6112 LDKLightningError e_conv;
6113 e_conv.inner = (void*)(e & (~1));
6114 e_conv.is_owned = (e & 1) || (e == 0);
6115 // Warning: we may need a move here but can't clone!
6116 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6117 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
6118 return (long)ret_conv;
6121 void CResult_1RouteLightningErrorZ_1free(void* ctx_TODO, uint32_t _res) {
6122 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)_res;
6124 CResult_RouteLightningErrorZ_free(_res_conv);
6127 uint32_t CResult_1RoutingFeesDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
6128 LDKRoutingFees o_conv;
6129 o_conv.inner = (void*)(o & (~1));
6130 o_conv.is_owned = (o & 1) || (o == 0);
6131 if (o_conv.inner != NULL)
6132 o_conv = RoutingFees_clone(&o_conv);
6133 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
6134 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
6135 return (long)ret_conv;
6138 uint32_t CResult_1RoutingFeesDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
6139 LDKDecodeError e_conv;
6140 e_conv.inner = (void*)(e & (~1));
6141 e_conv.is_owned = (e & 1) || (e == 0);
6142 // Warning: we may need a move here but can't clone!
6143 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
6144 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
6145 return (long)ret_conv;
6148 void CResult_1RoutingFeesDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
6149 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)_res;
6151 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
6154 uint32_t CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
6155 LDKNodeAnnouncementInfo o_conv;
6156 o_conv.inner = (void*)(o & (~1));
6157 o_conv.is_owned = (o & 1) || (o == 0);
6158 // Warning: we may need a move here but can't clone!
6159 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
6160 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
6161 return (long)ret_conv;
6164 uint32_t CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
6165 LDKDecodeError e_conv;
6166 e_conv.inner = (void*)(e & (~1));
6167 e_conv.is_owned = (e & 1) || (e == 0);
6168 // Warning: we may need a move here but can't clone!
6169 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
6170 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
6171 return (long)ret_conv;
6174 void CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
6175 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)_res;
6177 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
6180 uint32_t CResult_1NodeInfoDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
6182 o_conv.inner = (void*)(o & (~1));
6183 o_conv.is_owned = (o & 1) || (o == 0);
6184 // Warning: we may need a move here but can't clone!
6185 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
6186 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
6187 return (long)ret_conv;
6190 uint32_t CResult_1NodeInfoDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
6191 LDKDecodeError e_conv;
6192 e_conv.inner = (void*)(e & (~1));
6193 e_conv.is_owned = (e & 1) || (e == 0);
6194 // Warning: we may need a move here but can't clone!
6195 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
6196 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
6197 return (long)ret_conv;
6200 void CResult_1NodeInfoDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
6201 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)_res;
6203 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
6206 uint32_t CResult_1NetworkGraphDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
6207 LDKNetworkGraph o_conv;
6208 o_conv.inner = (void*)(o & (~1));
6209 o_conv.is_owned = (o & 1) || (o == 0);
6210 // Warning: we may need a move here but can't clone!
6211 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
6212 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
6213 return (long)ret_conv;
6216 uint32_t CResult_1NetworkGraphDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
6217 LDKDecodeError e_conv;
6218 e_conv.inner = (void*)(e & (~1));
6219 e_conv.is_owned = (e & 1) || (e == 0);
6220 // Warning: we may need a move here but can't clone!
6221 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
6222 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
6223 return (long)ret_conv;
6226 void CResult_1NetworkGraphDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
6227 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)_res;
6229 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
6232 void Event_1free(void* ctx_TODO, uint32_t this_ptr) {
6233 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
6234 FREE((void*)this_ptr);
6235 Event_free(this_ptr_conv);
6238 uint32_t Event_1clone(void* ctx_TODO, uint32_t orig) {
6239 LDKEvent* orig_conv = (LDKEvent*)orig;
6240 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6241 *ret_copy = Event_clone(orig_conv);
6242 long ret_ref = (long)ret_copy;
6246 int8_tArray Event_1write(void* ctx_TODO, uint32_t obj) {
6247 LDKEvent* obj_conv = (LDKEvent*)obj;
6248 LDKCVec_u8Z arg_var = Event_write(obj_conv);
6249 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
6250 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
6251 CVec_u8Z_free(arg_var);
6255 void MessageSendEvent_1free(void* ctx_TODO, uint32_t this_ptr) {
6256 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
6257 FREE((void*)this_ptr);
6258 MessageSendEvent_free(this_ptr_conv);
6261 uint32_t MessageSendEvent_1clone(void* ctx_TODO, uint32_t orig) {
6262 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
6263 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
6264 *ret_copy = MessageSendEvent_clone(orig_conv);
6265 long ret_ref = (long)ret_copy;
6269 void MessageSendEventsProvider_1free(void* ctx_TODO, uint32_t this_ptr) {
6270 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
6271 FREE((void*)this_ptr);
6272 MessageSendEventsProvider_free(this_ptr_conv);
6275 void EventsProvider_1free(void* ctx_TODO, uint32_t this_ptr) {
6276 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
6277 FREE((void*)this_ptr);
6278 EventsProvider_free(this_ptr_conv);
6281 void APIError_1free(void* ctx_TODO, uint32_t this_ptr) {
6282 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
6283 FREE((void*)this_ptr);
6284 APIError_free(this_ptr_conv);
6287 uint32_t APIError_1clone(void* ctx_TODO, uint32_t orig) {
6288 LDKAPIError* orig_conv = (LDKAPIError*)orig;
6289 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6290 *ret_copy = APIError_clone(orig_conv);
6291 long ret_ref = (long)ret_copy;
6295 uint32_t Level_1clone(void* ctx_TODO, uint32_t orig) {
6296 LDKLevel* orig_conv = (LDKLevel*)orig;
6297 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
6301 uint32_t Level_1max(void* ctx_TODO) {
6302 uint32_t ret_conv = LDKLevel_to_js(Level_max());
6306 void Logger_1free(void* ctx_TODO, uint32_t this_ptr) {
6307 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
6308 FREE((void*)this_ptr);
6309 Logger_free(this_ptr_conv);
6312 void ChannelHandshakeConfig_1free(void* ctx_TODO, uint32_t this_ptr) {
6313 LDKChannelHandshakeConfig this_ptr_conv;
6314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6315 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6316 ChannelHandshakeConfig_free(this_ptr_conv);
6319 uint32_t ChannelHandshakeConfig_1clone(void* ctx_TODO, uint32_t orig) {
6320 LDKChannelHandshakeConfig orig_conv;
6321 orig_conv.inner = (void*)(orig & (~1));
6322 orig_conv.is_owned = false;
6323 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
6324 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6325 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6326 long ret_ref = (long)ret_var.inner;
6327 if (ret_var.is_owned) {
6333 int32_t ChannelHandshakeConfig_1get_1minimum_1depth(void* ctx_TODO, uint32_t this_ptr) {
6334 LDKChannelHandshakeConfig this_ptr_conv;
6335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6336 this_ptr_conv.is_owned = false;
6337 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
6341 void ChannelHandshakeConfig_1set_1minimum_1depth(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
6342 LDKChannelHandshakeConfig this_ptr_conv;
6343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6344 this_ptr_conv.is_owned = false;
6345 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
6348 int16_t ChannelHandshakeConfig_1get_1our_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr) {
6349 LDKChannelHandshakeConfig this_ptr_conv;
6350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6351 this_ptr_conv.is_owned = false;
6352 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
6356 void ChannelHandshakeConfig_1set_1our_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
6357 LDKChannelHandshakeConfig this_ptr_conv;
6358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6359 this_ptr_conv.is_owned = false;
6360 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
6363 int64_t ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr) {
6364 LDKChannelHandshakeConfig this_ptr_conv;
6365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6366 this_ptr_conv.is_owned = false;
6367 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
6371 void ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
6372 LDKChannelHandshakeConfig this_ptr_conv;
6373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6374 this_ptr_conv.is_owned = false;
6375 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
6378 uint32_t ChannelHandshakeConfig_1new(void* ctx_TODO, int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg) {
6379 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
6380 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6381 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6382 long ret_ref = (long)ret_var.inner;
6383 if (ret_var.is_owned) {
6389 uint32_t ChannelHandshakeConfig_1default(void* ctx_TODO) {
6390 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
6391 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6392 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6393 long ret_ref = (long)ret_var.inner;
6394 if (ret_var.is_owned) {
6400 void ChannelHandshakeLimits_1free(void* ctx_TODO, uint32_t this_ptr) {
6401 LDKChannelHandshakeLimits this_ptr_conv;
6402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6403 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6404 ChannelHandshakeLimits_free(this_ptr_conv);
6407 uint32_t ChannelHandshakeLimits_1clone(void* ctx_TODO, uint32_t orig) {
6408 LDKChannelHandshakeLimits orig_conv;
6409 orig_conv.inner = (void*)(orig & (~1));
6410 orig_conv.is_owned = false;
6411 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
6412 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6413 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6414 long ret_ref = (long)ret_var.inner;
6415 if (ret_var.is_owned) {
6421 int64_t ChannelHandshakeLimits_1get_1min_1funding_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
6422 LDKChannelHandshakeLimits this_ptr_conv;
6423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6424 this_ptr_conv.is_owned = false;
6425 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
6429 void ChannelHandshakeLimits_1set_1min_1funding_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
6430 LDKChannelHandshakeLimits this_ptr_conv;
6431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6432 this_ptr_conv.is_owned = false;
6433 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
6436 int64_t ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr) {
6437 LDKChannelHandshakeLimits this_ptr_conv;
6438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6439 this_ptr_conv.is_owned = false;
6440 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
6444 void ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
6445 LDKChannelHandshakeLimits this_ptr_conv;
6446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6447 this_ptr_conv.is_owned = false;
6448 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
6451 int64_t ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(void* ctx_TODO, uint32_t this_ptr) {
6452 LDKChannelHandshakeLimits this_ptr_conv;
6453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6454 this_ptr_conv.is_owned = false;
6455 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
6459 void ChannelHandshakeLimits_1set_1min_1max_1htlc_1value_1in_1flight_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
6460 LDKChannelHandshakeLimits this_ptr_conv;
6461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6462 this_ptr_conv.is_owned = false;
6463 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
6466 int64_t ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
6467 LDKChannelHandshakeLimits this_ptr_conv;
6468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6469 this_ptr_conv.is_owned = false;
6470 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
6474 void ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
6475 LDKChannelHandshakeLimits this_ptr_conv;
6476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6477 this_ptr_conv.is_owned = false;
6478 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
6481 int16_t ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(void* ctx_TODO, uint32_t this_ptr) {
6482 LDKChannelHandshakeLimits this_ptr_conv;
6483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6484 this_ptr_conv.is_owned = false;
6485 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
6489 void ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
6490 LDKChannelHandshakeLimits this_ptr_conv;
6491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6492 this_ptr_conv.is_owned = false;
6493 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
6496 int64_t ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
6497 LDKChannelHandshakeLimits this_ptr_conv;
6498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6499 this_ptr_conv.is_owned = false;
6500 int64_t ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
6504 void ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
6505 LDKChannelHandshakeLimits this_ptr_conv;
6506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6507 this_ptr_conv.is_owned = false;
6508 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
6511 int64_t ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
6512 LDKChannelHandshakeLimits this_ptr_conv;
6513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6514 this_ptr_conv.is_owned = false;
6515 int64_t ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
6519 void ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
6520 LDKChannelHandshakeLimits this_ptr_conv;
6521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6522 this_ptr_conv.is_owned = false;
6523 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
6526 int32_t ChannelHandshakeLimits_1get_1max_1minimum_1depth(void* ctx_TODO, uint32_t this_ptr) {
6527 LDKChannelHandshakeLimits this_ptr_conv;
6528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6529 this_ptr_conv.is_owned = false;
6530 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
6534 void ChannelHandshakeLimits_1set_1max_1minimum_1depth(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
6535 LDKChannelHandshakeLimits this_ptr_conv;
6536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6537 this_ptr_conv.is_owned = false;
6538 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
6541 jboolean ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(void* ctx_TODO, uint32_t this_ptr) {
6542 LDKChannelHandshakeLimits this_ptr_conv;
6543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6544 this_ptr_conv.is_owned = false;
6545 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
6549 void ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
6550 LDKChannelHandshakeLimits this_ptr_conv;
6551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6552 this_ptr_conv.is_owned = false;
6553 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
6556 int16_t ChannelHandshakeLimits_1get_1their_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr) {
6557 LDKChannelHandshakeLimits this_ptr_conv;
6558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6559 this_ptr_conv.is_owned = false;
6560 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
6564 void ChannelHandshakeLimits_1set_1their_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
6565 LDKChannelHandshakeLimits this_ptr_conv;
6566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6567 this_ptr_conv.is_owned = false;
6568 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
6571 uint32_t ChannelHandshakeLimits_1new(void* ctx_TODO, int64_t min_funding_satoshis_arg, int64_t max_htlc_minimum_msat_arg, int64_t min_max_htlc_value_in_flight_msat_arg, int64_t max_channel_reserve_satoshis_arg, int16_t min_max_accepted_htlcs_arg, int64_t min_dust_limit_satoshis_arg, int64_t max_dust_limit_satoshis_arg, int32_t max_minimum_depth_arg, jboolean force_announced_channel_preference_arg, int16_t their_to_self_delay_arg) {
6572 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_new(min_funding_satoshis_arg, max_htlc_minimum_msat_arg, min_max_htlc_value_in_flight_msat_arg, max_channel_reserve_satoshis_arg, min_max_accepted_htlcs_arg, min_dust_limit_satoshis_arg, max_dust_limit_satoshis_arg, max_minimum_depth_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
6573 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6574 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6575 long ret_ref = (long)ret_var.inner;
6576 if (ret_var.is_owned) {
6582 uint32_t ChannelHandshakeLimits_1default(void* ctx_TODO) {
6583 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
6584 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6585 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6586 long ret_ref = (long)ret_var.inner;
6587 if (ret_var.is_owned) {
6593 void ChannelConfig_1free(void* ctx_TODO, uint32_t this_ptr) {
6594 LDKChannelConfig this_ptr_conv;
6595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6596 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6597 ChannelConfig_free(this_ptr_conv);
6600 uint32_t ChannelConfig_1clone(void* ctx_TODO, uint32_t orig) {
6601 LDKChannelConfig orig_conv;
6602 orig_conv.inner = (void*)(orig & (~1));
6603 orig_conv.is_owned = false;
6604 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
6605 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6606 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6607 long ret_ref = (long)ret_var.inner;
6608 if (ret_var.is_owned) {
6614 int32_t ChannelConfig_1get_1fee_1proportional_1millionths(void* ctx_TODO, uint32_t this_ptr) {
6615 LDKChannelConfig this_ptr_conv;
6616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6617 this_ptr_conv.is_owned = false;
6618 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
6622 void ChannelConfig_1set_1fee_1proportional_1millionths(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
6623 LDKChannelConfig this_ptr_conv;
6624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6625 this_ptr_conv.is_owned = false;
6626 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
6629 jboolean ChannelConfig_1get_1announced_1channel(void* ctx_TODO, uint32_t this_ptr) {
6630 LDKChannelConfig this_ptr_conv;
6631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6632 this_ptr_conv.is_owned = false;
6633 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
6637 void ChannelConfig_1set_1announced_1channel(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
6638 LDKChannelConfig this_ptr_conv;
6639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6640 this_ptr_conv.is_owned = false;
6641 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
6644 jboolean ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(void* ctx_TODO, uint32_t this_ptr) {
6645 LDKChannelConfig this_ptr_conv;
6646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6647 this_ptr_conv.is_owned = false;
6648 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
6652 void ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
6653 LDKChannelConfig this_ptr_conv;
6654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6655 this_ptr_conv.is_owned = false;
6656 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
6659 uint32_t ChannelConfig_1new(void* ctx_TODO, int32_t fee_proportional_millionths_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
6660 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
6661 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6662 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6663 long ret_ref = (long)ret_var.inner;
6664 if (ret_var.is_owned) {
6670 uint32_t ChannelConfig_1default(void* ctx_TODO) {
6671 LDKChannelConfig ret_var = ChannelConfig_default();
6672 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6673 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6674 long ret_ref = (long)ret_var.inner;
6675 if (ret_var.is_owned) {
6681 int8_tArray ChannelConfig_1write(void* ctx_TODO, uint32_t obj) {
6682 LDKChannelConfig obj_conv;
6683 obj_conv.inner = (void*)(obj & (~1));
6684 obj_conv.is_owned = false;
6685 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
6686 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
6687 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
6688 CVec_u8Z_free(arg_var);
6692 uint32_t ChannelConfig_1read(void* ctx_TODO, int8_tArray ser) {
6694 ser_ref.datalen = ser.len;
6695 ser_ref.data = ser.ptr;
6696 LDKChannelConfig ret_var = ChannelConfig_read(ser_ref);
6697 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6698 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6699 long ret_ref = (long)ret_var.inner;
6700 if (ret_var.is_owned) {
6706 void UserConfig_1free(void* ctx_TODO, uint32_t this_ptr) {
6707 LDKUserConfig this_ptr_conv;
6708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6709 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6710 UserConfig_free(this_ptr_conv);
6713 uint32_t UserConfig_1clone(void* ctx_TODO, uint32_t orig) {
6714 LDKUserConfig orig_conv;
6715 orig_conv.inner = (void*)(orig & (~1));
6716 orig_conv.is_owned = false;
6717 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
6718 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6719 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6720 long ret_ref = (long)ret_var.inner;
6721 if (ret_var.is_owned) {
6727 uint32_t UserConfig_1get_1own_1channel_1config(void* ctx_TODO, uint32_t this_ptr) {
6728 LDKUserConfig this_ptr_conv;
6729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6730 this_ptr_conv.is_owned = false;
6731 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
6732 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6733 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6734 long ret_ref = (long)ret_var.inner;
6735 if (ret_var.is_owned) {
6741 void UserConfig_1set_1own_1channel_1config(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
6742 LDKUserConfig this_ptr_conv;
6743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6744 this_ptr_conv.is_owned = false;
6745 LDKChannelHandshakeConfig val_conv;
6746 val_conv.inner = (void*)(val & (~1));
6747 val_conv.is_owned = (val & 1) || (val == 0);
6748 if (val_conv.inner != NULL)
6749 val_conv = ChannelHandshakeConfig_clone(&val_conv);
6750 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
6753 uint32_t UserConfig_1get_1peer_1channel_1config_1limits(void* ctx_TODO, uint32_t this_ptr) {
6754 LDKUserConfig this_ptr_conv;
6755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6756 this_ptr_conv.is_owned = false;
6757 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
6758 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6759 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6760 long ret_ref = (long)ret_var.inner;
6761 if (ret_var.is_owned) {
6767 void UserConfig_1set_1peer_1channel_1config_1limits(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
6768 LDKUserConfig this_ptr_conv;
6769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6770 this_ptr_conv.is_owned = false;
6771 LDKChannelHandshakeLimits val_conv;
6772 val_conv.inner = (void*)(val & (~1));
6773 val_conv.is_owned = (val & 1) || (val == 0);
6774 if (val_conv.inner != NULL)
6775 val_conv = ChannelHandshakeLimits_clone(&val_conv);
6776 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
6779 uint32_t UserConfig_1get_1channel_1options(void* ctx_TODO, uint32_t this_ptr) {
6780 LDKUserConfig this_ptr_conv;
6781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6782 this_ptr_conv.is_owned = false;
6783 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
6784 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6785 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6786 long ret_ref = (long)ret_var.inner;
6787 if (ret_var.is_owned) {
6793 void UserConfig_1set_1channel_1options(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
6794 LDKUserConfig this_ptr_conv;
6795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6796 this_ptr_conv.is_owned = false;
6797 LDKChannelConfig val_conv;
6798 val_conv.inner = (void*)(val & (~1));
6799 val_conv.is_owned = (val & 1) || (val == 0);
6800 if (val_conv.inner != NULL)
6801 val_conv = ChannelConfig_clone(&val_conv);
6802 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
6805 uint32_t UserConfig_1new(void* ctx_TODO, uint32_t own_channel_config_arg, uint32_t peer_channel_config_limits_arg, uint32_t channel_options_arg) {
6806 LDKChannelHandshakeConfig own_channel_config_arg_conv;
6807 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
6808 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
6809 if (own_channel_config_arg_conv.inner != NULL)
6810 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
6811 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
6812 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
6813 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
6814 if (peer_channel_config_limits_arg_conv.inner != NULL)
6815 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
6816 LDKChannelConfig channel_options_arg_conv;
6817 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
6818 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
6819 if (channel_options_arg_conv.inner != NULL)
6820 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
6821 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
6822 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6823 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6824 long ret_ref = (long)ret_var.inner;
6825 if (ret_var.is_owned) {
6831 uint32_t UserConfig_1default(void* ctx_TODO) {
6832 LDKUserConfig ret_var = UserConfig_default();
6833 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6834 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6835 long ret_ref = (long)ret_var.inner;
6836 if (ret_var.is_owned) {
6842 uint32_t AccessError_1clone(void* ctx_TODO, uint32_t orig) {
6843 LDKAccessError* orig_conv = (LDKAccessError*)orig;
6844 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
6848 void Access_1free(void* ctx_TODO, uint32_t this_ptr) {
6849 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
6850 FREE((void*)this_ptr);
6851 Access_free(this_ptr_conv);
6854 void Watch_1free(void* ctx_TODO, uint32_t this_ptr) {
6855 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
6856 FREE((void*)this_ptr);
6857 Watch_free(this_ptr_conv);
6860 void Filter_1free(void* ctx_TODO, uint32_t this_ptr) {
6861 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
6862 FREE((void*)this_ptr);
6863 Filter_free(this_ptr_conv);
6866 void BroadcasterInterface_1free(void* ctx_TODO, uint32_t this_ptr) {
6867 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
6868 FREE((void*)this_ptr);
6869 BroadcasterInterface_free(this_ptr_conv);
6872 uint32_t ConfirmationTarget_1clone(void* ctx_TODO, uint32_t orig) {
6873 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)orig;
6874 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
6878 void FeeEstimator_1free(void* ctx_TODO, uint32_t this_ptr) {
6879 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
6880 FREE((void*)this_ptr);
6881 FeeEstimator_free(this_ptr_conv);
6884 void ChainMonitor_1free(void* ctx_TODO, uint32_t this_ptr) {
6885 LDKChainMonitor this_ptr_conv;
6886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6887 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6888 ChainMonitor_free(this_ptr_conv);
6891 void ChainMonitor_1block_1connected(void* ctx_TODO, uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
6892 LDKChainMonitor this_arg_conv;
6893 this_arg_conv.inner = (void*)(this_arg & (~1));
6894 this_arg_conv.is_owned = false;
6895 unsigned char header_arr[80];
6896 CHECK(header.len == 80);
6897 memcpy(header_arr, header.ptr, 80);
6898 unsigned char (*header_ref)[80] = &header_arr;
6899 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6900 txdata_constr.datalen = txdata.len;
6901 if (txdata_constr.datalen > 0)
6902 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6904 txdata_constr.data = NULL;
6905 uint32_t* txdata_vals = (uint32_t*) txdata.ptr;
6906 for (size_t e = 0; e < txdata_constr.datalen; e++) {
6907 uint32_t arr_conv_30 = txdata_vals[e];
6908 LDKC2Tuple_usizeTransactionZ arr_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_30;
6909 FREE((void*)arr_conv_30);
6910 txdata_constr.data[e] = arr_conv_30_conv;
6912 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
6915 void ChainMonitor_1block_1disconnected(void* ctx_TODO, uint32_t this_arg, int8_tArray header, int32_t disconnected_height) {
6916 LDKChainMonitor this_arg_conv;
6917 this_arg_conv.inner = (void*)(this_arg & (~1));
6918 this_arg_conv.is_owned = false;
6919 unsigned char header_arr[80];
6920 CHECK(header.len == 80);
6921 memcpy(header_arr, header.ptr, 80);
6922 unsigned char (*header_ref)[80] = &header_arr;
6923 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
6926 uint32_t ChainMonitor_1new(void* ctx_TODO, uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
6927 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
6928 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6929 LDKLogger logger_conv = *(LDKLogger*)logger;
6930 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
6931 LDKPersist persister_conv = *(LDKPersist*)persister;
6932 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
6933 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6934 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6935 long ret_ref = (long)ret_var.inner;
6936 if (ret_var.is_owned) {
6942 uint32_t ChainMonitor_1as_1Watch(void* ctx_TODO, uint32_t this_arg) {
6943 LDKChainMonitor this_arg_conv;
6944 this_arg_conv.inner = (void*)(this_arg & (~1));
6945 this_arg_conv.is_owned = false;
6946 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
6947 *ret = ChainMonitor_as_Watch(&this_arg_conv);
6951 uint32_t ChainMonitor_1as_1EventsProvider(void* ctx_TODO, uint32_t this_arg) {
6952 LDKChainMonitor this_arg_conv;
6953 this_arg_conv.inner = (void*)(this_arg & (~1));
6954 this_arg_conv.is_owned = false;
6955 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6956 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
6960 void ChannelMonitorUpdate_1free(void* ctx_TODO, uint32_t this_ptr) {
6961 LDKChannelMonitorUpdate this_ptr_conv;
6962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6963 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6964 ChannelMonitorUpdate_free(this_ptr_conv);
6967 uint32_t ChannelMonitorUpdate_1clone(void* ctx_TODO, uint32_t orig) {
6968 LDKChannelMonitorUpdate orig_conv;
6969 orig_conv.inner = (void*)(orig & (~1));
6970 orig_conv.is_owned = false;
6971 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
6972 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6973 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6974 long ret_ref = (long)ret_var.inner;
6975 if (ret_var.is_owned) {
6981 int64_t ChannelMonitorUpdate_1get_1update_1id(void* ctx_TODO, uint32_t this_ptr) {
6982 LDKChannelMonitorUpdate this_ptr_conv;
6983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6984 this_ptr_conv.is_owned = false;
6985 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
6989 void ChannelMonitorUpdate_1set_1update_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
6990 LDKChannelMonitorUpdate this_ptr_conv;
6991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6992 this_ptr_conv.is_owned = false;
6993 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
6996 int8_tArray ChannelMonitorUpdate_1write(void* ctx_TODO, uint32_t obj) {
6997 LDKChannelMonitorUpdate obj_conv;
6998 obj_conv.inner = (void*)(obj & (~1));
6999 obj_conv.is_owned = false;
7000 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
7001 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
7002 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
7003 CVec_u8Z_free(arg_var);
7007 uint32_t ChannelMonitorUpdate_1read(void* ctx_TODO, int8_tArray ser) {
7009 ser_ref.datalen = ser.len;
7010 ser_ref.data = ser.ptr;
7011 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
7012 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
7013 return (long)ret_conv;
7016 uint32_t ChannelMonitorUpdateErr_1clone(void* ctx_TODO, uint32_t orig) {
7017 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)orig;
7018 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
7022 void MonitorUpdateError_1free(void* ctx_TODO, uint32_t this_ptr) {
7023 LDKMonitorUpdateError this_ptr_conv;
7024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7025 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7026 MonitorUpdateError_free(this_ptr_conv);
7029 void MonitorEvent_1free(void* ctx_TODO, uint32_t this_ptr) {
7030 LDKMonitorEvent this_ptr_conv;
7031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7032 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7033 MonitorEvent_free(this_ptr_conv);
7036 uint32_t MonitorEvent_1clone(void* ctx_TODO, uint32_t orig) {
7037 LDKMonitorEvent orig_conv;
7038 orig_conv.inner = (void*)(orig & (~1));
7039 orig_conv.is_owned = false;
7040 LDKMonitorEvent ret_var = MonitorEvent_clone(&orig_conv);
7041 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7042 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7043 long ret_ref = (long)ret_var.inner;
7044 if (ret_var.is_owned) {
7050 void HTLCUpdate_1free(void* ctx_TODO, uint32_t this_ptr) {
7051 LDKHTLCUpdate this_ptr_conv;
7052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7053 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7054 HTLCUpdate_free(this_ptr_conv);
7057 uint32_t HTLCUpdate_1clone(void* ctx_TODO, uint32_t orig) {
7058 LDKHTLCUpdate orig_conv;
7059 orig_conv.inner = (void*)(orig & (~1));
7060 orig_conv.is_owned = false;
7061 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
7062 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7063 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7064 long ret_ref = (long)ret_var.inner;
7065 if (ret_var.is_owned) {
7071 int8_tArray HTLCUpdate_1write(void* ctx_TODO, uint32_t obj) {
7072 LDKHTLCUpdate obj_conv;
7073 obj_conv.inner = (void*)(obj & (~1));
7074 obj_conv.is_owned = false;
7075 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
7076 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
7077 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
7078 CVec_u8Z_free(arg_var);
7082 uint32_t HTLCUpdate_1read(void* ctx_TODO, int8_tArray ser) {
7084 ser_ref.datalen = ser.len;
7085 ser_ref.data = ser.ptr;
7086 LDKHTLCUpdate ret_var = HTLCUpdate_read(ser_ref);
7087 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7088 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7089 long ret_ref = (long)ret_var.inner;
7090 if (ret_var.is_owned) {
7096 void ChannelMonitor_1free(void* ctx_TODO, uint32_t this_ptr) {
7097 LDKChannelMonitor this_ptr_conv;
7098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7099 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7100 ChannelMonitor_free(this_ptr_conv);
7103 int8_tArray ChannelMonitor_1write(void* ctx_TODO, uint32_t obj) {
7104 LDKChannelMonitor obj_conv;
7105 obj_conv.inner = (void*)(obj & (~1));
7106 obj_conv.is_owned = false;
7107 LDKCVec_u8Z arg_var = ChannelMonitor_write(&obj_conv);
7108 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
7109 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
7110 CVec_u8Z_free(arg_var);
7114 uint32_t ChannelMonitor_1update_1monitor(void* ctx_TODO, uint32_t this_arg, uint32_t updates, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
7115 LDKChannelMonitor this_arg_conv;
7116 this_arg_conv.inner = (void*)(this_arg & (~1));
7117 this_arg_conv.is_owned = false;
7118 LDKChannelMonitorUpdate updates_conv;
7119 updates_conv.inner = (void*)(updates & (~1));
7120 updates_conv.is_owned = false;
7121 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
7122 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator;
7123 LDKLogger* logger_conv = (LDKLogger*)logger;
7124 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
7125 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
7126 return (long)ret_conv;
7129 int64_t ChannelMonitor_1get_1latest_1update_1id(void* ctx_TODO, uint32_t this_arg) {
7130 LDKChannelMonitor this_arg_conv;
7131 this_arg_conv.inner = (void*)(this_arg & (~1));
7132 this_arg_conv.is_owned = false;
7133 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
7137 uint32_t ChannelMonitor_1get_1funding_1txo(void* ctx_TODO, uint32_t this_arg) {
7138 LDKChannelMonitor this_arg_conv;
7139 this_arg_conv.inner = (void*)(this_arg & (~1));
7140 this_arg_conv.is_owned = false;
7141 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
7142 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
7143 ret_ref->a = OutPoint_clone(&ret_ref->a);
7144 ret_ref->b = CVec_u8Z_clone(&ret_ref->b);
7145 return (long)ret_ref;
7148 uint32_tArray ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(void* ctx_TODO, uint32_t this_arg) {
7149 LDKChannelMonitor this_arg_conv;
7150 this_arg_conv.inner = (void*)(this_arg & (~1));
7151 this_arg_conv.is_owned = false;
7152 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
7153 uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
7154 uint32_t *ret_arr_ptr = (uint32_t*)ret_arr.ptr;
7155 for (size_t o = 0; o < ret_var.datalen; o++) {
7156 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
7157 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7158 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7159 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
7160 if (arr_conv_14_var.is_owned) {
7161 arr_conv_14_ref |= 1;
7163 ret_arr_ptr[o] = arr_conv_14_ref;
7169 uint32_tArray ChannelMonitor_1get_1and_1clear_1pending_1events(void* ctx_TODO, uint32_t this_arg) {
7170 LDKChannelMonitor this_arg_conv;
7171 this_arg_conv.inner = (void*)(this_arg & (~1));
7172 this_arg_conv.is_owned = false;
7173 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
7174 uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
7175 uint32_t *ret_arr_ptr = (uint32_t*)ret_arr.ptr;
7176 for (size_t h = 0; h < ret_var.datalen; h++) {
7177 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
7178 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
7179 long arr_conv_7_ref = (long)arr_conv_7_copy;
7180 ret_arr_ptr[h] = arr_conv_7_ref;
7186 ptrArray ChannelMonitor_1get_1latest_1holder_1commitment_1txn(void* ctx_TODO, uint32_t this_arg, uint32_t logger) {
7187 LDKChannelMonitor this_arg_conv;
7188 this_arg_conv.inner = (void*)(this_arg & (~1));
7189 this_arg_conv.is_owned = false;
7190 LDKLogger* logger_conv = (LDKLogger*)logger;
7191 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
7192 ptrArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native Object Bytes") };
7193 int8_tArray *ret_arr_ptr = (int8_tArray*)ret_arr.ptr;
7194 for (size_t m = 0; m < ret_var.datalen; m++) {
7195 LDKTransaction arr_conv_12_var = ret_var.data[m];
7196 int8_tArray arr_conv_12_arr = { .len = arr_conv_12_var.datalen, .ptr = MALLOC(arr_conv_12_var.datalen, "Native int8_tArray Bytes") };
7197 memcpy(arr_conv_12_arr.ptr, arr_conv_12_var.data, arr_conv_12_var.datalen);
7198 Transaction_free(arr_conv_12_var);
7199 ret_arr_ptr[m] = arr_conv_12_arr;
7205 uint32_tArray ChannelMonitor_1block_1connected(void* ctx_TODO, uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
7206 LDKChannelMonitor this_arg_conv;
7207 this_arg_conv.inner = (void*)(this_arg & (~1));
7208 this_arg_conv.is_owned = false;
7209 unsigned char header_arr[80];
7210 CHECK(header.len == 80);
7211 memcpy(header_arr, header.ptr, 80);
7212 unsigned char (*header_ref)[80] = &header_arr;
7213 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7214 txdata_constr.datalen = txdata.len;
7215 if (txdata_constr.datalen > 0)
7216 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7218 txdata_constr.data = NULL;
7219 uint32_t* txdata_vals = (uint32_t*) txdata.ptr;
7220 for (size_t e = 0; e < txdata_constr.datalen; e++) {
7221 uint32_t arr_conv_30 = txdata_vals[e];
7222 LDKC2Tuple_usizeTransactionZ arr_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_30;
7223 FREE((void*)arr_conv_30);
7224 txdata_constr.data[e] = arr_conv_30_conv;
7226 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
7227 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
7228 LDKLogger logger_conv = *(LDKLogger*)logger;
7229 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
7230 uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
7231 uint32_t *ret_arr_ptr = (uint32_t*)ret_arr.ptr;
7232 for (size_t x = 0; x < ret_var.datalen; x++) {
7233 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arr_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
7234 *arr_conv_49_ref = ret_var.data[x];
7235 arr_conv_49_ref->a = ThirtyTwoBytes_clone(&arr_conv_49_ref->a);
7236 // XXX: We likely need to clone here, but no _clone fn is available for TwoTuple<Number, TxOut>[]
7237 ret_arr_ptr[x] = (long)arr_conv_49_ref;
7243 void ChannelMonitor_1block_1disconnected(void* ctx_TODO, uint32_t this_arg, int8_tArray header, int32_t height, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
7244 LDKChannelMonitor this_arg_conv;
7245 this_arg_conv.inner = (void*)(this_arg & (~1));
7246 this_arg_conv.is_owned = false;
7247 unsigned char header_arr[80];
7248 CHECK(header.len == 80);
7249 memcpy(header_arr, header.ptr, 80);
7250 unsigned char (*header_ref)[80] = &header_arr;
7251 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
7252 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
7253 LDKLogger logger_conv = *(LDKLogger*)logger;
7254 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
7257 void Persist_1free(void* ctx_TODO, uint32_t this_ptr) {
7258 LDKPersist this_ptr_conv = *(LDKPersist*)this_ptr;
7259 FREE((void*)this_ptr);
7260 Persist_free(this_ptr_conv);
7263 uint32_t C2Tuple_1BlockHashChannelMonitorZ_1read(void* ctx_TODO, int8_tArray ser, uint32_t arg) {
7265 ser_ref.datalen = ser.len;
7266 ser_ref.data = ser.ptr;
7267 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
7268 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
7269 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
7270 return (long)ret_conv;
7273 void OutPoint_1free(void* ctx_TODO, uint32_t this_ptr) {
7274 LDKOutPoint this_ptr_conv;
7275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7276 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7277 OutPoint_free(this_ptr_conv);
7280 uint32_t OutPoint_1clone(void* ctx_TODO, uint32_t orig) {
7281 LDKOutPoint orig_conv;
7282 orig_conv.inner = (void*)(orig & (~1));
7283 orig_conv.is_owned = false;
7284 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
7285 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7286 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7287 long ret_ref = (long)ret_var.inner;
7288 if (ret_var.is_owned) {
7294 int8_tArray OutPoint_1get_1txid(void* ctx_TODO, uint32_t this_ptr) {
7295 LDKOutPoint this_ptr_conv;
7296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7297 this_ptr_conv.is_owned = false;
7298 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
7299 memcpy(ret_arr.ptr, *OutPoint_get_txid(&this_ptr_conv), 32);
7303 void OutPoint_1set_1txid(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7304 LDKOutPoint this_ptr_conv;
7305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7306 this_ptr_conv.is_owned = false;
7307 LDKThirtyTwoBytes val_ref;
7308 CHECK(val.len == 32);
7309 memcpy(val_ref.data, val.ptr, 32);
7310 OutPoint_set_txid(&this_ptr_conv, val_ref);
7313 int16_t OutPoint_1get_1index(void* ctx_TODO, uint32_t this_ptr) {
7314 LDKOutPoint this_ptr_conv;
7315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7316 this_ptr_conv.is_owned = false;
7317 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
7321 void OutPoint_1set_1index(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
7322 LDKOutPoint this_ptr_conv;
7323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7324 this_ptr_conv.is_owned = false;
7325 OutPoint_set_index(&this_ptr_conv, val);
7328 uint32_t OutPoint_1new(void* ctx_TODO, int8_tArray txid_arg, int16_t index_arg) {
7329 LDKThirtyTwoBytes txid_arg_ref;
7330 CHECK(txid_arg.len == 32);
7331 memcpy(txid_arg_ref.data, txid_arg.ptr, 32);
7332 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
7333 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7334 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7335 long ret_ref = (long)ret_var.inner;
7336 if (ret_var.is_owned) {
7342 int8_tArray OutPoint_1to_1channel_1id(void* ctx_TODO, uint32_t this_arg) {
7343 LDKOutPoint this_arg_conv;
7344 this_arg_conv.inner = (void*)(this_arg & (~1));
7345 this_arg_conv.is_owned = false;
7346 int8_tArray arg_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
7347 memcpy(arg_arr.ptr, OutPoint_to_channel_id(&this_arg_conv).data, 32);
7351 int8_tArray OutPoint_1write(void* ctx_TODO, uint32_t obj) {
7352 LDKOutPoint obj_conv;
7353 obj_conv.inner = (void*)(obj & (~1));
7354 obj_conv.is_owned = false;
7355 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
7356 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
7357 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
7358 CVec_u8Z_free(arg_var);
7362 uint32_t OutPoint_1read(void* ctx_TODO, int8_tArray ser) {
7364 ser_ref.datalen = ser.len;
7365 ser_ref.data = ser.ptr;
7366 LDKOutPoint ret_var = OutPoint_read(ser_ref);
7367 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7368 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7369 long ret_ref = (long)ret_var.inner;
7370 if (ret_var.is_owned) {
7376 void SpendableOutputDescriptor_1free(void* ctx_TODO, uint32_t this_ptr) {
7377 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
7378 FREE((void*)this_ptr);
7379 SpendableOutputDescriptor_free(this_ptr_conv);
7382 uint32_t SpendableOutputDescriptor_1clone(void* ctx_TODO, uint32_t orig) {
7383 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
7384 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
7385 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
7386 long ret_ref = (long)ret_copy;
7390 int8_tArray SpendableOutputDescriptor_1write(void* ctx_TODO, uint32_t obj) {
7391 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
7392 LDKCVec_u8Z arg_var = SpendableOutputDescriptor_write(obj_conv);
7393 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
7394 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
7395 CVec_u8Z_free(arg_var);
7399 uint32_t SpendableOutputDescriptor_1read(void* ctx_TODO, int8_tArray ser) {
7401 ser_ref.datalen = ser.len;
7402 ser_ref.data = ser.ptr;
7403 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7404 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
7405 return (long)ret_conv;
7408 uint32_t ChannelKeys_1clone(void* ctx_TODO, uint32_t orig) {
7409 LDKChannelKeys* orig_conv = (LDKChannelKeys*)orig;
7410 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
7411 *ret = ChannelKeys_clone(orig_conv);
7415 void ChannelKeys_1free(void* ctx_TODO, uint32_t this_ptr) {
7416 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
7417 FREE((void*)this_ptr);
7418 ChannelKeys_free(this_ptr_conv);
7421 void KeysInterface_1free(void* ctx_TODO, uint32_t this_ptr) {
7422 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
7423 FREE((void*)this_ptr);
7424 KeysInterface_free(this_ptr_conv);
7427 void InMemoryChannelKeys_1free(void* ctx_TODO, uint32_t this_ptr) {
7428 LDKInMemoryChannelKeys this_ptr_conv;
7429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7430 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7431 InMemoryChannelKeys_free(this_ptr_conv);
7434 uint32_t InMemoryChannelKeys_1clone(void* ctx_TODO, uint32_t orig) {
7435 LDKInMemoryChannelKeys orig_conv;
7436 orig_conv.inner = (void*)(orig & (~1));
7437 orig_conv.is_owned = false;
7438 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_clone(&orig_conv);
7439 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7440 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7441 long ret_ref = (long)ret_var.inner;
7442 if (ret_var.is_owned) {
7448 int8_tArray InMemoryChannelKeys_1get_1funding_1key(void* ctx_TODO, uint32_t this_ptr) {
7449 LDKInMemoryChannelKeys this_ptr_conv;
7450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7451 this_ptr_conv.is_owned = false;
7452 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
7453 memcpy(ret_arr.ptr, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv), 32);
7457 void InMemoryChannelKeys_1set_1funding_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7458 LDKInMemoryChannelKeys this_ptr_conv;
7459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7460 this_ptr_conv.is_owned = false;
7461 LDKSecretKey val_ref;
7462 CHECK(val.len == 32);
7463 memcpy(val_ref.bytes, val.ptr, 32);
7464 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
7467 int8_tArray InMemoryChannelKeys_1get_1revocation_1base_1key(void* ctx_TODO, uint32_t this_ptr) {
7468 LDKInMemoryChannelKeys this_ptr_conv;
7469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7470 this_ptr_conv.is_owned = false;
7471 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
7472 memcpy(ret_arr.ptr, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv), 32);
7476 void InMemoryChannelKeys_1set_1revocation_1base_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7477 LDKInMemoryChannelKeys this_ptr_conv;
7478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7479 this_ptr_conv.is_owned = false;
7480 LDKSecretKey val_ref;
7481 CHECK(val.len == 32);
7482 memcpy(val_ref.bytes, val.ptr, 32);
7483 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
7486 int8_tArray InMemoryChannelKeys_1get_1payment_1key(void* ctx_TODO, uint32_t this_ptr) {
7487 LDKInMemoryChannelKeys this_ptr_conv;
7488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7489 this_ptr_conv.is_owned = false;
7490 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
7491 memcpy(ret_arr.ptr, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv), 32);
7495 void InMemoryChannelKeys_1set_1payment_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7496 LDKInMemoryChannelKeys this_ptr_conv;
7497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7498 this_ptr_conv.is_owned = false;
7499 LDKSecretKey val_ref;
7500 CHECK(val.len == 32);
7501 memcpy(val_ref.bytes, val.ptr, 32);
7502 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
7505 int8_tArray InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(void* ctx_TODO, uint32_t this_ptr) {
7506 LDKInMemoryChannelKeys this_ptr_conv;
7507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7508 this_ptr_conv.is_owned = false;
7509 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
7510 memcpy(ret_arr.ptr, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv), 32);
7514 void InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7515 LDKInMemoryChannelKeys this_ptr_conv;
7516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7517 this_ptr_conv.is_owned = false;
7518 LDKSecretKey val_ref;
7519 CHECK(val.len == 32);
7520 memcpy(val_ref.bytes, val.ptr, 32);
7521 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
7524 int8_tArray InMemoryChannelKeys_1get_1htlc_1base_1key(void* ctx_TODO, uint32_t this_ptr) {
7525 LDKInMemoryChannelKeys this_ptr_conv;
7526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7527 this_ptr_conv.is_owned = false;
7528 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
7529 memcpy(ret_arr.ptr, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv), 32);
7533 void InMemoryChannelKeys_1set_1htlc_1base_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7534 LDKInMemoryChannelKeys this_ptr_conv;
7535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7536 this_ptr_conv.is_owned = false;
7537 LDKSecretKey val_ref;
7538 CHECK(val.len == 32);
7539 memcpy(val_ref.bytes, val.ptr, 32);
7540 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
7543 int8_tArray InMemoryChannelKeys_1get_1commitment_1seed(void* ctx_TODO, uint32_t this_ptr) {
7544 LDKInMemoryChannelKeys this_ptr_conv;
7545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7546 this_ptr_conv.is_owned = false;
7547 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
7548 memcpy(ret_arr.ptr, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv), 32);
7552 void InMemoryChannelKeys_1set_1commitment_1seed(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7553 LDKInMemoryChannelKeys this_ptr_conv;
7554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7555 this_ptr_conv.is_owned = false;
7556 LDKThirtyTwoBytes val_ref;
7557 CHECK(val.len == 32);
7558 memcpy(val_ref.data, val.ptr, 32);
7559 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
7562 uint32_t InMemoryChannelKeys_1new(void* ctx_TODO, int8_tArray funding_key, int8_tArray revocation_base_key, int8_tArray payment_key, int8_tArray delayed_payment_base_key, int8_tArray htlc_base_key, int8_tArray commitment_seed, int64_t channel_value_satoshis, uint32_t key_derivation_params) {
7563 LDKSecretKey funding_key_ref;
7564 CHECK(funding_key.len == 32);
7565 memcpy(funding_key_ref.bytes, funding_key.ptr, 32);
7566 LDKSecretKey revocation_base_key_ref;
7567 CHECK(revocation_base_key.len == 32);
7568 memcpy(revocation_base_key_ref.bytes, revocation_base_key.ptr, 32);
7569 LDKSecretKey payment_key_ref;
7570 CHECK(payment_key.len == 32);
7571 memcpy(payment_key_ref.bytes, payment_key.ptr, 32);
7572 LDKSecretKey delayed_payment_base_key_ref;
7573 CHECK(delayed_payment_base_key.len == 32);
7574 memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key.ptr, 32);
7575 LDKSecretKey htlc_base_key_ref;
7576 CHECK(htlc_base_key.len == 32);
7577 memcpy(htlc_base_key_ref.bytes, htlc_base_key.ptr, 32);
7578 LDKThirtyTwoBytes commitment_seed_ref;
7579 CHECK(commitment_seed.len == 32);
7580 memcpy(commitment_seed_ref.data, commitment_seed.ptr, 32);
7581 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
7582 FREE((void*)key_derivation_params);
7583 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, key_derivation_params_conv);
7584 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7585 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7586 long ret_ref = (long)ret_var.inner;
7587 if (ret_var.is_owned) {
7593 uint32_t InMemoryChannelKeys_1counterparty_1pubkeys(void* ctx_TODO, uint32_t this_arg) {
7594 LDKInMemoryChannelKeys this_arg_conv;
7595 this_arg_conv.inner = (void*)(this_arg & (~1));
7596 this_arg_conv.is_owned = false;
7597 LDKChannelPublicKeys ret_var = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
7598 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7599 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7600 long ret_ref = (long)ret_var.inner;
7601 if (ret_var.is_owned) {
7607 int16_t InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(void* ctx_TODO, uint32_t this_arg) {
7608 LDKInMemoryChannelKeys this_arg_conv;
7609 this_arg_conv.inner = (void*)(this_arg & (~1));
7610 this_arg_conv.is_owned = false;
7611 int16_t ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
7615 int16_t InMemoryChannelKeys_1holder_1selected_1contest_1delay(void* ctx_TODO, uint32_t this_arg) {
7616 LDKInMemoryChannelKeys this_arg_conv;
7617 this_arg_conv.inner = (void*)(this_arg & (~1));
7618 this_arg_conv.is_owned = false;
7619 int16_t ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
7623 jboolean InMemoryChannelKeys_1is_1outbound(void* ctx_TODO, uint32_t this_arg) {
7624 LDKInMemoryChannelKeys this_arg_conv;
7625 this_arg_conv.inner = (void*)(this_arg & (~1));
7626 this_arg_conv.is_owned = false;
7627 jboolean ret_val = InMemoryChannelKeys_is_outbound(&this_arg_conv);
7631 uint32_t InMemoryChannelKeys_1funding_1outpoint(void* ctx_TODO, uint32_t this_arg) {
7632 LDKInMemoryChannelKeys this_arg_conv;
7633 this_arg_conv.inner = (void*)(this_arg & (~1));
7634 this_arg_conv.is_owned = false;
7635 LDKOutPoint ret_var = InMemoryChannelKeys_funding_outpoint(&this_arg_conv);
7636 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7637 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7638 long ret_ref = (long)ret_var.inner;
7639 if (ret_var.is_owned) {
7645 uint32_t InMemoryChannelKeys_1get_1channel_1parameters(void* ctx_TODO, uint32_t this_arg) {
7646 LDKInMemoryChannelKeys this_arg_conv;
7647 this_arg_conv.inner = (void*)(this_arg & (~1));
7648 this_arg_conv.is_owned = false;
7649 LDKChannelTransactionParameters ret_var = InMemoryChannelKeys_get_channel_parameters(&this_arg_conv);
7650 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7651 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7652 long ret_ref = (long)ret_var.inner;
7653 if (ret_var.is_owned) {
7659 uint32_t InMemoryChannelKeys_1as_1ChannelKeys(void* ctx_TODO, uint32_t this_arg) {
7660 LDKInMemoryChannelKeys this_arg_conv;
7661 this_arg_conv.inner = (void*)(this_arg & (~1));
7662 this_arg_conv.is_owned = false;
7663 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
7664 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
7668 int8_tArray InMemoryChannelKeys_1write(void* ctx_TODO, uint32_t obj) {
7669 LDKInMemoryChannelKeys obj_conv;
7670 obj_conv.inner = (void*)(obj & (~1));
7671 obj_conv.is_owned = false;
7672 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
7673 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
7674 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
7675 CVec_u8Z_free(arg_var);
7679 uint32_t InMemoryChannelKeys_1read(void* ctx_TODO, int8_tArray ser) {
7681 ser_ref.datalen = ser.len;
7682 ser_ref.data = ser.ptr;
7683 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
7684 *ret_conv = InMemoryChannelKeys_read(ser_ref);
7685 return (long)ret_conv;
7688 void KeysManager_1free(void* ctx_TODO, uint32_t this_ptr) {
7689 LDKKeysManager this_ptr_conv;
7690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7691 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7692 KeysManager_free(this_ptr_conv);
7695 uint32_t KeysManager_1new(void* ctx_TODO, int8_tArray seed, uint32_t network, int64_t starting_time_secs, int32_t starting_time_nanos) {
7696 unsigned char seed_arr[32];
7697 CHECK(seed.len == 32);
7698 memcpy(seed_arr, seed.ptr, 32);
7699 unsigned char (*seed_ref)[32] = &seed_arr;
7700 LDKNetwork network_conv = LDKNetwork_from_js(network);
7701 LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
7702 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7703 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7704 long ret_ref = (long)ret_var.inner;
7705 if (ret_var.is_owned) {
7711 uint32_t KeysManager_1derive_1channel_1keys(void* ctx_TODO, uint32_t this_arg, int64_t channel_value_satoshis, int64_t params_1, int64_t params_2) {
7712 LDKKeysManager this_arg_conv;
7713 this_arg_conv.inner = (void*)(this_arg & (~1));
7714 this_arg_conv.is_owned = false;
7715 LDKInMemoryChannelKeys ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
7716 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7717 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7718 long ret_ref = (long)ret_var.inner;
7719 if (ret_var.is_owned) {
7725 uint32_t KeysManager_1as_1KeysInterface(void* ctx_TODO, uint32_t this_arg) {
7726 LDKKeysManager this_arg_conv;
7727 this_arg_conv.inner = (void*)(this_arg & (~1));
7728 this_arg_conv.is_owned = false;
7729 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
7730 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
7734 void ChannelManager_1free(void* ctx_TODO, uint32_t this_ptr) {
7735 LDKChannelManager this_ptr_conv;
7736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7737 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7738 ChannelManager_free(this_ptr_conv);
7741 void ChannelDetails_1free(void* ctx_TODO, uint32_t this_ptr) {
7742 LDKChannelDetails this_ptr_conv;
7743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7744 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7745 ChannelDetails_free(this_ptr_conv);
7748 uint32_t ChannelDetails_1clone(void* ctx_TODO, uint32_t orig) {
7749 LDKChannelDetails orig_conv;
7750 orig_conv.inner = (void*)(orig & (~1));
7751 orig_conv.is_owned = false;
7752 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
7753 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7754 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7755 long ret_ref = (long)ret_var.inner;
7756 if (ret_var.is_owned) {
7762 int8_tArray ChannelDetails_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
7763 LDKChannelDetails this_ptr_conv;
7764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7765 this_ptr_conv.is_owned = false;
7766 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
7767 memcpy(ret_arr.ptr, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
7771 void ChannelDetails_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7772 LDKChannelDetails this_ptr_conv;
7773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7774 this_ptr_conv.is_owned = false;
7775 LDKThirtyTwoBytes val_ref;
7776 CHECK(val.len == 32);
7777 memcpy(val_ref.data, val.ptr, 32);
7778 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
7781 int8_tArray ChannelDetails_1get_1remote_1network_1id(void* ctx_TODO, uint32_t this_ptr) {
7782 LDKChannelDetails this_ptr_conv;
7783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7784 this_ptr_conv.is_owned = false;
7785 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
7786 memcpy(arg_arr.ptr, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form, 33);
7790 void ChannelDetails_1set_1remote_1network_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7791 LDKChannelDetails this_ptr_conv;
7792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7793 this_ptr_conv.is_owned = false;
7794 LDKPublicKey val_ref;
7795 CHECK(val.len == 33);
7796 memcpy(val_ref.compressed_form, val.ptr, 33);
7797 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
7800 uint32_t ChannelDetails_1get_1counterparty_1features(void* ctx_TODO, uint32_t this_ptr) {
7801 LDKChannelDetails this_ptr_conv;
7802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7803 this_ptr_conv.is_owned = false;
7804 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
7805 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7806 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7807 long ret_ref = (long)ret_var.inner;
7808 if (ret_var.is_owned) {
7814 void ChannelDetails_1set_1counterparty_1features(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
7815 LDKChannelDetails this_ptr_conv;
7816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7817 this_ptr_conv.is_owned = false;
7818 LDKInitFeatures val_conv;
7819 val_conv.inner = (void*)(val & (~1));
7820 val_conv.is_owned = (val & 1) || (val == 0);
7821 // Warning: we may need a move here but can't clone!
7822 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
7825 int64_t ChannelDetails_1get_1channel_1value_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
7826 LDKChannelDetails this_ptr_conv;
7827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7828 this_ptr_conv.is_owned = false;
7829 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
7833 void ChannelDetails_1set_1channel_1value_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
7834 LDKChannelDetails this_ptr_conv;
7835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7836 this_ptr_conv.is_owned = false;
7837 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
7840 int64_t ChannelDetails_1get_1user_1id(void* ctx_TODO, uint32_t this_ptr) {
7841 LDKChannelDetails this_ptr_conv;
7842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7843 this_ptr_conv.is_owned = false;
7844 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
7848 void ChannelDetails_1set_1user_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
7849 LDKChannelDetails this_ptr_conv;
7850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7851 this_ptr_conv.is_owned = false;
7852 ChannelDetails_set_user_id(&this_ptr_conv, val);
7855 int64_t ChannelDetails_1get_1outbound_1capacity_1msat(void* ctx_TODO, uint32_t this_ptr) {
7856 LDKChannelDetails this_ptr_conv;
7857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7858 this_ptr_conv.is_owned = false;
7859 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
7863 void ChannelDetails_1set_1outbound_1capacity_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
7864 LDKChannelDetails this_ptr_conv;
7865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7866 this_ptr_conv.is_owned = false;
7867 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
7870 int64_t ChannelDetails_1get_1inbound_1capacity_1msat(void* ctx_TODO, uint32_t this_ptr) {
7871 LDKChannelDetails this_ptr_conv;
7872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7873 this_ptr_conv.is_owned = false;
7874 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
7878 void ChannelDetails_1set_1inbound_1capacity_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
7879 LDKChannelDetails this_ptr_conv;
7880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7881 this_ptr_conv.is_owned = false;
7882 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
7885 jboolean ChannelDetails_1get_1is_1live(void* ctx_TODO, uint32_t this_ptr) {
7886 LDKChannelDetails this_ptr_conv;
7887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7888 this_ptr_conv.is_owned = false;
7889 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
7893 void ChannelDetails_1set_1is_1live(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
7894 LDKChannelDetails this_ptr_conv;
7895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7896 this_ptr_conv.is_owned = false;
7897 ChannelDetails_set_is_live(&this_ptr_conv, val);
7900 void PaymentSendFailure_1free(void* ctx_TODO, uint32_t this_ptr) {
7901 LDKPaymentSendFailure this_ptr_conv;
7902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7903 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7904 PaymentSendFailure_free(this_ptr_conv);
7907 uint32_t ChannelManager_1new(void* ctx_TODO, uint32_t network, uint32_t fee_est, uint32_t chain_monitor, uint32_t tx_broadcaster, uint32_t logger, uint32_t keys_manager, uint32_t config, intptr_t current_blockchain_height) {
7908 LDKNetwork network_conv = LDKNetwork_from_js(network);
7909 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
7910 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7911 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7912 LDKLogger logger_conv = *(LDKLogger*)logger;
7913 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7914 LDKUserConfig config_conv;
7915 config_conv.inner = (void*)(config & (~1));
7916 config_conv.is_owned = (config & 1) || (config == 0);
7917 if (config_conv.inner != NULL)
7918 config_conv = UserConfig_clone(&config_conv);
7919 LDKChannelManager ret_var = ChannelManager_new(network_conv, fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, current_blockchain_height);
7920 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7921 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7922 long ret_ref = (long)ret_var.inner;
7923 if (ret_var.is_owned) {
7929 uint32_t ChannelManager_1create_1channel(void* ctx_TODO, uint32_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_id, uint32_t override_config) {
7930 LDKChannelManager this_arg_conv;
7931 this_arg_conv.inner = (void*)(this_arg & (~1));
7932 this_arg_conv.is_owned = false;
7933 LDKPublicKey their_network_key_ref;
7934 CHECK(their_network_key.len == 33);
7935 memcpy(their_network_key_ref.compressed_form, their_network_key.ptr, 33);
7936 LDKUserConfig override_config_conv;
7937 override_config_conv.inner = (void*)(override_config & (~1));
7938 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
7939 if (override_config_conv.inner != NULL)
7940 override_config_conv = UserConfig_clone(&override_config_conv);
7941 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7942 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
7943 return (long)ret_conv;
7946 uint32_tArray ChannelManager_1list_1channels(void* ctx_TODO, uint32_t this_arg) {
7947 LDKChannelManager this_arg_conv;
7948 this_arg_conv.inner = (void*)(this_arg & (~1));
7949 this_arg_conv.is_owned = false;
7950 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
7951 uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
7952 uint32_t *ret_arr_ptr = (uint32_t*)ret_arr.ptr;
7953 for (size_t q = 0; q < ret_var.datalen; q++) {
7954 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
7955 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7956 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7957 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
7958 if (arr_conv_16_var.is_owned) {
7959 arr_conv_16_ref |= 1;
7961 ret_arr_ptr[q] = arr_conv_16_ref;
7967 uint32_tArray ChannelManager_1list_1usable_1channels(void* ctx_TODO, uint32_t this_arg) {
7968 LDKChannelManager this_arg_conv;
7969 this_arg_conv.inner = (void*)(this_arg & (~1));
7970 this_arg_conv.is_owned = false;
7971 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
7972 uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
7973 uint32_t *ret_arr_ptr = (uint32_t*)ret_arr.ptr;
7974 for (size_t q = 0; q < ret_var.datalen; q++) {
7975 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
7976 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7977 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7978 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
7979 if (arr_conv_16_var.is_owned) {
7980 arr_conv_16_ref |= 1;
7982 ret_arr_ptr[q] = arr_conv_16_ref;
7988 uint32_t ChannelManager_1close_1channel(void* ctx_TODO, uint32_t this_arg, int8_tArray channel_id) {
7989 LDKChannelManager this_arg_conv;
7990 this_arg_conv.inner = (void*)(this_arg & (~1));
7991 this_arg_conv.is_owned = false;
7992 unsigned char channel_id_arr[32];
7993 CHECK(channel_id.len == 32);
7994 memcpy(channel_id_arr, channel_id.ptr, 32);
7995 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
7996 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7997 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
7998 return (long)ret_conv;
8001 void ChannelManager_1force_1close_1channel(void* ctx_TODO, uint32_t this_arg, int8_tArray channel_id) {
8002 LDKChannelManager this_arg_conv;
8003 this_arg_conv.inner = (void*)(this_arg & (~1));
8004 this_arg_conv.is_owned = false;
8005 unsigned char channel_id_arr[32];
8006 CHECK(channel_id.len == 32);
8007 memcpy(channel_id_arr, channel_id.ptr, 32);
8008 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
8009 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
8012 void ChannelManager_1force_1close_1all_1channels(void* ctx_TODO, uint32_t this_arg) {
8013 LDKChannelManager this_arg_conv;
8014 this_arg_conv.inner = (void*)(this_arg & (~1));
8015 this_arg_conv.is_owned = false;
8016 ChannelManager_force_close_all_channels(&this_arg_conv);
8019 uint32_t ChannelManager_1send_1payment(void* ctx_TODO, uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
8020 LDKChannelManager this_arg_conv;
8021 this_arg_conv.inner = (void*)(this_arg & (~1));
8022 this_arg_conv.is_owned = false;
8023 LDKRoute route_conv;
8024 route_conv.inner = (void*)(route & (~1));
8025 route_conv.is_owned = false;
8026 LDKThirtyTwoBytes payment_hash_ref;
8027 CHECK(payment_hash.len == 32);
8028 memcpy(payment_hash_ref.data, payment_hash.ptr, 32);
8029 LDKThirtyTwoBytes payment_secret_ref;
8030 CHECK(payment_secret.len == 32);
8031 memcpy(payment_secret_ref.data, payment_secret.ptr, 32);
8032 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8033 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
8034 return (long)ret_conv;
8037 void ChannelManager_1funding_1transaction_1generated(void* ctx_TODO, uint32_t this_arg, int8_tArray temporary_channel_id, uint32_t funding_txo) {
8038 LDKChannelManager this_arg_conv;
8039 this_arg_conv.inner = (void*)(this_arg & (~1));
8040 this_arg_conv.is_owned = false;
8041 unsigned char temporary_channel_id_arr[32];
8042 CHECK(temporary_channel_id.len == 32);
8043 memcpy(temporary_channel_id_arr, temporary_channel_id.ptr, 32);
8044 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
8045 LDKOutPoint funding_txo_conv;
8046 funding_txo_conv.inner = (void*)(funding_txo & (~1));
8047 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
8048 if (funding_txo_conv.inner != NULL)
8049 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
8050 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
8053 void ChannelManager_1broadcast_1node_1announcement(void* ctx_TODO, uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
8054 LDKChannelManager this_arg_conv;
8055 this_arg_conv.inner = (void*)(this_arg & (~1));
8056 this_arg_conv.is_owned = false;
8057 LDKThreeBytes rgb_ref;
8058 CHECK(rgb.len == 3);
8059 memcpy(rgb_ref.data, rgb.ptr, 3);
8060 LDKThirtyTwoBytes alias_ref;
8061 CHECK(alias.len == 32);
8062 memcpy(alias_ref.data, alias.ptr, 32);
8063 LDKCVec_NetAddressZ addresses_constr;
8064 addresses_constr.datalen = addresses.len;
8065 if (addresses_constr.datalen > 0)
8066 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
8068 addresses_constr.data = NULL;
8069 uint32_t* addresses_vals = (uint32_t*) addresses.ptr;
8070 for (size_t m = 0; m < addresses_constr.datalen; m++) {
8071 uint32_t arr_conv_12 = addresses_vals[m];
8072 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
8073 FREE((void*)arr_conv_12);
8074 addresses_constr.data[m] = arr_conv_12_conv;
8076 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
8079 void ChannelManager_1process_1pending_1htlc_1forwards(void* ctx_TODO, uint32_t this_arg) {
8080 LDKChannelManager this_arg_conv;
8081 this_arg_conv.inner = (void*)(this_arg & (~1));
8082 this_arg_conv.is_owned = false;
8083 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
8086 void ChannelManager_1timer_1chan_1freshness_1every_1min(void* ctx_TODO, uint32_t this_arg) {
8087 LDKChannelManager this_arg_conv;
8088 this_arg_conv.inner = (void*)(this_arg & (~1));
8089 this_arg_conv.is_owned = false;
8090 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
8093 jboolean ChannelManager_1fail_1htlc_1backwards(void* ctx_TODO, uint32_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
8094 LDKChannelManager this_arg_conv;
8095 this_arg_conv.inner = (void*)(this_arg & (~1));
8096 this_arg_conv.is_owned = false;
8097 unsigned char payment_hash_arr[32];
8098 CHECK(payment_hash.len == 32);
8099 memcpy(payment_hash_arr, payment_hash.ptr, 32);
8100 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
8101 LDKThirtyTwoBytes payment_secret_ref;
8102 CHECK(payment_secret.len == 32);
8103 memcpy(payment_secret_ref.data, payment_secret.ptr, 32);
8104 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
8108 jboolean ChannelManager_1claim_1funds(void* ctx_TODO, uint32_t this_arg, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t expected_amount) {
8109 LDKChannelManager this_arg_conv;
8110 this_arg_conv.inner = (void*)(this_arg & (~1));
8111 this_arg_conv.is_owned = false;
8112 LDKThirtyTwoBytes payment_preimage_ref;
8113 CHECK(payment_preimage.len == 32);
8114 memcpy(payment_preimage_ref.data, payment_preimage.ptr, 32);
8115 LDKThirtyTwoBytes payment_secret_ref;
8116 CHECK(payment_secret.len == 32);
8117 memcpy(payment_secret_ref.data, payment_secret.ptr, 32);
8118 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
8122 int8_tArray ChannelManager_1get_1our_1node_1id(void* ctx_TODO, uint32_t this_arg) {
8123 LDKChannelManager this_arg_conv;
8124 this_arg_conv.inner = (void*)(this_arg & (~1));
8125 this_arg_conv.is_owned = false;
8126 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
8127 memcpy(arg_arr.ptr, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
8131 void ChannelManager_1channel_1monitor_1updated(void* ctx_TODO, uint32_t this_arg, uint32_t funding_txo, int64_t highest_applied_update_id) {
8132 LDKChannelManager this_arg_conv;
8133 this_arg_conv.inner = (void*)(this_arg & (~1));
8134 this_arg_conv.is_owned = false;
8135 LDKOutPoint funding_txo_conv;
8136 funding_txo_conv.inner = (void*)(funding_txo & (~1));
8137 funding_txo_conv.is_owned = false;
8138 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
8141 uint32_t ChannelManager_1as_1MessageSendEventsProvider(void* ctx_TODO, uint32_t this_arg) {
8142 LDKChannelManager this_arg_conv;
8143 this_arg_conv.inner = (void*)(this_arg & (~1));
8144 this_arg_conv.is_owned = false;
8145 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
8146 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
8150 uint32_t ChannelManager_1as_1EventsProvider(void* ctx_TODO, uint32_t this_arg) {
8151 LDKChannelManager this_arg_conv;
8152 this_arg_conv.inner = (void*)(this_arg & (~1));
8153 this_arg_conv.is_owned = false;
8154 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
8155 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
8159 void ChannelManager_1block_1connected(void* ctx_TODO, uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
8160 LDKChannelManager this_arg_conv;
8161 this_arg_conv.inner = (void*)(this_arg & (~1));
8162 this_arg_conv.is_owned = false;
8163 unsigned char header_arr[80];
8164 CHECK(header.len == 80);
8165 memcpy(header_arr, header.ptr, 80);
8166 unsigned char (*header_ref)[80] = &header_arr;
8167 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8168 txdata_constr.datalen = txdata.len;
8169 if (txdata_constr.datalen > 0)
8170 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8172 txdata_constr.data = NULL;
8173 uint32_t* txdata_vals = (uint32_t*) txdata.ptr;
8174 for (size_t e = 0; e < txdata_constr.datalen; e++) {
8175 uint32_t arr_conv_30 = txdata_vals[e];
8176 LDKC2Tuple_usizeTransactionZ arr_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_30;
8177 FREE((void*)arr_conv_30);
8178 txdata_constr.data[e] = arr_conv_30_conv;
8180 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
8183 void ChannelManager_1block_1disconnected(void* ctx_TODO, uint32_t this_arg, int8_tArray header) {
8184 LDKChannelManager this_arg_conv;
8185 this_arg_conv.inner = (void*)(this_arg & (~1));
8186 this_arg_conv.is_owned = false;
8187 unsigned char header_arr[80];
8188 CHECK(header.len == 80);
8189 memcpy(header_arr, header.ptr, 80);
8190 unsigned char (*header_ref)[80] = &header_arr;
8191 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
8194 uint32_t ChannelManager_1as_1ChannelMessageHandler(void* ctx_TODO, uint32_t this_arg) {
8195 LDKChannelManager this_arg_conv;
8196 this_arg_conv.inner = (void*)(this_arg & (~1));
8197 this_arg_conv.is_owned = false;
8198 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
8199 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
8203 int8_tArray ChannelManager_1write(void* ctx_TODO, uint32_t obj) {
8204 LDKChannelManager obj_conv;
8205 obj_conv.inner = (void*)(obj & (~1));
8206 obj_conv.is_owned = false;
8207 LDKCVec_u8Z arg_var = ChannelManager_write(&obj_conv);
8208 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
8209 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
8210 CVec_u8Z_free(arg_var);
8214 void ChannelManagerReadArgs_1free(void* ctx_TODO, uint32_t this_ptr) {
8215 LDKChannelManagerReadArgs this_ptr_conv;
8216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8217 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8218 ChannelManagerReadArgs_free(this_ptr_conv);
8221 uint32_t ChannelManagerReadArgs_1get_1keys_1manager(void* ctx_TODO, uint32_t this_ptr) {
8222 LDKChannelManagerReadArgs this_ptr_conv;
8223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8224 this_ptr_conv.is_owned = false;
8225 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
8229 void ChannelManagerReadArgs_1set_1keys_1manager(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
8230 LDKChannelManagerReadArgs this_ptr_conv;
8231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8232 this_ptr_conv.is_owned = false;
8233 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
8234 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
8237 uint32_t ChannelManagerReadArgs_1get_1fee_1estimator(void* ctx_TODO, uint32_t this_ptr) {
8238 LDKChannelManagerReadArgs this_ptr_conv;
8239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8240 this_ptr_conv.is_owned = false;
8241 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
8245 void ChannelManagerReadArgs_1set_1fee_1estimator(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
8246 LDKChannelManagerReadArgs this_ptr_conv;
8247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8248 this_ptr_conv.is_owned = false;
8249 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
8250 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
8253 uint32_t ChannelManagerReadArgs_1get_1chain_1monitor(void* ctx_TODO, uint32_t this_ptr) {
8254 LDKChannelManagerReadArgs this_ptr_conv;
8255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8256 this_ptr_conv.is_owned = false;
8257 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
8261 void ChannelManagerReadArgs_1set_1chain_1monitor(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
8262 LDKChannelManagerReadArgs this_ptr_conv;
8263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8264 this_ptr_conv.is_owned = false;
8265 LDKWatch val_conv = *(LDKWatch*)val;
8266 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
8269 uint32_t ChannelManagerReadArgs_1get_1tx_1broadcaster(void* ctx_TODO, uint32_t this_ptr) {
8270 LDKChannelManagerReadArgs this_ptr_conv;
8271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8272 this_ptr_conv.is_owned = false;
8273 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
8277 void ChannelManagerReadArgs_1set_1tx_1broadcaster(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
8278 LDKChannelManagerReadArgs this_ptr_conv;
8279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8280 this_ptr_conv.is_owned = false;
8281 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
8282 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
8285 uint32_t ChannelManagerReadArgs_1get_1logger(void* ctx_TODO, uint32_t this_ptr) {
8286 LDKChannelManagerReadArgs this_ptr_conv;
8287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8288 this_ptr_conv.is_owned = false;
8289 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
8293 void ChannelManagerReadArgs_1set_1logger(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
8294 LDKChannelManagerReadArgs this_ptr_conv;
8295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8296 this_ptr_conv.is_owned = false;
8297 LDKLogger val_conv = *(LDKLogger*)val;
8298 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
8301 uint32_t ChannelManagerReadArgs_1get_1default_1config(void* ctx_TODO, uint32_t this_ptr) {
8302 LDKChannelManagerReadArgs this_ptr_conv;
8303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8304 this_ptr_conv.is_owned = false;
8305 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
8306 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8307 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8308 long ret_ref = (long)ret_var.inner;
8309 if (ret_var.is_owned) {
8315 void ChannelManagerReadArgs_1set_1default_1config(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
8316 LDKChannelManagerReadArgs this_ptr_conv;
8317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8318 this_ptr_conv.is_owned = false;
8319 LDKUserConfig val_conv;
8320 val_conv.inner = (void*)(val & (~1));
8321 val_conv.is_owned = (val & 1) || (val == 0);
8322 if (val_conv.inner != NULL)
8323 val_conv = UserConfig_clone(&val_conv);
8324 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
8327 uint32_t ChannelManagerReadArgs_1new(void* ctx_TODO, uint32_t keys_manager, uint32_t fee_estimator, uint32_t chain_monitor, uint32_t tx_broadcaster, uint32_t logger, uint32_t default_config, uint32_tArray channel_monitors) {
8328 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
8329 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
8330 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
8331 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
8332 LDKLogger logger_conv = *(LDKLogger*)logger;
8333 LDKUserConfig default_config_conv;
8334 default_config_conv.inner = (void*)(default_config & (~1));
8335 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
8336 if (default_config_conv.inner != NULL)
8337 default_config_conv = UserConfig_clone(&default_config_conv);
8338 LDKCVec_ChannelMonitorZ channel_monitors_constr;
8339 channel_monitors_constr.datalen = channel_monitors.len;
8340 if (channel_monitors_constr.datalen > 0)
8341 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
8343 channel_monitors_constr.data = NULL;
8344 uint32_t* channel_monitors_vals = (uint32_t*) channel_monitors.ptr;
8345 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
8346 uint32_t arr_conv_16 = channel_monitors_vals[q];
8347 LDKChannelMonitor arr_conv_16_conv;
8348 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
8349 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
8350 // Warning: we may need a move here but can't clone!
8351 channel_monitors_constr.data[q] = arr_conv_16_conv;
8353 LDKChannelManagerReadArgs ret_var = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_constr);
8354 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8355 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8356 long ret_ref = (long)ret_var.inner;
8357 if (ret_var.is_owned) {
8363 uint32_t C2Tuple_1BlockHashChannelManagerZ_1read(void* ctx_TODO, int8_tArray ser, uint32_t arg) {
8365 ser_ref.datalen = ser.len;
8366 ser_ref.data = ser.ptr;
8367 LDKChannelManagerReadArgs arg_conv;
8368 arg_conv.inner = (void*)(arg & (~1));
8369 arg_conv.is_owned = (arg & 1) || (arg == 0);
8370 // Warning: we may need a move here but can't clone!
8371 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
8372 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
8373 return (long)ret_conv;
8376 void DecodeError_1free(void* ctx_TODO, uint32_t this_ptr) {
8377 LDKDecodeError this_ptr_conv;
8378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8379 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8380 DecodeError_free(this_ptr_conv);
8383 void Init_1free(void* ctx_TODO, uint32_t this_ptr) {
8384 LDKInit this_ptr_conv;
8385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8386 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8387 Init_free(this_ptr_conv);
8390 uint32_t Init_1clone(void* ctx_TODO, uint32_t orig) {
8392 orig_conv.inner = (void*)(orig & (~1));
8393 orig_conv.is_owned = false;
8394 LDKInit ret_var = Init_clone(&orig_conv);
8395 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8396 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8397 long ret_ref = (long)ret_var.inner;
8398 if (ret_var.is_owned) {
8404 void ErrorMessage_1free(void* ctx_TODO, uint32_t this_ptr) {
8405 LDKErrorMessage this_ptr_conv;
8406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8407 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8408 ErrorMessage_free(this_ptr_conv);
8411 uint32_t ErrorMessage_1clone(void* ctx_TODO, uint32_t orig) {
8412 LDKErrorMessage orig_conv;
8413 orig_conv.inner = (void*)(orig & (~1));
8414 orig_conv.is_owned = false;
8415 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
8416 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8417 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8418 long ret_ref = (long)ret_var.inner;
8419 if (ret_var.is_owned) {
8425 int8_tArray ErrorMessage_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
8426 LDKErrorMessage this_ptr_conv;
8427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8428 this_ptr_conv.is_owned = false;
8429 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
8430 memcpy(ret_arr.ptr, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
8434 void ErrorMessage_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8435 LDKErrorMessage this_ptr_conv;
8436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8437 this_ptr_conv.is_owned = false;
8438 LDKThirtyTwoBytes val_ref;
8439 CHECK(val.len == 32);
8440 memcpy(val_ref.data, val.ptr, 32);
8441 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
8444 jstring ErrorMessage_1get_1data(void* ctx_TODO, uint32_t this_ptr) {
8445 LDKErrorMessage this_ptr_conv;
8446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8447 this_ptr_conv.is_owned = false;
8448 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
8449 char* _buf = MALLOC(_str.len + 1, "str conv buf");
8450 memcpy(_buf, _str.chars, _str.len);
8452 jstring _conv = conv_owned_string(_str.chars);
8457 void ErrorMessage_1set_1data(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8458 LDKErrorMessage this_ptr_conv;
8459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8460 this_ptr_conv.is_owned = false;
8461 LDKCVec_u8Z val_ref;
8462 val_ref.datalen = val.len;
8463 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
8464 memcpy(val_ref.data, val.ptr, val_ref.datalen);
8465 ErrorMessage_set_data(&this_ptr_conv, val_ref);
8468 uint32_t ErrorMessage_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray data_arg) {
8469 LDKThirtyTwoBytes channel_id_arg_ref;
8470 CHECK(channel_id_arg.len == 32);
8471 memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
8472 LDKCVec_u8Z data_arg_ref;
8473 data_arg_ref.datalen = data_arg.len;
8474 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
8475 memcpy(data_arg_ref.data, data_arg.ptr, data_arg_ref.datalen);
8476 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
8477 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8478 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8479 long ret_ref = (long)ret_var.inner;
8480 if (ret_var.is_owned) {
8486 void Ping_1free(void* ctx_TODO, uint32_t this_ptr) {
8487 LDKPing this_ptr_conv;
8488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8489 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8490 Ping_free(this_ptr_conv);
8493 uint32_t Ping_1clone(void* ctx_TODO, uint32_t orig) {
8495 orig_conv.inner = (void*)(orig & (~1));
8496 orig_conv.is_owned = false;
8497 LDKPing ret_var = Ping_clone(&orig_conv);
8498 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8499 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8500 long ret_ref = (long)ret_var.inner;
8501 if (ret_var.is_owned) {
8507 int16_t Ping_1get_1ponglen(void* ctx_TODO, uint32_t this_ptr) {
8508 LDKPing this_ptr_conv;
8509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8510 this_ptr_conv.is_owned = false;
8511 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
8515 void Ping_1set_1ponglen(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
8516 LDKPing this_ptr_conv;
8517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8518 this_ptr_conv.is_owned = false;
8519 Ping_set_ponglen(&this_ptr_conv, val);
8522 int16_t Ping_1get_1byteslen(void* ctx_TODO, uint32_t this_ptr) {
8523 LDKPing this_ptr_conv;
8524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8525 this_ptr_conv.is_owned = false;
8526 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
8530 void Ping_1set_1byteslen(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
8531 LDKPing this_ptr_conv;
8532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8533 this_ptr_conv.is_owned = false;
8534 Ping_set_byteslen(&this_ptr_conv, val);
8537 uint32_t Ping_1new(void* ctx_TODO, int16_t ponglen_arg, int16_t byteslen_arg) {
8538 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
8539 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8540 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8541 long ret_ref = (long)ret_var.inner;
8542 if (ret_var.is_owned) {
8548 void Pong_1free(void* ctx_TODO, uint32_t this_ptr) {
8549 LDKPong this_ptr_conv;
8550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8551 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8552 Pong_free(this_ptr_conv);
8555 uint32_t Pong_1clone(void* ctx_TODO, uint32_t orig) {
8557 orig_conv.inner = (void*)(orig & (~1));
8558 orig_conv.is_owned = false;
8559 LDKPong ret_var = Pong_clone(&orig_conv);
8560 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8561 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8562 long ret_ref = (long)ret_var.inner;
8563 if (ret_var.is_owned) {
8569 int16_t Pong_1get_1byteslen(void* ctx_TODO, uint32_t this_ptr) {
8570 LDKPong this_ptr_conv;
8571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8572 this_ptr_conv.is_owned = false;
8573 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
8577 void Pong_1set_1byteslen(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
8578 LDKPong this_ptr_conv;
8579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8580 this_ptr_conv.is_owned = false;
8581 Pong_set_byteslen(&this_ptr_conv, val);
8584 uint32_t Pong_1new(void* ctx_TODO, int16_t byteslen_arg) {
8585 LDKPong ret_var = Pong_new(byteslen_arg);
8586 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8587 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8588 long ret_ref = (long)ret_var.inner;
8589 if (ret_var.is_owned) {
8595 void OpenChannel_1free(void* ctx_TODO, uint32_t this_ptr) {
8596 LDKOpenChannel this_ptr_conv;
8597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8598 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8599 OpenChannel_free(this_ptr_conv);
8602 uint32_t OpenChannel_1clone(void* ctx_TODO, uint32_t orig) {
8603 LDKOpenChannel orig_conv;
8604 orig_conv.inner = (void*)(orig & (~1));
8605 orig_conv.is_owned = false;
8606 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
8607 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8608 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8609 long ret_ref = (long)ret_var.inner;
8610 if (ret_var.is_owned) {
8616 int8_tArray OpenChannel_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
8617 LDKOpenChannel this_ptr_conv;
8618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8619 this_ptr_conv.is_owned = false;
8620 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
8621 memcpy(ret_arr.ptr, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
8625 void OpenChannel_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8626 LDKOpenChannel this_ptr_conv;
8627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8628 this_ptr_conv.is_owned = false;
8629 LDKThirtyTwoBytes val_ref;
8630 CHECK(val.len == 32);
8631 memcpy(val_ref.data, val.ptr, 32);
8632 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
8635 int8_tArray OpenChannel_1get_1temporary_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
8636 LDKOpenChannel this_ptr_conv;
8637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8638 this_ptr_conv.is_owned = false;
8639 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
8640 memcpy(ret_arr.ptr, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
8644 void OpenChannel_1set_1temporary_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8645 LDKOpenChannel this_ptr_conv;
8646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8647 this_ptr_conv.is_owned = false;
8648 LDKThirtyTwoBytes val_ref;
8649 CHECK(val.len == 32);
8650 memcpy(val_ref.data, val.ptr, 32);
8651 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
8654 int64_t OpenChannel_1get_1funding_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
8655 LDKOpenChannel this_ptr_conv;
8656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8657 this_ptr_conv.is_owned = false;
8658 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
8662 void OpenChannel_1set_1funding_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8663 LDKOpenChannel this_ptr_conv;
8664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8665 this_ptr_conv.is_owned = false;
8666 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
8669 int64_t OpenChannel_1get_1push_1msat(void* ctx_TODO, uint32_t this_ptr) {
8670 LDKOpenChannel this_ptr_conv;
8671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8672 this_ptr_conv.is_owned = false;
8673 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
8677 void OpenChannel_1set_1push_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8678 LDKOpenChannel this_ptr_conv;
8679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8680 this_ptr_conv.is_owned = false;
8681 OpenChannel_set_push_msat(&this_ptr_conv, val);
8684 int64_t OpenChannel_1get_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
8685 LDKOpenChannel this_ptr_conv;
8686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8687 this_ptr_conv.is_owned = false;
8688 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
8692 void OpenChannel_1set_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8693 LDKOpenChannel this_ptr_conv;
8694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8695 this_ptr_conv.is_owned = false;
8696 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
8699 int64_t OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(void* ctx_TODO, uint32_t this_ptr) {
8700 LDKOpenChannel this_ptr_conv;
8701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8702 this_ptr_conv.is_owned = false;
8703 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
8707 void OpenChannel_1set_1max_1htlc_1value_1in_1flight_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8708 LDKOpenChannel this_ptr_conv;
8709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8710 this_ptr_conv.is_owned = false;
8711 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8714 int64_t OpenChannel_1get_1channel_1reserve_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
8715 LDKOpenChannel this_ptr_conv;
8716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8717 this_ptr_conv.is_owned = false;
8718 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
8722 void OpenChannel_1set_1channel_1reserve_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8723 LDKOpenChannel this_ptr_conv;
8724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8725 this_ptr_conv.is_owned = false;
8726 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
8729 int64_t OpenChannel_1get_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr) {
8730 LDKOpenChannel this_ptr_conv;
8731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8732 this_ptr_conv.is_owned = false;
8733 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
8737 void OpenChannel_1set_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8738 LDKOpenChannel this_ptr_conv;
8739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8740 this_ptr_conv.is_owned = false;
8741 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
8744 int32_t OpenChannel_1get_1feerate_1per_1kw(void* ctx_TODO, uint32_t this_ptr) {
8745 LDKOpenChannel this_ptr_conv;
8746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8747 this_ptr_conv.is_owned = false;
8748 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
8752 void OpenChannel_1set_1feerate_1per_1kw(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
8753 LDKOpenChannel this_ptr_conv;
8754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8755 this_ptr_conv.is_owned = false;
8756 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
8759 int16_t OpenChannel_1get_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr) {
8760 LDKOpenChannel this_ptr_conv;
8761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8762 this_ptr_conv.is_owned = false;
8763 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
8767 void OpenChannel_1set_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
8768 LDKOpenChannel this_ptr_conv;
8769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8770 this_ptr_conv.is_owned = false;
8771 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
8774 int16_t OpenChannel_1get_1max_1accepted_1htlcs(void* ctx_TODO, uint32_t this_ptr) {
8775 LDKOpenChannel this_ptr_conv;
8776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8777 this_ptr_conv.is_owned = false;
8778 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
8782 void OpenChannel_1set_1max_1accepted_1htlcs(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
8783 LDKOpenChannel this_ptr_conv;
8784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8785 this_ptr_conv.is_owned = false;
8786 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
8789 int8_tArray OpenChannel_1get_1funding_1pubkey(void* ctx_TODO, uint32_t this_ptr) {
8790 LDKOpenChannel this_ptr_conv;
8791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8792 this_ptr_conv.is_owned = false;
8793 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
8794 memcpy(arg_arr.ptr, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
8798 void OpenChannel_1set_1funding_1pubkey(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8799 LDKOpenChannel this_ptr_conv;
8800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8801 this_ptr_conv.is_owned = false;
8802 LDKPublicKey val_ref;
8803 CHECK(val.len == 33);
8804 memcpy(val_ref.compressed_form, val.ptr, 33);
8805 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
8808 int8_tArray OpenChannel_1get_1revocation_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
8809 LDKOpenChannel this_ptr_conv;
8810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8811 this_ptr_conv.is_owned = false;
8812 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
8813 memcpy(arg_arr.ptr, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
8817 void OpenChannel_1set_1revocation_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8818 LDKOpenChannel this_ptr_conv;
8819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8820 this_ptr_conv.is_owned = false;
8821 LDKPublicKey val_ref;
8822 CHECK(val.len == 33);
8823 memcpy(val_ref.compressed_form, val.ptr, 33);
8824 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
8827 int8_tArray OpenChannel_1get_1payment_1point(void* ctx_TODO, uint32_t this_ptr) {
8828 LDKOpenChannel this_ptr_conv;
8829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8830 this_ptr_conv.is_owned = false;
8831 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
8832 memcpy(arg_arr.ptr, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
8836 void OpenChannel_1set_1payment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8837 LDKOpenChannel this_ptr_conv;
8838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8839 this_ptr_conv.is_owned = false;
8840 LDKPublicKey val_ref;
8841 CHECK(val.len == 33);
8842 memcpy(val_ref.compressed_form, val.ptr, 33);
8843 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
8846 int8_tArray OpenChannel_1get_1delayed_1payment_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
8847 LDKOpenChannel this_ptr_conv;
8848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8849 this_ptr_conv.is_owned = false;
8850 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
8851 memcpy(arg_arr.ptr, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
8855 void OpenChannel_1set_1delayed_1payment_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8856 LDKOpenChannel this_ptr_conv;
8857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8858 this_ptr_conv.is_owned = false;
8859 LDKPublicKey val_ref;
8860 CHECK(val.len == 33);
8861 memcpy(val_ref.compressed_form, val.ptr, 33);
8862 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
8865 int8_tArray OpenChannel_1get_1htlc_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
8866 LDKOpenChannel this_ptr_conv;
8867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8868 this_ptr_conv.is_owned = false;
8869 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
8870 memcpy(arg_arr.ptr, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
8874 void OpenChannel_1set_1htlc_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8875 LDKOpenChannel this_ptr_conv;
8876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8877 this_ptr_conv.is_owned = false;
8878 LDKPublicKey val_ref;
8879 CHECK(val.len == 33);
8880 memcpy(val_ref.compressed_form, val.ptr, 33);
8881 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
8884 int8_tArray OpenChannel_1get_1first_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr) {
8885 LDKOpenChannel this_ptr_conv;
8886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8887 this_ptr_conv.is_owned = false;
8888 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
8889 memcpy(arg_arr.ptr, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
8893 void OpenChannel_1set_1first_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8894 LDKOpenChannel this_ptr_conv;
8895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8896 this_ptr_conv.is_owned = false;
8897 LDKPublicKey val_ref;
8898 CHECK(val.len == 33);
8899 memcpy(val_ref.compressed_form, val.ptr, 33);
8900 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
8903 int8_t OpenChannel_1get_1channel_1flags(void* ctx_TODO, uint32_t this_ptr) {
8904 LDKOpenChannel this_ptr_conv;
8905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8906 this_ptr_conv.is_owned = false;
8907 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
8911 void OpenChannel_1set_1channel_1flags(void* ctx_TODO, uint32_t this_ptr, int8_t val) {
8912 LDKOpenChannel this_ptr_conv;
8913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8914 this_ptr_conv.is_owned = false;
8915 OpenChannel_set_channel_flags(&this_ptr_conv, val);
8918 void AcceptChannel_1free(void* ctx_TODO, uint32_t this_ptr) {
8919 LDKAcceptChannel this_ptr_conv;
8920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8921 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8922 AcceptChannel_free(this_ptr_conv);
8925 uint32_t AcceptChannel_1clone(void* ctx_TODO, uint32_t orig) {
8926 LDKAcceptChannel orig_conv;
8927 orig_conv.inner = (void*)(orig & (~1));
8928 orig_conv.is_owned = false;
8929 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
8930 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8931 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8932 long ret_ref = (long)ret_var.inner;
8933 if (ret_var.is_owned) {
8939 int8_tArray AcceptChannel_1get_1temporary_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
8940 LDKAcceptChannel this_ptr_conv;
8941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8942 this_ptr_conv.is_owned = false;
8943 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
8944 memcpy(ret_arr.ptr, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
8948 void AcceptChannel_1set_1temporary_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8949 LDKAcceptChannel this_ptr_conv;
8950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8951 this_ptr_conv.is_owned = false;
8952 LDKThirtyTwoBytes val_ref;
8953 CHECK(val.len == 32);
8954 memcpy(val_ref.data, val.ptr, 32);
8955 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
8958 int64_t AcceptChannel_1get_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
8959 LDKAcceptChannel this_ptr_conv;
8960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8961 this_ptr_conv.is_owned = false;
8962 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
8966 void AcceptChannel_1set_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8967 LDKAcceptChannel this_ptr_conv;
8968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8969 this_ptr_conv.is_owned = false;
8970 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
8973 int64_t AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(void* ctx_TODO, uint32_t this_ptr) {
8974 LDKAcceptChannel this_ptr_conv;
8975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8976 this_ptr_conv.is_owned = false;
8977 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
8981 void AcceptChannel_1set_1max_1htlc_1value_1in_1flight_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8982 LDKAcceptChannel this_ptr_conv;
8983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8984 this_ptr_conv.is_owned = false;
8985 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8988 int64_t AcceptChannel_1get_1channel_1reserve_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
8989 LDKAcceptChannel this_ptr_conv;
8990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8991 this_ptr_conv.is_owned = false;
8992 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
8996 void AcceptChannel_1set_1channel_1reserve_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8997 LDKAcceptChannel this_ptr_conv;
8998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8999 this_ptr_conv.is_owned = false;
9000 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
9003 int64_t AcceptChannel_1get_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr) {
9004 LDKAcceptChannel this_ptr_conv;
9005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9006 this_ptr_conv.is_owned = false;
9007 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
9011 void AcceptChannel_1set_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
9012 LDKAcceptChannel this_ptr_conv;
9013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9014 this_ptr_conv.is_owned = false;
9015 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
9018 int32_t AcceptChannel_1get_1minimum_1depth(void* ctx_TODO, uint32_t this_ptr) {
9019 LDKAcceptChannel this_ptr_conv;
9020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9021 this_ptr_conv.is_owned = false;
9022 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
9026 void AcceptChannel_1set_1minimum_1depth(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
9027 LDKAcceptChannel this_ptr_conv;
9028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9029 this_ptr_conv.is_owned = false;
9030 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
9033 int16_t AcceptChannel_1get_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr) {
9034 LDKAcceptChannel this_ptr_conv;
9035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9036 this_ptr_conv.is_owned = false;
9037 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
9041 void AcceptChannel_1set_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
9042 LDKAcceptChannel this_ptr_conv;
9043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9044 this_ptr_conv.is_owned = false;
9045 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
9048 int16_t AcceptChannel_1get_1max_1accepted_1htlcs(void* ctx_TODO, uint32_t this_ptr) {
9049 LDKAcceptChannel this_ptr_conv;
9050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9051 this_ptr_conv.is_owned = false;
9052 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
9056 void AcceptChannel_1set_1max_1accepted_1htlcs(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
9057 LDKAcceptChannel this_ptr_conv;
9058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9059 this_ptr_conv.is_owned = false;
9060 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
9063 int8_tArray AcceptChannel_1get_1funding_1pubkey(void* ctx_TODO, uint32_t this_ptr) {
9064 LDKAcceptChannel this_ptr_conv;
9065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9066 this_ptr_conv.is_owned = false;
9067 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
9068 memcpy(arg_arr.ptr, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
9072 void AcceptChannel_1set_1funding_1pubkey(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9073 LDKAcceptChannel this_ptr_conv;
9074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9075 this_ptr_conv.is_owned = false;
9076 LDKPublicKey val_ref;
9077 CHECK(val.len == 33);
9078 memcpy(val_ref.compressed_form, val.ptr, 33);
9079 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
9082 int8_tArray AcceptChannel_1get_1revocation_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
9083 LDKAcceptChannel this_ptr_conv;
9084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9085 this_ptr_conv.is_owned = false;
9086 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
9087 memcpy(arg_arr.ptr, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
9091 void AcceptChannel_1set_1revocation_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9092 LDKAcceptChannel this_ptr_conv;
9093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9094 this_ptr_conv.is_owned = false;
9095 LDKPublicKey val_ref;
9096 CHECK(val.len == 33);
9097 memcpy(val_ref.compressed_form, val.ptr, 33);
9098 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
9101 int8_tArray AcceptChannel_1get_1payment_1point(void* ctx_TODO, uint32_t this_ptr) {
9102 LDKAcceptChannel this_ptr_conv;
9103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9104 this_ptr_conv.is_owned = false;
9105 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
9106 memcpy(arg_arr.ptr, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
9110 void AcceptChannel_1set_1payment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9111 LDKAcceptChannel this_ptr_conv;
9112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9113 this_ptr_conv.is_owned = false;
9114 LDKPublicKey val_ref;
9115 CHECK(val.len == 33);
9116 memcpy(val_ref.compressed_form, val.ptr, 33);
9117 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
9120 int8_tArray AcceptChannel_1get_1delayed_1payment_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
9121 LDKAcceptChannel this_ptr_conv;
9122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9123 this_ptr_conv.is_owned = false;
9124 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
9125 memcpy(arg_arr.ptr, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
9129 void AcceptChannel_1set_1delayed_1payment_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9130 LDKAcceptChannel this_ptr_conv;
9131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9132 this_ptr_conv.is_owned = false;
9133 LDKPublicKey val_ref;
9134 CHECK(val.len == 33);
9135 memcpy(val_ref.compressed_form, val.ptr, 33);
9136 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
9139 int8_tArray AcceptChannel_1get_1htlc_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
9140 LDKAcceptChannel this_ptr_conv;
9141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9142 this_ptr_conv.is_owned = false;
9143 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
9144 memcpy(arg_arr.ptr, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
9148 void AcceptChannel_1set_1htlc_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9149 LDKAcceptChannel this_ptr_conv;
9150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9151 this_ptr_conv.is_owned = false;
9152 LDKPublicKey val_ref;
9153 CHECK(val.len == 33);
9154 memcpy(val_ref.compressed_form, val.ptr, 33);
9155 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
9158 int8_tArray AcceptChannel_1get_1first_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr) {
9159 LDKAcceptChannel this_ptr_conv;
9160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9161 this_ptr_conv.is_owned = false;
9162 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
9163 memcpy(arg_arr.ptr, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
9167 void AcceptChannel_1set_1first_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9168 LDKAcceptChannel this_ptr_conv;
9169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9170 this_ptr_conv.is_owned = false;
9171 LDKPublicKey val_ref;
9172 CHECK(val.len == 33);
9173 memcpy(val_ref.compressed_form, val.ptr, 33);
9174 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
9177 void FundingCreated_1free(void* ctx_TODO, uint32_t this_ptr) {
9178 LDKFundingCreated this_ptr_conv;
9179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9180 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9181 FundingCreated_free(this_ptr_conv);
9184 uint32_t FundingCreated_1clone(void* ctx_TODO, uint32_t orig) {
9185 LDKFundingCreated orig_conv;
9186 orig_conv.inner = (void*)(orig & (~1));
9187 orig_conv.is_owned = false;
9188 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
9189 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9190 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9191 long ret_ref = (long)ret_var.inner;
9192 if (ret_var.is_owned) {
9198 int8_tArray FundingCreated_1get_1temporary_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9199 LDKFundingCreated this_ptr_conv;
9200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9201 this_ptr_conv.is_owned = false;
9202 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
9203 memcpy(ret_arr.ptr, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
9207 void FundingCreated_1set_1temporary_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9208 LDKFundingCreated this_ptr_conv;
9209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9210 this_ptr_conv.is_owned = false;
9211 LDKThirtyTwoBytes val_ref;
9212 CHECK(val.len == 32);
9213 memcpy(val_ref.data, val.ptr, 32);
9214 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
9217 int8_tArray FundingCreated_1get_1funding_1txid(void* ctx_TODO, uint32_t this_ptr) {
9218 LDKFundingCreated this_ptr_conv;
9219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9220 this_ptr_conv.is_owned = false;
9221 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
9222 memcpy(ret_arr.ptr, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
9226 void FundingCreated_1set_1funding_1txid(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9227 LDKFundingCreated this_ptr_conv;
9228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9229 this_ptr_conv.is_owned = false;
9230 LDKThirtyTwoBytes val_ref;
9231 CHECK(val.len == 32);
9232 memcpy(val_ref.data, val.ptr, 32);
9233 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
9236 int16_t FundingCreated_1get_1funding_1output_1index(void* ctx_TODO, uint32_t this_ptr) {
9237 LDKFundingCreated this_ptr_conv;
9238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9239 this_ptr_conv.is_owned = false;
9240 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
9244 void FundingCreated_1set_1funding_1output_1index(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
9245 LDKFundingCreated this_ptr_conv;
9246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9247 this_ptr_conv.is_owned = false;
9248 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
9251 int8_tArray FundingCreated_1get_1signature(void* ctx_TODO, uint32_t this_ptr) {
9252 LDKFundingCreated this_ptr_conv;
9253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9254 this_ptr_conv.is_owned = false;
9255 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
9256 memcpy(arg_arr.ptr, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
9260 void FundingCreated_1set_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9261 LDKFundingCreated this_ptr_conv;
9262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9263 this_ptr_conv.is_owned = false;
9264 LDKSignature val_ref;
9265 CHECK(val.len == 64);
9266 memcpy(val_ref.compact_form, val.ptr, 64);
9267 FundingCreated_set_signature(&this_ptr_conv, val_ref);
9270 uint32_t FundingCreated_1new(void* ctx_TODO, int8_tArray temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
9271 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
9272 CHECK(temporary_channel_id_arg.len == 32);
9273 memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg.ptr, 32);
9274 LDKThirtyTwoBytes funding_txid_arg_ref;
9275 CHECK(funding_txid_arg.len == 32);
9276 memcpy(funding_txid_arg_ref.data, funding_txid_arg.ptr, 32);
9277 LDKSignature signature_arg_ref;
9278 CHECK(signature_arg.len == 64);
9279 memcpy(signature_arg_ref.compact_form, signature_arg.ptr, 64);
9280 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
9281 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9282 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9283 long ret_ref = (long)ret_var.inner;
9284 if (ret_var.is_owned) {
9290 void FundingSigned_1free(void* ctx_TODO, uint32_t this_ptr) {
9291 LDKFundingSigned this_ptr_conv;
9292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9293 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9294 FundingSigned_free(this_ptr_conv);
9297 uint32_t FundingSigned_1clone(void* ctx_TODO, uint32_t orig) {
9298 LDKFundingSigned orig_conv;
9299 orig_conv.inner = (void*)(orig & (~1));
9300 orig_conv.is_owned = false;
9301 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
9302 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9303 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9304 long ret_ref = (long)ret_var.inner;
9305 if (ret_var.is_owned) {
9311 int8_tArray FundingSigned_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9312 LDKFundingSigned this_ptr_conv;
9313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9314 this_ptr_conv.is_owned = false;
9315 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
9316 memcpy(ret_arr.ptr, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
9320 void FundingSigned_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9321 LDKFundingSigned this_ptr_conv;
9322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9323 this_ptr_conv.is_owned = false;
9324 LDKThirtyTwoBytes val_ref;
9325 CHECK(val.len == 32);
9326 memcpy(val_ref.data, val.ptr, 32);
9327 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
9330 int8_tArray FundingSigned_1get_1signature(void* ctx_TODO, uint32_t this_ptr) {
9331 LDKFundingSigned this_ptr_conv;
9332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9333 this_ptr_conv.is_owned = false;
9334 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
9335 memcpy(arg_arr.ptr, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
9339 void FundingSigned_1set_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9340 LDKFundingSigned this_ptr_conv;
9341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9342 this_ptr_conv.is_owned = false;
9343 LDKSignature val_ref;
9344 CHECK(val.len == 64);
9345 memcpy(val_ref.compact_form, val.ptr, 64);
9346 FundingSigned_set_signature(&this_ptr_conv, val_ref);
9349 uint32_t FundingSigned_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray signature_arg) {
9350 LDKThirtyTwoBytes channel_id_arg_ref;
9351 CHECK(channel_id_arg.len == 32);
9352 memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
9353 LDKSignature signature_arg_ref;
9354 CHECK(signature_arg.len == 64);
9355 memcpy(signature_arg_ref.compact_form, signature_arg.ptr, 64);
9356 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
9357 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9358 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9359 long ret_ref = (long)ret_var.inner;
9360 if (ret_var.is_owned) {
9366 void FundingLocked_1free(void* ctx_TODO, uint32_t this_ptr) {
9367 LDKFundingLocked this_ptr_conv;
9368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9369 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9370 FundingLocked_free(this_ptr_conv);
9373 uint32_t FundingLocked_1clone(void* ctx_TODO, uint32_t orig) {
9374 LDKFundingLocked orig_conv;
9375 orig_conv.inner = (void*)(orig & (~1));
9376 orig_conv.is_owned = false;
9377 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
9378 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9379 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9380 long ret_ref = (long)ret_var.inner;
9381 if (ret_var.is_owned) {
9387 int8_tArray FundingLocked_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9388 LDKFundingLocked this_ptr_conv;
9389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9390 this_ptr_conv.is_owned = false;
9391 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
9392 memcpy(ret_arr.ptr, *FundingLocked_get_channel_id(&this_ptr_conv), 32);
9396 void FundingLocked_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9397 LDKFundingLocked this_ptr_conv;
9398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9399 this_ptr_conv.is_owned = false;
9400 LDKThirtyTwoBytes val_ref;
9401 CHECK(val.len == 32);
9402 memcpy(val_ref.data, val.ptr, 32);
9403 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
9406 int8_tArray FundingLocked_1get_1next_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr) {
9407 LDKFundingLocked this_ptr_conv;
9408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9409 this_ptr_conv.is_owned = false;
9410 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
9411 memcpy(arg_arr.ptr, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
9415 void FundingLocked_1set_1next_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9416 LDKFundingLocked this_ptr_conv;
9417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9418 this_ptr_conv.is_owned = false;
9419 LDKPublicKey val_ref;
9420 CHECK(val.len == 33);
9421 memcpy(val_ref.compressed_form, val.ptr, 33);
9422 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
9425 uint32_t FundingLocked_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
9426 LDKThirtyTwoBytes channel_id_arg_ref;
9427 CHECK(channel_id_arg.len == 32);
9428 memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
9429 LDKPublicKey next_per_commitment_point_arg_ref;
9430 CHECK(next_per_commitment_point_arg.len == 33);
9431 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg.ptr, 33);
9432 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
9433 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9434 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9435 long ret_ref = (long)ret_var.inner;
9436 if (ret_var.is_owned) {
9442 void Shutdown_1free(void* ctx_TODO, uint32_t this_ptr) {
9443 LDKShutdown this_ptr_conv;
9444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9445 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9446 Shutdown_free(this_ptr_conv);
9449 uint32_t Shutdown_1clone(void* ctx_TODO, uint32_t orig) {
9450 LDKShutdown orig_conv;
9451 orig_conv.inner = (void*)(orig & (~1));
9452 orig_conv.is_owned = false;
9453 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
9454 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9455 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9456 long ret_ref = (long)ret_var.inner;
9457 if (ret_var.is_owned) {
9463 int8_tArray Shutdown_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9464 LDKShutdown this_ptr_conv;
9465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9466 this_ptr_conv.is_owned = false;
9467 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
9468 memcpy(ret_arr.ptr, *Shutdown_get_channel_id(&this_ptr_conv), 32);
9472 void Shutdown_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9473 LDKShutdown this_ptr_conv;
9474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9475 this_ptr_conv.is_owned = false;
9476 LDKThirtyTwoBytes val_ref;
9477 CHECK(val.len == 32);
9478 memcpy(val_ref.data, val.ptr, 32);
9479 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
9482 int8_tArray Shutdown_1get_1scriptpubkey(void* ctx_TODO, uint32_t this_ptr) {
9483 LDKShutdown this_ptr_conv;
9484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9485 this_ptr_conv.is_owned = false;
9486 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
9487 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
9488 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
9492 void Shutdown_1set_1scriptpubkey(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9493 LDKShutdown this_ptr_conv;
9494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9495 this_ptr_conv.is_owned = false;
9496 LDKCVec_u8Z val_ref;
9497 val_ref.datalen = val.len;
9498 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
9499 memcpy(val_ref.data, val.ptr, val_ref.datalen);
9500 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
9503 uint32_t Shutdown_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
9504 LDKThirtyTwoBytes channel_id_arg_ref;
9505 CHECK(channel_id_arg.len == 32);
9506 memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
9507 LDKCVec_u8Z scriptpubkey_arg_ref;
9508 scriptpubkey_arg_ref.datalen = scriptpubkey_arg.len;
9509 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
9510 memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg.ptr, scriptpubkey_arg_ref.datalen);
9511 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
9512 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9513 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9514 long ret_ref = (long)ret_var.inner;
9515 if (ret_var.is_owned) {
9521 void ClosingSigned_1free(void* ctx_TODO, uint32_t this_ptr) {
9522 LDKClosingSigned this_ptr_conv;
9523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9524 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9525 ClosingSigned_free(this_ptr_conv);
9528 uint32_t ClosingSigned_1clone(void* ctx_TODO, uint32_t orig) {
9529 LDKClosingSigned orig_conv;
9530 orig_conv.inner = (void*)(orig & (~1));
9531 orig_conv.is_owned = false;
9532 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
9533 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9534 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9535 long ret_ref = (long)ret_var.inner;
9536 if (ret_var.is_owned) {
9542 int8_tArray ClosingSigned_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9543 LDKClosingSigned this_ptr_conv;
9544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9545 this_ptr_conv.is_owned = false;
9546 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
9547 memcpy(ret_arr.ptr, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
9551 void ClosingSigned_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9552 LDKClosingSigned this_ptr_conv;
9553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9554 this_ptr_conv.is_owned = false;
9555 LDKThirtyTwoBytes val_ref;
9556 CHECK(val.len == 32);
9557 memcpy(val_ref.data, val.ptr, 32);
9558 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
9561 int64_t ClosingSigned_1get_1fee_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
9562 LDKClosingSigned this_ptr_conv;
9563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9564 this_ptr_conv.is_owned = false;
9565 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
9569 void ClosingSigned_1set_1fee_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
9570 LDKClosingSigned this_ptr_conv;
9571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9572 this_ptr_conv.is_owned = false;
9573 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
9576 int8_tArray ClosingSigned_1get_1signature(void* ctx_TODO, uint32_t this_ptr) {
9577 LDKClosingSigned this_ptr_conv;
9578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9579 this_ptr_conv.is_owned = false;
9580 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
9581 memcpy(arg_arr.ptr, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
9585 void ClosingSigned_1set_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9586 LDKClosingSigned this_ptr_conv;
9587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9588 this_ptr_conv.is_owned = false;
9589 LDKSignature val_ref;
9590 CHECK(val.len == 64);
9591 memcpy(val_ref.compact_form, val.ptr, 64);
9592 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
9595 uint32_t ClosingSigned_1new(void* ctx_TODO, int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg) {
9596 LDKThirtyTwoBytes channel_id_arg_ref;
9597 CHECK(channel_id_arg.len == 32);
9598 memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
9599 LDKSignature signature_arg_ref;
9600 CHECK(signature_arg.len == 64);
9601 memcpy(signature_arg_ref.compact_form, signature_arg.ptr, 64);
9602 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
9603 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9604 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9605 long ret_ref = (long)ret_var.inner;
9606 if (ret_var.is_owned) {
9612 void UpdateAddHTLC_1free(void* ctx_TODO, uint32_t this_ptr) {
9613 LDKUpdateAddHTLC this_ptr_conv;
9614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9615 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9616 UpdateAddHTLC_free(this_ptr_conv);
9619 uint32_t UpdateAddHTLC_1clone(void* ctx_TODO, uint32_t orig) {
9620 LDKUpdateAddHTLC orig_conv;
9621 orig_conv.inner = (void*)(orig & (~1));
9622 orig_conv.is_owned = false;
9623 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
9624 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9625 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9626 long ret_ref = (long)ret_var.inner;
9627 if (ret_var.is_owned) {
9633 int8_tArray UpdateAddHTLC_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9634 LDKUpdateAddHTLC this_ptr_conv;
9635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9636 this_ptr_conv.is_owned = false;
9637 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
9638 memcpy(ret_arr.ptr, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
9642 void UpdateAddHTLC_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9643 LDKUpdateAddHTLC this_ptr_conv;
9644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9645 this_ptr_conv.is_owned = false;
9646 LDKThirtyTwoBytes val_ref;
9647 CHECK(val.len == 32);
9648 memcpy(val_ref.data, val.ptr, 32);
9649 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
9652 int64_t UpdateAddHTLC_1get_1htlc_1id(void* ctx_TODO, uint32_t this_ptr) {
9653 LDKUpdateAddHTLC this_ptr_conv;
9654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9655 this_ptr_conv.is_owned = false;
9656 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
9660 void UpdateAddHTLC_1set_1htlc_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
9661 LDKUpdateAddHTLC this_ptr_conv;
9662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9663 this_ptr_conv.is_owned = false;
9664 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
9667 int64_t UpdateAddHTLC_1get_1amount_1msat(void* ctx_TODO, uint32_t this_ptr) {
9668 LDKUpdateAddHTLC this_ptr_conv;
9669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9670 this_ptr_conv.is_owned = false;
9671 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
9675 void UpdateAddHTLC_1set_1amount_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
9676 LDKUpdateAddHTLC this_ptr_conv;
9677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9678 this_ptr_conv.is_owned = false;
9679 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
9682 int8_tArray UpdateAddHTLC_1get_1payment_1hash(void* ctx_TODO, uint32_t this_ptr) {
9683 LDKUpdateAddHTLC this_ptr_conv;
9684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9685 this_ptr_conv.is_owned = false;
9686 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
9687 memcpy(ret_arr.ptr, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
9691 void UpdateAddHTLC_1set_1payment_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9692 LDKUpdateAddHTLC this_ptr_conv;
9693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9694 this_ptr_conv.is_owned = false;
9695 LDKThirtyTwoBytes val_ref;
9696 CHECK(val.len == 32);
9697 memcpy(val_ref.data, val.ptr, 32);
9698 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
9701 int32_t UpdateAddHTLC_1get_1cltv_1expiry(void* ctx_TODO, uint32_t this_ptr) {
9702 LDKUpdateAddHTLC this_ptr_conv;
9703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9704 this_ptr_conv.is_owned = false;
9705 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
9709 void UpdateAddHTLC_1set_1cltv_1expiry(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
9710 LDKUpdateAddHTLC this_ptr_conv;
9711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9712 this_ptr_conv.is_owned = false;
9713 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
9716 void UpdateFulfillHTLC_1free(void* ctx_TODO, uint32_t this_ptr) {
9717 LDKUpdateFulfillHTLC this_ptr_conv;
9718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9719 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9720 UpdateFulfillHTLC_free(this_ptr_conv);
9723 uint32_t UpdateFulfillHTLC_1clone(void* ctx_TODO, uint32_t orig) {
9724 LDKUpdateFulfillHTLC orig_conv;
9725 orig_conv.inner = (void*)(orig & (~1));
9726 orig_conv.is_owned = false;
9727 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
9728 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9729 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9730 long ret_ref = (long)ret_var.inner;
9731 if (ret_var.is_owned) {
9737 int8_tArray UpdateFulfillHTLC_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9738 LDKUpdateFulfillHTLC this_ptr_conv;
9739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9740 this_ptr_conv.is_owned = false;
9741 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
9742 memcpy(ret_arr.ptr, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
9746 void UpdateFulfillHTLC_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9747 LDKUpdateFulfillHTLC this_ptr_conv;
9748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9749 this_ptr_conv.is_owned = false;
9750 LDKThirtyTwoBytes val_ref;
9751 CHECK(val.len == 32);
9752 memcpy(val_ref.data, val.ptr, 32);
9753 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
9756 int64_t UpdateFulfillHTLC_1get_1htlc_1id(void* ctx_TODO, uint32_t this_ptr) {
9757 LDKUpdateFulfillHTLC this_ptr_conv;
9758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9759 this_ptr_conv.is_owned = false;
9760 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
9764 void UpdateFulfillHTLC_1set_1htlc_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
9765 LDKUpdateFulfillHTLC this_ptr_conv;
9766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9767 this_ptr_conv.is_owned = false;
9768 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
9771 int8_tArray UpdateFulfillHTLC_1get_1payment_1preimage(void* ctx_TODO, uint32_t this_ptr) {
9772 LDKUpdateFulfillHTLC this_ptr_conv;
9773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9774 this_ptr_conv.is_owned = false;
9775 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
9776 memcpy(ret_arr.ptr, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
9780 void UpdateFulfillHTLC_1set_1payment_1preimage(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9781 LDKUpdateFulfillHTLC this_ptr_conv;
9782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9783 this_ptr_conv.is_owned = false;
9784 LDKThirtyTwoBytes val_ref;
9785 CHECK(val.len == 32);
9786 memcpy(val_ref.data, val.ptr, 32);
9787 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
9790 uint32_t UpdateFulfillHTLC_1new(void* ctx_TODO, int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
9791 LDKThirtyTwoBytes channel_id_arg_ref;
9792 CHECK(channel_id_arg.len == 32);
9793 memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
9794 LDKThirtyTwoBytes payment_preimage_arg_ref;
9795 CHECK(payment_preimage_arg.len == 32);
9796 memcpy(payment_preimage_arg_ref.data, payment_preimage_arg.ptr, 32);
9797 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
9798 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9799 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9800 long ret_ref = (long)ret_var.inner;
9801 if (ret_var.is_owned) {
9807 void UpdateFailHTLC_1free(void* ctx_TODO, uint32_t this_ptr) {
9808 LDKUpdateFailHTLC this_ptr_conv;
9809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9810 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9811 UpdateFailHTLC_free(this_ptr_conv);
9814 uint32_t UpdateFailHTLC_1clone(void* ctx_TODO, uint32_t orig) {
9815 LDKUpdateFailHTLC orig_conv;
9816 orig_conv.inner = (void*)(orig & (~1));
9817 orig_conv.is_owned = false;
9818 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
9819 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9820 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9821 long ret_ref = (long)ret_var.inner;
9822 if (ret_var.is_owned) {
9828 int8_tArray UpdateFailHTLC_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9829 LDKUpdateFailHTLC this_ptr_conv;
9830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9831 this_ptr_conv.is_owned = false;
9832 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
9833 memcpy(ret_arr.ptr, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
9837 void UpdateFailHTLC_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9838 LDKUpdateFailHTLC this_ptr_conv;
9839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9840 this_ptr_conv.is_owned = false;
9841 LDKThirtyTwoBytes val_ref;
9842 CHECK(val.len == 32);
9843 memcpy(val_ref.data, val.ptr, 32);
9844 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
9847 int64_t UpdateFailHTLC_1get_1htlc_1id(void* ctx_TODO, uint32_t this_ptr) {
9848 LDKUpdateFailHTLC this_ptr_conv;
9849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9850 this_ptr_conv.is_owned = false;
9851 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
9855 void UpdateFailHTLC_1set_1htlc_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
9856 LDKUpdateFailHTLC this_ptr_conv;
9857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9858 this_ptr_conv.is_owned = false;
9859 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
9862 void UpdateFailMalformedHTLC_1free(void* ctx_TODO, uint32_t this_ptr) {
9863 LDKUpdateFailMalformedHTLC this_ptr_conv;
9864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9865 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9866 UpdateFailMalformedHTLC_free(this_ptr_conv);
9869 uint32_t UpdateFailMalformedHTLC_1clone(void* ctx_TODO, uint32_t orig) {
9870 LDKUpdateFailMalformedHTLC orig_conv;
9871 orig_conv.inner = (void*)(orig & (~1));
9872 orig_conv.is_owned = false;
9873 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
9874 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9875 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9876 long ret_ref = (long)ret_var.inner;
9877 if (ret_var.is_owned) {
9883 int8_tArray UpdateFailMalformedHTLC_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9884 LDKUpdateFailMalformedHTLC this_ptr_conv;
9885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9886 this_ptr_conv.is_owned = false;
9887 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
9888 memcpy(ret_arr.ptr, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
9892 void UpdateFailMalformedHTLC_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9893 LDKUpdateFailMalformedHTLC this_ptr_conv;
9894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9895 this_ptr_conv.is_owned = false;
9896 LDKThirtyTwoBytes val_ref;
9897 CHECK(val.len == 32);
9898 memcpy(val_ref.data, val.ptr, 32);
9899 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
9902 int64_t UpdateFailMalformedHTLC_1get_1htlc_1id(void* ctx_TODO, uint32_t this_ptr) {
9903 LDKUpdateFailMalformedHTLC this_ptr_conv;
9904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9905 this_ptr_conv.is_owned = false;
9906 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
9910 void UpdateFailMalformedHTLC_1set_1htlc_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
9911 LDKUpdateFailMalformedHTLC this_ptr_conv;
9912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9913 this_ptr_conv.is_owned = false;
9914 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
9917 int16_t UpdateFailMalformedHTLC_1get_1failure_1code(void* ctx_TODO, uint32_t this_ptr) {
9918 LDKUpdateFailMalformedHTLC this_ptr_conv;
9919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9920 this_ptr_conv.is_owned = false;
9921 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
9925 void UpdateFailMalformedHTLC_1set_1failure_1code(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
9926 LDKUpdateFailMalformedHTLC this_ptr_conv;
9927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9928 this_ptr_conv.is_owned = false;
9929 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
9932 void CommitmentSigned_1free(void* ctx_TODO, uint32_t this_ptr) {
9933 LDKCommitmentSigned this_ptr_conv;
9934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9935 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9936 CommitmentSigned_free(this_ptr_conv);
9939 uint32_t CommitmentSigned_1clone(void* ctx_TODO, uint32_t orig) {
9940 LDKCommitmentSigned orig_conv;
9941 orig_conv.inner = (void*)(orig & (~1));
9942 orig_conv.is_owned = false;
9943 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
9944 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9945 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9946 long ret_ref = (long)ret_var.inner;
9947 if (ret_var.is_owned) {
9953 int8_tArray CommitmentSigned_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9954 LDKCommitmentSigned this_ptr_conv;
9955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9956 this_ptr_conv.is_owned = false;
9957 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
9958 memcpy(ret_arr.ptr, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
9962 void CommitmentSigned_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9963 LDKCommitmentSigned this_ptr_conv;
9964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9965 this_ptr_conv.is_owned = false;
9966 LDKThirtyTwoBytes val_ref;
9967 CHECK(val.len == 32);
9968 memcpy(val_ref.data, val.ptr, 32);
9969 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
9972 int8_tArray CommitmentSigned_1get_1signature(void* ctx_TODO, uint32_t this_ptr) {
9973 LDKCommitmentSigned this_ptr_conv;
9974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9975 this_ptr_conv.is_owned = false;
9976 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
9977 memcpy(arg_arr.ptr, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
9981 void CommitmentSigned_1set_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9982 LDKCommitmentSigned this_ptr_conv;
9983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9984 this_ptr_conv.is_owned = false;
9985 LDKSignature val_ref;
9986 CHECK(val.len == 64);
9987 memcpy(val_ref.compact_form, val.ptr, 64);
9988 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
9991 void CommitmentSigned_1set_1htlc_1signatures(void* ctx_TODO, uint32_t this_ptr, ptrArray val) {
9992 LDKCommitmentSigned this_ptr_conv;
9993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9994 this_ptr_conv.is_owned = false;
9995 LDKCVec_SignatureZ val_constr;
9996 val_constr.datalen = val.len;
9997 if (val_constr.datalen > 0)
9998 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10000 val_constr.data = NULL;
10001 int8_tArray* val_vals = (int8_tArray*) val.ptr;
10002 for (size_t m = 0; m < val_constr.datalen; m++) {
10003 int8_tArray arr_conv_12 = val_vals[m];
10004 LDKSignature arr_conv_12_ref;
10005 CHECK(arr_conv_12.len == 64);
10006 memcpy(arr_conv_12_ref.compact_form, arr_conv_12.ptr, 64);
10007 val_constr.data[m] = arr_conv_12_ref;
10009 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
10012 uint32_t CommitmentSigned_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
10013 LDKThirtyTwoBytes channel_id_arg_ref;
10014 CHECK(channel_id_arg.len == 32);
10015 memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
10016 LDKSignature signature_arg_ref;
10017 CHECK(signature_arg.len == 64);
10018 memcpy(signature_arg_ref.compact_form, signature_arg.ptr, 64);
10019 LDKCVec_SignatureZ htlc_signatures_arg_constr;
10020 htlc_signatures_arg_constr.datalen = htlc_signatures_arg.len;
10021 if (htlc_signatures_arg_constr.datalen > 0)
10022 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10024 htlc_signatures_arg_constr.data = NULL;
10025 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*) htlc_signatures_arg.ptr;
10026 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
10027 int8_tArray arr_conv_12 = htlc_signatures_arg_vals[m];
10028 LDKSignature arr_conv_12_ref;
10029 CHECK(arr_conv_12.len == 64);
10030 memcpy(arr_conv_12_ref.compact_form, arr_conv_12.ptr, 64);
10031 htlc_signatures_arg_constr.data[m] = arr_conv_12_ref;
10033 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
10034 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10035 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10036 long ret_ref = (long)ret_var.inner;
10037 if (ret_var.is_owned) {
10043 void RevokeAndACK_1free(void* ctx_TODO, uint32_t this_ptr) {
10044 LDKRevokeAndACK this_ptr_conv;
10045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10046 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10047 RevokeAndACK_free(this_ptr_conv);
10050 uint32_t RevokeAndACK_1clone(void* ctx_TODO, uint32_t orig) {
10051 LDKRevokeAndACK orig_conv;
10052 orig_conv.inner = (void*)(orig & (~1));
10053 orig_conv.is_owned = false;
10054 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
10055 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10056 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10057 long ret_ref = (long)ret_var.inner;
10058 if (ret_var.is_owned) {
10064 int8_tArray RevokeAndACK_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
10065 LDKRevokeAndACK this_ptr_conv;
10066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10067 this_ptr_conv.is_owned = false;
10068 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
10069 memcpy(ret_arr.ptr, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
10073 void RevokeAndACK_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10074 LDKRevokeAndACK this_ptr_conv;
10075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10076 this_ptr_conv.is_owned = false;
10077 LDKThirtyTwoBytes val_ref;
10078 CHECK(val.len == 32);
10079 memcpy(val_ref.data, val.ptr, 32);
10080 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
10083 int8_tArray RevokeAndACK_1get_1per_1commitment_1secret(void* ctx_TODO, uint32_t this_ptr) {
10084 LDKRevokeAndACK this_ptr_conv;
10085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10086 this_ptr_conv.is_owned = false;
10087 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
10088 memcpy(ret_arr.ptr, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
10092 void RevokeAndACK_1set_1per_1commitment_1secret(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10093 LDKRevokeAndACK this_ptr_conv;
10094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10095 this_ptr_conv.is_owned = false;
10096 LDKThirtyTwoBytes val_ref;
10097 CHECK(val.len == 32);
10098 memcpy(val_ref.data, val.ptr, 32);
10099 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
10102 int8_tArray RevokeAndACK_1get_1next_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr) {
10103 LDKRevokeAndACK this_ptr_conv;
10104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10105 this_ptr_conv.is_owned = false;
10106 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
10107 memcpy(arg_arr.ptr, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
10111 void RevokeAndACK_1set_1next_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10112 LDKRevokeAndACK this_ptr_conv;
10113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10114 this_ptr_conv.is_owned = false;
10115 LDKPublicKey val_ref;
10116 CHECK(val.len == 33);
10117 memcpy(val_ref.compressed_form, val.ptr, 33);
10118 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
10121 uint32_t RevokeAndACK_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
10122 LDKThirtyTwoBytes channel_id_arg_ref;
10123 CHECK(channel_id_arg.len == 32);
10124 memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
10125 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
10126 CHECK(per_commitment_secret_arg.len == 32);
10127 memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg.ptr, 32);
10128 LDKPublicKey next_per_commitment_point_arg_ref;
10129 CHECK(next_per_commitment_point_arg.len == 33);
10130 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg.ptr, 33);
10131 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
10132 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10133 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10134 long ret_ref = (long)ret_var.inner;
10135 if (ret_var.is_owned) {
10141 void UpdateFee_1free(void* ctx_TODO, uint32_t this_ptr) {
10142 LDKUpdateFee this_ptr_conv;
10143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10144 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10145 UpdateFee_free(this_ptr_conv);
10148 uint32_t UpdateFee_1clone(void* ctx_TODO, uint32_t orig) {
10149 LDKUpdateFee orig_conv;
10150 orig_conv.inner = (void*)(orig & (~1));
10151 orig_conv.is_owned = false;
10152 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
10153 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10154 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10155 long ret_ref = (long)ret_var.inner;
10156 if (ret_var.is_owned) {
10162 int8_tArray UpdateFee_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
10163 LDKUpdateFee this_ptr_conv;
10164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10165 this_ptr_conv.is_owned = false;
10166 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
10167 memcpy(ret_arr.ptr, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
10171 void UpdateFee_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10172 LDKUpdateFee this_ptr_conv;
10173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10174 this_ptr_conv.is_owned = false;
10175 LDKThirtyTwoBytes val_ref;
10176 CHECK(val.len == 32);
10177 memcpy(val_ref.data, val.ptr, 32);
10178 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
10181 int32_t UpdateFee_1get_1feerate_1per_1kw(void* ctx_TODO, uint32_t this_ptr) {
10182 LDKUpdateFee this_ptr_conv;
10183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10184 this_ptr_conv.is_owned = false;
10185 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
10189 void UpdateFee_1set_1feerate_1per_1kw(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
10190 LDKUpdateFee this_ptr_conv;
10191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10192 this_ptr_conv.is_owned = false;
10193 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
10196 uint32_t UpdateFee_1new(void* ctx_TODO, int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
10197 LDKThirtyTwoBytes channel_id_arg_ref;
10198 CHECK(channel_id_arg.len == 32);
10199 memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
10200 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
10201 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10202 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10203 long ret_ref = (long)ret_var.inner;
10204 if (ret_var.is_owned) {
10210 void DataLossProtect_1free(void* ctx_TODO, uint32_t this_ptr) {
10211 LDKDataLossProtect this_ptr_conv;
10212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10213 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10214 DataLossProtect_free(this_ptr_conv);
10217 uint32_t DataLossProtect_1clone(void* ctx_TODO, uint32_t orig) {
10218 LDKDataLossProtect orig_conv;
10219 orig_conv.inner = (void*)(orig & (~1));
10220 orig_conv.is_owned = false;
10221 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
10222 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10223 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10224 long ret_ref = (long)ret_var.inner;
10225 if (ret_var.is_owned) {
10231 int8_tArray DataLossProtect_1get_1your_1last_1per_1commitment_1secret(void* ctx_TODO, uint32_t this_ptr) {
10232 LDKDataLossProtect this_ptr_conv;
10233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10234 this_ptr_conv.is_owned = false;
10235 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
10236 memcpy(ret_arr.ptr, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
10240 void DataLossProtect_1set_1your_1last_1per_1commitment_1secret(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10241 LDKDataLossProtect this_ptr_conv;
10242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10243 this_ptr_conv.is_owned = false;
10244 LDKThirtyTwoBytes val_ref;
10245 CHECK(val.len == 32);
10246 memcpy(val_ref.data, val.ptr, 32);
10247 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
10250 int8_tArray DataLossProtect_1get_1my_1current_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr) {
10251 LDKDataLossProtect this_ptr_conv;
10252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10253 this_ptr_conv.is_owned = false;
10254 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
10255 memcpy(arg_arr.ptr, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
10259 void DataLossProtect_1set_1my_1current_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10260 LDKDataLossProtect this_ptr_conv;
10261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10262 this_ptr_conv.is_owned = false;
10263 LDKPublicKey val_ref;
10264 CHECK(val.len == 33);
10265 memcpy(val_ref.compressed_form, val.ptr, 33);
10266 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
10269 uint32_t DataLossProtect_1new(void* ctx_TODO, int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
10270 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
10271 CHECK(your_last_per_commitment_secret_arg.len == 32);
10272 memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg.ptr, 32);
10273 LDKPublicKey my_current_per_commitment_point_arg_ref;
10274 CHECK(my_current_per_commitment_point_arg.len == 33);
10275 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, my_current_per_commitment_point_arg.ptr, 33);
10276 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
10277 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10278 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10279 long ret_ref = (long)ret_var.inner;
10280 if (ret_var.is_owned) {
10286 void ChannelReestablish_1free(void* ctx_TODO, uint32_t this_ptr) {
10287 LDKChannelReestablish this_ptr_conv;
10288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10289 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10290 ChannelReestablish_free(this_ptr_conv);
10293 uint32_t ChannelReestablish_1clone(void* ctx_TODO, uint32_t orig) {
10294 LDKChannelReestablish orig_conv;
10295 orig_conv.inner = (void*)(orig & (~1));
10296 orig_conv.is_owned = false;
10297 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
10298 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10299 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10300 long ret_ref = (long)ret_var.inner;
10301 if (ret_var.is_owned) {
10307 int8_tArray ChannelReestablish_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
10308 LDKChannelReestablish this_ptr_conv;
10309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10310 this_ptr_conv.is_owned = false;
10311 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
10312 memcpy(ret_arr.ptr, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
10316 void ChannelReestablish_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10317 LDKChannelReestablish this_ptr_conv;
10318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10319 this_ptr_conv.is_owned = false;
10320 LDKThirtyTwoBytes val_ref;
10321 CHECK(val.len == 32);
10322 memcpy(val_ref.data, val.ptr, 32);
10323 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
10326 int64_t ChannelReestablish_1get_1next_1local_1commitment_1number(void* ctx_TODO, uint32_t this_ptr) {
10327 LDKChannelReestablish this_ptr_conv;
10328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10329 this_ptr_conv.is_owned = false;
10330 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
10334 void ChannelReestablish_1set_1next_1local_1commitment_1number(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
10335 LDKChannelReestablish this_ptr_conv;
10336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10337 this_ptr_conv.is_owned = false;
10338 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
10341 int64_t ChannelReestablish_1get_1next_1remote_1commitment_1number(void* ctx_TODO, uint32_t this_ptr) {
10342 LDKChannelReestablish this_ptr_conv;
10343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10344 this_ptr_conv.is_owned = false;
10345 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
10349 void ChannelReestablish_1set_1next_1remote_1commitment_1number(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
10350 LDKChannelReestablish this_ptr_conv;
10351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10352 this_ptr_conv.is_owned = false;
10353 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
10356 void AnnouncementSignatures_1free(void* ctx_TODO, uint32_t this_ptr) {
10357 LDKAnnouncementSignatures this_ptr_conv;
10358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10359 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10360 AnnouncementSignatures_free(this_ptr_conv);
10363 uint32_t AnnouncementSignatures_1clone(void* ctx_TODO, uint32_t orig) {
10364 LDKAnnouncementSignatures orig_conv;
10365 orig_conv.inner = (void*)(orig & (~1));
10366 orig_conv.is_owned = false;
10367 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
10368 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10369 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10370 long ret_ref = (long)ret_var.inner;
10371 if (ret_var.is_owned) {
10377 int8_tArray AnnouncementSignatures_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
10378 LDKAnnouncementSignatures this_ptr_conv;
10379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10380 this_ptr_conv.is_owned = false;
10381 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
10382 memcpy(ret_arr.ptr, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
10386 void AnnouncementSignatures_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10387 LDKAnnouncementSignatures this_ptr_conv;
10388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10389 this_ptr_conv.is_owned = false;
10390 LDKThirtyTwoBytes val_ref;
10391 CHECK(val.len == 32);
10392 memcpy(val_ref.data, val.ptr, 32);
10393 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
10396 int64_t AnnouncementSignatures_1get_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
10397 LDKAnnouncementSignatures this_ptr_conv;
10398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10399 this_ptr_conv.is_owned = false;
10400 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
10404 void AnnouncementSignatures_1set_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
10405 LDKAnnouncementSignatures this_ptr_conv;
10406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10407 this_ptr_conv.is_owned = false;
10408 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
10411 int8_tArray AnnouncementSignatures_1get_1node_1signature(void* ctx_TODO, uint32_t this_ptr) {
10412 LDKAnnouncementSignatures this_ptr_conv;
10413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10414 this_ptr_conv.is_owned = false;
10415 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
10416 memcpy(arg_arr.ptr, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
10420 void AnnouncementSignatures_1set_1node_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10421 LDKAnnouncementSignatures this_ptr_conv;
10422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10423 this_ptr_conv.is_owned = false;
10424 LDKSignature val_ref;
10425 CHECK(val.len == 64);
10426 memcpy(val_ref.compact_form, val.ptr, 64);
10427 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
10430 int8_tArray AnnouncementSignatures_1get_1bitcoin_1signature(void* ctx_TODO, uint32_t this_ptr) {
10431 LDKAnnouncementSignatures this_ptr_conv;
10432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10433 this_ptr_conv.is_owned = false;
10434 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
10435 memcpy(arg_arr.ptr, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
10439 void AnnouncementSignatures_1set_1bitcoin_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10440 LDKAnnouncementSignatures this_ptr_conv;
10441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10442 this_ptr_conv.is_owned = false;
10443 LDKSignature val_ref;
10444 CHECK(val.len == 64);
10445 memcpy(val_ref.compact_form, val.ptr, 64);
10446 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
10449 uint32_t AnnouncementSignatures_1new(void* ctx_TODO, int8_tArray channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
10450 LDKThirtyTwoBytes channel_id_arg_ref;
10451 CHECK(channel_id_arg.len == 32);
10452 memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
10453 LDKSignature node_signature_arg_ref;
10454 CHECK(node_signature_arg.len == 64);
10455 memcpy(node_signature_arg_ref.compact_form, node_signature_arg.ptr, 64);
10456 LDKSignature bitcoin_signature_arg_ref;
10457 CHECK(bitcoin_signature_arg.len == 64);
10458 memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg.ptr, 64);
10459 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
10460 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10461 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10462 long ret_ref = (long)ret_var.inner;
10463 if (ret_var.is_owned) {
10469 void NetAddress_1free(void* ctx_TODO, uint32_t this_ptr) {
10470 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
10471 FREE((void*)this_ptr);
10472 NetAddress_free(this_ptr_conv);
10475 uint32_t NetAddress_1clone(void* ctx_TODO, uint32_t orig) {
10476 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
10477 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
10478 *ret_copy = NetAddress_clone(orig_conv);
10479 long ret_ref = (long)ret_copy;
10483 int8_tArray NetAddress_1write(void* ctx_TODO, uint32_t obj) {
10484 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
10485 LDKCVec_u8Z arg_var = NetAddress_write(obj_conv);
10486 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
10487 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
10488 CVec_u8Z_free(arg_var);
10492 uint32_t Result_1read(void* ctx_TODO, int8_tArray ser) {
10493 LDKu8slice ser_ref;
10494 ser_ref.datalen = ser.len;
10495 ser_ref.data = ser.ptr;
10496 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
10497 *ret_conv = Result_read(ser_ref);
10498 return (long)ret_conv;
10501 void UnsignedNodeAnnouncement_1free(void* ctx_TODO, uint32_t this_ptr) {
10502 LDKUnsignedNodeAnnouncement this_ptr_conv;
10503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10504 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10505 UnsignedNodeAnnouncement_free(this_ptr_conv);
10508 uint32_t UnsignedNodeAnnouncement_1clone(void* ctx_TODO, uint32_t orig) {
10509 LDKUnsignedNodeAnnouncement orig_conv;
10510 orig_conv.inner = (void*)(orig & (~1));
10511 orig_conv.is_owned = false;
10512 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
10513 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10514 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10515 long ret_ref = (long)ret_var.inner;
10516 if (ret_var.is_owned) {
10522 uint32_t UnsignedNodeAnnouncement_1get_1features(void* ctx_TODO, uint32_t this_ptr) {
10523 LDKUnsignedNodeAnnouncement this_ptr_conv;
10524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10525 this_ptr_conv.is_owned = false;
10526 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
10527 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10528 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10529 long ret_ref = (long)ret_var.inner;
10530 if (ret_var.is_owned) {
10536 void UnsignedNodeAnnouncement_1set_1features(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
10537 LDKUnsignedNodeAnnouncement this_ptr_conv;
10538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10539 this_ptr_conv.is_owned = false;
10540 LDKNodeFeatures val_conv;
10541 val_conv.inner = (void*)(val & (~1));
10542 val_conv.is_owned = (val & 1) || (val == 0);
10543 // Warning: we may need a move here but can't clone!
10544 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
10547 int32_t UnsignedNodeAnnouncement_1get_1timestamp(void* ctx_TODO, uint32_t this_ptr) {
10548 LDKUnsignedNodeAnnouncement this_ptr_conv;
10549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10550 this_ptr_conv.is_owned = false;
10551 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
10555 void UnsignedNodeAnnouncement_1set_1timestamp(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
10556 LDKUnsignedNodeAnnouncement this_ptr_conv;
10557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10558 this_ptr_conv.is_owned = false;
10559 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
10562 int8_tArray UnsignedNodeAnnouncement_1get_1node_1id(void* ctx_TODO, uint32_t this_ptr) {
10563 LDKUnsignedNodeAnnouncement this_ptr_conv;
10564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10565 this_ptr_conv.is_owned = false;
10566 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
10567 memcpy(arg_arr.ptr, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
10571 void UnsignedNodeAnnouncement_1set_1node_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10572 LDKUnsignedNodeAnnouncement this_ptr_conv;
10573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10574 this_ptr_conv.is_owned = false;
10575 LDKPublicKey val_ref;
10576 CHECK(val.len == 33);
10577 memcpy(val_ref.compressed_form, val.ptr, 33);
10578 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
10581 int8_tArray UnsignedNodeAnnouncement_1get_1rgb(void* ctx_TODO, uint32_t this_ptr) {
10582 LDKUnsignedNodeAnnouncement this_ptr_conv;
10583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10584 this_ptr_conv.is_owned = false;
10585 int8_tArray ret_arr = { .len = 3, .ptr = MALLOC(3, "Native int8_tArray Bytes") };
10586 memcpy(ret_arr.ptr, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
10590 void UnsignedNodeAnnouncement_1set_1rgb(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10591 LDKUnsignedNodeAnnouncement this_ptr_conv;
10592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10593 this_ptr_conv.is_owned = false;
10594 LDKThreeBytes val_ref;
10595 CHECK(val.len == 3);
10596 memcpy(val_ref.data, val.ptr, 3);
10597 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
10600 int8_tArray UnsignedNodeAnnouncement_1get_1alias(void* ctx_TODO, uint32_t this_ptr) {
10601 LDKUnsignedNodeAnnouncement this_ptr_conv;
10602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10603 this_ptr_conv.is_owned = false;
10604 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
10605 memcpy(ret_arr.ptr, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
10609 void UnsignedNodeAnnouncement_1set_1alias(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10610 LDKUnsignedNodeAnnouncement this_ptr_conv;
10611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10612 this_ptr_conv.is_owned = false;
10613 LDKThirtyTwoBytes val_ref;
10614 CHECK(val.len == 32);
10615 memcpy(val_ref.data, val.ptr, 32);
10616 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
10619 void UnsignedNodeAnnouncement_1set_1addresses(void* ctx_TODO, uint32_t this_ptr, uint32_tArray val) {
10620 LDKUnsignedNodeAnnouncement this_ptr_conv;
10621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10622 this_ptr_conv.is_owned = false;
10623 LDKCVec_NetAddressZ val_constr;
10624 val_constr.datalen = val.len;
10625 if (val_constr.datalen > 0)
10626 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
10628 val_constr.data = NULL;
10629 uint32_t* val_vals = (uint32_t*) val.ptr;
10630 for (size_t m = 0; m < val_constr.datalen; m++) {
10631 uint32_t arr_conv_12 = val_vals[m];
10632 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
10633 FREE((void*)arr_conv_12);
10634 val_constr.data[m] = arr_conv_12_conv;
10636 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
10639 void NodeAnnouncement_1free(void* ctx_TODO, uint32_t this_ptr) {
10640 LDKNodeAnnouncement this_ptr_conv;
10641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10642 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10643 NodeAnnouncement_free(this_ptr_conv);
10646 uint32_t NodeAnnouncement_1clone(void* ctx_TODO, uint32_t orig) {
10647 LDKNodeAnnouncement orig_conv;
10648 orig_conv.inner = (void*)(orig & (~1));
10649 orig_conv.is_owned = false;
10650 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
10651 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10652 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10653 long ret_ref = (long)ret_var.inner;
10654 if (ret_var.is_owned) {
10660 int8_tArray NodeAnnouncement_1get_1signature(void* ctx_TODO, uint32_t this_ptr) {
10661 LDKNodeAnnouncement this_ptr_conv;
10662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10663 this_ptr_conv.is_owned = false;
10664 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
10665 memcpy(arg_arr.ptr, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
10669 void NodeAnnouncement_1set_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10670 LDKNodeAnnouncement this_ptr_conv;
10671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10672 this_ptr_conv.is_owned = false;
10673 LDKSignature val_ref;
10674 CHECK(val.len == 64);
10675 memcpy(val_ref.compact_form, val.ptr, 64);
10676 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
10679 uint32_t NodeAnnouncement_1get_1contents(void* ctx_TODO, uint32_t this_ptr) {
10680 LDKNodeAnnouncement this_ptr_conv;
10681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10682 this_ptr_conv.is_owned = false;
10683 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
10684 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10685 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10686 long ret_ref = (long)ret_var.inner;
10687 if (ret_var.is_owned) {
10693 void NodeAnnouncement_1set_1contents(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
10694 LDKNodeAnnouncement this_ptr_conv;
10695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10696 this_ptr_conv.is_owned = false;
10697 LDKUnsignedNodeAnnouncement val_conv;
10698 val_conv.inner = (void*)(val & (~1));
10699 val_conv.is_owned = (val & 1) || (val == 0);
10700 if (val_conv.inner != NULL)
10701 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
10702 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
10705 uint32_t NodeAnnouncement_1new(void* ctx_TODO, int8_tArray signature_arg, uint32_t contents_arg) {
10706 LDKSignature signature_arg_ref;
10707 CHECK(signature_arg.len == 64);
10708 memcpy(signature_arg_ref.compact_form, signature_arg.ptr, 64);
10709 LDKUnsignedNodeAnnouncement contents_arg_conv;
10710 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10711 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10712 if (contents_arg_conv.inner != NULL)
10713 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
10714 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
10715 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10716 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10717 long ret_ref = (long)ret_var.inner;
10718 if (ret_var.is_owned) {
10724 void UnsignedChannelAnnouncement_1free(void* ctx_TODO, uint32_t this_ptr) {
10725 LDKUnsignedChannelAnnouncement this_ptr_conv;
10726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10727 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10728 UnsignedChannelAnnouncement_free(this_ptr_conv);
10731 uint32_t UnsignedChannelAnnouncement_1clone(void* ctx_TODO, uint32_t orig) {
10732 LDKUnsignedChannelAnnouncement orig_conv;
10733 orig_conv.inner = (void*)(orig & (~1));
10734 orig_conv.is_owned = false;
10735 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
10736 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10737 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10738 long ret_ref = (long)ret_var.inner;
10739 if (ret_var.is_owned) {
10745 uint32_t UnsignedChannelAnnouncement_1get_1features(void* ctx_TODO, uint32_t this_ptr) {
10746 LDKUnsignedChannelAnnouncement this_ptr_conv;
10747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10748 this_ptr_conv.is_owned = false;
10749 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
10750 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10751 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10752 long ret_ref = (long)ret_var.inner;
10753 if (ret_var.is_owned) {
10759 void UnsignedChannelAnnouncement_1set_1features(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
10760 LDKUnsignedChannelAnnouncement this_ptr_conv;
10761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10762 this_ptr_conv.is_owned = false;
10763 LDKChannelFeatures val_conv;
10764 val_conv.inner = (void*)(val & (~1));
10765 val_conv.is_owned = (val & 1) || (val == 0);
10766 // Warning: we may need a move here but can't clone!
10767 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
10770 int8_tArray UnsignedChannelAnnouncement_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
10771 LDKUnsignedChannelAnnouncement this_ptr_conv;
10772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10773 this_ptr_conv.is_owned = false;
10774 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
10775 memcpy(ret_arr.ptr, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
10779 void UnsignedChannelAnnouncement_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10780 LDKUnsignedChannelAnnouncement this_ptr_conv;
10781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10782 this_ptr_conv.is_owned = false;
10783 LDKThirtyTwoBytes val_ref;
10784 CHECK(val.len == 32);
10785 memcpy(val_ref.data, val.ptr, 32);
10786 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
10789 int64_t UnsignedChannelAnnouncement_1get_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
10790 LDKUnsignedChannelAnnouncement this_ptr_conv;
10791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10792 this_ptr_conv.is_owned = false;
10793 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
10797 void UnsignedChannelAnnouncement_1set_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
10798 LDKUnsignedChannelAnnouncement this_ptr_conv;
10799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10800 this_ptr_conv.is_owned = false;
10801 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
10804 int8_tArray UnsignedChannelAnnouncement_1get_1node_1id_11(void* ctx_TODO, uint32_t this_ptr) {
10805 LDKUnsignedChannelAnnouncement this_ptr_conv;
10806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10807 this_ptr_conv.is_owned = false;
10808 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
10809 memcpy(arg_arr.ptr, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
10813 void UnsignedChannelAnnouncement_1set_1node_1id_11(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10814 LDKUnsignedChannelAnnouncement this_ptr_conv;
10815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10816 this_ptr_conv.is_owned = false;
10817 LDKPublicKey val_ref;
10818 CHECK(val.len == 33);
10819 memcpy(val_ref.compressed_form, val.ptr, 33);
10820 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
10823 int8_tArray UnsignedChannelAnnouncement_1get_1node_1id_12(void* ctx_TODO, uint32_t this_ptr) {
10824 LDKUnsignedChannelAnnouncement this_ptr_conv;
10825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10826 this_ptr_conv.is_owned = false;
10827 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
10828 memcpy(arg_arr.ptr, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
10832 void UnsignedChannelAnnouncement_1set_1node_1id_12(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10833 LDKUnsignedChannelAnnouncement this_ptr_conv;
10834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10835 this_ptr_conv.is_owned = false;
10836 LDKPublicKey val_ref;
10837 CHECK(val.len == 33);
10838 memcpy(val_ref.compressed_form, val.ptr, 33);
10839 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
10842 int8_tArray UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(void* ctx_TODO, uint32_t this_ptr) {
10843 LDKUnsignedChannelAnnouncement this_ptr_conv;
10844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10845 this_ptr_conv.is_owned = false;
10846 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
10847 memcpy(arg_arr.ptr, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
10851 void UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10852 LDKUnsignedChannelAnnouncement this_ptr_conv;
10853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10854 this_ptr_conv.is_owned = false;
10855 LDKPublicKey val_ref;
10856 CHECK(val.len == 33);
10857 memcpy(val_ref.compressed_form, val.ptr, 33);
10858 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
10861 int8_tArray UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(void* ctx_TODO, uint32_t this_ptr) {
10862 LDKUnsignedChannelAnnouncement this_ptr_conv;
10863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10864 this_ptr_conv.is_owned = false;
10865 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
10866 memcpy(arg_arr.ptr, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
10870 void UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10871 LDKUnsignedChannelAnnouncement this_ptr_conv;
10872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10873 this_ptr_conv.is_owned = false;
10874 LDKPublicKey val_ref;
10875 CHECK(val.len == 33);
10876 memcpy(val_ref.compressed_form, val.ptr, 33);
10877 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
10880 void ChannelAnnouncement_1free(void* ctx_TODO, uint32_t this_ptr) {
10881 LDKChannelAnnouncement this_ptr_conv;
10882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10883 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10884 ChannelAnnouncement_free(this_ptr_conv);
10887 uint32_t ChannelAnnouncement_1clone(void* ctx_TODO, uint32_t orig) {
10888 LDKChannelAnnouncement orig_conv;
10889 orig_conv.inner = (void*)(orig & (~1));
10890 orig_conv.is_owned = false;
10891 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
10892 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10893 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10894 long ret_ref = (long)ret_var.inner;
10895 if (ret_var.is_owned) {
10901 int8_tArray ChannelAnnouncement_1get_1node_1signature_11(void* ctx_TODO, uint32_t this_ptr) {
10902 LDKChannelAnnouncement this_ptr_conv;
10903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10904 this_ptr_conv.is_owned = false;
10905 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
10906 memcpy(arg_arr.ptr, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
10910 void ChannelAnnouncement_1set_1node_1signature_11(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10911 LDKChannelAnnouncement this_ptr_conv;
10912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10913 this_ptr_conv.is_owned = false;
10914 LDKSignature val_ref;
10915 CHECK(val.len == 64);
10916 memcpy(val_ref.compact_form, val.ptr, 64);
10917 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
10920 int8_tArray ChannelAnnouncement_1get_1node_1signature_12(void* ctx_TODO, uint32_t this_ptr) {
10921 LDKChannelAnnouncement this_ptr_conv;
10922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10923 this_ptr_conv.is_owned = false;
10924 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
10925 memcpy(arg_arr.ptr, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
10929 void ChannelAnnouncement_1set_1node_1signature_12(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10930 LDKChannelAnnouncement this_ptr_conv;
10931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10932 this_ptr_conv.is_owned = false;
10933 LDKSignature val_ref;
10934 CHECK(val.len == 64);
10935 memcpy(val_ref.compact_form, val.ptr, 64);
10936 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
10939 int8_tArray ChannelAnnouncement_1get_1bitcoin_1signature_11(void* ctx_TODO, uint32_t this_ptr) {
10940 LDKChannelAnnouncement this_ptr_conv;
10941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10942 this_ptr_conv.is_owned = false;
10943 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
10944 memcpy(arg_arr.ptr, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
10948 void ChannelAnnouncement_1set_1bitcoin_1signature_11(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10949 LDKChannelAnnouncement this_ptr_conv;
10950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10951 this_ptr_conv.is_owned = false;
10952 LDKSignature val_ref;
10953 CHECK(val.len == 64);
10954 memcpy(val_ref.compact_form, val.ptr, 64);
10955 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
10958 int8_tArray ChannelAnnouncement_1get_1bitcoin_1signature_12(void* ctx_TODO, uint32_t this_ptr) {
10959 LDKChannelAnnouncement this_ptr_conv;
10960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10961 this_ptr_conv.is_owned = false;
10962 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
10963 memcpy(arg_arr.ptr, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
10967 void ChannelAnnouncement_1set_1bitcoin_1signature_12(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10968 LDKChannelAnnouncement this_ptr_conv;
10969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10970 this_ptr_conv.is_owned = false;
10971 LDKSignature val_ref;
10972 CHECK(val.len == 64);
10973 memcpy(val_ref.compact_form, val.ptr, 64);
10974 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
10977 uint32_t ChannelAnnouncement_1get_1contents(void* ctx_TODO, uint32_t this_ptr) {
10978 LDKChannelAnnouncement this_ptr_conv;
10979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10980 this_ptr_conv.is_owned = false;
10981 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
10982 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10983 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10984 long ret_ref = (long)ret_var.inner;
10985 if (ret_var.is_owned) {
10991 void ChannelAnnouncement_1set_1contents(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
10992 LDKChannelAnnouncement this_ptr_conv;
10993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10994 this_ptr_conv.is_owned = false;
10995 LDKUnsignedChannelAnnouncement val_conv;
10996 val_conv.inner = (void*)(val & (~1));
10997 val_conv.is_owned = (val & 1) || (val == 0);
10998 if (val_conv.inner != NULL)
10999 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
11000 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
11003 uint32_t ChannelAnnouncement_1new(void* ctx_TODO, int8_tArray node_signature_1_arg, int8_tArray node_signature_2_arg, int8_tArray bitcoin_signature_1_arg, int8_tArray bitcoin_signature_2_arg, uint32_t contents_arg) {
11004 LDKSignature node_signature_1_arg_ref;
11005 CHECK(node_signature_1_arg.len == 64);
11006 memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg.ptr, 64);
11007 LDKSignature node_signature_2_arg_ref;
11008 CHECK(node_signature_2_arg.len == 64);
11009 memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg.ptr, 64);
11010 LDKSignature bitcoin_signature_1_arg_ref;
11011 CHECK(bitcoin_signature_1_arg.len == 64);
11012 memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg.ptr, 64);
11013 LDKSignature bitcoin_signature_2_arg_ref;
11014 CHECK(bitcoin_signature_2_arg.len == 64);
11015 memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg.ptr, 64);
11016 LDKUnsignedChannelAnnouncement contents_arg_conv;
11017 contents_arg_conv.inner = (void*)(contents_arg & (~1));
11018 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
11019 if (contents_arg_conv.inner != NULL)
11020 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
11021 LDKChannelAnnouncement ret_var = ChannelAnnouncement_new(node_signature_1_arg_ref, node_signature_2_arg_ref, bitcoin_signature_1_arg_ref, bitcoin_signature_2_arg_ref, contents_arg_conv);
11022 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11023 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11024 long ret_ref = (long)ret_var.inner;
11025 if (ret_var.is_owned) {
11031 void UnsignedChannelUpdate_1free(void* ctx_TODO, uint32_t this_ptr) {
11032 LDKUnsignedChannelUpdate this_ptr_conv;
11033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11034 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11035 UnsignedChannelUpdate_free(this_ptr_conv);
11038 uint32_t UnsignedChannelUpdate_1clone(void* ctx_TODO, uint32_t orig) {
11039 LDKUnsignedChannelUpdate orig_conv;
11040 orig_conv.inner = (void*)(orig & (~1));
11041 orig_conv.is_owned = false;
11042 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
11043 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11044 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11045 long ret_ref = (long)ret_var.inner;
11046 if (ret_var.is_owned) {
11052 int8_tArray UnsignedChannelUpdate_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
11053 LDKUnsignedChannelUpdate this_ptr_conv;
11054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11055 this_ptr_conv.is_owned = false;
11056 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
11057 memcpy(ret_arr.ptr, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
11061 void UnsignedChannelUpdate_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11062 LDKUnsignedChannelUpdate this_ptr_conv;
11063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11064 this_ptr_conv.is_owned = false;
11065 LDKThirtyTwoBytes val_ref;
11066 CHECK(val.len == 32);
11067 memcpy(val_ref.data, val.ptr, 32);
11068 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
11071 int64_t UnsignedChannelUpdate_1get_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
11072 LDKUnsignedChannelUpdate this_ptr_conv;
11073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11074 this_ptr_conv.is_owned = false;
11075 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
11079 void UnsignedChannelUpdate_1set_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
11080 LDKUnsignedChannelUpdate this_ptr_conv;
11081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11082 this_ptr_conv.is_owned = false;
11083 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
11086 int32_t UnsignedChannelUpdate_1get_1timestamp(void* ctx_TODO, uint32_t this_ptr) {
11087 LDKUnsignedChannelUpdate this_ptr_conv;
11088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11089 this_ptr_conv.is_owned = false;
11090 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
11094 void UnsignedChannelUpdate_1set_1timestamp(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
11095 LDKUnsignedChannelUpdate this_ptr_conv;
11096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11097 this_ptr_conv.is_owned = false;
11098 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
11101 int8_t UnsignedChannelUpdate_1get_1flags(void* ctx_TODO, uint32_t this_ptr) {
11102 LDKUnsignedChannelUpdate this_ptr_conv;
11103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11104 this_ptr_conv.is_owned = false;
11105 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
11109 void UnsignedChannelUpdate_1set_1flags(void* ctx_TODO, uint32_t this_ptr, int8_t val) {
11110 LDKUnsignedChannelUpdate this_ptr_conv;
11111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11112 this_ptr_conv.is_owned = false;
11113 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
11116 int16_t UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr) {
11117 LDKUnsignedChannelUpdate this_ptr_conv;
11118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11119 this_ptr_conv.is_owned = false;
11120 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
11124 void UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
11125 LDKUnsignedChannelUpdate this_ptr_conv;
11126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11127 this_ptr_conv.is_owned = false;
11128 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
11131 int64_t UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr) {
11132 LDKUnsignedChannelUpdate this_ptr_conv;
11133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11134 this_ptr_conv.is_owned = false;
11135 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
11139 void UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
11140 LDKUnsignedChannelUpdate this_ptr_conv;
11141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11142 this_ptr_conv.is_owned = false;
11143 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
11146 int32_t UnsignedChannelUpdate_1get_1fee_1base_1msat(void* ctx_TODO, uint32_t this_ptr) {
11147 LDKUnsignedChannelUpdate this_ptr_conv;
11148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11149 this_ptr_conv.is_owned = false;
11150 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
11154 void UnsignedChannelUpdate_1set_1fee_1base_1msat(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
11155 LDKUnsignedChannelUpdate this_ptr_conv;
11156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11157 this_ptr_conv.is_owned = false;
11158 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
11161 int32_t UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(void* ctx_TODO, uint32_t this_ptr) {
11162 LDKUnsignedChannelUpdate this_ptr_conv;
11163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11164 this_ptr_conv.is_owned = false;
11165 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
11169 void UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
11170 LDKUnsignedChannelUpdate this_ptr_conv;
11171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11172 this_ptr_conv.is_owned = false;
11173 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
11176 void ChannelUpdate_1free(void* ctx_TODO, uint32_t this_ptr) {
11177 LDKChannelUpdate this_ptr_conv;
11178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11179 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11180 ChannelUpdate_free(this_ptr_conv);
11183 uint32_t ChannelUpdate_1clone(void* ctx_TODO, uint32_t orig) {
11184 LDKChannelUpdate orig_conv;
11185 orig_conv.inner = (void*)(orig & (~1));
11186 orig_conv.is_owned = false;
11187 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
11188 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11189 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11190 long ret_ref = (long)ret_var.inner;
11191 if (ret_var.is_owned) {
11197 int8_tArray ChannelUpdate_1get_1signature(void* ctx_TODO, uint32_t this_ptr) {
11198 LDKChannelUpdate this_ptr_conv;
11199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11200 this_ptr_conv.is_owned = false;
11201 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
11202 memcpy(arg_arr.ptr, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
11206 void ChannelUpdate_1set_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11207 LDKChannelUpdate this_ptr_conv;
11208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11209 this_ptr_conv.is_owned = false;
11210 LDKSignature val_ref;
11211 CHECK(val.len == 64);
11212 memcpy(val_ref.compact_form, val.ptr, 64);
11213 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
11216 uint32_t ChannelUpdate_1get_1contents(void* ctx_TODO, uint32_t this_ptr) {
11217 LDKChannelUpdate this_ptr_conv;
11218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11219 this_ptr_conv.is_owned = false;
11220 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
11221 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11222 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11223 long ret_ref = (long)ret_var.inner;
11224 if (ret_var.is_owned) {
11230 void ChannelUpdate_1set_1contents(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
11231 LDKChannelUpdate this_ptr_conv;
11232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11233 this_ptr_conv.is_owned = false;
11234 LDKUnsignedChannelUpdate val_conv;
11235 val_conv.inner = (void*)(val & (~1));
11236 val_conv.is_owned = (val & 1) || (val == 0);
11237 if (val_conv.inner != NULL)
11238 val_conv = UnsignedChannelUpdate_clone(&val_conv);
11239 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
11242 uint32_t ChannelUpdate_1new(void* ctx_TODO, int8_tArray signature_arg, uint32_t contents_arg) {
11243 LDKSignature signature_arg_ref;
11244 CHECK(signature_arg.len == 64);
11245 memcpy(signature_arg_ref.compact_form, signature_arg.ptr, 64);
11246 LDKUnsignedChannelUpdate contents_arg_conv;
11247 contents_arg_conv.inner = (void*)(contents_arg & (~1));
11248 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
11249 if (contents_arg_conv.inner != NULL)
11250 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
11251 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
11252 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11253 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11254 long ret_ref = (long)ret_var.inner;
11255 if (ret_var.is_owned) {
11261 void QueryChannelRange_1free(void* ctx_TODO, uint32_t this_ptr) {
11262 LDKQueryChannelRange this_ptr_conv;
11263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11264 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11265 QueryChannelRange_free(this_ptr_conv);
11268 uint32_t QueryChannelRange_1clone(void* ctx_TODO, uint32_t orig) {
11269 LDKQueryChannelRange orig_conv;
11270 orig_conv.inner = (void*)(orig & (~1));
11271 orig_conv.is_owned = false;
11272 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
11273 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11274 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11275 long ret_ref = (long)ret_var.inner;
11276 if (ret_var.is_owned) {
11282 int8_tArray QueryChannelRange_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
11283 LDKQueryChannelRange this_ptr_conv;
11284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11285 this_ptr_conv.is_owned = false;
11286 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
11287 memcpy(ret_arr.ptr, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
11291 void QueryChannelRange_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11292 LDKQueryChannelRange this_ptr_conv;
11293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11294 this_ptr_conv.is_owned = false;
11295 LDKThirtyTwoBytes val_ref;
11296 CHECK(val.len == 32);
11297 memcpy(val_ref.data, val.ptr, 32);
11298 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
11301 int32_t QueryChannelRange_1get_1first_1blocknum(void* ctx_TODO, uint32_t this_ptr) {
11302 LDKQueryChannelRange this_ptr_conv;
11303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11304 this_ptr_conv.is_owned = false;
11305 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
11309 void QueryChannelRange_1set_1first_1blocknum(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
11310 LDKQueryChannelRange this_ptr_conv;
11311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11312 this_ptr_conv.is_owned = false;
11313 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
11316 int32_t QueryChannelRange_1get_1number_1of_1blocks(void* ctx_TODO, uint32_t this_ptr) {
11317 LDKQueryChannelRange this_ptr_conv;
11318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11319 this_ptr_conv.is_owned = false;
11320 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
11324 void QueryChannelRange_1set_1number_1of_1blocks(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
11325 LDKQueryChannelRange this_ptr_conv;
11326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11327 this_ptr_conv.is_owned = false;
11328 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
11331 uint32_t QueryChannelRange_1new(void* ctx_TODO, int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
11332 LDKThirtyTwoBytes chain_hash_arg_ref;
11333 CHECK(chain_hash_arg.len == 32);
11334 memcpy(chain_hash_arg_ref.data, chain_hash_arg.ptr, 32);
11335 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
11336 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11337 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11338 long ret_ref = (long)ret_var.inner;
11339 if (ret_var.is_owned) {
11345 void ReplyChannelRange_1free(void* ctx_TODO, uint32_t this_ptr) {
11346 LDKReplyChannelRange this_ptr_conv;
11347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11348 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11349 ReplyChannelRange_free(this_ptr_conv);
11352 uint32_t ReplyChannelRange_1clone(void* ctx_TODO, uint32_t orig) {
11353 LDKReplyChannelRange orig_conv;
11354 orig_conv.inner = (void*)(orig & (~1));
11355 orig_conv.is_owned = false;
11356 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
11357 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11358 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11359 long ret_ref = (long)ret_var.inner;
11360 if (ret_var.is_owned) {
11366 int8_tArray ReplyChannelRange_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
11367 LDKReplyChannelRange this_ptr_conv;
11368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11369 this_ptr_conv.is_owned = false;
11370 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
11371 memcpy(ret_arr.ptr, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
11375 void ReplyChannelRange_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11376 LDKReplyChannelRange this_ptr_conv;
11377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11378 this_ptr_conv.is_owned = false;
11379 LDKThirtyTwoBytes val_ref;
11380 CHECK(val.len == 32);
11381 memcpy(val_ref.data, val.ptr, 32);
11382 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
11385 int32_t ReplyChannelRange_1get_1first_1blocknum(void* ctx_TODO, uint32_t this_ptr) {
11386 LDKReplyChannelRange this_ptr_conv;
11387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11388 this_ptr_conv.is_owned = false;
11389 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
11393 void ReplyChannelRange_1set_1first_1blocknum(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
11394 LDKReplyChannelRange this_ptr_conv;
11395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11396 this_ptr_conv.is_owned = false;
11397 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
11400 int32_t ReplyChannelRange_1get_1number_1of_1blocks(void* ctx_TODO, uint32_t this_ptr) {
11401 LDKReplyChannelRange this_ptr_conv;
11402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11403 this_ptr_conv.is_owned = false;
11404 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
11408 void ReplyChannelRange_1set_1number_1of_1blocks(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
11409 LDKReplyChannelRange this_ptr_conv;
11410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11411 this_ptr_conv.is_owned = false;
11412 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
11415 jboolean ReplyChannelRange_1get_1full_1information(void* ctx_TODO, uint32_t this_ptr) {
11416 LDKReplyChannelRange this_ptr_conv;
11417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11418 this_ptr_conv.is_owned = false;
11419 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
11423 void ReplyChannelRange_1set_1full_1information(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
11424 LDKReplyChannelRange this_ptr_conv;
11425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11426 this_ptr_conv.is_owned = false;
11427 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
11430 void ReplyChannelRange_1set_1short_1channel_1ids(void* ctx_TODO, uint32_t this_ptr, int64_tArray val) {
11431 LDKReplyChannelRange this_ptr_conv;
11432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11433 this_ptr_conv.is_owned = false;
11434 LDKCVec_u64Z val_constr;
11435 val_constr.datalen = val.len;
11436 if (val_constr.datalen > 0)
11437 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
11439 val_constr.data = NULL;
11440 int64_t* val_vals = (int64_t*) val.ptr;
11441 for (size_t i = 0; i < val_constr.datalen; i++) {
11442 int64_t arr_conv_8 = val_vals[i];
11443 val_constr.data[i] = arr_conv_8;
11445 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
11448 uint32_t ReplyChannelRange_1new(void* ctx_TODO, int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg, jboolean full_information_arg, int64_tArray short_channel_ids_arg) {
11449 LDKThirtyTwoBytes chain_hash_arg_ref;
11450 CHECK(chain_hash_arg.len == 32);
11451 memcpy(chain_hash_arg_ref.data, chain_hash_arg.ptr, 32);
11452 LDKCVec_u64Z short_channel_ids_arg_constr;
11453 short_channel_ids_arg_constr.datalen = short_channel_ids_arg.len;
11454 if (short_channel_ids_arg_constr.datalen > 0)
11455 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
11457 short_channel_ids_arg_constr.data = NULL;
11458 int64_t* short_channel_ids_arg_vals = (int64_t*) short_channel_ids_arg.ptr;
11459 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
11460 int64_t arr_conv_8 = short_channel_ids_arg_vals[i];
11461 short_channel_ids_arg_constr.data[i] = arr_conv_8;
11463 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
11464 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11465 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11466 long ret_ref = (long)ret_var.inner;
11467 if (ret_var.is_owned) {
11473 void QueryShortChannelIds_1free(void* ctx_TODO, uint32_t this_ptr) {
11474 LDKQueryShortChannelIds this_ptr_conv;
11475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11476 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11477 QueryShortChannelIds_free(this_ptr_conv);
11480 uint32_t QueryShortChannelIds_1clone(void* ctx_TODO, uint32_t orig) {
11481 LDKQueryShortChannelIds orig_conv;
11482 orig_conv.inner = (void*)(orig & (~1));
11483 orig_conv.is_owned = false;
11484 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
11485 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11486 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11487 long ret_ref = (long)ret_var.inner;
11488 if (ret_var.is_owned) {
11494 int8_tArray QueryShortChannelIds_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
11495 LDKQueryShortChannelIds this_ptr_conv;
11496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11497 this_ptr_conv.is_owned = false;
11498 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
11499 memcpy(ret_arr.ptr, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
11503 void QueryShortChannelIds_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11504 LDKQueryShortChannelIds this_ptr_conv;
11505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11506 this_ptr_conv.is_owned = false;
11507 LDKThirtyTwoBytes val_ref;
11508 CHECK(val.len == 32);
11509 memcpy(val_ref.data, val.ptr, 32);
11510 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
11513 void QueryShortChannelIds_1set_1short_1channel_1ids(void* ctx_TODO, uint32_t this_ptr, int64_tArray val) {
11514 LDKQueryShortChannelIds this_ptr_conv;
11515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11516 this_ptr_conv.is_owned = false;
11517 LDKCVec_u64Z val_constr;
11518 val_constr.datalen = val.len;
11519 if (val_constr.datalen > 0)
11520 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
11522 val_constr.data = NULL;
11523 int64_t* val_vals = (int64_t*) val.ptr;
11524 for (size_t i = 0; i < val_constr.datalen; i++) {
11525 int64_t arr_conv_8 = val_vals[i];
11526 val_constr.data[i] = arr_conv_8;
11528 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
11531 uint32_t QueryShortChannelIds_1new(void* ctx_TODO, int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
11532 LDKThirtyTwoBytes chain_hash_arg_ref;
11533 CHECK(chain_hash_arg.len == 32);
11534 memcpy(chain_hash_arg_ref.data, chain_hash_arg.ptr, 32);
11535 LDKCVec_u64Z short_channel_ids_arg_constr;
11536 short_channel_ids_arg_constr.datalen = short_channel_ids_arg.len;
11537 if (short_channel_ids_arg_constr.datalen > 0)
11538 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
11540 short_channel_ids_arg_constr.data = NULL;
11541 int64_t* short_channel_ids_arg_vals = (int64_t*) short_channel_ids_arg.ptr;
11542 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
11543 int64_t arr_conv_8 = short_channel_ids_arg_vals[i];
11544 short_channel_ids_arg_constr.data[i] = arr_conv_8;
11546 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
11547 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11548 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11549 long ret_ref = (long)ret_var.inner;
11550 if (ret_var.is_owned) {
11556 void ReplyShortChannelIdsEnd_1free(void* ctx_TODO, uint32_t this_ptr) {
11557 LDKReplyShortChannelIdsEnd this_ptr_conv;
11558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11559 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11560 ReplyShortChannelIdsEnd_free(this_ptr_conv);
11563 uint32_t ReplyShortChannelIdsEnd_1clone(void* ctx_TODO, uint32_t orig) {
11564 LDKReplyShortChannelIdsEnd orig_conv;
11565 orig_conv.inner = (void*)(orig & (~1));
11566 orig_conv.is_owned = false;
11567 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
11568 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11569 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11570 long ret_ref = (long)ret_var.inner;
11571 if (ret_var.is_owned) {
11577 int8_tArray ReplyShortChannelIdsEnd_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
11578 LDKReplyShortChannelIdsEnd this_ptr_conv;
11579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11580 this_ptr_conv.is_owned = false;
11581 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
11582 memcpy(ret_arr.ptr, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
11586 void ReplyShortChannelIdsEnd_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11587 LDKReplyShortChannelIdsEnd this_ptr_conv;
11588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11589 this_ptr_conv.is_owned = false;
11590 LDKThirtyTwoBytes val_ref;
11591 CHECK(val.len == 32);
11592 memcpy(val_ref.data, val.ptr, 32);
11593 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
11596 jboolean ReplyShortChannelIdsEnd_1get_1full_1information(void* ctx_TODO, uint32_t this_ptr) {
11597 LDKReplyShortChannelIdsEnd this_ptr_conv;
11598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11599 this_ptr_conv.is_owned = false;
11600 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
11604 void ReplyShortChannelIdsEnd_1set_1full_1information(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
11605 LDKReplyShortChannelIdsEnd this_ptr_conv;
11606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11607 this_ptr_conv.is_owned = false;
11608 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
11611 uint32_t ReplyShortChannelIdsEnd_1new(void* ctx_TODO, int8_tArray chain_hash_arg, jboolean full_information_arg) {
11612 LDKThirtyTwoBytes chain_hash_arg_ref;
11613 CHECK(chain_hash_arg.len == 32);
11614 memcpy(chain_hash_arg_ref.data, chain_hash_arg.ptr, 32);
11615 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
11616 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11617 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11618 long ret_ref = (long)ret_var.inner;
11619 if (ret_var.is_owned) {
11625 void GossipTimestampFilter_1free(void* ctx_TODO, uint32_t this_ptr) {
11626 LDKGossipTimestampFilter this_ptr_conv;
11627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11628 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11629 GossipTimestampFilter_free(this_ptr_conv);
11632 uint32_t GossipTimestampFilter_1clone(void* ctx_TODO, uint32_t orig) {
11633 LDKGossipTimestampFilter orig_conv;
11634 orig_conv.inner = (void*)(orig & (~1));
11635 orig_conv.is_owned = false;
11636 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
11637 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11638 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11639 long ret_ref = (long)ret_var.inner;
11640 if (ret_var.is_owned) {
11646 int8_tArray GossipTimestampFilter_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
11647 LDKGossipTimestampFilter this_ptr_conv;
11648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11649 this_ptr_conv.is_owned = false;
11650 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
11651 memcpy(ret_arr.ptr, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
11655 void GossipTimestampFilter_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11656 LDKGossipTimestampFilter this_ptr_conv;
11657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11658 this_ptr_conv.is_owned = false;
11659 LDKThirtyTwoBytes val_ref;
11660 CHECK(val.len == 32);
11661 memcpy(val_ref.data, val.ptr, 32);
11662 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
11665 int32_t GossipTimestampFilter_1get_1first_1timestamp(void* ctx_TODO, uint32_t this_ptr) {
11666 LDKGossipTimestampFilter this_ptr_conv;
11667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11668 this_ptr_conv.is_owned = false;
11669 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
11673 void GossipTimestampFilter_1set_1first_1timestamp(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
11674 LDKGossipTimestampFilter this_ptr_conv;
11675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11676 this_ptr_conv.is_owned = false;
11677 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
11680 int32_t GossipTimestampFilter_1get_1timestamp_1range(void* ctx_TODO, uint32_t this_ptr) {
11681 LDKGossipTimestampFilter this_ptr_conv;
11682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11683 this_ptr_conv.is_owned = false;
11684 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
11688 void GossipTimestampFilter_1set_1timestamp_1range(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
11689 LDKGossipTimestampFilter this_ptr_conv;
11690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11691 this_ptr_conv.is_owned = false;
11692 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
11695 uint32_t GossipTimestampFilter_1new(void* ctx_TODO, int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
11696 LDKThirtyTwoBytes chain_hash_arg_ref;
11697 CHECK(chain_hash_arg.len == 32);
11698 memcpy(chain_hash_arg_ref.data, chain_hash_arg.ptr, 32);
11699 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
11700 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11701 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11702 long ret_ref = (long)ret_var.inner;
11703 if (ret_var.is_owned) {
11709 void ErrorAction_1free(void* ctx_TODO, uint32_t this_ptr) {
11710 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
11711 FREE((void*)this_ptr);
11712 ErrorAction_free(this_ptr_conv);
11715 uint32_t ErrorAction_1clone(void* ctx_TODO, uint32_t orig) {
11716 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
11717 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
11718 *ret_copy = ErrorAction_clone(orig_conv);
11719 long ret_ref = (long)ret_copy;
11723 void LightningError_1free(void* ctx_TODO, uint32_t this_ptr) {
11724 LDKLightningError this_ptr_conv;
11725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11726 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11727 LightningError_free(this_ptr_conv);
11730 jstring LightningError_1get_1err(void* ctx_TODO, uint32_t this_ptr) {
11731 LDKLightningError this_ptr_conv;
11732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11733 this_ptr_conv.is_owned = false;
11734 LDKStr _str = LightningError_get_err(&this_ptr_conv);
11735 char* _buf = MALLOC(_str.len + 1, "str conv buf");
11736 memcpy(_buf, _str.chars, _str.len);
11737 _buf[_str.len] = 0;
11738 jstring _conv = conv_owned_string(_str.chars);
11743 void LightningError_1set_1err(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11744 LDKLightningError this_ptr_conv;
11745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11746 this_ptr_conv.is_owned = false;
11747 LDKCVec_u8Z val_ref;
11748 val_ref.datalen = val.len;
11749 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
11750 memcpy(val_ref.data, val.ptr, val_ref.datalen);
11751 LightningError_set_err(&this_ptr_conv, val_ref);
11754 uint32_t LightningError_1get_1action(void* ctx_TODO, uint32_t this_ptr) {
11755 LDKLightningError this_ptr_conv;
11756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11757 this_ptr_conv.is_owned = false;
11758 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
11759 *ret_copy = LightningError_get_action(&this_ptr_conv);
11760 long ret_ref = (long)ret_copy;
11764 void LightningError_1set_1action(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
11765 LDKLightningError this_ptr_conv;
11766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11767 this_ptr_conv.is_owned = false;
11768 LDKErrorAction val_conv = *(LDKErrorAction*)val;
11770 LightningError_set_action(&this_ptr_conv, val_conv);
11773 uint32_t LightningError_1new(void* ctx_TODO, int8_tArray err_arg, uint32_t action_arg) {
11774 LDKCVec_u8Z err_arg_ref;
11775 err_arg_ref.datalen = err_arg.len;
11776 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
11777 memcpy(err_arg_ref.data, err_arg.ptr, err_arg_ref.datalen);
11778 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
11779 FREE((void*)action_arg);
11780 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
11781 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11782 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11783 long ret_ref = (long)ret_var.inner;
11784 if (ret_var.is_owned) {
11790 void CommitmentUpdate_1free(void* ctx_TODO, uint32_t this_ptr) {
11791 LDKCommitmentUpdate this_ptr_conv;
11792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11793 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11794 CommitmentUpdate_free(this_ptr_conv);
11797 uint32_t CommitmentUpdate_1clone(void* ctx_TODO, uint32_t orig) {
11798 LDKCommitmentUpdate orig_conv;
11799 orig_conv.inner = (void*)(orig & (~1));
11800 orig_conv.is_owned = false;
11801 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
11802 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11803 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11804 long ret_ref = (long)ret_var.inner;
11805 if (ret_var.is_owned) {
11811 void CommitmentUpdate_1set_1update_1add_1htlcs(void* ctx_TODO, uint32_t this_ptr, uint32_tArray val) {
11812 LDKCommitmentUpdate this_ptr_conv;
11813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11814 this_ptr_conv.is_owned = false;
11815 LDKCVec_UpdateAddHTLCZ val_constr;
11816 val_constr.datalen = val.len;
11817 if (val_constr.datalen > 0)
11818 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11820 val_constr.data = NULL;
11821 uint32_t* val_vals = (uint32_t*) val.ptr;
11822 for (size_t p = 0; p < val_constr.datalen; p++) {
11823 uint32_t arr_conv_15 = val_vals[p];
11824 LDKUpdateAddHTLC arr_conv_15_conv;
11825 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
11826 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
11827 if (arr_conv_15_conv.inner != NULL)
11828 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
11829 val_constr.data[p] = arr_conv_15_conv;
11831 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
11834 void CommitmentUpdate_1set_1update_1fulfill_1htlcs(void* ctx_TODO, uint32_t this_ptr, uint32_tArray val) {
11835 LDKCommitmentUpdate this_ptr_conv;
11836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11837 this_ptr_conv.is_owned = false;
11838 LDKCVec_UpdateFulfillHTLCZ val_constr;
11839 val_constr.datalen = val.len;
11840 if (val_constr.datalen > 0)
11841 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11843 val_constr.data = NULL;
11844 uint32_t* val_vals = (uint32_t*) val.ptr;
11845 for (size_t t = 0; t < val_constr.datalen; t++) {
11846 uint32_t arr_conv_19 = val_vals[t];
11847 LDKUpdateFulfillHTLC arr_conv_19_conv;
11848 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
11849 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
11850 if (arr_conv_19_conv.inner != NULL)
11851 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
11852 val_constr.data[t] = arr_conv_19_conv;
11854 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
11857 void CommitmentUpdate_1set_1update_1fail_1htlcs(void* ctx_TODO, uint32_t this_ptr, uint32_tArray val) {
11858 LDKCommitmentUpdate this_ptr_conv;
11859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11860 this_ptr_conv.is_owned = false;
11861 LDKCVec_UpdateFailHTLCZ val_constr;
11862 val_constr.datalen = val.len;
11863 if (val_constr.datalen > 0)
11864 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11866 val_constr.data = NULL;
11867 uint32_t* val_vals = (uint32_t*) val.ptr;
11868 for (size_t q = 0; q < val_constr.datalen; q++) {
11869 uint32_t arr_conv_16 = val_vals[q];
11870 LDKUpdateFailHTLC arr_conv_16_conv;
11871 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
11872 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
11873 if (arr_conv_16_conv.inner != NULL)
11874 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
11875 val_constr.data[q] = arr_conv_16_conv;
11877 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
11880 void CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(void* ctx_TODO, uint32_t this_ptr, uint32_tArray val) {
11881 LDKCommitmentUpdate this_ptr_conv;
11882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11883 this_ptr_conv.is_owned = false;
11884 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
11885 val_constr.datalen = val.len;
11886 if (val_constr.datalen > 0)
11887 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11889 val_constr.data = NULL;
11890 uint32_t* val_vals = (uint32_t*) val.ptr;
11891 for (size_t z = 0; z < val_constr.datalen; z++) {
11892 uint32_t arr_conv_25 = val_vals[z];
11893 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
11894 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
11895 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
11896 if (arr_conv_25_conv.inner != NULL)
11897 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
11898 val_constr.data[z] = arr_conv_25_conv;
11900 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
11903 uint32_t CommitmentUpdate_1get_1update_1fee(void* ctx_TODO, uint32_t this_ptr) {
11904 LDKCommitmentUpdate this_ptr_conv;
11905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11906 this_ptr_conv.is_owned = false;
11907 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
11908 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11909 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11910 long ret_ref = (long)ret_var.inner;
11911 if (ret_var.is_owned) {
11917 void CommitmentUpdate_1set_1update_1fee(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
11918 LDKCommitmentUpdate this_ptr_conv;
11919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11920 this_ptr_conv.is_owned = false;
11921 LDKUpdateFee val_conv;
11922 val_conv.inner = (void*)(val & (~1));
11923 val_conv.is_owned = (val & 1) || (val == 0);
11924 if (val_conv.inner != NULL)
11925 val_conv = UpdateFee_clone(&val_conv);
11926 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
11929 uint32_t CommitmentUpdate_1get_1commitment_1signed(void* ctx_TODO, uint32_t this_ptr) {
11930 LDKCommitmentUpdate this_ptr_conv;
11931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11932 this_ptr_conv.is_owned = false;
11933 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
11934 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11935 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11936 long ret_ref = (long)ret_var.inner;
11937 if (ret_var.is_owned) {
11943 void CommitmentUpdate_1set_1commitment_1signed(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
11944 LDKCommitmentUpdate this_ptr_conv;
11945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11946 this_ptr_conv.is_owned = false;
11947 LDKCommitmentSigned val_conv;
11948 val_conv.inner = (void*)(val & (~1));
11949 val_conv.is_owned = (val & 1) || (val == 0);
11950 if (val_conv.inner != NULL)
11951 val_conv = CommitmentSigned_clone(&val_conv);
11952 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
11955 uint32_t CommitmentUpdate_1new(void* ctx_TODO, uint32_tArray update_add_htlcs_arg, uint32_tArray update_fulfill_htlcs_arg, uint32_tArray update_fail_htlcs_arg, uint32_tArray update_fail_malformed_htlcs_arg, uint32_t update_fee_arg, uint32_t commitment_signed_arg) {
11956 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
11957 update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg.len;
11958 if (update_add_htlcs_arg_constr.datalen > 0)
11959 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11961 update_add_htlcs_arg_constr.data = NULL;
11962 uint32_t* update_add_htlcs_arg_vals = (uint32_t*) update_add_htlcs_arg.ptr;
11963 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
11964 uint32_t arr_conv_15 = update_add_htlcs_arg_vals[p];
11965 LDKUpdateAddHTLC arr_conv_15_conv;
11966 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
11967 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
11968 if (arr_conv_15_conv.inner != NULL)
11969 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
11970 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
11972 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
11973 update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg.len;
11974 if (update_fulfill_htlcs_arg_constr.datalen > 0)
11975 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11977 update_fulfill_htlcs_arg_constr.data = NULL;
11978 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*) update_fulfill_htlcs_arg.ptr;
11979 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
11980 uint32_t arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
11981 LDKUpdateFulfillHTLC arr_conv_19_conv;
11982 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
11983 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
11984 if (arr_conv_19_conv.inner != NULL)
11985 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
11986 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
11988 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
11989 update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg.len;
11990 if (update_fail_htlcs_arg_constr.datalen > 0)
11991 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11993 update_fail_htlcs_arg_constr.data = NULL;
11994 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*) update_fail_htlcs_arg.ptr;
11995 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
11996 uint32_t arr_conv_16 = update_fail_htlcs_arg_vals[q];
11997 LDKUpdateFailHTLC arr_conv_16_conv;
11998 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
11999 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
12000 if (arr_conv_16_conv.inner != NULL)
12001 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
12002 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
12004 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
12005 update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg.len;
12006 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
12007 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
12009 update_fail_malformed_htlcs_arg_constr.data = NULL;
12010 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*) update_fail_malformed_htlcs_arg.ptr;
12011 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
12012 uint32_t arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
12013 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
12014 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
12015 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
12016 if (arr_conv_25_conv.inner != NULL)
12017 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
12018 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
12020 LDKUpdateFee update_fee_arg_conv;
12021 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
12022 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
12023 if (update_fee_arg_conv.inner != NULL)
12024 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
12025 LDKCommitmentSigned commitment_signed_arg_conv;
12026 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
12027 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
12028 if (commitment_signed_arg_conv.inner != NULL)
12029 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
12030 LDKCommitmentUpdate ret_var = CommitmentUpdate_new(update_add_htlcs_arg_constr, update_fulfill_htlcs_arg_constr, update_fail_htlcs_arg_constr, update_fail_malformed_htlcs_arg_constr, update_fee_arg_conv, commitment_signed_arg_conv);
12031 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12032 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12033 long ret_ref = (long)ret_var.inner;
12034 if (ret_var.is_owned) {
12040 void HTLCFailChannelUpdate_1free(void* ctx_TODO, uint32_t this_ptr) {
12041 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
12042 FREE((void*)this_ptr);
12043 HTLCFailChannelUpdate_free(this_ptr_conv);
12046 uint32_t HTLCFailChannelUpdate_1clone(void* ctx_TODO, uint32_t orig) {
12047 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
12048 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
12049 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
12050 long ret_ref = (long)ret_copy;
12054 void ChannelMessageHandler_1free(void* ctx_TODO, uint32_t this_ptr) {
12055 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
12056 FREE((void*)this_ptr);
12057 ChannelMessageHandler_free(this_ptr_conv);
12060 void RoutingMessageHandler_1free(void* ctx_TODO, uint32_t this_ptr) {
12061 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
12062 FREE((void*)this_ptr);
12063 RoutingMessageHandler_free(this_ptr_conv);
12066 int8_tArray AcceptChannel_1write(void* ctx_TODO, uint32_t obj) {
12067 LDKAcceptChannel obj_conv;
12068 obj_conv.inner = (void*)(obj & (~1));
12069 obj_conv.is_owned = false;
12070 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
12071 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12072 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12073 CVec_u8Z_free(arg_var);
12077 uint32_t AcceptChannel_1read(void* ctx_TODO, int8_tArray ser) {
12078 LDKu8slice ser_ref;
12079 ser_ref.datalen = ser.len;
12080 ser_ref.data = ser.ptr;
12081 LDKAcceptChannel ret_var = AcceptChannel_read(ser_ref);
12082 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12083 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12084 long ret_ref = (long)ret_var.inner;
12085 if (ret_var.is_owned) {
12091 int8_tArray AnnouncementSignatures_1write(void* ctx_TODO, uint32_t obj) {
12092 LDKAnnouncementSignatures obj_conv;
12093 obj_conv.inner = (void*)(obj & (~1));
12094 obj_conv.is_owned = false;
12095 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
12096 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12097 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12098 CVec_u8Z_free(arg_var);
12102 uint32_t AnnouncementSignatures_1read(void* ctx_TODO, int8_tArray ser) {
12103 LDKu8slice ser_ref;
12104 ser_ref.datalen = ser.len;
12105 ser_ref.data = ser.ptr;
12106 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_read(ser_ref);
12107 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12108 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12109 long ret_ref = (long)ret_var.inner;
12110 if (ret_var.is_owned) {
12116 int8_tArray ChannelReestablish_1write(void* ctx_TODO, uint32_t obj) {
12117 LDKChannelReestablish obj_conv;
12118 obj_conv.inner = (void*)(obj & (~1));
12119 obj_conv.is_owned = false;
12120 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
12121 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12122 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12123 CVec_u8Z_free(arg_var);
12127 uint32_t ChannelReestablish_1read(void* ctx_TODO, int8_tArray ser) {
12128 LDKu8slice ser_ref;
12129 ser_ref.datalen = ser.len;
12130 ser_ref.data = ser.ptr;
12131 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12132 *ret_conv = ChannelReestablish_read(ser_ref);
12133 return (long)ret_conv;
12136 int8_tArray ClosingSigned_1write(void* ctx_TODO, uint32_t obj) {
12137 LDKClosingSigned obj_conv;
12138 obj_conv.inner = (void*)(obj & (~1));
12139 obj_conv.is_owned = false;
12140 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
12141 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12142 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12143 CVec_u8Z_free(arg_var);
12147 uint32_t ClosingSigned_1read(void* ctx_TODO, int8_tArray ser) {
12148 LDKu8slice ser_ref;
12149 ser_ref.datalen = ser.len;
12150 ser_ref.data = ser.ptr;
12151 LDKClosingSigned ret_var = ClosingSigned_read(ser_ref);
12152 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12153 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12154 long ret_ref = (long)ret_var.inner;
12155 if (ret_var.is_owned) {
12161 int8_tArray CommitmentSigned_1write(void* ctx_TODO, uint32_t obj) {
12162 LDKCommitmentSigned obj_conv;
12163 obj_conv.inner = (void*)(obj & (~1));
12164 obj_conv.is_owned = false;
12165 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
12166 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12167 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12168 CVec_u8Z_free(arg_var);
12172 uint32_t CommitmentSigned_1read(void* ctx_TODO, int8_tArray ser) {
12173 LDKu8slice ser_ref;
12174 ser_ref.datalen = ser.len;
12175 ser_ref.data = ser.ptr;
12176 LDKCommitmentSigned ret_var = CommitmentSigned_read(ser_ref);
12177 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12178 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12179 long ret_ref = (long)ret_var.inner;
12180 if (ret_var.is_owned) {
12186 int8_tArray FundingCreated_1write(void* ctx_TODO, uint32_t obj) {
12187 LDKFundingCreated obj_conv;
12188 obj_conv.inner = (void*)(obj & (~1));
12189 obj_conv.is_owned = false;
12190 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
12191 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12192 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12193 CVec_u8Z_free(arg_var);
12197 uint32_t FundingCreated_1read(void* ctx_TODO, int8_tArray ser) {
12198 LDKu8slice ser_ref;
12199 ser_ref.datalen = ser.len;
12200 ser_ref.data = ser.ptr;
12201 LDKFundingCreated ret_var = FundingCreated_read(ser_ref);
12202 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12203 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12204 long ret_ref = (long)ret_var.inner;
12205 if (ret_var.is_owned) {
12211 int8_tArray FundingSigned_1write(void* ctx_TODO, uint32_t obj) {
12212 LDKFundingSigned obj_conv;
12213 obj_conv.inner = (void*)(obj & (~1));
12214 obj_conv.is_owned = false;
12215 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
12216 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12217 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12218 CVec_u8Z_free(arg_var);
12222 uint32_t FundingSigned_1read(void* ctx_TODO, int8_tArray ser) {
12223 LDKu8slice ser_ref;
12224 ser_ref.datalen = ser.len;
12225 ser_ref.data = ser.ptr;
12226 LDKFundingSigned ret_var = FundingSigned_read(ser_ref);
12227 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12228 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12229 long ret_ref = (long)ret_var.inner;
12230 if (ret_var.is_owned) {
12236 int8_tArray FundingLocked_1write(void* ctx_TODO, uint32_t obj) {
12237 LDKFundingLocked obj_conv;
12238 obj_conv.inner = (void*)(obj & (~1));
12239 obj_conv.is_owned = false;
12240 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
12241 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12242 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12243 CVec_u8Z_free(arg_var);
12247 uint32_t FundingLocked_1read(void* ctx_TODO, int8_tArray ser) {
12248 LDKu8slice ser_ref;
12249 ser_ref.datalen = ser.len;
12250 ser_ref.data = ser.ptr;
12251 LDKFundingLocked ret_var = FundingLocked_read(ser_ref);
12252 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12253 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12254 long ret_ref = (long)ret_var.inner;
12255 if (ret_var.is_owned) {
12261 int8_tArray Init_1write(void* ctx_TODO, uint32_t obj) {
12263 obj_conv.inner = (void*)(obj & (~1));
12264 obj_conv.is_owned = false;
12265 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
12266 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12267 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12268 CVec_u8Z_free(arg_var);
12272 uint32_t Init_1read(void* ctx_TODO, int8_tArray ser) {
12273 LDKu8slice ser_ref;
12274 ser_ref.datalen = ser.len;
12275 ser_ref.data = ser.ptr;
12276 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12277 *ret_conv = Init_read(ser_ref);
12278 return (long)ret_conv;
12281 int8_tArray OpenChannel_1write(void* ctx_TODO, uint32_t obj) {
12282 LDKOpenChannel obj_conv;
12283 obj_conv.inner = (void*)(obj & (~1));
12284 obj_conv.is_owned = false;
12285 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
12286 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12287 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12288 CVec_u8Z_free(arg_var);
12292 uint32_t OpenChannel_1read(void* ctx_TODO, int8_tArray ser) {
12293 LDKu8slice ser_ref;
12294 ser_ref.datalen = ser.len;
12295 ser_ref.data = ser.ptr;
12296 LDKOpenChannel ret_var = OpenChannel_read(ser_ref);
12297 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12298 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12299 long ret_ref = (long)ret_var.inner;
12300 if (ret_var.is_owned) {
12306 int8_tArray RevokeAndACK_1write(void* ctx_TODO, uint32_t obj) {
12307 LDKRevokeAndACK obj_conv;
12308 obj_conv.inner = (void*)(obj & (~1));
12309 obj_conv.is_owned = false;
12310 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
12311 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12312 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12313 CVec_u8Z_free(arg_var);
12317 uint32_t RevokeAndACK_1read(void* ctx_TODO, int8_tArray ser) {
12318 LDKu8slice ser_ref;
12319 ser_ref.datalen = ser.len;
12320 ser_ref.data = ser.ptr;
12321 LDKRevokeAndACK ret_var = RevokeAndACK_read(ser_ref);
12322 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12323 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12324 long ret_ref = (long)ret_var.inner;
12325 if (ret_var.is_owned) {
12331 int8_tArray Shutdown_1write(void* ctx_TODO, uint32_t obj) {
12332 LDKShutdown obj_conv;
12333 obj_conv.inner = (void*)(obj & (~1));
12334 obj_conv.is_owned = false;
12335 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
12336 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12337 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12338 CVec_u8Z_free(arg_var);
12342 uint32_t Shutdown_1read(void* ctx_TODO, int8_tArray ser) {
12343 LDKu8slice ser_ref;
12344 ser_ref.datalen = ser.len;
12345 ser_ref.data = ser.ptr;
12346 LDKShutdown ret_var = Shutdown_read(ser_ref);
12347 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12348 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12349 long ret_ref = (long)ret_var.inner;
12350 if (ret_var.is_owned) {
12356 int8_tArray UpdateFailHTLC_1write(void* ctx_TODO, uint32_t obj) {
12357 LDKUpdateFailHTLC obj_conv;
12358 obj_conv.inner = (void*)(obj & (~1));
12359 obj_conv.is_owned = false;
12360 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
12361 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12362 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12363 CVec_u8Z_free(arg_var);
12367 uint32_t UpdateFailHTLC_1read(void* ctx_TODO, int8_tArray ser) {
12368 LDKu8slice ser_ref;
12369 ser_ref.datalen = ser.len;
12370 ser_ref.data = ser.ptr;
12371 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_read(ser_ref);
12372 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12373 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12374 long ret_ref = (long)ret_var.inner;
12375 if (ret_var.is_owned) {
12381 int8_tArray UpdateFailMalformedHTLC_1write(void* ctx_TODO, uint32_t obj) {
12382 LDKUpdateFailMalformedHTLC obj_conv;
12383 obj_conv.inner = (void*)(obj & (~1));
12384 obj_conv.is_owned = false;
12385 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
12386 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12387 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12388 CVec_u8Z_free(arg_var);
12392 uint32_t UpdateFailMalformedHTLC_1read(void* ctx_TODO, int8_tArray ser) {
12393 LDKu8slice ser_ref;
12394 ser_ref.datalen = ser.len;
12395 ser_ref.data = ser.ptr;
12396 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_read(ser_ref);
12397 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12398 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12399 long ret_ref = (long)ret_var.inner;
12400 if (ret_var.is_owned) {
12406 int8_tArray UpdateFee_1write(void* ctx_TODO, uint32_t obj) {
12407 LDKUpdateFee obj_conv;
12408 obj_conv.inner = (void*)(obj & (~1));
12409 obj_conv.is_owned = false;
12410 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
12411 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12412 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12413 CVec_u8Z_free(arg_var);
12417 uint32_t UpdateFee_1read(void* ctx_TODO, int8_tArray ser) {
12418 LDKu8slice ser_ref;
12419 ser_ref.datalen = ser.len;
12420 ser_ref.data = ser.ptr;
12421 LDKUpdateFee ret_var = UpdateFee_read(ser_ref);
12422 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12423 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12424 long ret_ref = (long)ret_var.inner;
12425 if (ret_var.is_owned) {
12431 int8_tArray UpdateFulfillHTLC_1write(void* ctx_TODO, uint32_t obj) {
12432 LDKUpdateFulfillHTLC obj_conv;
12433 obj_conv.inner = (void*)(obj & (~1));
12434 obj_conv.is_owned = false;
12435 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
12436 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12437 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12438 CVec_u8Z_free(arg_var);
12442 uint32_t UpdateFulfillHTLC_1read(void* ctx_TODO, int8_tArray ser) {
12443 LDKu8slice ser_ref;
12444 ser_ref.datalen = ser.len;
12445 ser_ref.data = ser.ptr;
12446 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_read(ser_ref);
12447 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12448 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12449 long ret_ref = (long)ret_var.inner;
12450 if (ret_var.is_owned) {
12456 int8_tArray UpdateAddHTLC_1write(void* ctx_TODO, uint32_t obj) {
12457 LDKUpdateAddHTLC obj_conv;
12458 obj_conv.inner = (void*)(obj & (~1));
12459 obj_conv.is_owned = false;
12460 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
12461 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12462 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12463 CVec_u8Z_free(arg_var);
12467 uint32_t UpdateAddHTLC_1read(void* ctx_TODO, int8_tArray ser) {
12468 LDKu8slice ser_ref;
12469 ser_ref.datalen = ser.len;
12470 ser_ref.data = ser.ptr;
12471 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_read(ser_ref);
12472 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12473 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12474 long ret_ref = (long)ret_var.inner;
12475 if (ret_var.is_owned) {
12481 int8_tArray Ping_1write(void* ctx_TODO, uint32_t obj) {
12483 obj_conv.inner = (void*)(obj & (~1));
12484 obj_conv.is_owned = false;
12485 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
12486 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12487 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12488 CVec_u8Z_free(arg_var);
12492 uint32_t Ping_1read(void* ctx_TODO, int8_tArray ser) {
12493 LDKu8slice ser_ref;
12494 ser_ref.datalen = ser.len;
12495 ser_ref.data = ser.ptr;
12496 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12497 *ret_conv = Ping_read(ser_ref);
12498 return (long)ret_conv;
12501 int8_tArray Pong_1write(void* ctx_TODO, uint32_t obj) {
12503 obj_conv.inner = (void*)(obj & (~1));
12504 obj_conv.is_owned = false;
12505 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
12506 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12507 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12508 CVec_u8Z_free(arg_var);
12512 uint32_t Pong_1read(void* ctx_TODO, int8_tArray ser) {
12513 LDKu8slice ser_ref;
12514 ser_ref.datalen = ser.len;
12515 ser_ref.data = ser.ptr;
12516 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12517 *ret_conv = Pong_read(ser_ref);
12518 return (long)ret_conv;
12521 int8_tArray UnsignedChannelAnnouncement_1write(void* ctx_TODO, uint32_t obj) {
12522 LDKUnsignedChannelAnnouncement obj_conv;
12523 obj_conv.inner = (void*)(obj & (~1));
12524 obj_conv.is_owned = false;
12525 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
12526 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12527 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12528 CVec_u8Z_free(arg_var);
12532 uint32_t UnsignedChannelAnnouncement_1read(void* ctx_TODO, int8_tArray ser) {
12533 LDKu8slice ser_ref;
12534 ser_ref.datalen = ser.len;
12535 ser_ref.data = ser.ptr;
12536 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12537 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
12538 return (long)ret_conv;
12541 int8_tArray ChannelAnnouncement_1write(void* ctx_TODO, uint32_t obj) {
12542 LDKChannelAnnouncement obj_conv;
12543 obj_conv.inner = (void*)(obj & (~1));
12544 obj_conv.is_owned = false;
12545 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
12546 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12547 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12548 CVec_u8Z_free(arg_var);
12552 uint32_t ChannelAnnouncement_1read(void* ctx_TODO, int8_tArray ser) {
12553 LDKu8slice ser_ref;
12554 ser_ref.datalen = ser.len;
12555 ser_ref.data = ser.ptr;
12556 LDKChannelAnnouncement ret_var = ChannelAnnouncement_read(ser_ref);
12557 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12558 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12559 long ret_ref = (long)ret_var.inner;
12560 if (ret_var.is_owned) {
12566 int8_tArray UnsignedChannelUpdate_1write(void* ctx_TODO, uint32_t obj) {
12567 LDKUnsignedChannelUpdate obj_conv;
12568 obj_conv.inner = (void*)(obj & (~1));
12569 obj_conv.is_owned = false;
12570 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
12571 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12572 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12573 CVec_u8Z_free(arg_var);
12577 uint32_t UnsignedChannelUpdate_1read(void* ctx_TODO, int8_tArray ser) {
12578 LDKu8slice ser_ref;
12579 ser_ref.datalen = ser.len;
12580 ser_ref.data = ser.ptr;
12581 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12582 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
12583 return (long)ret_conv;
12586 int8_tArray ChannelUpdate_1write(void* ctx_TODO, uint32_t obj) {
12587 LDKChannelUpdate obj_conv;
12588 obj_conv.inner = (void*)(obj & (~1));
12589 obj_conv.is_owned = false;
12590 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
12591 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12592 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12593 CVec_u8Z_free(arg_var);
12597 uint32_t ChannelUpdate_1read(void* ctx_TODO, int8_tArray ser) {
12598 LDKu8slice ser_ref;
12599 ser_ref.datalen = ser.len;
12600 ser_ref.data = ser.ptr;
12601 LDKChannelUpdate ret_var = ChannelUpdate_read(ser_ref);
12602 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12603 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12604 long ret_ref = (long)ret_var.inner;
12605 if (ret_var.is_owned) {
12611 int8_tArray ErrorMessage_1write(void* ctx_TODO, uint32_t obj) {
12612 LDKErrorMessage obj_conv;
12613 obj_conv.inner = (void*)(obj & (~1));
12614 obj_conv.is_owned = false;
12615 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
12616 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12617 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12618 CVec_u8Z_free(arg_var);
12622 uint32_t ErrorMessage_1read(void* ctx_TODO, int8_tArray ser) {
12623 LDKu8slice ser_ref;
12624 ser_ref.datalen = ser.len;
12625 ser_ref.data = ser.ptr;
12626 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12627 *ret_conv = ErrorMessage_read(ser_ref);
12628 return (long)ret_conv;
12631 int8_tArray UnsignedNodeAnnouncement_1write(void* ctx_TODO, uint32_t obj) {
12632 LDKUnsignedNodeAnnouncement obj_conv;
12633 obj_conv.inner = (void*)(obj & (~1));
12634 obj_conv.is_owned = false;
12635 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
12636 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12637 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12638 CVec_u8Z_free(arg_var);
12642 uint32_t UnsignedNodeAnnouncement_1read(void* ctx_TODO, int8_tArray ser) {
12643 LDKu8slice ser_ref;
12644 ser_ref.datalen = ser.len;
12645 ser_ref.data = ser.ptr;
12646 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12647 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
12648 return (long)ret_conv;
12651 int8_tArray NodeAnnouncement_1write(void* ctx_TODO, uint32_t obj) {
12652 LDKNodeAnnouncement obj_conv;
12653 obj_conv.inner = (void*)(obj & (~1));
12654 obj_conv.is_owned = false;
12655 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
12656 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12657 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12658 CVec_u8Z_free(arg_var);
12662 uint32_t NodeAnnouncement_1read(void* ctx_TODO, int8_tArray ser) {
12663 LDKu8slice ser_ref;
12664 ser_ref.datalen = ser.len;
12665 ser_ref.data = ser.ptr;
12666 LDKNodeAnnouncement ret_var = NodeAnnouncement_read(ser_ref);
12667 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12668 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12669 long ret_ref = (long)ret_var.inner;
12670 if (ret_var.is_owned) {
12676 uint32_t QueryShortChannelIds_1read(void* ctx_TODO, int8_tArray ser) {
12677 LDKu8slice ser_ref;
12678 ser_ref.datalen = ser.len;
12679 ser_ref.data = ser.ptr;
12680 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12681 *ret_conv = QueryShortChannelIds_read(ser_ref);
12682 return (long)ret_conv;
12685 int8_tArray QueryShortChannelIds_1write(void* ctx_TODO, uint32_t obj) {
12686 LDKQueryShortChannelIds obj_conv;
12687 obj_conv.inner = (void*)(obj & (~1));
12688 obj_conv.is_owned = false;
12689 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
12690 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12691 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12692 CVec_u8Z_free(arg_var);
12696 uint32_t ReplyShortChannelIdsEnd_1read(void* ctx_TODO, int8_tArray ser) {
12697 LDKu8slice ser_ref;
12698 ser_ref.datalen = ser.len;
12699 ser_ref.data = ser.ptr;
12700 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12701 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
12702 return (long)ret_conv;
12705 int8_tArray ReplyShortChannelIdsEnd_1write(void* ctx_TODO, uint32_t obj) {
12706 LDKReplyShortChannelIdsEnd obj_conv;
12707 obj_conv.inner = (void*)(obj & (~1));
12708 obj_conv.is_owned = false;
12709 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
12710 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12711 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12712 CVec_u8Z_free(arg_var);
12716 uint32_t QueryChannelRange_1read(void* ctx_TODO, int8_tArray ser) {
12717 LDKu8slice ser_ref;
12718 ser_ref.datalen = ser.len;
12719 ser_ref.data = ser.ptr;
12720 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12721 *ret_conv = QueryChannelRange_read(ser_ref);
12722 return (long)ret_conv;
12725 int8_tArray QueryChannelRange_1write(void* ctx_TODO, uint32_t obj) {
12726 LDKQueryChannelRange obj_conv;
12727 obj_conv.inner = (void*)(obj & (~1));
12728 obj_conv.is_owned = false;
12729 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
12730 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12731 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12732 CVec_u8Z_free(arg_var);
12736 uint32_t ReplyChannelRange_1read(void* ctx_TODO, int8_tArray ser) {
12737 LDKu8slice ser_ref;
12738 ser_ref.datalen = ser.len;
12739 ser_ref.data = ser.ptr;
12740 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12741 *ret_conv = ReplyChannelRange_read(ser_ref);
12742 return (long)ret_conv;
12745 int8_tArray ReplyChannelRange_1write(void* ctx_TODO, uint32_t obj) {
12746 LDKReplyChannelRange obj_conv;
12747 obj_conv.inner = (void*)(obj & (~1));
12748 obj_conv.is_owned = false;
12749 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
12750 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12751 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12752 CVec_u8Z_free(arg_var);
12756 uint32_t GossipTimestampFilter_1read(void* ctx_TODO, int8_tArray ser) {
12757 LDKu8slice ser_ref;
12758 ser_ref.datalen = ser.len;
12759 ser_ref.data = ser.ptr;
12760 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12761 *ret_conv = GossipTimestampFilter_read(ser_ref);
12762 return (long)ret_conv;
12765 int8_tArray GossipTimestampFilter_1write(void* ctx_TODO, uint32_t obj) {
12766 LDKGossipTimestampFilter obj_conv;
12767 obj_conv.inner = (void*)(obj & (~1));
12768 obj_conv.is_owned = false;
12769 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
12770 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12771 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12772 CVec_u8Z_free(arg_var);
12776 void MessageHandler_1free(void* ctx_TODO, uint32_t this_ptr) {
12777 LDKMessageHandler this_ptr_conv;
12778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12779 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12780 MessageHandler_free(this_ptr_conv);
12783 uint32_t MessageHandler_1get_1chan_1handler(void* ctx_TODO, uint32_t this_ptr) {
12784 LDKMessageHandler this_ptr_conv;
12785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12786 this_ptr_conv.is_owned = false;
12787 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
12791 void MessageHandler_1set_1chan_1handler(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
12792 LDKMessageHandler this_ptr_conv;
12793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12794 this_ptr_conv.is_owned = false;
12795 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
12796 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
12799 uint32_t MessageHandler_1get_1route_1handler(void* ctx_TODO, uint32_t this_ptr) {
12800 LDKMessageHandler this_ptr_conv;
12801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12802 this_ptr_conv.is_owned = false;
12803 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
12807 void MessageHandler_1set_1route_1handler(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
12808 LDKMessageHandler this_ptr_conv;
12809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12810 this_ptr_conv.is_owned = false;
12811 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
12812 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
12815 uint32_t MessageHandler_1new(void* ctx_TODO, uint32_t chan_handler_arg, uint32_t route_handler_arg) {
12816 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
12817 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
12818 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
12819 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12820 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12821 long ret_ref = (long)ret_var.inner;
12822 if (ret_var.is_owned) {
12828 uint32_t SocketDescriptor_1clone(void* ctx_TODO, uint32_t orig) {
12829 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig;
12830 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
12831 *ret = SocketDescriptor_clone(orig_conv);
12835 void SocketDescriptor_1free(void* ctx_TODO, uint32_t this_ptr) {
12836 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
12837 FREE((void*)this_ptr);
12838 SocketDescriptor_free(this_ptr_conv);
12841 void PeerHandleError_1free(void* ctx_TODO, uint32_t this_ptr) {
12842 LDKPeerHandleError this_ptr_conv;
12843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12844 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12845 PeerHandleError_free(this_ptr_conv);
12848 jboolean PeerHandleError_1get_1no_1connection_1possible(void* ctx_TODO, uint32_t this_ptr) {
12849 LDKPeerHandleError this_ptr_conv;
12850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12851 this_ptr_conv.is_owned = false;
12852 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
12856 void PeerHandleError_1set_1no_1connection_1possible(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
12857 LDKPeerHandleError this_ptr_conv;
12858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12859 this_ptr_conv.is_owned = false;
12860 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
12863 uint32_t PeerHandleError_1new(void* ctx_TODO, jboolean no_connection_possible_arg) {
12864 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
12865 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12866 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12867 long ret_ref = (long)ret_var.inner;
12868 if (ret_var.is_owned) {
12874 void PeerManager_1free(void* ctx_TODO, uint32_t this_ptr) {
12875 LDKPeerManager this_ptr_conv;
12876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12877 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12878 PeerManager_free(this_ptr_conv);
12881 uint32_t PeerManager_1new(void* ctx_TODO, uint32_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, uint32_t logger) {
12882 LDKMessageHandler message_handler_conv;
12883 message_handler_conv.inner = (void*)(message_handler & (~1));
12884 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
12885 // Warning: we may need a move here but can't clone!
12886 LDKSecretKey our_node_secret_ref;
12887 CHECK(our_node_secret.len == 32);
12888 memcpy(our_node_secret_ref.bytes, our_node_secret.ptr, 32);
12889 unsigned char ephemeral_random_data_arr[32];
12890 CHECK(ephemeral_random_data.len == 32);
12891 memcpy(ephemeral_random_data_arr, ephemeral_random_data.ptr, 32);
12892 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
12893 LDKLogger logger_conv = *(LDKLogger*)logger;
12894 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
12895 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12896 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12897 long ret_ref = (long)ret_var.inner;
12898 if (ret_var.is_owned) {
12904 ptrArray PeerManager_1get_1peer_1node_1ids(void* ctx_TODO, uint32_t this_arg) {
12905 LDKPeerManager this_arg_conv;
12906 this_arg_conv.inner = (void*)(this_arg & (~1));
12907 this_arg_conv.is_owned = false;
12908 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
12909 ptrArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native Object Bytes") };
12910 int8_tArray *ret_arr_ptr = (int8_tArray*)ret_arr.ptr;
12911 for (size_t m = 0; m < ret_var.datalen; m++) {
12912 int8_tArray arr_conv_12_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
12913 memcpy(arr_conv_12_arr.ptr, ret_var.data[m].compressed_form, 33);
12914 ret_arr_ptr[m] = arr_conv_12_arr;
12916 FREE(ret_var.data);
12920 uint32_t PeerManager_1new_1outbound_1connection(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
12921 LDKPeerManager this_arg_conv;
12922 this_arg_conv.inner = (void*)(this_arg & (~1));
12923 this_arg_conv.is_owned = false;
12924 LDKPublicKey their_node_id_ref;
12925 CHECK(their_node_id.len == 33);
12926 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
12927 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12928 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
12929 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
12930 return (long)ret_conv;
12933 uint32_t PeerManager_1new_1inbound_1connection(void* ctx_TODO, uint32_t this_arg, uint32_t descriptor) {
12934 LDKPeerManager this_arg_conv;
12935 this_arg_conv.inner = (void*)(this_arg & (~1));
12936 this_arg_conv.is_owned = false;
12937 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12938 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12939 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
12940 return (long)ret_conv;
12943 uint32_t PeerManager_1write_1buffer_1space_1avail(void* ctx_TODO, uint32_t this_arg, uint32_t descriptor) {
12944 LDKPeerManager this_arg_conv;
12945 this_arg_conv.inner = (void*)(this_arg & (~1));
12946 this_arg_conv.is_owned = false;
12947 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12948 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12949 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
12950 return (long)ret_conv;
12953 uint32_t PeerManager_1read_1event(void* ctx_TODO, uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
12954 LDKPeerManager this_arg_conv;
12955 this_arg_conv.inner = (void*)(this_arg & (~1));
12956 this_arg_conv.is_owned = false;
12957 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
12958 LDKu8slice data_ref;
12959 data_ref.datalen = data.len;
12960 data_ref.data = data.ptr;
12961 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
12962 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
12963 return (long)ret_conv;
12966 void PeerManager_1process_1events(void* ctx_TODO, uint32_t this_arg) {
12967 LDKPeerManager this_arg_conv;
12968 this_arg_conv.inner = (void*)(this_arg & (~1));
12969 this_arg_conv.is_owned = false;
12970 PeerManager_process_events(&this_arg_conv);
12973 void PeerManager_1socket_1disconnected(void* ctx_TODO, uint32_t this_arg, uint32_t descriptor) {
12974 LDKPeerManager this_arg_conv;
12975 this_arg_conv.inner = (void*)(this_arg & (~1));
12976 this_arg_conv.is_owned = false;
12977 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12978 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
12981 void PeerManager_1timer_1tick_1occured(void* ctx_TODO, uint32_t this_arg) {
12982 LDKPeerManager this_arg_conv;
12983 this_arg_conv.inner = (void*)(this_arg & (~1));
12984 this_arg_conv.is_owned = false;
12985 PeerManager_timer_tick_occured(&this_arg_conv);
12988 int8_tArray build_1commitment_1secret(void* ctx_TODO, int8_tArray commitment_seed, int64_t idx) {
12989 unsigned char commitment_seed_arr[32];
12990 CHECK(commitment_seed.len == 32);
12991 memcpy(commitment_seed_arr, commitment_seed.ptr, 32);
12992 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
12993 int8_tArray arg_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
12994 memcpy(arg_arr.ptr, build_commitment_secret(commitment_seed_ref, idx).data, 32);
12998 uint32_t derive_1private_1key(void* ctx_TODO, int8_tArray per_commitment_point, int8_tArray base_secret) {
12999 LDKPublicKey per_commitment_point_ref;
13000 CHECK(per_commitment_point.len == 33);
13001 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.ptr, 33);
13002 unsigned char base_secret_arr[32];
13003 CHECK(base_secret.len == 32);
13004 memcpy(base_secret_arr, base_secret.ptr, 32);
13005 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
13006 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
13007 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
13008 return (long)ret_conv;
13011 uint32_t derive_1public_1key(void* ctx_TODO, int8_tArray per_commitment_point, int8_tArray base_point) {
13012 LDKPublicKey per_commitment_point_ref;
13013 CHECK(per_commitment_point.len == 33);
13014 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.ptr, 33);
13015 LDKPublicKey base_point_ref;
13016 CHECK(base_point.len == 33);
13017 memcpy(base_point_ref.compressed_form, base_point.ptr, 33);
13018 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
13019 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
13020 return (long)ret_conv;
13023 uint32_t derive_1private_1revocation_1key(void* ctx_TODO, int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
13024 unsigned char per_commitment_secret_arr[32];
13025 CHECK(per_commitment_secret.len == 32);
13026 memcpy(per_commitment_secret_arr, per_commitment_secret.ptr, 32);
13027 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
13028 unsigned char countersignatory_revocation_base_secret_arr[32];
13029 CHECK(countersignatory_revocation_base_secret.len == 32);
13030 memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret.ptr, 32);
13031 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
13032 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
13033 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
13034 return (long)ret_conv;
13037 uint32_t derive_1public_1revocation_1key(void* ctx_TODO, int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
13038 LDKPublicKey per_commitment_point_ref;
13039 CHECK(per_commitment_point.len == 33);
13040 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.ptr, 33);
13041 LDKPublicKey countersignatory_revocation_base_point_ref;
13042 CHECK(countersignatory_revocation_base_point.len == 33);
13043 memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point.ptr, 33);
13044 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
13045 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
13046 return (long)ret_conv;
13049 void TxCreationKeys_1free(void* ctx_TODO, uint32_t this_ptr) {
13050 LDKTxCreationKeys this_ptr_conv;
13051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13052 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13053 TxCreationKeys_free(this_ptr_conv);
13056 uint32_t TxCreationKeys_1clone(void* ctx_TODO, uint32_t orig) {
13057 LDKTxCreationKeys orig_conv;
13058 orig_conv.inner = (void*)(orig & (~1));
13059 orig_conv.is_owned = false;
13060 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
13061 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13062 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13063 long ret_ref = (long)ret_var.inner;
13064 if (ret_var.is_owned) {
13070 int8_tArray TxCreationKeys_1get_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr) {
13071 LDKTxCreationKeys this_ptr_conv;
13072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13073 this_ptr_conv.is_owned = false;
13074 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
13075 memcpy(arg_arr.ptr, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
13079 void TxCreationKeys_1set_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13080 LDKTxCreationKeys this_ptr_conv;
13081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13082 this_ptr_conv.is_owned = false;
13083 LDKPublicKey val_ref;
13084 CHECK(val.len == 33);
13085 memcpy(val_ref.compressed_form, val.ptr, 33);
13086 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
13089 int8_tArray TxCreationKeys_1get_1revocation_1key(void* ctx_TODO, uint32_t this_ptr) {
13090 LDKTxCreationKeys this_ptr_conv;
13091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13092 this_ptr_conv.is_owned = false;
13093 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
13094 memcpy(arg_arr.ptr, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
13098 void TxCreationKeys_1set_1revocation_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13099 LDKTxCreationKeys this_ptr_conv;
13100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13101 this_ptr_conv.is_owned = false;
13102 LDKPublicKey val_ref;
13103 CHECK(val.len == 33);
13104 memcpy(val_ref.compressed_form, val.ptr, 33);
13105 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
13108 int8_tArray TxCreationKeys_1get_1broadcaster_1htlc_1key(void* ctx_TODO, uint32_t this_ptr) {
13109 LDKTxCreationKeys this_ptr_conv;
13110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13111 this_ptr_conv.is_owned = false;
13112 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
13113 memcpy(arg_arr.ptr, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
13117 void TxCreationKeys_1set_1broadcaster_1htlc_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13118 LDKTxCreationKeys this_ptr_conv;
13119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13120 this_ptr_conv.is_owned = false;
13121 LDKPublicKey val_ref;
13122 CHECK(val.len == 33);
13123 memcpy(val_ref.compressed_form, val.ptr, 33);
13124 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
13127 int8_tArray TxCreationKeys_1get_1countersignatory_1htlc_1key(void* ctx_TODO, uint32_t this_ptr) {
13128 LDKTxCreationKeys this_ptr_conv;
13129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13130 this_ptr_conv.is_owned = false;
13131 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
13132 memcpy(arg_arr.ptr, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
13136 void TxCreationKeys_1set_1countersignatory_1htlc_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13137 LDKTxCreationKeys this_ptr_conv;
13138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13139 this_ptr_conv.is_owned = false;
13140 LDKPublicKey val_ref;
13141 CHECK(val.len == 33);
13142 memcpy(val_ref.compressed_form, val.ptr, 33);
13143 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
13146 int8_tArray TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(void* ctx_TODO, uint32_t this_ptr) {
13147 LDKTxCreationKeys this_ptr_conv;
13148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13149 this_ptr_conv.is_owned = false;
13150 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
13151 memcpy(arg_arr.ptr, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
13155 void TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13156 LDKTxCreationKeys this_ptr_conv;
13157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13158 this_ptr_conv.is_owned = false;
13159 LDKPublicKey val_ref;
13160 CHECK(val.len == 33);
13161 memcpy(val_ref.compressed_form, val.ptr, 33);
13162 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
13165 uint32_t TxCreationKeys_1new(void* ctx_TODO, int8_tArray per_commitment_point_arg, int8_tArray revocation_key_arg, int8_tArray broadcaster_htlc_key_arg, int8_tArray countersignatory_htlc_key_arg, int8_tArray broadcaster_delayed_payment_key_arg) {
13166 LDKPublicKey per_commitment_point_arg_ref;
13167 CHECK(per_commitment_point_arg.len == 33);
13168 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg.ptr, 33);
13169 LDKPublicKey revocation_key_arg_ref;
13170 CHECK(revocation_key_arg.len == 33);
13171 memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg.ptr, 33);
13172 LDKPublicKey broadcaster_htlc_key_arg_ref;
13173 CHECK(broadcaster_htlc_key_arg.len == 33);
13174 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg.ptr, 33);
13175 LDKPublicKey countersignatory_htlc_key_arg_ref;
13176 CHECK(countersignatory_htlc_key_arg.len == 33);
13177 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg.ptr, 33);
13178 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
13179 CHECK(broadcaster_delayed_payment_key_arg.len == 33);
13180 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg.ptr, 33);
13181 LDKTxCreationKeys ret_var = TxCreationKeys_new(per_commitment_point_arg_ref, revocation_key_arg_ref, broadcaster_htlc_key_arg_ref, countersignatory_htlc_key_arg_ref, broadcaster_delayed_payment_key_arg_ref);
13182 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13183 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13184 long ret_ref = (long)ret_var.inner;
13185 if (ret_var.is_owned) {
13191 int8_tArray TxCreationKeys_1write(void* ctx_TODO, uint32_t obj) {
13192 LDKTxCreationKeys obj_conv;
13193 obj_conv.inner = (void*)(obj & (~1));
13194 obj_conv.is_owned = false;
13195 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
13196 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
13197 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
13198 CVec_u8Z_free(arg_var);
13202 uint32_t TxCreationKeys_1read(void* ctx_TODO, int8_tArray ser) {
13203 LDKu8slice ser_ref;
13204 ser_ref.datalen = ser.len;
13205 ser_ref.data = ser.ptr;
13206 LDKTxCreationKeys ret_var = TxCreationKeys_read(ser_ref);
13207 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13208 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13209 long ret_ref = (long)ret_var.inner;
13210 if (ret_var.is_owned) {
13216 void ChannelPublicKeys_1free(void* ctx_TODO, uint32_t this_ptr) {
13217 LDKChannelPublicKeys this_ptr_conv;
13218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13219 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13220 ChannelPublicKeys_free(this_ptr_conv);
13223 uint32_t ChannelPublicKeys_1clone(void* ctx_TODO, uint32_t orig) {
13224 LDKChannelPublicKeys orig_conv;
13225 orig_conv.inner = (void*)(orig & (~1));
13226 orig_conv.is_owned = false;
13227 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
13228 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13229 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13230 long ret_ref = (long)ret_var.inner;
13231 if (ret_var.is_owned) {
13237 int8_tArray ChannelPublicKeys_1get_1funding_1pubkey(void* ctx_TODO, uint32_t this_ptr) {
13238 LDKChannelPublicKeys this_ptr_conv;
13239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13240 this_ptr_conv.is_owned = false;
13241 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
13242 memcpy(arg_arr.ptr, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
13246 void ChannelPublicKeys_1set_1funding_1pubkey(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13247 LDKChannelPublicKeys this_ptr_conv;
13248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13249 this_ptr_conv.is_owned = false;
13250 LDKPublicKey val_ref;
13251 CHECK(val.len == 33);
13252 memcpy(val_ref.compressed_form, val.ptr, 33);
13253 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
13256 int8_tArray ChannelPublicKeys_1get_1revocation_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
13257 LDKChannelPublicKeys this_ptr_conv;
13258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13259 this_ptr_conv.is_owned = false;
13260 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
13261 memcpy(arg_arr.ptr, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
13265 void ChannelPublicKeys_1set_1revocation_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13266 LDKChannelPublicKeys this_ptr_conv;
13267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13268 this_ptr_conv.is_owned = false;
13269 LDKPublicKey val_ref;
13270 CHECK(val.len == 33);
13271 memcpy(val_ref.compressed_form, val.ptr, 33);
13272 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
13275 int8_tArray ChannelPublicKeys_1get_1payment_1point(void* ctx_TODO, uint32_t this_ptr) {
13276 LDKChannelPublicKeys this_ptr_conv;
13277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13278 this_ptr_conv.is_owned = false;
13279 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
13280 memcpy(arg_arr.ptr, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
13284 void ChannelPublicKeys_1set_1payment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13285 LDKChannelPublicKeys this_ptr_conv;
13286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13287 this_ptr_conv.is_owned = false;
13288 LDKPublicKey val_ref;
13289 CHECK(val.len == 33);
13290 memcpy(val_ref.compressed_form, val.ptr, 33);
13291 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
13294 int8_tArray ChannelPublicKeys_1get_1delayed_1payment_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
13295 LDKChannelPublicKeys this_ptr_conv;
13296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13297 this_ptr_conv.is_owned = false;
13298 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
13299 memcpy(arg_arr.ptr, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
13303 void ChannelPublicKeys_1set_1delayed_1payment_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13304 LDKChannelPublicKeys this_ptr_conv;
13305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13306 this_ptr_conv.is_owned = false;
13307 LDKPublicKey val_ref;
13308 CHECK(val.len == 33);
13309 memcpy(val_ref.compressed_form, val.ptr, 33);
13310 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
13313 int8_tArray ChannelPublicKeys_1get_1htlc_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
13314 LDKChannelPublicKeys this_ptr_conv;
13315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13316 this_ptr_conv.is_owned = false;
13317 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
13318 memcpy(arg_arr.ptr, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
13322 void ChannelPublicKeys_1set_1htlc_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13323 LDKChannelPublicKeys this_ptr_conv;
13324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13325 this_ptr_conv.is_owned = false;
13326 LDKPublicKey val_ref;
13327 CHECK(val.len == 33);
13328 memcpy(val_ref.compressed_form, val.ptr, 33);
13329 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
13332 uint32_t ChannelPublicKeys_1new(void* ctx_TODO, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_point_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg) {
13333 LDKPublicKey funding_pubkey_arg_ref;
13334 CHECK(funding_pubkey_arg.len == 33);
13335 memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg.ptr, 33);
13336 LDKPublicKey revocation_basepoint_arg_ref;
13337 CHECK(revocation_basepoint_arg.len == 33);
13338 memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg.ptr, 33);
13339 LDKPublicKey payment_point_arg_ref;
13340 CHECK(payment_point_arg.len == 33);
13341 memcpy(payment_point_arg_ref.compressed_form, payment_point_arg.ptr, 33);
13342 LDKPublicKey delayed_payment_basepoint_arg_ref;
13343 CHECK(delayed_payment_basepoint_arg.len == 33);
13344 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg.ptr, 33);
13345 LDKPublicKey htlc_basepoint_arg_ref;
13346 CHECK(htlc_basepoint_arg.len == 33);
13347 memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg.ptr, 33);
13348 LDKChannelPublicKeys ret_var = ChannelPublicKeys_new(funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref);
13349 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13350 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13351 long ret_ref = (long)ret_var.inner;
13352 if (ret_var.is_owned) {
13358 int8_tArray ChannelPublicKeys_1write(void* ctx_TODO, uint32_t obj) {
13359 LDKChannelPublicKeys obj_conv;
13360 obj_conv.inner = (void*)(obj & (~1));
13361 obj_conv.is_owned = false;
13362 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
13363 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
13364 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
13365 CVec_u8Z_free(arg_var);
13369 uint32_t ChannelPublicKeys_1read(void* ctx_TODO, int8_tArray ser) {
13370 LDKu8slice ser_ref;
13371 ser_ref.datalen = ser.len;
13372 ser_ref.data = ser.ptr;
13373 LDKChannelPublicKeys ret_var = ChannelPublicKeys_read(ser_ref);
13374 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13375 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13376 long ret_ref = (long)ret_var.inner;
13377 if (ret_var.is_owned) {
13383 uint32_t TxCreationKeys_1derive_1new(void* ctx_TODO, int8_tArray per_commitment_point, int8_tArray broadcaster_delayed_payment_base, int8_tArray broadcaster_htlc_base, int8_tArray countersignatory_revocation_base, int8_tArray countersignatory_htlc_base) {
13384 LDKPublicKey per_commitment_point_ref;
13385 CHECK(per_commitment_point.len == 33);
13386 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.ptr, 33);
13387 LDKPublicKey broadcaster_delayed_payment_base_ref;
13388 CHECK(broadcaster_delayed_payment_base.len == 33);
13389 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base.ptr, 33);
13390 LDKPublicKey broadcaster_htlc_base_ref;
13391 CHECK(broadcaster_htlc_base.len == 33);
13392 memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base.ptr, 33);
13393 LDKPublicKey countersignatory_revocation_base_ref;
13394 CHECK(countersignatory_revocation_base.len == 33);
13395 memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base.ptr, 33);
13396 LDKPublicKey countersignatory_htlc_base_ref;
13397 CHECK(countersignatory_htlc_base.len == 33);
13398 memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base.ptr, 33);
13399 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
13400 *ret_conv = TxCreationKeys_derive_new(per_commitment_point_ref, broadcaster_delayed_payment_base_ref, broadcaster_htlc_base_ref, countersignatory_revocation_base_ref, countersignatory_htlc_base_ref);
13401 return (long)ret_conv;
13404 uint32_t TxCreationKeys_1from_1channel_1static_1keys(void* ctx_TODO, int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
13405 LDKPublicKey per_commitment_point_ref;
13406 CHECK(per_commitment_point.len == 33);
13407 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.ptr, 33);
13408 LDKChannelPublicKeys broadcaster_keys_conv;
13409 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
13410 broadcaster_keys_conv.is_owned = false;
13411 LDKChannelPublicKeys countersignatory_keys_conv;
13412 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
13413 countersignatory_keys_conv.is_owned = false;
13414 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
13415 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
13416 return (long)ret_conv;
13419 int8_tArray get_1revokeable_1redeemscript(void* ctx_TODO, int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
13420 LDKPublicKey revocation_key_ref;
13421 CHECK(revocation_key.len == 33);
13422 memcpy(revocation_key_ref.compressed_form, revocation_key.ptr, 33);
13423 LDKPublicKey broadcaster_delayed_payment_key_ref;
13424 CHECK(broadcaster_delayed_payment_key.len == 33);
13425 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key.ptr, 33);
13426 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
13427 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
13428 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
13429 CVec_u8Z_free(arg_var);
13433 void HTLCOutputInCommitment_1free(void* ctx_TODO, uint32_t this_ptr) {
13434 LDKHTLCOutputInCommitment this_ptr_conv;
13435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13436 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13437 HTLCOutputInCommitment_free(this_ptr_conv);
13440 uint32_t HTLCOutputInCommitment_1clone(void* ctx_TODO, uint32_t orig) {
13441 LDKHTLCOutputInCommitment orig_conv;
13442 orig_conv.inner = (void*)(orig & (~1));
13443 orig_conv.is_owned = false;
13444 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
13445 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13446 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13447 long ret_ref = (long)ret_var.inner;
13448 if (ret_var.is_owned) {
13454 jboolean HTLCOutputInCommitment_1get_1offered(void* ctx_TODO, uint32_t this_ptr) {
13455 LDKHTLCOutputInCommitment this_ptr_conv;
13456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13457 this_ptr_conv.is_owned = false;
13458 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
13462 void HTLCOutputInCommitment_1set_1offered(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
13463 LDKHTLCOutputInCommitment this_ptr_conv;
13464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13465 this_ptr_conv.is_owned = false;
13466 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
13469 int64_t HTLCOutputInCommitment_1get_1amount_1msat(void* ctx_TODO, uint32_t this_ptr) {
13470 LDKHTLCOutputInCommitment this_ptr_conv;
13471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13472 this_ptr_conv.is_owned = false;
13473 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
13477 void HTLCOutputInCommitment_1set_1amount_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
13478 LDKHTLCOutputInCommitment this_ptr_conv;
13479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13480 this_ptr_conv.is_owned = false;
13481 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
13484 int32_t HTLCOutputInCommitment_1get_1cltv_1expiry(void* ctx_TODO, uint32_t this_ptr) {
13485 LDKHTLCOutputInCommitment this_ptr_conv;
13486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13487 this_ptr_conv.is_owned = false;
13488 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
13492 void HTLCOutputInCommitment_1set_1cltv_1expiry(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
13493 LDKHTLCOutputInCommitment this_ptr_conv;
13494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13495 this_ptr_conv.is_owned = false;
13496 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
13499 int8_tArray HTLCOutputInCommitment_1get_1payment_1hash(void* ctx_TODO, uint32_t this_ptr) {
13500 LDKHTLCOutputInCommitment this_ptr_conv;
13501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13502 this_ptr_conv.is_owned = false;
13503 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
13504 memcpy(ret_arr.ptr, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
13508 void HTLCOutputInCommitment_1set_1payment_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13509 LDKHTLCOutputInCommitment this_ptr_conv;
13510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13511 this_ptr_conv.is_owned = false;
13512 LDKThirtyTwoBytes val_ref;
13513 CHECK(val.len == 32);
13514 memcpy(val_ref.data, val.ptr, 32);
13515 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
13518 int8_tArray HTLCOutputInCommitment_1write(void* ctx_TODO, uint32_t obj) {
13519 LDKHTLCOutputInCommitment obj_conv;
13520 obj_conv.inner = (void*)(obj & (~1));
13521 obj_conv.is_owned = false;
13522 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
13523 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
13524 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
13525 CVec_u8Z_free(arg_var);
13529 uint32_t HTLCOutputInCommitment_1read(void* ctx_TODO, int8_tArray ser) {
13530 LDKu8slice ser_ref;
13531 ser_ref.datalen = ser.len;
13532 ser_ref.data = ser.ptr;
13533 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_read(ser_ref);
13534 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13535 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13536 long ret_ref = (long)ret_var.inner;
13537 if (ret_var.is_owned) {
13543 int8_tArray get_1htlc_1redeemscript(void* ctx_TODO, uint32_t htlc, uint32_t keys) {
13544 LDKHTLCOutputInCommitment htlc_conv;
13545 htlc_conv.inner = (void*)(htlc & (~1));
13546 htlc_conv.is_owned = false;
13547 LDKTxCreationKeys keys_conv;
13548 keys_conv.inner = (void*)(keys & (~1));
13549 keys_conv.is_owned = false;
13550 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
13551 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
13552 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
13553 CVec_u8Z_free(arg_var);
13557 int8_tArray make_1funding_1redeemscript(void* ctx_TODO, int8_tArray broadcaster, int8_tArray countersignatory) {
13558 LDKPublicKey broadcaster_ref;
13559 CHECK(broadcaster.len == 33);
13560 memcpy(broadcaster_ref.compressed_form, broadcaster.ptr, 33);
13561 LDKPublicKey countersignatory_ref;
13562 CHECK(countersignatory.len == 33);
13563 memcpy(countersignatory_ref.compressed_form, countersignatory.ptr, 33);
13564 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
13565 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
13566 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
13567 CVec_u8Z_free(arg_var);
13571 int8_tArray build_1htlc_1transaction(void* ctx_TODO, int8_tArray prev_hash, int32_t feerate_per_kw, int16_t contest_delay, uint32_t htlc, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
13572 unsigned char prev_hash_arr[32];
13573 CHECK(prev_hash.len == 32);
13574 memcpy(prev_hash_arr, prev_hash.ptr, 32);
13575 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
13576 LDKHTLCOutputInCommitment htlc_conv;
13577 htlc_conv.inner = (void*)(htlc & (~1));
13578 htlc_conv.is_owned = false;
13579 LDKPublicKey broadcaster_delayed_payment_key_ref;
13580 CHECK(broadcaster_delayed_payment_key.len == 33);
13581 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key.ptr, 33);
13582 LDKPublicKey revocation_key_ref;
13583 CHECK(revocation_key.len == 33);
13584 memcpy(revocation_key_ref.compressed_form, revocation_key.ptr, 33);
13585 LDKTransaction arg_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
13586 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
13587 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
13588 Transaction_free(arg_var);
13592 void ChannelTransactionParameters_1free(void* ctx_TODO, uint32_t this_ptr) {
13593 LDKChannelTransactionParameters this_ptr_conv;
13594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13595 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13596 ChannelTransactionParameters_free(this_ptr_conv);
13599 uint32_t ChannelTransactionParameters_1clone(void* ctx_TODO, uint32_t orig) {
13600 LDKChannelTransactionParameters orig_conv;
13601 orig_conv.inner = (void*)(orig & (~1));
13602 orig_conv.is_owned = false;
13603 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
13604 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13605 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13606 long ret_ref = (long)ret_var.inner;
13607 if (ret_var.is_owned) {
13613 uint32_t ChannelTransactionParameters_1get_1holder_1pubkeys(void* ctx_TODO, uint32_t this_ptr) {
13614 LDKChannelTransactionParameters this_ptr_conv;
13615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13616 this_ptr_conv.is_owned = false;
13617 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
13618 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13619 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13620 long ret_ref = (long)ret_var.inner;
13621 if (ret_var.is_owned) {
13627 void ChannelTransactionParameters_1set_1holder_1pubkeys(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
13628 LDKChannelTransactionParameters this_ptr_conv;
13629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13630 this_ptr_conv.is_owned = false;
13631 LDKChannelPublicKeys val_conv;
13632 val_conv.inner = (void*)(val & (~1));
13633 val_conv.is_owned = (val & 1) || (val == 0);
13634 if (val_conv.inner != NULL)
13635 val_conv = ChannelPublicKeys_clone(&val_conv);
13636 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
13639 int16_t ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(void* ctx_TODO, uint32_t this_ptr) {
13640 LDKChannelTransactionParameters this_ptr_conv;
13641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13642 this_ptr_conv.is_owned = false;
13643 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
13647 void ChannelTransactionParameters_1set_1holder_1selected_1contest_1delay(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
13648 LDKChannelTransactionParameters this_ptr_conv;
13649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13650 this_ptr_conv.is_owned = false;
13651 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
13654 jboolean ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(void* ctx_TODO, uint32_t this_ptr) {
13655 LDKChannelTransactionParameters this_ptr_conv;
13656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13657 this_ptr_conv.is_owned = false;
13658 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
13662 void ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
13663 LDKChannelTransactionParameters this_ptr_conv;
13664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13665 this_ptr_conv.is_owned = false;
13666 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
13669 uint32_t ChannelTransactionParameters_1get_1counterparty_1parameters(void* ctx_TODO, uint32_t this_ptr) {
13670 LDKChannelTransactionParameters this_ptr_conv;
13671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13672 this_ptr_conv.is_owned = false;
13673 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
13674 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13675 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13676 long ret_ref = (long)ret_var.inner;
13677 if (ret_var.is_owned) {
13683 void ChannelTransactionParameters_1set_1counterparty_1parameters(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
13684 LDKChannelTransactionParameters this_ptr_conv;
13685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13686 this_ptr_conv.is_owned = false;
13687 LDKCounterpartyChannelTransactionParameters val_conv;
13688 val_conv.inner = (void*)(val & (~1));
13689 val_conv.is_owned = (val & 1) || (val == 0);
13690 if (val_conv.inner != NULL)
13691 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
13692 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
13695 uint32_t ChannelTransactionParameters_1get_1funding_1outpoint(void* ctx_TODO, uint32_t this_ptr) {
13696 LDKChannelTransactionParameters this_ptr_conv;
13697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13698 this_ptr_conv.is_owned = false;
13699 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
13700 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13701 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13702 long ret_ref = (long)ret_var.inner;
13703 if (ret_var.is_owned) {
13709 void ChannelTransactionParameters_1set_1funding_1outpoint(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
13710 LDKChannelTransactionParameters this_ptr_conv;
13711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13712 this_ptr_conv.is_owned = false;
13713 LDKOutPoint val_conv;
13714 val_conv.inner = (void*)(val & (~1));
13715 val_conv.is_owned = (val & 1) || (val == 0);
13716 if (val_conv.inner != NULL)
13717 val_conv = OutPoint_clone(&val_conv);
13718 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
13721 uint32_t ChannelTransactionParameters_1new(void* ctx_TODO, uint32_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, uint32_t counterparty_parameters_arg, uint32_t funding_outpoint_arg) {
13722 LDKChannelPublicKeys holder_pubkeys_arg_conv;
13723 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
13724 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
13725 if (holder_pubkeys_arg_conv.inner != NULL)
13726 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
13727 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
13728 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
13729 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
13730 if (counterparty_parameters_arg_conv.inner != NULL)
13731 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
13732 LDKOutPoint funding_outpoint_arg_conv;
13733 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
13734 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
13735 if (funding_outpoint_arg_conv.inner != NULL)
13736 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
13737 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_new(holder_pubkeys_arg_conv, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg_conv, funding_outpoint_arg_conv);
13738 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13739 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13740 long ret_ref = (long)ret_var.inner;
13741 if (ret_var.is_owned) {
13747 void CounterpartyChannelTransactionParameters_1free(void* ctx_TODO, uint32_t this_ptr) {
13748 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
13749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13750 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13751 CounterpartyChannelTransactionParameters_free(this_ptr_conv);
13754 uint32_t CounterpartyChannelTransactionParameters_1clone(void* ctx_TODO, uint32_t orig) {
13755 LDKCounterpartyChannelTransactionParameters orig_conv;
13756 orig_conv.inner = (void*)(orig & (~1));
13757 orig_conv.is_owned = false;
13758 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
13759 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13760 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13761 long ret_ref = (long)ret_var.inner;
13762 if (ret_var.is_owned) {
13768 uint32_t CounterpartyChannelTransactionParameters_1get_1pubkeys(void* ctx_TODO, uint32_t this_ptr) {
13769 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
13770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13771 this_ptr_conv.is_owned = false;
13772 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
13773 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13774 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13775 long ret_ref = (long)ret_var.inner;
13776 if (ret_var.is_owned) {
13782 void CounterpartyChannelTransactionParameters_1set_1pubkeys(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
13783 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
13784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13785 this_ptr_conv.is_owned = false;
13786 LDKChannelPublicKeys val_conv;
13787 val_conv.inner = (void*)(val & (~1));
13788 val_conv.is_owned = (val & 1) || (val == 0);
13789 if (val_conv.inner != NULL)
13790 val_conv = ChannelPublicKeys_clone(&val_conv);
13791 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
13794 int16_t CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(void* ctx_TODO, uint32_t this_ptr) {
13795 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
13796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13797 this_ptr_conv.is_owned = false;
13798 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
13802 void CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
13803 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
13804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13805 this_ptr_conv.is_owned = false;
13806 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
13809 uint32_t CounterpartyChannelTransactionParameters_1new(void* ctx_TODO, uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
13810 LDKChannelPublicKeys pubkeys_arg_conv;
13811 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
13812 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
13813 if (pubkeys_arg_conv.inner != NULL)
13814 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
13815 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
13816 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13817 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13818 long ret_ref = (long)ret_var.inner;
13819 if (ret_var.is_owned) {
13825 jboolean ChannelTransactionParameters_1is_1populated(void* ctx_TODO, uint32_t this_arg) {
13826 LDKChannelTransactionParameters this_arg_conv;
13827 this_arg_conv.inner = (void*)(this_arg & (~1));
13828 this_arg_conv.is_owned = false;
13829 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
13833 uint32_t ChannelTransactionParameters_1as_1holder_1broadcastable(void* ctx_TODO, uint32_t this_arg) {
13834 LDKChannelTransactionParameters this_arg_conv;
13835 this_arg_conv.inner = (void*)(this_arg & (~1));
13836 this_arg_conv.is_owned = false;
13837 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
13838 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13839 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13840 long ret_ref = (long)ret_var.inner;
13841 if (ret_var.is_owned) {
13847 uint32_t ChannelTransactionParameters_1as_1counterparty_1broadcastable(void* ctx_TODO, uint32_t this_arg) {
13848 LDKChannelTransactionParameters this_arg_conv;
13849 this_arg_conv.inner = (void*)(this_arg & (~1));
13850 this_arg_conv.is_owned = false;
13851 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
13852 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13853 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13854 long ret_ref = (long)ret_var.inner;
13855 if (ret_var.is_owned) {
13861 int8_tArray CounterpartyChannelTransactionParameters_1write(void* ctx_TODO, uint32_t obj) {
13862 LDKCounterpartyChannelTransactionParameters obj_conv;
13863 obj_conv.inner = (void*)(obj & (~1));
13864 obj_conv.is_owned = false;
13865 LDKCVec_u8Z arg_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
13866 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
13867 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
13868 CVec_u8Z_free(arg_var);
13872 uint32_t CounterpartyChannelTransactionParameters_1read(void* ctx_TODO, int8_tArray ser) {
13873 LDKu8slice ser_ref;
13874 ser_ref.datalen = ser.len;
13875 ser_ref.data = ser.ptr;
13876 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_read(ser_ref);
13877 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13878 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13879 long ret_ref = (long)ret_var.inner;
13880 if (ret_var.is_owned) {
13886 int8_tArray ChannelTransactionParameters_1write(void* ctx_TODO, uint32_t obj) {
13887 LDKChannelTransactionParameters obj_conv;
13888 obj_conv.inner = (void*)(obj & (~1));
13889 obj_conv.is_owned = false;
13890 LDKCVec_u8Z arg_var = ChannelTransactionParameters_write(&obj_conv);
13891 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
13892 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
13893 CVec_u8Z_free(arg_var);
13897 uint32_t ChannelTransactionParameters_1read(void* ctx_TODO, int8_tArray ser) {
13898 LDKu8slice ser_ref;
13899 ser_ref.datalen = ser.len;
13900 ser_ref.data = ser.ptr;
13901 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_read(ser_ref);
13902 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13903 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13904 long ret_ref = (long)ret_var.inner;
13905 if (ret_var.is_owned) {
13911 void DirectedChannelTransactionParameters_1free(void* ctx_TODO, uint32_t this_ptr) {
13912 LDKDirectedChannelTransactionParameters this_ptr_conv;
13913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13914 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13915 DirectedChannelTransactionParameters_free(this_ptr_conv);
13918 uint32_t DirectedChannelTransactionParameters_1broadcaster_1pubkeys(void* ctx_TODO, uint32_t this_arg) {
13919 LDKDirectedChannelTransactionParameters this_arg_conv;
13920 this_arg_conv.inner = (void*)(this_arg & (~1));
13921 this_arg_conv.is_owned = false;
13922 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
13923 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13924 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13925 long ret_ref = (long)ret_var.inner;
13926 if (ret_var.is_owned) {
13932 uint32_t DirectedChannelTransactionParameters_1countersignatory_1pubkeys(void* ctx_TODO, uint32_t this_arg) {
13933 LDKDirectedChannelTransactionParameters this_arg_conv;
13934 this_arg_conv.inner = (void*)(this_arg & (~1));
13935 this_arg_conv.is_owned = false;
13936 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
13937 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13938 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13939 long ret_ref = (long)ret_var.inner;
13940 if (ret_var.is_owned) {
13946 int16_t DirectedChannelTransactionParameters_1contest_1delay(void* ctx_TODO, uint32_t this_arg) {
13947 LDKDirectedChannelTransactionParameters this_arg_conv;
13948 this_arg_conv.inner = (void*)(this_arg & (~1));
13949 this_arg_conv.is_owned = false;
13950 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
13954 jboolean DirectedChannelTransactionParameters_1is_1outbound(void* ctx_TODO, uint32_t this_arg) {
13955 LDKDirectedChannelTransactionParameters this_arg_conv;
13956 this_arg_conv.inner = (void*)(this_arg & (~1));
13957 this_arg_conv.is_owned = false;
13958 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
13962 uint32_t DirectedChannelTransactionParameters_1funding_1outpoint(void* ctx_TODO, uint32_t this_arg) {
13963 LDKDirectedChannelTransactionParameters this_arg_conv;
13964 this_arg_conv.inner = (void*)(this_arg & (~1));
13965 this_arg_conv.is_owned = false;
13966 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
13967 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13968 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13969 long ret_ref = (long)ret_var.inner;
13970 if (ret_var.is_owned) {
13976 void HolderCommitmentTransaction_1free(void* ctx_TODO, uint32_t this_ptr) {
13977 LDKHolderCommitmentTransaction this_ptr_conv;
13978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13979 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13980 HolderCommitmentTransaction_free(this_ptr_conv);
13983 uint32_t HolderCommitmentTransaction_1clone(void* ctx_TODO, uint32_t orig) {
13984 LDKHolderCommitmentTransaction orig_conv;
13985 orig_conv.inner = (void*)(orig & (~1));
13986 orig_conv.is_owned = false;
13987 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
13988 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13989 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13990 long ret_ref = (long)ret_var.inner;
13991 if (ret_var.is_owned) {
13997 int8_tArray HolderCommitmentTransaction_1get_1counterparty_1sig(void* ctx_TODO, uint32_t this_ptr) {
13998 LDKHolderCommitmentTransaction this_ptr_conv;
13999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14000 this_ptr_conv.is_owned = false;
14001 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
14002 memcpy(arg_arr.ptr, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
14006 void HolderCommitmentTransaction_1set_1counterparty_1sig(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
14007 LDKHolderCommitmentTransaction this_ptr_conv;
14008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14009 this_ptr_conv.is_owned = false;
14010 LDKSignature val_ref;
14011 CHECK(val.len == 64);
14012 memcpy(val_ref.compact_form, val.ptr, 64);
14013 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
14016 void HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(void* ctx_TODO, uint32_t this_ptr, ptrArray val) {
14017 LDKHolderCommitmentTransaction this_ptr_conv;
14018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14019 this_ptr_conv.is_owned = false;
14020 LDKCVec_SignatureZ val_constr;
14021 val_constr.datalen = val.len;
14022 if (val_constr.datalen > 0)
14023 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14025 val_constr.data = NULL;
14026 int8_tArray* val_vals = (int8_tArray*) val.ptr;
14027 for (size_t m = 0; m < val_constr.datalen; m++) {
14028 int8_tArray arr_conv_12 = val_vals[m];
14029 LDKSignature arr_conv_12_ref;
14030 CHECK(arr_conv_12.len == 64);
14031 memcpy(arr_conv_12_ref.compact_form, arr_conv_12.ptr, 64);
14032 val_constr.data[m] = arr_conv_12_ref;
14034 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
14037 int8_tArray HolderCommitmentTransaction_1write(void* ctx_TODO, uint32_t obj) {
14038 LDKHolderCommitmentTransaction obj_conv;
14039 obj_conv.inner = (void*)(obj & (~1));
14040 obj_conv.is_owned = false;
14041 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
14042 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
14043 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
14044 CVec_u8Z_free(arg_var);
14048 uint32_t HolderCommitmentTransaction_1read(void* ctx_TODO, int8_tArray ser) {
14049 LDKu8slice ser_ref;
14050 ser_ref.datalen = ser.len;
14051 ser_ref.data = ser.ptr;
14052 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_read(ser_ref);
14053 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14054 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14055 long ret_ref = (long)ret_var.inner;
14056 if (ret_var.is_owned) {
14062 uint32_t HolderCommitmentTransaction_1new(void* ctx_TODO, uint32_t commitment_tx, int8_tArray counterparty_sig, ptrArray counterparty_htlc_sigs, int8_tArray holder_funding_key, int8_tArray counterparty_funding_key) {
14063 LDKCommitmentTransaction commitment_tx_conv;
14064 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
14065 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
14066 if (commitment_tx_conv.inner != NULL)
14067 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
14068 LDKSignature counterparty_sig_ref;
14069 CHECK(counterparty_sig.len == 64);
14070 memcpy(counterparty_sig_ref.compact_form, counterparty_sig.ptr, 64);
14071 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
14072 counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs.len;
14073 if (counterparty_htlc_sigs_constr.datalen > 0)
14074 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14076 counterparty_htlc_sigs_constr.data = NULL;
14077 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*) counterparty_htlc_sigs.ptr;
14078 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
14079 int8_tArray arr_conv_12 = counterparty_htlc_sigs_vals[m];
14080 LDKSignature arr_conv_12_ref;
14081 CHECK(arr_conv_12.len == 64);
14082 memcpy(arr_conv_12_ref.compact_form, arr_conv_12.ptr, 64);
14083 counterparty_htlc_sigs_constr.data[m] = arr_conv_12_ref;
14085 LDKPublicKey holder_funding_key_ref;
14086 CHECK(holder_funding_key.len == 33);
14087 memcpy(holder_funding_key_ref.compressed_form, holder_funding_key.ptr, 33);
14088 LDKPublicKey counterparty_funding_key_ref;
14089 CHECK(counterparty_funding_key.len == 33);
14090 memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key.ptr, 33);
14091 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
14092 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14093 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14094 long ret_ref = (long)ret_var.inner;
14095 if (ret_var.is_owned) {
14101 void BuiltCommitmentTransaction_1free(void* ctx_TODO, uint32_t this_ptr) {
14102 LDKBuiltCommitmentTransaction this_ptr_conv;
14103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14104 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14105 BuiltCommitmentTransaction_free(this_ptr_conv);
14108 uint32_t BuiltCommitmentTransaction_1clone(void* ctx_TODO, uint32_t orig) {
14109 LDKBuiltCommitmentTransaction orig_conv;
14110 orig_conv.inner = (void*)(orig & (~1));
14111 orig_conv.is_owned = false;
14112 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
14113 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14114 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14115 long ret_ref = (long)ret_var.inner;
14116 if (ret_var.is_owned) {
14122 int8_tArray BuiltCommitmentTransaction_1get_1transaction(void* ctx_TODO, uint32_t this_ptr) {
14123 LDKBuiltCommitmentTransaction this_ptr_conv;
14124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14125 this_ptr_conv.is_owned = false;
14126 LDKTransaction arg_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
14127 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
14128 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
14129 Transaction_free(arg_var);
14133 void BuiltCommitmentTransaction_1set_1transaction(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
14134 LDKBuiltCommitmentTransaction this_ptr_conv;
14135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14136 this_ptr_conv.is_owned = false;
14137 LDKTransaction val_ref;
14138 val_ref.datalen = val.len;
14139 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
14140 memcpy(val_ref.data, val.ptr, val_ref.datalen);
14141 val_ref.data_is_owned = true;
14142 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
14145 int8_tArray BuiltCommitmentTransaction_1get_1txid(void* ctx_TODO, uint32_t this_ptr) {
14146 LDKBuiltCommitmentTransaction this_ptr_conv;
14147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14148 this_ptr_conv.is_owned = false;
14149 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
14150 memcpy(ret_arr.ptr, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
14154 void BuiltCommitmentTransaction_1set_1txid(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
14155 LDKBuiltCommitmentTransaction this_ptr_conv;
14156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14157 this_ptr_conv.is_owned = false;
14158 LDKThirtyTwoBytes val_ref;
14159 CHECK(val.len == 32);
14160 memcpy(val_ref.data, val.ptr, 32);
14161 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
14164 uint32_t BuiltCommitmentTransaction_1new(void* ctx_TODO, int8_tArray transaction_arg, int8_tArray txid_arg) {
14165 LDKTransaction transaction_arg_ref;
14166 transaction_arg_ref.datalen = transaction_arg.len;
14167 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
14168 memcpy(transaction_arg_ref.data, transaction_arg.ptr, transaction_arg_ref.datalen);
14169 transaction_arg_ref.data_is_owned = true;
14170 LDKThirtyTwoBytes txid_arg_ref;
14171 CHECK(txid_arg.len == 32);
14172 memcpy(txid_arg_ref.data, txid_arg.ptr, 32);
14173 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
14174 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14175 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14176 long ret_ref = (long)ret_var.inner;
14177 if (ret_var.is_owned) {
14183 int8_tArray BuiltCommitmentTransaction_1write(void* ctx_TODO, uint32_t obj) {
14184 LDKBuiltCommitmentTransaction obj_conv;
14185 obj_conv.inner = (void*)(obj & (~1));
14186 obj_conv.is_owned = false;
14187 LDKCVec_u8Z arg_var = BuiltCommitmentTransaction_write(&obj_conv);
14188 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
14189 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
14190 CVec_u8Z_free(arg_var);
14194 uint32_t BuiltCommitmentTransaction_1read(void* ctx_TODO, int8_tArray ser) {
14195 LDKu8slice ser_ref;
14196 ser_ref.datalen = ser.len;
14197 ser_ref.data = ser.ptr;
14198 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_read(ser_ref);
14199 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14200 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14201 long ret_ref = (long)ret_var.inner;
14202 if (ret_var.is_owned) {
14208 int8_tArray BuiltCommitmentTransaction_1get_1sighash_1all(void* ctx_TODO, uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
14209 LDKBuiltCommitmentTransaction this_arg_conv;
14210 this_arg_conv.inner = (void*)(this_arg & (~1));
14211 this_arg_conv.is_owned = false;
14212 LDKu8slice funding_redeemscript_ref;
14213 funding_redeemscript_ref.datalen = funding_redeemscript.len;
14214 funding_redeemscript_ref.data = funding_redeemscript.ptr;
14215 int8_tArray arg_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
14216 memcpy(arg_arr.ptr, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
14220 int8_tArray BuiltCommitmentTransaction_1sign(void* ctx_TODO, uint32_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
14221 LDKBuiltCommitmentTransaction this_arg_conv;
14222 this_arg_conv.inner = (void*)(this_arg & (~1));
14223 this_arg_conv.is_owned = false;
14224 unsigned char funding_key_arr[32];
14225 CHECK(funding_key.len == 32);
14226 memcpy(funding_key_arr, funding_key.ptr, 32);
14227 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
14228 LDKu8slice funding_redeemscript_ref;
14229 funding_redeemscript_ref.datalen = funding_redeemscript.len;
14230 funding_redeemscript_ref.data = funding_redeemscript.ptr;
14231 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
14232 memcpy(arg_arr.ptr, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
14236 void CommitmentTransaction_1free(void* ctx_TODO, uint32_t this_ptr) {
14237 LDKCommitmentTransaction this_ptr_conv;
14238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14239 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14240 CommitmentTransaction_free(this_ptr_conv);
14243 uint32_t CommitmentTransaction_1clone(void* ctx_TODO, uint32_t orig) {
14244 LDKCommitmentTransaction orig_conv;
14245 orig_conv.inner = (void*)(orig & (~1));
14246 orig_conv.is_owned = false;
14247 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
14248 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14249 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14250 long ret_ref = (long)ret_var.inner;
14251 if (ret_var.is_owned) {
14257 int8_tArray CommitmentTransaction_1write(void* ctx_TODO, uint32_t obj) {
14258 LDKCommitmentTransaction obj_conv;
14259 obj_conv.inner = (void*)(obj & (~1));
14260 obj_conv.is_owned = false;
14261 LDKCVec_u8Z arg_var = CommitmentTransaction_write(&obj_conv);
14262 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
14263 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
14264 CVec_u8Z_free(arg_var);
14268 uint32_t CommitmentTransaction_1read(void* ctx_TODO, int8_tArray ser) {
14269 LDKu8slice ser_ref;
14270 ser_ref.datalen = ser.len;
14271 ser_ref.data = ser.ptr;
14272 LDKCommitmentTransaction ret_var = CommitmentTransaction_read(ser_ref);
14273 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14274 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14275 long ret_ref = (long)ret_var.inner;
14276 if (ret_var.is_owned) {
14282 int64_t CommitmentTransaction_1commitment_1number(void* ctx_TODO, uint32_t this_arg) {
14283 LDKCommitmentTransaction this_arg_conv;
14284 this_arg_conv.inner = (void*)(this_arg & (~1));
14285 this_arg_conv.is_owned = false;
14286 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
14290 int64_t CommitmentTransaction_1to_1broadcaster_1value_1sat(void* ctx_TODO, uint32_t this_arg) {
14291 LDKCommitmentTransaction this_arg_conv;
14292 this_arg_conv.inner = (void*)(this_arg & (~1));
14293 this_arg_conv.is_owned = false;
14294 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
14298 int64_t CommitmentTransaction_1to_1countersignatory_1value_1sat(void* ctx_TODO, uint32_t this_arg) {
14299 LDKCommitmentTransaction this_arg_conv;
14300 this_arg_conv.inner = (void*)(this_arg & (~1));
14301 this_arg_conv.is_owned = false;
14302 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
14306 int32_t CommitmentTransaction_1feerate_1per_1kw(void* ctx_TODO, uint32_t this_arg) {
14307 LDKCommitmentTransaction this_arg_conv;
14308 this_arg_conv.inner = (void*)(this_arg & (~1));
14309 this_arg_conv.is_owned = false;
14310 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
14314 uint32_t CommitmentTransaction_1trust(void* ctx_TODO, uint32_t this_arg) {
14315 LDKCommitmentTransaction this_arg_conv;
14316 this_arg_conv.inner = (void*)(this_arg & (~1));
14317 this_arg_conv.is_owned = false;
14318 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
14319 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14320 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14321 long ret_ref = (long)ret_var.inner;
14322 if (ret_var.is_owned) {
14328 uint32_t CommitmentTransaction_1verify(void* ctx_TODO, uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
14329 LDKCommitmentTransaction this_arg_conv;
14330 this_arg_conv.inner = (void*)(this_arg & (~1));
14331 this_arg_conv.is_owned = false;
14332 LDKDirectedChannelTransactionParameters channel_parameters_conv;
14333 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
14334 channel_parameters_conv.is_owned = false;
14335 LDKChannelPublicKeys broadcaster_keys_conv;
14336 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
14337 broadcaster_keys_conv.is_owned = false;
14338 LDKChannelPublicKeys countersignatory_keys_conv;
14339 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
14340 countersignatory_keys_conv.is_owned = false;
14341 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
14342 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
14343 return (long)ret_conv;
14346 void TrustedCommitmentTransaction_1free(void* ctx_TODO, uint32_t this_ptr) {
14347 LDKTrustedCommitmentTransaction this_ptr_conv;
14348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14349 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14350 TrustedCommitmentTransaction_free(this_ptr_conv);
14353 int8_tArray TrustedCommitmentTransaction_1txid(void* ctx_TODO, uint32_t this_arg) {
14354 LDKTrustedCommitmentTransaction this_arg_conv;
14355 this_arg_conv.inner = (void*)(this_arg & (~1));
14356 this_arg_conv.is_owned = false;
14357 int8_tArray arg_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
14358 memcpy(arg_arr.ptr, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
14362 uint32_t TrustedCommitmentTransaction_1built_1transaction(void* ctx_TODO, uint32_t this_arg) {
14363 LDKTrustedCommitmentTransaction this_arg_conv;
14364 this_arg_conv.inner = (void*)(this_arg & (~1));
14365 this_arg_conv.is_owned = false;
14366 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
14367 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14368 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14369 long ret_ref = (long)ret_var.inner;
14370 if (ret_var.is_owned) {
14376 uint32_t TrustedCommitmentTransaction_1keys(void* ctx_TODO, uint32_t this_arg) {
14377 LDKTrustedCommitmentTransaction this_arg_conv;
14378 this_arg_conv.inner = (void*)(this_arg & (~1));
14379 this_arg_conv.is_owned = false;
14380 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
14381 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14382 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14383 long ret_ref = (long)ret_var.inner;
14384 if (ret_var.is_owned) {
14390 uint32_t TrustedCommitmentTransaction_1get_1htlc_1sigs(void* ctx_TODO, uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
14391 LDKTrustedCommitmentTransaction this_arg_conv;
14392 this_arg_conv.inner = (void*)(this_arg & (~1));
14393 this_arg_conv.is_owned = false;
14394 unsigned char htlc_base_key_arr[32];
14395 CHECK(htlc_base_key.len == 32);
14396 memcpy(htlc_base_key_arr, htlc_base_key.ptr, 32);
14397 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
14398 LDKDirectedChannelTransactionParameters channel_parameters_conv;
14399 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
14400 channel_parameters_conv.is_owned = false;
14401 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14402 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
14403 return (long)ret_conv;
14406 int64_t get_1commitment_1transaction_1number_1obscure_1factor(void* ctx_TODO, int8_tArray broadcaster_payment_basepoint, int8_tArray countersignatory_payment_basepoint, jboolean outbound_from_broadcaster) {
14407 LDKPublicKey broadcaster_payment_basepoint_ref;
14408 CHECK(broadcaster_payment_basepoint.len == 33);
14409 memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint.ptr, 33);
14410 LDKPublicKey countersignatory_payment_basepoint_ref;
14411 CHECK(countersignatory_payment_basepoint.len == 33);
14412 memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint.ptr, 33);
14413 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
14417 void InitFeatures_1free(void* ctx_TODO, uint32_t this_ptr) {
14418 LDKInitFeatures this_ptr_conv;
14419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14420 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14421 InitFeatures_free(this_ptr_conv);
14424 void NodeFeatures_1free(void* ctx_TODO, uint32_t this_ptr) {
14425 LDKNodeFeatures this_ptr_conv;
14426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14427 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14428 NodeFeatures_free(this_ptr_conv);
14431 void ChannelFeatures_1free(void* ctx_TODO, uint32_t this_ptr) {
14432 LDKChannelFeatures this_ptr_conv;
14433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14434 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14435 ChannelFeatures_free(this_ptr_conv);
14438 void RouteHop_1free(void* ctx_TODO, uint32_t this_ptr) {
14439 LDKRouteHop this_ptr_conv;
14440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14441 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14442 RouteHop_free(this_ptr_conv);
14445 uint32_t RouteHop_1clone(void* ctx_TODO, uint32_t orig) {
14446 LDKRouteHop orig_conv;
14447 orig_conv.inner = (void*)(orig & (~1));
14448 orig_conv.is_owned = false;
14449 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
14450 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14451 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14452 long ret_ref = (long)ret_var.inner;
14453 if (ret_var.is_owned) {
14459 int8_tArray RouteHop_1get_1pubkey(void* ctx_TODO, uint32_t this_ptr) {
14460 LDKRouteHop this_ptr_conv;
14461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14462 this_ptr_conv.is_owned = false;
14463 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
14464 memcpy(arg_arr.ptr, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
14468 void RouteHop_1set_1pubkey(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
14469 LDKRouteHop this_ptr_conv;
14470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14471 this_ptr_conv.is_owned = false;
14472 LDKPublicKey val_ref;
14473 CHECK(val.len == 33);
14474 memcpy(val_ref.compressed_form, val.ptr, 33);
14475 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
14478 uint32_t RouteHop_1get_1node_1features(void* ctx_TODO, uint32_t this_ptr) {
14479 LDKRouteHop this_ptr_conv;
14480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14481 this_ptr_conv.is_owned = false;
14482 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
14483 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14484 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14485 long ret_ref = (long)ret_var.inner;
14486 if (ret_var.is_owned) {
14492 void RouteHop_1set_1node_1features(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
14493 LDKRouteHop this_ptr_conv;
14494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14495 this_ptr_conv.is_owned = false;
14496 LDKNodeFeatures val_conv;
14497 val_conv.inner = (void*)(val & (~1));
14498 val_conv.is_owned = (val & 1) || (val == 0);
14499 // Warning: we may need a move here but can't clone!
14500 RouteHop_set_node_features(&this_ptr_conv, val_conv);
14503 int64_t RouteHop_1get_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
14504 LDKRouteHop this_ptr_conv;
14505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14506 this_ptr_conv.is_owned = false;
14507 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
14511 void RouteHop_1set_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
14512 LDKRouteHop this_ptr_conv;
14513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14514 this_ptr_conv.is_owned = false;
14515 RouteHop_set_short_channel_id(&this_ptr_conv, val);
14518 uint32_t RouteHop_1get_1channel_1features(void* ctx_TODO, uint32_t this_ptr) {
14519 LDKRouteHop this_ptr_conv;
14520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14521 this_ptr_conv.is_owned = false;
14522 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
14523 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14524 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14525 long ret_ref = (long)ret_var.inner;
14526 if (ret_var.is_owned) {
14532 void RouteHop_1set_1channel_1features(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
14533 LDKRouteHop this_ptr_conv;
14534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14535 this_ptr_conv.is_owned = false;
14536 LDKChannelFeatures val_conv;
14537 val_conv.inner = (void*)(val & (~1));
14538 val_conv.is_owned = (val & 1) || (val == 0);
14539 // Warning: we may need a move here but can't clone!
14540 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
14543 int64_t RouteHop_1get_1fee_1msat(void* ctx_TODO, uint32_t this_ptr) {
14544 LDKRouteHop this_ptr_conv;
14545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14546 this_ptr_conv.is_owned = false;
14547 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
14551 void RouteHop_1set_1fee_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
14552 LDKRouteHop this_ptr_conv;
14553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14554 this_ptr_conv.is_owned = false;
14555 RouteHop_set_fee_msat(&this_ptr_conv, val);
14558 int32_t RouteHop_1get_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr) {
14559 LDKRouteHop this_ptr_conv;
14560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14561 this_ptr_conv.is_owned = false;
14562 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
14566 void RouteHop_1set_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
14567 LDKRouteHop this_ptr_conv;
14568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14569 this_ptr_conv.is_owned = false;
14570 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
14573 uint32_t RouteHop_1new(void* ctx_TODO, int8_tArray pubkey_arg, uint32_t node_features_arg, int64_t short_channel_id_arg, uint32_t channel_features_arg, int64_t fee_msat_arg, int32_t cltv_expiry_delta_arg) {
14574 LDKPublicKey pubkey_arg_ref;
14575 CHECK(pubkey_arg.len == 33);
14576 memcpy(pubkey_arg_ref.compressed_form, pubkey_arg.ptr, 33);
14577 LDKNodeFeatures node_features_arg_conv;
14578 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
14579 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
14580 // Warning: we may need a move here but can't clone!
14581 LDKChannelFeatures channel_features_arg_conv;
14582 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
14583 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
14584 // Warning: we may need a move here but can't clone!
14585 LDKRouteHop ret_var = RouteHop_new(pubkey_arg_ref, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg);
14586 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14587 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14588 long ret_ref = (long)ret_var.inner;
14589 if (ret_var.is_owned) {
14595 void Route_1free(void* ctx_TODO, uint32_t this_ptr) {
14596 LDKRoute this_ptr_conv;
14597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14598 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14599 Route_free(this_ptr_conv);
14602 uint32_t Route_1clone(void* ctx_TODO, uint32_t orig) {
14603 LDKRoute orig_conv;
14604 orig_conv.inner = (void*)(orig & (~1));
14605 orig_conv.is_owned = false;
14606 LDKRoute ret_var = Route_clone(&orig_conv);
14607 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14608 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14609 long ret_ref = (long)ret_var.inner;
14610 if (ret_var.is_owned) {
14616 void Route_1set_1paths(void* ctx_TODO, uint32_t this_ptr, ptrArray val) {
14617 LDKRoute this_ptr_conv;
14618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14619 this_ptr_conv.is_owned = false;
14620 LDKCVec_CVec_RouteHopZZ val_constr;
14621 val_constr.datalen = val.len;
14622 if (val_constr.datalen > 0)
14623 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
14625 val_constr.data = NULL;
14626 uint32_tArray* val_vals = (uint32_tArray*) val.ptr;
14627 for (size_t m = 0; m < val_constr.datalen; m++) {
14628 uint32_tArray arr_conv_12 = val_vals[m];
14629 LDKCVec_RouteHopZ arr_conv_12_constr;
14630 arr_conv_12_constr.datalen = arr_conv_12.len;
14631 if (arr_conv_12_constr.datalen > 0)
14632 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14634 arr_conv_12_constr.data = NULL;
14635 uint32_t* arr_conv_12_vals = (uint32_t*) arr_conv_12.ptr;
14636 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
14637 uint32_t arr_conv_10 = arr_conv_12_vals[k];
14638 LDKRouteHop arr_conv_10_conv;
14639 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
14640 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
14641 if (arr_conv_10_conv.inner != NULL)
14642 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
14643 arr_conv_12_constr.data[k] = arr_conv_10_conv;
14645 val_constr.data[m] = arr_conv_12_constr;
14647 Route_set_paths(&this_ptr_conv, val_constr);
14650 uint32_t Route_1new(void* ctx_TODO, ptrArray paths_arg) {
14651 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
14652 paths_arg_constr.datalen = paths_arg.len;
14653 if (paths_arg_constr.datalen > 0)
14654 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
14656 paths_arg_constr.data = NULL;
14657 uint32_tArray* paths_arg_vals = (uint32_tArray*) paths_arg.ptr;
14658 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
14659 uint32_tArray arr_conv_12 = paths_arg_vals[m];
14660 LDKCVec_RouteHopZ arr_conv_12_constr;
14661 arr_conv_12_constr.datalen = arr_conv_12.len;
14662 if (arr_conv_12_constr.datalen > 0)
14663 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14665 arr_conv_12_constr.data = NULL;
14666 uint32_t* arr_conv_12_vals = (uint32_t*) arr_conv_12.ptr;
14667 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
14668 uint32_t arr_conv_10 = arr_conv_12_vals[k];
14669 LDKRouteHop arr_conv_10_conv;
14670 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
14671 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
14672 if (arr_conv_10_conv.inner != NULL)
14673 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
14674 arr_conv_12_constr.data[k] = arr_conv_10_conv;
14676 paths_arg_constr.data[m] = arr_conv_12_constr;
14678 LDKRoute ret_var = Route_new(paths_arg_constr);
14679 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14680 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14681 long ret_ref = (long)ret_var.inner;
14682 if (ret_var.is_owned) {
14688 int8_tArray Route_1write(void* ctx_TODO, uint32_t obj) {
14690 obj_conv.inner = (void*)(obj & (~1));
14691 obj_conv.is_owned = false;
14692 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
14693 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
14694 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
14695 CVec_u8Z_free(arg_var);
14699 uint32_t Route_1read(void* ctx_TODO, int8_tArray ser) {
14700 LDKu8slice ser_ref;
14701 ser_ref.datalen = ser.len;
14702 ser_ref.data = ser.ptr;
14703 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14704 *ret_conv = Route_read(ser_ref);
14705 return (long)ret_conv;
14708 void RouteHint_1free(void* ctx_TODO, uint32_t this_ptr) {
14709 LDKRouteHint this_ptr_conv;
14710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14711 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14712 RouteHint_free(this_ptr_conv);
14715 uint32_t RouteHint_1clone(void* ctx_TODO, uint32_t orig) {
14716 LDKRouteHint orig_conv;
14717 orig_conv.inner = (void*)(orig & (~1));
14718 orig_conv.is_owned = false;
14719 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
14720 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14721 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14722 long ret_ref = (long)ret_var.inner;
14723 if (ret_var.is_owned) {
14729 int8_tArray RouteHint_1get_1src_1node_1id(void* ctx_TODO, uint32_t this_ptr) {
14730 LDKRouteHint this_ptr_conv;
14731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14732 this_ptr_conv.is_owned = false;
14733 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
14734 memcpy(arg_arr.ptr, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form, 33);
14738 void RouteHint_1set_1src_1node_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
14739 LDKRouteHint this_ptr_conv;
14740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14741 this_ptr_conv.is_owned = false;
14742 LDKPublicKey val_ref;
14743 CHECK(val.len == 33);
14744 memcpy(val_ref.compressed_form, val.ptr, 33);
14745 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
14748 int64_t RouteHint_1get_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
14749 LDKRouteHint this_ptr_conv;
14750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14751 this_ptr_conv.is_owned = false;
14752 int64_t ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
14756 void RouteHint_1set_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
14757 LDKRouteHint this_ptr_conv;
14758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14759 this_ptr_conv.is_owned = false;
14760 RouteHint_set_short_channel_id(&this_ptr_conv, val);
14763 uint32_t RouteHint_1get_1fees(void* ctx_TODO, uint32_t this_ptr) {
14764 LDKRouteHint this_ptr_conv;
14765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14766 this_ptr_conv.is_owned = false;
14767 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
14768 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14769 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14770 long ret_ref = (long)ret_var.inner;
14771 if (ret_var.is_owned) {
14777 void RouteHint_1set_1fees(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
14778 LDKRouteHint this_ptr_conv;
14779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14780 this_ptr_conv.is_owned = false;
14781 LDKRoutingFees val_conv;
14782 val_conv.inner = (void*)(val & (~1));
14783 val_conv.is_owned = (val & 1) || (val == 0);
14784 if (val_conv.inner != NULL)
14785 val_conv = RoutingFees_clone(&val_conv);
14786 RouteHint_set_fees(&this_ptr_conv, val_conv);
14789 int16_t RouteHint_1get_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr) {
14790 LDKRouteHint this_ptr_conv;
14791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14792 this_ptr_conv.is_owned = false;
14793 int16_t ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
14797 void RouteHint_1set_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
14798 LDKRouteHint this_ptr_conv;
14799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14800 this_ptr_conv.is_owned = false;
14801 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
14804 int64_t RouteHint_1get_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr) {
14805 LDKRouteHint this_ptr_conv;
14806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14807 this_ptr_conv.is_owned = false;
14808 int64_t ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
14812 void RouteHint_1set_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
14813 LDKRouteHint this_ptr_conv;
14814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14815 this_ptr_conv.is_owned = false;
14816 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
14819 uint32_t RouteHint_1new(void* ctx_TODO, int8_tArray src_node_id_arg, int64_t short_channel_id_arg, uint32_t fees_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg) {
14820 LDKPublicKey src_node_id_arg_ref;
14821 CHECK(src_node_id_arg.len == 33);
14822 memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg.ptr, 33);
14823 LDKRoutingFees fees_arg_conv;
14824 fees_arg_conv.inner = (void*)(fees_arg & (~1));
14825 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
14826 if (fees_arg_conv.inner != NULL)
14827 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
14828 LDKRouteHint ret_var = RouteHint_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
14829 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14830 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14831 long ret_ref = (long)ret_var.inner;
14832 if (ret_var.is_owned) {
14838 uint32_t get_1route(void* ctx_TODO, int8_tArray our_node_id, uint32_t network, int8_tArray target, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) {
14839 LDKPublicKey our_node_id_ref;
14840 CHECK(our_node_id.len == 33);
14841 memcpy(our_node_id_ref.compressed_form, our_node_id.ptr, 33);
14842 LDKNetworkGraph network_conv;
14843 network_conv.inner = (void*)(network & (~1));
14844 network_conv.is_owned = false;
14845 LDKPublicKey target_ref;
14846 CHECK(target.len == 33);
14847 memcpy(target_ref.compressed_form, target.ptr, 33);
14848 LDKCVec_ChannelDetailsZ first_hops_constr;
14849 first_hops_constr.datalen = first_hops.len;
14850 if (first_hops_constr.datalen > 0)
14851 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
14853 first_hops_constr.data = NULL;
14854 uint32_t* first_hops_vals = (uint32_t*) first_hops.ptr;
14855 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
14856 uint32_t arr_conv_16 = first_hops_vals[q];
14857 LDKChannelDetails arr_conv_16_conv;
14858 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
14859 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
14860 first_hops_constr.data[q] = arr_conv_16_conv;
14862 LDKCVec_RouteHintZ last_hops_constr;
14863 last_hops_constr.datalen = last_hops.len;
14864 if (last_hops_constr.datalen > 0)
14865 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
14867 last_hops_constr.data = NULL;
14868 uint32_t* last_hops_vals = (uint32_t*) last_hops.ptr;
14869 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
14870 uint32_t arr_conv_11 = last_hops_vals[l];
14871 LDKRouteHint arr_conv_11_conv;
14872 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
14873 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
14874 if (arr_conv_11_conv.inner != NULL)
14875 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
14876 last_hops_constr.data[l] = arr_conv_11_conv;
14878 LDKLogger logger_conv = *(LDKLogger*)logger;
14879 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
14880 *ret_conv = get_route(our_node_id_ref, &network_conv, target_ref, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
14881 FREE(first_hops_constr.data);
14882 return (long)ret_conv;
14885 void NetworkGraph_1free(void* ctx_TODO, uint32_t this_ptr) {
14886 LDKNetworkGraph this_ptr_conv;
14887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14888 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14889 NetworkGraph_free(this_ptr_conv);
14892 void LockedNetworkGraph_1free(void* ctx_TODO, uint32_t this_ptr) {
14893 LDKLockedNetworkGraph this_ptr_conv;
14894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14895 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14896 LockedNetworkGraph_free(this_ptr_conv);
14899 void NetGraphMsgHandler_1free(void* ctx_TODO, uint32_t this_ptr) {
14900 LDKNetGraphMsgHandler this_ptr_conv;
14901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14902 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14903 NetGraphMsgHandler_free(this_ptr_conv);
14906 uint32_t NetGraphMsgHandler_1new(void* ctx_TODO, int8_tArray genesis_hash, uint32_t chain_access, uint32_t logger) {
14907 LDKThirtyTwoBytes genesis_hash_ref;
14908 CHECK(genesis_hash.len == 32);
14909 memcpy(genesis_hash_ref.data, genesis_hash.ptr, 32);
14910 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
14911 LDKLogger logger_conv = *(LDKLogger*)logger;
14912 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv, logger_conv);
14913 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14914 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14915 long ret_ref = (long)ret_var.inner;
14916 if (ret_var.is_owned) {
14922 uint32_t NetGraphMsgHandler_1from_1net_1graph(void* ctx_TODO, uint32_t chain_access, uint32_t logger, uint32_t network_graph) {
14923 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
14924 LDKLogger logger_conv = *(LDKLogger*)logger;
14925 LDKNetworkGraph network_graph_conv;
14926 network_graph_conv.inner = (void*)(network_graph & (~1));
14927 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
14928 // Warning: we may need a move here but can't clone!
14929 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
14930 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14931 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14932 long ret_ref = (long)ret_var.inner;
14933 if (ret_var.is_owned) {
14939 uint32_t NetGraphMsgHandler_1read_1locked_1graph(void* ctx_TODO, uint32_t this_arg) {
14940 LDKNetGraphMsgHandler this_arg_conv;
14941 this_arg_conv.inner = (void*)(this_arg & (~1));
14942 this_arg_conv.is_owned = false;
14943 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
14944 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14945 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14946 long ret_ref = (long)ret_var.inner;
14947 if (ret_var.is_owned) {
14953 uint32_t LockedNetworkGraph_1graph(void* ctx_TODO, uint32_t this_arg) {
14954 LDKLockedNetworkGraph this_arg_conv;
14955 this_arg_conv.inner = (void*)(this_arg & (~1));
14956 this_arg_conv.is_owned = false;
14957 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
14958 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14959 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14960 long ret_ref = (long)ret_var.inner;
14961 if (ret_var.is_owned) {
14967 uint32_t NetGraphMsgHandler_1as_1RoutingMessageHandler(void* ctx_TODO, uint32_t this_arg) {
14968 LDKNetGraphMsgHandler this_arg_conv;
14969 this_arg_conv.inner = (void*)(this_arg & (~1));
14970 this_arg_conv.is_owned = false;
14971 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
14972 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
14976 uint32_t NetGraphMsgHandler_1as_1MessageSendEventsProvider(void* ctx_TODO, uint32_t this_arg) {
14977 LDKNetGraphMsgHandler this_arg_conv;
14978 this_arg_conv.inner = (void*)(this_arg & (~1));
14979 this_arg_conv.is_owned = false;
14980 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
14981 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
14985 void DirectionalChannelInfo_1free(void* ctx_TODO, uint32_t this_ptr) {
14986 LDKDirectionalChannelInfo this_ptr_conv;
14987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14988 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14989 DirectionalChannelInfo_free(this_ptr_conv);
14992 int32_t DirectionalChannelInfo_1get_1last_1update(void* ctx_TODO, uint32_t this_ptr) {
14993 LDKDirectionalChannelInfo this_ptr_conv;
14994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14995 this_ptr_conv.is_owned = false;
14996 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
15000 void DirectionalChannelInfo_1set_1last_1update(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
15001 LDKDirectionalChannelInfo this_ptr_conv;
15002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15003 this_ptr_conv.is_owned = false;
15004 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
15007 jboolean DirectionalChannelInfo_1get_1enabled(void* ctx_TODO, uint32_t this_ptr) {
15008 LDKDirectionalChannelInfo this_ptr_conv;
15009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15010 this_ptr_conv.is_owned = false;
15011 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
15015 void DirectionalChannelInfo_1set_1enabled(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
15016 LDKDirectionalChannelInfo this_ptr_conv;
15017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15018 this_ptr_conv.is_owned = false;
15019 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
15022 int16_t DirectionalChannelInfo_1get_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr) {
15023 LDKDirectionalChannelInfo this_ptr_conv;
15024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15025 this_ptr_conv.is_owned = false;
15026 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
15030 void DirectionalChannelInfo_1set_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
15031 LDKDirectionalChannelInfo this_ptr_conv;
15032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15033 this_ptr_conv.is_owned = false;
15034 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
15037 int64_t DirectionalChannelInfo_1get_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr) {
15038 LDKDirectionalChannelInfo this_ptr_conv;
15039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15040 this_ptr_conv.is_owned = false;
15041 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
15045 void DirectionalChannelInfo_1set_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
15046 LDKDirectionalChannelInfo this_ptr_conv;
15047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15048 this_ptr_conv.is_owned = false;
15049 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
15052 uint32_t DirectionalChannelInfo_1get_1fees(void* ctx_TODO, uint32_t this_ptr) {
15053 LDKDirectionalChannelInfo this_ptr_conv;
15054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15055 this_ptr_conv.is_owned = false;
15056 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
15057 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15058 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15059 long ret_ref = (long)ret_var.inner;
15060 if (ret_var.is_owned) {
15066 void DirectionalChannelInfo_1set_1fees(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
15067 LDKDirectionalChannelInfo this_ptr_conv;
15068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15069 this_ptr_conv.is_owned = false;
15070 LDKRoutingFees val_conv;
15071 val_conv.inner = (void*)(val & (~1));
15072 val_conv.is_owned = (val & 1) || (val == 0);
15073 if (val_conv.inner != NULL)
15074 val_conv = RoutingFees_clone(&val_conv);
15075 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
15078 uint32_t DirectionalChannelInfo_1get_1last_1update_1message(void* ctx_TODO, uint32_t this_ptr) {
15079 LDKDirectionalChannelInfo this_ptr_conv;
15080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15081 this_ptr_conv.is_owned = false;
15082 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
15083 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15084 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15085 long ret_ref = (long)ret_var.inner;
15086 if (ret_var.is_owned) {
15092 void DirectionalChannelInfo_1set_1last_1update_1message(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
15093 LDKDirectionalChannelInfo this_ptr_conv;
15094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15095 this_ptr_conv.is_owned = false;
15096 LDKChannelUpdate val_conv;
15097 val_conv.inner = (void*)(val & (~1));
15098 val_conv.is_owned = (val & 1) || (val == 0);
15099 if (val_conv.inner != NULL)
15100 val_conv = ChannelUpdate_clone(&val_conv);
15101 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
15104 int8_tArray DirectionalChannelInfo_1write(void* ctx_TODO, uint32_t obj) {
15105 LDKDirectionalChannelInfo obj_conv;
15106 obj_conv.inner = (void*)(obj & (~1));
15107 obj_conv.is_owned = false;
15108 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
15109 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
15110 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
15111 CVec_u8Z_free(arg_var);
15115 uint32_t DirectionalChannelInfo_1read(void* ctx_TODO, int8_tArray ser) {
15116 LDKu8slice ser_ref;
15117 ser_ref.datalen = ser.len;
15118 ser_ref.data = ser.ptr;
15119 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_read(ser_ref);
15120 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15121 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15122 long ret_ref = (long)ret_var.inner;
15123 if (ret_var.is_owned) {
15129 void ChannelInfo_1free(void* ctx_TODO, uint32_t this_ptr) {
15130 LDKChannelInfo this_ptr_conv;
15131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15132 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15133 ChannelInfo_free(this_ptr_conv);
15136 uint32_t ChannelInfo_1get_1features(void* ctx_TODO, uint32_t this_ptr) {
15137 LDKChannelInfo this_ptr_conv;
15138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15139 this_ptr_conv.is_owned = false;
15140 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
15141 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15142 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15143 long ret_ref = (long)ret_var.inner;
15144 if (ret_var.is_owned) {
15150 void ChannelInfo_1set_1features(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
15151 LDKChannelInfo this_ptr_conv;
15152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15153 this_ptr_conv.is_owned = false;
15154 LDKChannelFeatures val_conv;
15155 val_conv.inner = (void*)(val & (~1));
15156 val_conv.is_owned = (val & 1) || (val == 0);
15157 // Warning: we may need a move here but can't clone!
15158 ChannelInfo_set_features(&this_ptr_conv, val_conv);
15161 int8_tArray ChannelInfo_1get_1node_1one(void* ctx_TODO, uint32_t this_ptr) {
15162 LDKChannelInfo this_ptr_conv;
15163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15164 this_ptr_conv.is_owned = false;
15165 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
15166 memcpy(arg_arr.ptr, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form, 33);
15170 void ChannelInfo_1set_1node_1one(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
15171 LDKChannelInfo this_ptr_conv;
15172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15173 this_ptr_conv.is_owned = false;
15174 LDKPublicKey val_ref;
15175 CHECK(val.len == 33);
15176 memcpy(val_ref.compressed_form, val.ptr, 33);
15177 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
15180 uint32_t ChannelInfo_1get_1one_1to_1two(void* ctx_TODO, uint32_t this_ptr) {
15181 LDKChannelInfo this_ptr_conv;
15182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15183 this_ptr_conv.is_owned = false;
15184 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
15185 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15186 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15187 long ret_ref = (long)ret_var.inner;
15188 if (ret_var.is_owned) {
15194 void ChannelInfo_1set_1one_1to_1two(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
15195 LDKChannelInfo this_ptr_conv;
15196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15197 this_ptr_conv.is_owned = false;
15198 LDKDirectionalChannelInfo val_conv;
15199 val_conv.inner = (void*)(val & (~1));
15200 val_conv.is_owned = (val & 1) || (val == 0);
15201 // Warning: we may need a move here but can't clone!
15202 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
15205 int8_tArray ChannelInfo_1get_1node_1two(void* ctx_TODO, uint32_t this_ptr) {
15206 LDKChannelInfo this_ptr_conv;
15207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15208 this_ptr_conv.is_owned = false;
15209 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
15210 memcpy(arg_arr.ptr, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form, 33);
15214 void ChannelInfo_1set_1node_1two(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
15215 LDKChannelInfo this_ptr_conv;
15216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15217 this_ptr_conv.is_owned = false;
15218 LDKPublicKey val_ref;
15219 CHECK(val.len == 33);
15220 memcpy(val_ref.compressed_form, val.ptr, 33);
15221 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
15224 uint32_t ChannelInfo_1get_1two_1to_1one(void* ctx_TODO, uint32_t this_ptr) {
15225 LDKChannelInfo this_ptr_conv;
15226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15227 this_ptr_conv.is_owned = false;
15228 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
15229 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15230 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15231 long ret_ref = (long)ret_var.inner;
15232 if (ret_var.is_owned) {
15238 void ChannelInfo_1set_1two_1to_1one(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
15239 LDKChannelInfo this_ptr_conv;
15240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15241 this_ptr_conv.is_owned = false;
15242 LDKDirectionalChannelInfo val_conv;
15243 val_conv.inner = (void*)(val & (~1));
15244 val_conv.is_owned = (val & 1) || (val == 0);
15245 // Warning: we may need a move here but can't clone!
15246 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
15249 uint32_t ChannelInfo_1get_1announcement_1message(void* ctx_TODO, uint32_t this_ptr) {
15250 LDKChannelInfo this_ptr_conv;
15251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15252 this_ptr_conv.is_owned = false;
15253 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
15254 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15255 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15256 long ret_ref = (long)ret_var.inner;
15257 if (ret_var.is_owned) {
15263 void ChannelInfo_1set_1announcement_1message(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
15264 LDKChannelInfo this_ptr_conv;
15265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15266 this_ptr_conv.is_owned = false;
15267 LDKChannelAnnouncement val_conv;
15268 val_conv.inner = (void*)(val & (~1));
15269 val_conv.is_owned = (val & 1) || (val == 0);
15270 if (val_conv.inner != NULL)
15271 val_conv = ChannelAnnouncement_clone(&val_conv);
15272 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
15275 int8_tArray ChannelInfo_1write(void* ctx_TODO, uint32_t obj) {
15276 LDKChannelInfo obj_conv;
15277 obj_conv.inner = (void*)(obj & (~1));
15278 obj_conv.is_owned = false;
15279 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
15280 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
15281 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
15282 CVec_u8Z_free(arg_var);
15286 uint32_t ChannelInfo_1read(void* ctx_TODO, int8_tArray ser) {
15287 LDKu8slice ser_ref;
15288 ser_ref.datalen = ser.len;
15289 ser_ref.data = ser.ptr;
15290 LDKChannelInfo ret_var = ChannelInfo_read(ser_ref);
15291 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15292 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15293 long ret_ref = (long)ret_var.inner;
15294 if (ret_var.is_owned) {
15300 void RoutingFees_1free(void* ctx_TODO, uint32_t this_ptr) {
15301 LDKRoutingFees this_ptr_conv;
15302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15303 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15304 RoutingFees_free(this_ptr_conv);
15307 uint32_t RoutingFees_1clone(void* ctx_TODO, uint32_t orig) {
15308 LDKRoutingFees orig_conv;
15309 orig_conv.inner = (void*)(orig & (~1));
15310 orig_conv.is_owned = false;
15311 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
15312 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15313 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15314 long ret_ref = (long)ret_var.inner;
15315 if (ret_var.is_owned) {
15321 int32_t RoutingFees_1get_1base_1msat(void* ctx_TODO, uint32_t this_ptr) {
15322 LDKRoutingFees this_ptr_conv;
15323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15324 this_ptr_conv.is_owned = false;
15325 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
15329 void RoutingFees_1set_1base_1msat(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
15330 LDKRoutingFees this_ptr_conv;
15331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15332 this_ptr_conv.is_owned = false;
15333 RoutingFees_set_base_msat(&this_ptr_conv, val);
15336 int32_t RoutingFees_1get_1proportional_1millionths(void* ctx_TODO, uint32_t this_ptr) {
15337 LDKRoutingFees this_ptr_conv;
15338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15339 this_ptr_conv.is_owned = false;
15340 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
15344 void RoutingFees_1set_1proportional_1millionths(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
15345 LDKRoutingFees this_ptr_conv;
15346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15347 this_ptr_conv.is_owned = false;
15348 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
15351 uint32_t RoutingFees_1new(void* ctx_TODO, int32_t base_msat_arg, int32_t proportional_millionths_arg) {
15352 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
15353 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15354 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15355 long ret_ref = (long)ret_var.inner;
15356 if (ret_var.is_owned) {
15362 uint32_t RoutingFees_1read(void* ctx_TODO, int8_tArray ser) {
15363 LDKu8slice ser_ref;
15364 ser_ref.datalen = ser.len;
15365 ser_ref.data = ser.ptr;
15366 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15367 *ret_conv = RoutingFees_read(ser_ref);
15368 return (long)ret_conv;
15371 int8_tArray RoutingFees_1write(void* ctx_TODO, uint32_t obj) {
15372 LDKRoutingFees obj_conv;
15373 obj_conv.inner = (void*)(obj & (~1));
15374 obj_conv.is_owned = false;
15375 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
15376 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
15377 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
15378 CVec_u8Z_free(arg_var);
15382 void NodeAnnouncementInfo_1free(void* ctx_TODO, uint32_t this_ptr) {
15383 LDKNodeAnnouncementInfo this_ptr_conv;
15384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15385 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15386 NodeAnnouncementInfo_free(this_ptr_conv);
15389 uint32_t NodeAnnouncementInfo_1get_1features(void* ctx_TODO, uint32_t this_ptr) {
15390 LDKNodeAnnouncementInfo this_ptr_conv;
15391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15392 this_ptr_conv.is_owned = false;
15393 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
15394 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15395 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15396 long ret_ref = (long)ret_var.inner;
15397 if (ret_var.is_owned) {
15403 void NodeAnnouncementInfo_1set_1features(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
15404 LDKNodeAnnouncementInfo this_ptr_conv;
15405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15406 this_ptr_conv.is_owned = false;
15407 LDKNodeFeatures val_conv;
15408 val_conv.inner = (void*)(val & (~1));
15409 val_conv.is_owned = (val & 1) || (val == 0);
15410 // Warning: we may need a move here but can't clone!
15411 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
15414 int32_t NodeAnnouncementInfo_1get_1last_1update(void* ctx_TODO, uint32_t this_ptr) {
15415 LDKNodeAnnouncementInfo this_ptr_conv;
15416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15417 this_ptr_conv.is_owned = false;
15418 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
15422 void NodeAnnouncementInfo_1set_1last_1update(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
15423 LDKNodeAnnouncementInfo this_ptr_conv;
15424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15425 this_ptr_conv.is_owned = false;
15426 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
15429 int8_tArray NodeAnnouncementInfo_1get_1rgb(void* ctx_TODO, uint32_t this_ptr) {
15430 LDKNodeAnnouncementInfo this_ptr_conv;
15431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15432 this_ptr_conv.is_owned = false;
15433 int8_tArray ret_arr = { .len = 3, .ptr = MALLOC(3, "Native int8_tArray Bytes") };
15434 memcpy(ret_arr.ptr, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
15438 void NodeAnnouncementInfo_1set_1rgb(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
15439 LDKNodeAnnouncementInfo this_ptr_conv;
15440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15441 this_ptr_conv.is_owned = false;
15442 LDKThreeBytes val_ref;
15443 CHECK(val.len == 3);
15444 memcpy(val_ref.data, val.ptr, 3);
15445 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
15448 int8_tArray NodeAnnouncementInfo_1get_1alias(void* ctx_TODO, uint32_t this_ptr) {
15449 LDKNodeAnnouncementInfo this_ptr_conv;
15450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15451 this_ptr_conv.is_owned = false;
15452 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
15453 memcpy(ret_arr.ptr, *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
15457 void NodeAnnouncementInfo_1set_1alias(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
15458 LDKNodeAnnouncementInfo this_ptr_conv;
15459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15460 this_ptr_conv.is_owned = false;
15461 LDKThirtyTwoBytes val_ref;
15462 CHECK(val.len == 32);
15463 memcpy(val_ref.data, val.ptr, 32);
15464 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
15467 void NodeAnnouncementInfo_1set_1addresses(void* ctx_TODO, uint32_t this_ptr, uint32_tArray val) {
15468 LDKNodeAnnouncementInfo this_ptr_conv;
15469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15470 this_ptr_conv.is_owned = false;
15471 LDKCVec_NetAddressZ val_constr;
15472 val_constr.datalen = val.len;
15473 if (val_constr.datalen > 0)
15474 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15476 val_constr.data = NULL;
15477 uint32_t* val_vals = (uint32_t*) val.ptr;
15478 for (size_t m = 0; m < val_constr.datalen; m++) {
15479 uint32_t arr_conv_12 = val_vals[m];
15480 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
15481 FREE((void*)arr_conv_12);
15482 val_constr.data[m] = arr_conv_12_conv;
15484 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
15487 uint32_t NodeAnnouncementInfo_1get_1announcement_1message(void* ctx_TODO, uint32_t this_ptr) {
15488 LDKNodeAnnouncementInfo this_ptr_conv;
15489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15490 this_ptr_conv.is_owned = false;
15491 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
15492 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15493 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15494 long ret_ref = (long)ret_var.inner;
15495 if (ret_var.is_owned) {
15501 void NodeAnnouncementInfo_1set_1announcement_1message(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
15502 LDKNodeAnnouncementInfo this_ptr_conv;
15503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15504 this_ptr_conv.is_owned = false;
15505 LDKNodeAnnouncement val_conv;
15506 val_conv.inner = (void*)(val & (~1));
15507 val_conv.is_owned = (val & 1) || (val == 0);
15508 if (val_conv.inner != NULL)
15509 val_conv = NodeAnnouncement_clone(&val_conv);
15510 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
15513 uint32_t NodeAnnouncementInfo_1new(void* ctx_TODO, uint32_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, int8_tArray alias_arg, uint32_tArray addresses_arg, uint32_t announcement_message_arg) {
15514 LDKNodeFeatures features_arg_conv;
15515 features_arg_conv.inner = (void*)(features_arg & (~1));
15516 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
15517 // Warning: we may need a move here but can't clone!
15518 LDKThreeBytes rgb_arg_ref;
15519 CHECK(rgb_arg.len == 3);
15520 memcpy(rgb_arg_ref.data, rgb_arg.ptr, 3);
15521 LDKThirtyTwoBytes alias_arg_ref;
15522 CHECK(alias_arg.len == 32);
15523 memcpy(alias_arg_ref.data, alias_arg.ptr, 32);
15524 LDKCVec_NetAddressZ addresses_arg_constr;
15525 addresses_arg_constr.datalen = addresses_arg.len;
15526 if (addresses_arg_constr.datalen > 0)
15527 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15529 addresses_arg_constr.data = NULL;
15530 uint32_t* addresses_arg_vals = (uint32_t*) addresses_arg.ptr;
15531 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
15532 uint32_t arr_conv_12 = addresses_arg_vals[m];
15533 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
15534 FREE((void*)arr_conv_12);
15535 addresses_arg_constr.data[m] = arr_conv_12_conv;
15537 LDKNodeAnnouncement announcement_message_arg_conv;
15538 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
15539 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
15540 if (announcement_message_arg_conv.inner != NULL)
15541 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
15542 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
15543 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15544 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15545 long ret_ref = (long)ret_var.inner;
15546 if (ret_var.is_owned) {
15552 int8_tArray NodeAnnouncementInfo_1write(void* ctx_TODO, uint32_t obj) {
15553 LDKNodeAnnouncementInfo obj_conv;
15554 obj_conv.inner = (void*)(obj & (~1));
15555 obj_conv.is_owned = false;
15556 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
15557 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
15558 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
15559 CVec_u8Z_free(arg_var);
15563 uint32_t NodeAnnouncementInfo_1read(void* ctx_TODO, int8_tArray ser) {
15564 LDKu8slice ser_ref;
15565 ser_ref.datalen = ser.len;
15566 ser_ref.data = ser.ptr;
15567 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15568 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
15569 return (long)ret_conv;
15572 void NodeInfo_1free(void* ctx_TODO, uint32_t this_ptr) {
15573 LDKNodeInfo this_ptr_conv;
15574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15575 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15576 NodeInfo_free(this_ptr_conv);
15579 void NodeInfo_1set_1channels(void* ctx_TODO, uint32_t this_ptr, int64_tArray val) {
15580 LDKNodeInfo this_ptr_conv;
15581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15582 this_ptr_conv.is_owned = false;
15583 LDKCVec_u64Z val_constr;
15584 val_constr.datalen = val.len;
15585 if (val_constr.datalen > 0)
15586 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15588 val_constr.data = NULL;
15589 int64_t* val_vals = (int64_t*) val.ptr;
15590 for (size_t i = 0; i < val_constr.datalen; i++) {
15591 int64_t arr_conv_8 = val_vals[i];
15592 val_constr.data[i] = arr_conv_8;
15594 NodeInfo_set_channels(&this_ptr_conv, val_constr);
15597 uint32_t NodeInfo_1get_1lowest_1inbound_1channel_1fees(void* ctx_TODO, uint32_t this_ptr) {
15598 LDKNodeInfo this_ptr_conv;
15599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15600 this_ptr_conv.is_owned = false;
15601 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
15602 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15603 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15604 long ret_ref = (long)ret_var.inner;
15605 if (ret_var.is_owned) {
15611 void NodeInfo_1set_1lowest_1inbound_1channel_1fees(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
15612 LDKNodeInfo this_ptr_conv;
15613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15614 this_ptr_conv.is_owned = false;
15615 LDKRoutingFees val_conv;
15616 val_conv.inner = (void*)(val & (~1));
15617 val_conv.is_owned = (val & 1) || (val == 0);
15618 if (val_conv.inner != NULL)
15619 val_conv = RoutingFees_clone(&val_conv);
15620 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
15623 uint32_t NodeInfo_1get_1announcement_1info(void* ctx_TODO, uint32_t this_ptr) {
15624 LDKNodeInfo this_ptr_conv;
15625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15626 this_ptr_conv.is_owned = false;
15627 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
15628 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15629 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15630 long ret_ref = (long)ret_var.inner;
15631 if (ret_var.is_owned) {
15637 void NodeInfo_1set_1announcement_1info(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
15638 LDKNodeInfo this_ptr_conv;
15639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15640 this_ptr_conv.is_owned = false;
15641 LDKNodeAnnouncementInfo val_conv;
15642 val_conv.inner = (void*)(val & (~1));
15643 val_conv.is_owned = (val & 1) || (val == 0);
15644 // Warning: we may need a move here but can't clone!
15645 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
15648 uint32_t NodeInfo_1new(void* ctx_TODO, int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
15649 LDKCVec_u64Z channels_arg_constr;
15650 channels_arg_constr.datalen = channels_arg.len;
15651 if (channels_arg_constr.datalen > 0)
15652 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15654 channels_arg_constr.data = NULL;
15655 int64_t* channels_arg_vals = (int64_t*) channels_arg.ptr;
15656 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
15657 int64_t arr_conv_8 = channels_arg_vals[i];
15658 channels_arg_constr.data[i] = arr_conv_8;
15660 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
15661 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
15662 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
15663 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
15664 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
15665 LDKNodeAnnouncementInfo announcement_info_arg_conv;
15666 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
15667 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
15668 // Warning: we may need a move here but can't clone!
15669 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
15670 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15671 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15672 long ret_ref = (long)ret_var.inner;
15673 if (ret_var.is_owned) {
15679 int8_tArray NodeInfo_1write(void* ctx_TODO, uint32_t obj) {
15680 LDKNodeInfo obj_conv;
15681 obj_conv.inner = (void*)(obj & (~1));
15682 obj_conv.is_owned = false;
15683 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
15684 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
15685 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
15686 CVec_u8Z_free(arg_var);
15690 uint32_t NodeInfo_1read(void* ctx_TODO, int8_tArray ser) {
15691 LDKu8slice ser_ref;
15692 ser_ref.datalen = ser.len;
15693 ser_ref.data = ser.ptr;
15694 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
15695 *ret_conv = NodeInfo_read(ser_ref);
15696 return (long)ret_conv;
15699 int8_tArray NetworkGraph_1write(void* ctx_TODO, uint32_t obj) {
15700 LDKNetworkGraph obj_conv;
15701 obj_conv.inner = (void*)(obj & (~1));
15702 obj_conv.is_owned = false;
15703 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
15704 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
15705 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
15706 CVec_u8Z_free(arg_var);
15710 uint32_t NetworkGraph_1read(void* ctx_TODO, int8_tArray ser) {
15711 LDKu8slice ser_ref;
15712 ser_ref.datalen = ser.len;
15713 ser_ref.data = ser.ptr;
15714 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
15715 *ret_conv = NetworkGraph_read(ser_ref);
15716 return (long)ret_conv;
15719 uint32_t NetworkGraph_1new(void* ctx_TODO, int8_tArray genesis_hash) {
15720 LDKThirtyTwoBytes genesis_hash_ref;
15721 CHECK(genesis_hash.len == 32);
15722 memcpy(genesis_hash_ref.data, genesis_hash.ptr, 32);
15723 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
15724 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15725 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15726 long ret_ref = (long)ret_var.inner;
15727 if (ret_var.is_owned) {
15733 uint32_t NetworkGraph_1update_1node_1from_1announcement(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
15734 LDKNetworkGraph this_arg_conv;
15735 this_arg_conv.inner = (void*)(this_arg & (~1));
15736 this_arg_conv.is_owned = false;
15737 LDKNodeAnnouncement msg_conv;
15738 msg_conv.inner = (void*)(msg & (~1));
15739 msg_conv.is_owned = false;
15740 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15741 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
15742 return (long)ret_conv;
15745 uint32_t NetworkGraph_1update_1node_1from_1unsigned_1announcement(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
15746 LDKNetworkGraph this_arg_conv;
15747 this_arg_conv.inner = (void*)(this_arg & (~1));
15748 this_arg_conv.is_owned = false;
15749 LDKUnsignedNodeAnnouncement msg_conv;
15750 msg_conv.inner = (void*)(msg & (~1));
15751 msg_conv.is_owned = false;
15752 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15753 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
15754 return (long)ret_conv;
15757 uint32_t NetworkGraph_1update_1channel_1from_1announcement(void* ctx_TODO, uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
15758 LDKNetworkGraph this_arg_conv;
15759 this_arg_conv.inner = (void*)(this_arg & (~1));
15760 this_arg_conv.is_owned = false;
15761 LDKChannelAnnouncement msg_conv;
15762 msg_conv.inner = (void*)(msg & (~1));
15763 msg_conv.is_owned = false;
15764 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
15765 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15766 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
15767 return (long)ret_conv;
15770 uint32_t NetworkGraph_1update_1channel_1from_1unsigned_1announcement(void* ctx_TODO, uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
15771 LDKNetworkGraph this_arg_conv;
15772 this_arg_conv.inner = (void*)(this_arg & (~1));
15773 this_arg_conv.is_owned = false;
15774 LDKUnsignedChannelAnnouncement msg_conv;
15775 msg_conv.inner = (void*)(msg & (~1));
15776 msg_conv.is_owned = false;
15777 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
15778 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15779 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
15780 return (long)ret_conv;
15783 void NetworkGraph_1close_1channel_1from_1update(void* ctx_TODO, uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
15784 LDKNetworkGraph this_arg_conv;
15785 this_arg_conv.inner = (void*)(this_arg & (~1));
15786 this_arg_conv.is_owned = false;
15787 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
15790 uint32_t NetworkGraph_1update_1channel(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
15791 LDKNetworkGraph this_arg_conv;
15792 this_arg_conv.inner = (void*)(this_arg & (~1));
15793 this_arg_conv.is_owned = false;
15794 LDKChannelUpdate msg_conv;
15795 msg_conv.inner = (void*)(msg & (~1));
15796 msg_conv.is_owned = false;
15797 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15798 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
15799 return (long)ret_conv;
15802 uint32_t NetworkGraph_1update_1channel_1unsigned(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
15803 LDKNetworkGraph this_arg_conv;
15804 this_arg_conv.inner = (void*)(this_arg & (~1));
15805 this_arg_conv.is_owned = false;
15806 LDKUnsignedChannelUpdate msg_conv;
15807 msg_conv.inner = (void*)(msg & (~1));
15808 msg_conv.is_owned = false;
15809 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15810 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
15811 return (long)ret_conv;