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(scalar 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 int8_tArray {uint32_t len;int8_t *ptr;} int8_tArray;
112 typedef bool jboolean;
114 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
115 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
117 case 0: return LDKAccessError_UnknownChain;
118 case 1: return LDKAccessError_UnknownTx;
122 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
124 case LDKAccessError_UnknownChain: return 0;
125 case LDKAccessError_UnknownTx: return 1;
129 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
131 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
132 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
136 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
138 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
139 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
143 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
145 case 0: return LDKConfirmationTarget_Background;
146 case 1: return LDKConfirmationTarget_Normal;
147 case 2: return LDKConfirmationTarget_HighPriority;
151 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
153 case LDKConfirmationTarget_Background: return 0;
154 case LDKConfirmationTarget_Normal: return 1;
155 case LDKConfirmationTarget_HighPriority: return 2;
159 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
161 case 0: return LDKLevel_Off;
162 case 1: return LDKLevel_Error;
163 case 2: return LDKLevel_Warn;
164 case 3: return LDKLevel_Info;
165 case 4: return LDKLevel_Debug;
166 case 5: return LDKLevel_Trace;
170 static inline int32_t LDKLevel_to_js(LDKLevel val) {
172 case LDKLevel_Off: return 0;
173 case LDKLevel_Error: return 1;
174 case LDKLevel_Warn: return 2;
175 case LDKLevel_Info: return 3;
176 case LDKLevel_Debug: return 4;
177 case LDKLevel_Trace: return 5;
181 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
183 case 0: return LDKNetwork_Bitcoin;
184 case 1: return LDKNetwork_Testnet;
185 case 2: return LDKNetwork_Regtest;
189 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
191 case LDKNetwork_Bitcoin: return 0;
192 case LDKNetwork_Testnet: return 1;
193 case LDKNetwork_Regtest: return 2;
197 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
199 case 0: return LDKSecp256k1Error_IncorrectSignature;
200 case 1: return LDKSecp256k1Error_InvalidMessage;
201 case 2: return LDKSecp256k1Error_InvalidPublicKey;
202 case 3: return LDKSecp256k1Error_InvalidSignature;
203 case 4: return LDKSecp256k1Error_InvalidSecretKey;
204 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
205 case 6: return LDKSecp256k1Error_InvalidTweak;
206 case 7: return LDKSecp256k1Error_NotEnoughMemory;
207 case 8: return LDKSecp256k1Error_CallbackPanicked;
211 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
213 case LDKSecp256k1Error_IncorrectSignature: return 0;
214 case LDKSecp256k1Error_InvalidMessage: return 1;
215 case LDKSecp256k1Error_InvalidPublicKey: return 2;
216 case LDKSecp256k1Error_InvalidSignature: return 3;
217 case LDKSecp256k1Error_InvalidSecretKey: return 4;
218 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
219 case LDKSecp256k1Error_InvalidTweak: return 6;
220 case LDKSecp256k1Error_NotEnoughMemory: return 7;
221 case LDKSecp256k1Error_CallbackPanicked: return 8;
225 uint32_t LDKCVec_1u8Z_1new(void* ctx_TODO, int8_tArray elems) {
226 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
227 ret->datalen = elems.len;
228 if (ret->datalen == 0) {
231 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
232 int8_t *java_elems = elems.ptr;
233 for (size_t i = 0; i < ret->datalen; i++) {
234 ret->data[i] = java_elems[i];
239 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
240 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
241 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
244 uint32_t LDKC2Tuple_1u64u64Z_1new(void* ctx_TODO, int64_t a, int64_t b) {
245 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
250 static inline LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const LDKC2Tuple_u64u64Z *orig) {
251 LDKC2Tuple_u64u64Z ret = {
257 int64_t LDKC2Tuple_1u64u64Z_1get_1a(void* ctx_TODO, uint32_t ptr) {
258 LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)ptr;
261 int64_t LDKC2Tuple_1u64u64Z_1get_1b(void* ctx_TODO, uint32_t ptr) {
262 LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)ptr;
265 uint32_t LDKSpendableOutputDescriptor_1ref_1from_1ptr (void* ctx_TODO, uint32_t ptr) {
266 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
268 case LDKSpendableOutputDescriptor_StaticOutput: {
269 LDKOutPoint outpoint_var = obj->static_output.outpoint;
270 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
271 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
272 long outpoint_ref = (long)outpoint_var.inner & ~1;
273 long output_ref = (long)&obj->static_output.output;
274 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (long)output_ref;
276 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
277 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
278 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
279 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
280 long outpoint_ref = (long)outpoint_var.inner & ~1;
281 int8_tArray per_commitment_point_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
282 memcpy(per_commitment_point_arr.ptr, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form, 33);
283 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
284 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
285 int8_tArray revocation_pubkey_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
286 memcpy(revocation_pubkey_arr.ptr, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form, 33);
287 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;
289 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
290 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
291 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
292 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
293 long outpoint_ref = (long)outpoint_var.inner & ~1;
294 long output_ref = (long)&obj->static_output_counterparty_payment.output;
295 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
296 return 0 /* LDKSpendableOutputDescriptor - StaticOutputCounterpartyPayment */; (void) outpoint_ref; (void) (long)output_ref; (void) key_derivation_params_ref;
301 uint32_t LDKCVec_1SpendableOutputDescriptorZ_1new(void* ctx_TODO, uint32_tArray elems) {
302 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
303 ret->datalen = elems.len;
304 if (ret->datalen == 0) {
307 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
308 uint32_t *java_elems = elems.ptr;
309 for (size_t i = 0; i < ret->datalen; i++) {
310 uint32_t arr_elem = java_elems[i];
311 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
312 FREE((void*)arr_elem);
313 ret->data[i] = arr_elem_conv;
318 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
319 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
320 for (size_t i = 0; i < ret.datalen; i++) {
321 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
325 uint32_t LDKErrorAction_1ref_1from_1ptr (void* ctx_TODO, uint32_t ptr) {
326 LDKErrorAction *obj = (LDKErrorAction*)ptr;
328 case LDKErrorAction_DisconnectPeer: {
329 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
330 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
331 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
332 long msg_ref = (long)msg_var.inner & ~1;
333 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
335 case LDKErrorAction_IgnoreError: {
336 return 0 /* LDKErrorAction - IgnoreError */;
338 case LDKErrorAction_SendErrorMessage: {
339 LDKErrorMessage msg_var = obj->send_error_message.msg;
340 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
341 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
342 long msg_ref = (long)msg_var.inner & ~1;
343 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
348 uint32_t LDKHTLCFailChannelUpdate_1ref_1from_1ptr (void* ctx_TODO, uint32_t ptr) {
349 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
351 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
352 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
353 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
354 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
355 long msg_ref = (long)msg_var.inner & ~1;
356 return 0 /* LDKHTLCFailChannelUpdate - ChannelUpdateMessage */; (void) msg_ref;
358 case LDKHTLCFailChannelUpdate_ChannelClosed: {
359 return 0 /* LDKHTLCFailChannelUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
361 case LDKHTLCFailChannelUpdate_NodeFailure: {
362 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
363 memcpy(node_id_arr.ptr, obj->node_failure.node_id.compressed_form, 33);
364 return 0 /* LDKHTLCFailChannelUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
369 uint32_t LDKMessageSendEvent_1ref_1from_1ptr (void* ctx_TODO, uint32_t ptr) {
370 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
372 case LDKMessageSendEvent_SendAcceptChannel: {
373 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
374 memcpy(node_id_arr.ptr, obj->send_accept_channel.node_id.compressed_form, 33);
375 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
376 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
377 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
378 long msg_ref = (long)msg_var.inner & ~1;
379 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
381 case LDKMessageSendEvent_SendOpenChannel: {
382 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
383 memcpy(node_id_arr.ptr, obj->send_open_channel.node_id.compressed_form, 33);
384 LDKOpenChannel msg_var = obj->send_open_channel.msg;
385 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
386 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
387 long msg_ref = (long)msg_var.inner & ~1;
388 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
390 case LDKMessageSendEvent_SendFundingCreated: {
391 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
392 memcpy(node_id_arr.ptr, obj->send_funding_created.node_id.compressed_form, 33);
393 LDKFundingCreated msg_var = obj->send_funding_created.msg;
394 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
395 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
396 long msg_ref = (long)msg_var.inner & ~1;
397 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
399 case LDKMessageSendEvent_SendFundingSigned: {
400 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
401 memcpy(node_id_arr.ptr, obj->send_funding_signed.node_id.compressed_form, 33);
402 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
403 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
404 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
405 long msg_ref = (long)msg_var.inner & ~1;
406 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
408 case LDKMessageSendEvent_SendFundingLocked: {
409 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
410 memcpy(node_id_arr.ptr, obj->send_funding_locked.node_id.compressed_form, 33);
411 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
412 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
413 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
414 long msg_ref = (long)msg_var.inner & ~1;
415 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
417 case LDKMessageSendEvent_SendAnnouncementSignatures: {
418 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
419 memcpy(node_id_arr.ptr, obj->send_announcement_signatures.node_id.compressed_form, 33);
420 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
421 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
422 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
423 long msg_ref = (long)msg_var.inner & ~1;
424 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
426 case LDKMessageSendEvent_UpdateHTLCs: {
427 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
428 memcpy(node_id_arr.ptr, obj->update_htl_cs.node_id.compressed_form, 33);
429 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
430 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
431 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
432 long updates_ref = (long)updates_var.inner & ~1;
433 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
435 case LDKMessageSendEvent_SendRevokeAndACK: {
436 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
437 memcpy(node_id_arr.ptr, obj->send_revoke_and_ack.node_id.compressed_form, 33);
438 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
439 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
440 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
441 long msg_ref = (long)msg_var.inner & ~1;
442 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
444 case LDKMessageSendEvent_SendClosingSigned: {
445 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
446 memcpy(node_id_arr.ptr, obj->send_closing_signed.node_id.compressed_form, 33);
447 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
448 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
449 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
450 long msg_ref = (long)msg_var.inner & ~1;
451 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
453 case LDKMessageSendEvent_SendShutdown: {
454 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
455 memcpy(node_id_arr.ptr, obj->send_shutdown.node_id.compressed_form, 33);
456 LDKShutdown msg_var = obj->send_shutdown.msg;
457 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
458 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
459 long msg_ref = (long)msg_var.inner & ~1;
460 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
462 case LDKMessageSendEvent_SendChannelReestablish: {
463 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
464 memcpy(node_id_arr.ptr, obj->send_channel_reestablish.node_id.compressed_form, 33);
465 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
466 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
467 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
468 long msg_ref = (long)msg_var.inner & ~1;
469 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
471 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
472 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
473 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
474 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
475 long msg_ref = (long)msg_var.inner & ~1;
476 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
477 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
478 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
479 long update_msg_ref = (long)update_msg_var.inner & ~1;
480 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
482 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
483 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
484 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
485 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
486 long msg_ref = (long)msg_var.inner & ~1;
487 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
489 case LDKMessageSendEvent_BroadcastChannelUpdate: {
490 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
491 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
492 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
493 long msg_ref = (long)msg_var.inner & ~1;
494 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
496 case LDKMessageSendEvent_HandleError: {
497 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
498 memcpy(node_id_arr.ptr, obj->handle_error.node_id.compressed_form, 33);
499 long action_ref = (long)&obj->handle_error.action;
500 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
502 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
503 long update_ref = (long)&obj->payment_failure_network_update.update;
504 return 0 /* LDKMessageSendEvent - PaymentFailureNetworkUpdate */; (void) update_ref;
506 case LDKMessageSendEvent_SendChannelRangeQuery: {
507 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
508 memcpy(node_id_arr.ptr, obj->send_channel_range_query.node_id.compressed_form, 33);
509 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
510 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
511 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
512 long msg_ref = (long)msg_var.inner & ~1;
513 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
515 case LDKMessageSendEvent_SendShortIdsQuery: {
516 int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
517 memcpy(node_id_arr.ptr, obj->send_short_ids_query.node_id.compressed_form, 33);
518 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
519 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
520 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
521 long msg_ref = (long)msg_var.inner & ~1;
522 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
527 uint32_t LDKCVec_1MessageSendEventZ_1new(void* ctx_TODO, uint32_tArray elems) {
528 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
529 ret->datalen = elems.len;
530 if (ret->datalen == 0) {
533 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
534 uint32_t *java_elems = elems.ptr;
535 for (size_t i = 0; i < ret->datalen; i++) {
536 uint32_t arr_elem = java_elems[i];
537 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
538 FREE((void*)arr_elem);
539 ret->data[i] = arr_elem_conv;
544 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
545 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
546 for (size_t i = 0; i < ret.datalen; i++) {
547 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
551 uint32_t LDKEvent_1ref_1from_1ptr (void* ctx_TODO, uint32_t ptr) {
552 LDKEvent *obj = (LDKEvent*)ptr;
554 case LDKEvent_FundingGenerationReady: {
555 int8_tArray temporary_channel_id_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
556 memcpy(temporary_channel_id_arr.ptr, obj->funding_generation_ready.temporary_channel_id.data, 32);
557 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
558 int8_tArray output_script_arr = { .len = output_script_var.datalen, .ptr = MALLOC(output_script_var.datalen, "Native int8_tArray Bytes") };
559 memcpy(output_script_arr.ptr, output_script_var.data, output_script_var.datalen);
560 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;
562 case LDKEvent_FundingBroadcastSafe: {
563 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
564 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
565 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
566 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
567 return 0 /* LDKEvent - FundingBroadcastSafe */; (void) funding_txo_ref; (void) obj->funding_broadcast_safe.user_channel_id;
569 case LDKEvent_PaymentReceived: {
570 int8_tArray payment_hash_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
571 memcpy(payment_hash_arr.ptr, obj->payment_received.payment_hash.data, 32);
572 int8_tArray payment_secret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
573 memcpy(payment_secret_arr.ptr, obj->payment_received.payment_secret.data, 32);
574 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) payment_secret_arr; (void) obj->payment_received.amt;
576 case LDKEvent_PaymentSent: {
577 int8_tArray payment_preimage_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
578 memcpy(payment_preimage_arr.ptr, obj->payment_sent.payment_preimage.data, 32);
579 return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr;
581 case LDKEvent_PaymentFailed: {
582 int8_tArray payment_hash_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
583 memcpy(payment_hash_arr.ptr, obj->payment_failed.payment_hash.data, 32);
584 return 0 /* LDKEvent - PaymentFailed */; (void) payment_hash_arr; (void) obj->payment_failed.rejected_by_dest;
586 case LDKEvent_PendingHTLCsForwardable: {
587 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
589 case LDKEvent_SpendableOutputs: {
590 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
591 uint32_tArray outputs_arr = { .len = outputs_var.datalen, .ptr = MALLOC(outputs_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
592 uint32_t *outputs_arr_ptr = outputs_arr.ptr;
593 for (size_t b = 0; b < outputs_var.datalen; b++) {
594 long arr_conv_27_ref = (long)&outputs_var.data[b];
595 outputs_arr_ptr[b] = arr_conv_27_ref;
597 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
602 uint32_t LDKCVec_1EventZ_1new(void* ctx_TODO, uint32_tArray elems) {
603 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
604 ret->datalen = elems.len;
605 if (ret->datalen == 0) {
608 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
609 uint32_t *java_elems = elems.ptr;
610 for (size_t i = 0; i < ret->datalen; i++) {
611 uint32_t arr_elem = java_elems[i];
612 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
613 FREE((void*)arr_elem);
614 ret->data[i] = arr_elem_conv;
619 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
620 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
621 for (size_t i = 0; i < ret.datalen; i++) {
622 ret.data[i] = Event_clone(&orig->data[i]);
626 uint32_t LDKC2Tuple_1usizeTransactionZ_1new(void* ctx_TODO, int64_t a, int8_tArray b) {
627 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
629 LDKTransaction b_ref;
630 b_ref.datalen = b.len;
631 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
632 memcpy(b_ref.data, b.ptr, b_ref.datalen);
633 b_ref.data_is_owned = false;
637 int64_t LDKC2Tuple_1usizeTransactionZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
638 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)ptr;
641 int8_tArray LDKC2Tuple_1usizeTransactionZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
642 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)ptr;
643 LDKTransaction b_var = tuple->b;
644 int8_tArray b_arr = { .len = b_var.datalen, .ptr = MALLOC(b_var.datalen, "Native int8_tArray Bytes") };
645 memcpy(b_arr.ptr, b_var.data, b_var.datalen);
648 uint32_t LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(void* ctx_TODO, uint32_tArray elems) {
649 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
650 ret->datalen = elems.len;
651 if (ret->datalen == 0) {
654 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
655 uint32_t *java_elems = elems.ptr;
656 for (size_t i = 0; i < ret->datalen; i++) {
657 uint32_t arr_elem = java_elems[i];
658 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_elem;
659 FREE((void*)arr_elem);
660 ret->data[i] = arr_elem_conv;
665 jboolean LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
666 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
668 void LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
669 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
670 CHECK(val->result_ok);
671 return *val->contents.result;
673 uint32_t LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err (void* ctx_TODO, uint32_t arg) {
674 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
675 CHECK(!val->result_ok);
676 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
679 static inline LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const LDKCResult_NoneChannelMonitorUpdateErrZ *orig) {
680 LDKCResult_NoneChannelMonitorUpdateErrZ res = { .result_ok = orig->result_ok };
681 if (orig->result_ok) {
682 res.contents.result = NULL;
684 LDKChannelMonitorUpdateErr* contents = MALLOC(sizeof(LDKChannelMonitorUpdateErr), "LDKChannelMonitorUpdateErr result Err clone");
685 *contents = ChannelMonitorUpdateErr_clone(orig->contents.err);
686 res.contents.err = contents;
690 uint32_t LDKCVec_1MonitorEventZ_1new(void* ctx_TODO, uint32_tArray elems) {
691 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
692 ret->datalen = elems.len;
693 if (ret->datalen == 0) {
696 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
697 uint32_t *java_elems = elems.ptr;
698 for (size_t i = 0; i < ret->datalen; i++) {
699 uint32_t arr_elem = java_elems[i];
700 LDKMonitorEvent arr_elem_conv;
701 arr_elem_conv.inner = (void*)(arr_elem & (~1));
702 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
703 if (arr_elem_conv.inner != NULL)
704 arr_elem_conv = MonitorEvent_clone(&arr_elem_conv);
705 ret->data[i] = arr_elem_conv;
710 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
711 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
712 for (size_t i = 0; i < ret.datalen; i++) {
713 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
717 jboolean LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
718 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
720 uint32_t LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
721 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg;
722 CHECK(val->result_ok);
723 LDKChannelMonitorUpdate res_var = (*val->contents.result);
724 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
725 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
726 long res_ref = (long)res_var.inner & ~1;
729 uint32_t LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
730 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg;
731 CHECK(!val->result_ok);
732 LDKDecodeError err_var = (*val->contents.err);
733 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
734 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
735 long err_ref = (long)err_var.inner & ~1;
738 jboolean LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
739 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
741 void LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
742 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
743 CHECK(val->result_ok);
744 return *val->contents.result;
746 uint32_t LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
747 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
748 CHECK(!val->result_ok);
749 LDKMonitorUpdateError err_var = (*val->contents.err);
750 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
751 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
752 long err_ref = (long)err_var.inner & ~1;
755 uint32_t LDKC2Tuple_1OutPointScriptZ_1new(void* ctx_TODO, uint32_t a, int8_tArray b) {
756 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
758 a_conv.inner = (void*)(a & (~1));
759 a_conv.is_owned = (a & 1) || (a == 0);
760 if (a_conv.inner != NULL)
761 a_conv = OutPoint_clone(&a_conv);
764 b_ref.datalen = b.len;
765 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
766 memcpy(b_ref.data, b.ptr, b_ref.datalen);
770 static inline LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const LDKC2Tuple_OutPointScriptZ *orig) {
771 LDKC2Tuple_OutPointScriptZ ret = {
772 .a = OutPoint_clone(&orig->a),
773 .b = CVec_u8Z_clone(&orig->b),
777 uint32_t LDKC2Tuple_1OutPointScriptZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
778 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)ptr;
779 LDKOutPoint a_var = tuple->a;
780 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
781 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
782 long a_ref = (long)a_var.inner & ~1;
785 int8_tArray LDKC2Tuple_1OutPointScriptZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
786 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)ptr;
787 LDKCVec_u8Z b_var = tuple->b;
788 int8_tArray b_arr = { .len = b_var.datalen, .ptr = MALLOC(b_var.datalen, "Native int8_tArray Bytes") };
789 memcpy(b_arr.ptr, b_var.data, b_var.datalen);
792 uint32_t LDKC2Tuple_1u32TxOutZ_1new(void* ctx_TODO, int32_t a, uint32_t b) {
793 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
795 LDKTxOut b_conv = *(LDKTxOut*)b;
800 int32_t LDKC2Tuple_1u32TxOutZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
801 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)ptr;
804 uint32_t LDKC2Tuple_1u32TxOutZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
805 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)ptr;
806 long b_ref = (long)&tuple->b;
809 uint32_t LDKCVec_1C2Tuple_1u32TxOutZZ_1new(void* ctx_TODO, uint32_tArray elems) {
810 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
811 ret->datalen = elems.len;
812 if (ret->datalen == 0) {
815 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
816 uint32_t *java_elems = elems.ptr;
817 for (size_t i = 0; i < ret->datalen; i++) {
818 uint32_t arr_elem = java_elems[i];
819 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)arr_elem;
820 FREE((void*)arr_elem);
821 ret->data[i] = arr_elem_conv;
826 uint32_t LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(void* ctx_TODO, int8_tArray a, uint32_tArray b) {
827 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
828 LDKThirtyTwoBytes a_ref;
830 memcpy(a_ref.data, a.ptr, 32);
832 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
833 b_constr.datalen = b.len;
834 if (b_constr.datalen > 0)
835 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
837 b_constr.data = NULL;
838 uint32_t* b_vals = (uint32_t*) b.ptr;
839 for (size_t a = 0; a < b_constr.datalen; a++) {
840 uint32_t arr_conv_26 = b_vals[a];
841 LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)arr_conv_26;
842 FREE((void*)arr_conv_26);
843 b_constr.data[a] = arr_conv_26_conv;
848 int8_tArray LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
849 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)ptr;
850 int8_tArray a_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
851 memcpy(a_arr.ptr, tuple->a.data, 32);
854 uint32_tArray LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
855 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)ptr;
856 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
857 uint32_tArray b_arr = { .len = b_var.datalen, .ptr = MALLOC(b_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
858 uint32_t *b_arr_ptr = b_arr.ptr;
859 for (size_t a = 0; a < b_var.datalen; a++) {
860 long arr_conv_26_ref = (long)&b_var.data[a];
861 b_arr_ptr[a] = arr_conv_26_ref;
865 uint32_t LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(void* ctx_TODO, uint32_tArray elems) {
866 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
867 ret->datalen = elems.len;
868 if (ret->datalen == 0) {
871 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
872 uint32_t *java_elems = elems.ptr;
873 for (size_t i = 0; i < ret->datalen; i++) {
874 uint32_t arr_elem = java_elems[i];
875 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)arr_elem;
876 FREE((void*)arr_elem);
877 ret->data[i] = arr_elem_conv;
882 uint32_t LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(void* ctx_TODO, int8_tArray a, uint32_tArray b) {
883 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
886 memcpy(a_ref.compact_form, a.ptr, 64);
888 LDKCVec_SignatureZ b_constr;
889 b_constr.datalen = b.len;
890 if (b_constr.datalen > 0)
891 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
893 b_constr.data = NULL;
894 int8_tArray* b_vals = (int8_tArray*) b.ptr;
895 for (size_t i = 0; i < b_constr.datalen; i++) {
896 int8_tArray arr_conv_8 = b_vals[i];
897 LDKSignature arr_conv_8_ref;
898 CHECK(arr_conv_8.len == 64);
899 memcpy(arr_conv_8_ref.compact_form, arr_conv_8.ptr, 64);
900 b_constr.data[i] = arr_conv_8_ref;
905 int8_tArray LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
906 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)ptr;
907 int8_tArray a_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
908 memcpy(a_arr.ptr, tuple->a.compact_form, 64);
911 uint32_tArray LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
912 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)ptr;
913 LDKCVec_SignatureZ b_var = tuple->b;
914 uint32_tArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL);
915 for (size_t i = 0; i < b_var.datalen; i++) {
916 int8_tArray arr_conv_8_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
917 memcpy(arr_conv_8_arr.ptr, b_var.data[i].compact_form, 64);
918 (*env)->SetObjectArrayElement(env, b_arr, i, arr_conv_8_arr);
922 jboolean LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
923 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
925 uint32_t LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
926 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
927 CHECK(val->result_ok);
928 long res_ref = (long)&(*val->contents.result);
931 void LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err (void* ctx_TODO, uint32_t arg) {
932 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
933 CHECK(!val->result_ok);
934 return *val->contents.err;
936 jboolean LDKCResult_1SignatureNoneZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
937 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
939 int8_tArray LDKCResult_1SignatureNoneZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
940 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
941 CHECK(val->result_ok);
942 int8_tArray res_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
943 memcpy(res_arr.ptr, (*val->contents.result).compact_form, 64);
946 void LDKCResult_1SignatureNoneZ_1get_1err (void* ctx_TODO, uint32_t arg) {
947 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
948 CHECK(!val->result_ok);
949 return *val->contents.err;
951 jboolean LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
952 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
954 uint32_tArray LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
955 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
956 CHECK(val->result_ok);
957 LDKCVec_SignatureZ res_var = (*val->contents.result);
958 uint32_tArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
959 for (size_t i = 0; i < res_var.datalen; i++) {
960 int8_tArray arr_conv_8_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
961 memcpy(arr_conv_8_arr.ptr, res_var.data[i].compact_form, 64);
962 (*env)->SetObjectArrayElement(env, res_arr, i, arr_conv_8_arr);
966 void LDKCResult_1CVec_1SignatureZNoneZ_1get_1err (void* ctx_TODO, uint32_t arg) {
967 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
968 CHECK(!val->result_ok);
969 return *val->contents.err;
971 int8_tArray ChannelKeys_1get_1per_1commitment_1point(void* ctx_TODO, uint32_t this_arg, int64_t idx) {
972 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
973 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
974 memcpy(arg_arr.ptr, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
978 int8_tArray ChannelKeys_1release_1commitment_1secret(void* ctx_TODO, uint32_t this_arg, int64_t idx) {
979 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
980 int8_tArray arg_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
981 memcpy(arg_arr.ptr, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
985 uint32_t ChannelKeys_1key_1derivation_1params(void* ctx_TODO, uint32_t this_arg) {
986 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
987 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
988 *ret_ref = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
989 return (long)ret_ref;
992 uint32_t ChannelKeys_1sign_1counterparty_1commitment(void* ctx_TODO, uint32_t this_arg, uint32_t commitment_tx) {
993 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
994 LDKCommitmentTransaction commitment_tx_conv;
995 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
996 commitment_tx_conv.is_owned = false;
997 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
998 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
999 return (long)ret_conv;
1002 uint32_t ChannelKeys_1sign_1holder_1commitment(void* ctx_TODO, uint32_t this_arg, uint32_t commitment_tx) {
1003 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1004 LDKHolderCommitmentTransaction commitment_tx_conv;
1005 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1006 commitment_tx_conv.is_owned = false;
1007 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1008 *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1009 return (long)ret_conv;
1012 uint32_t ChannelKeys_1sign_1holder_1commitment_1htlc_1transactions(void* ctx_TODO, uint32_t this_arg, uint32_t commitment_tx) {
1013 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1014 LDKHolderCommitmentTransaction commitment_tx_conv;
1015 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1016 commitment_tx_conv.is_owned = false;
1017 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
1018 *ret_conv = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &commitment_tx_conv);
1019 return (long)ret_conv;
1022 uint32_t ChannelKeys_1sign_1justice_1transaction(void* ctx_TODO, uint32_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, uint32_t htlc) {
1023 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1024 LDKTransaction justice_tx_ref;
1025 justice_tx_ref.datalen = justice_tx.len;
1026 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1027 memcpy(justice_tx_ref.data, justice_tx.ptr, justice_tx_ref.datalen);
1028 justice_tx_ref.data_is_owned = true;
1029 unsigned char per_commitment_key_arr[32];
1030 CHECK(per_commitment_key.len == 32);
1031 memcpy(per_commitment_key_arr, per_commitment_key.ptr, 32);
1032 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1033 LDKHTLCOutputInCommitment htlc_conv;
1034 htlc_conv.inner = (void*)(htlc & (~1));
1035 htlc_conv.is_owned = false;
1036 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1037 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
1038 return (long)ret_conv;
1041 uint32_t ChannelKeys_1sign_1counterparty_1htlc_1transaction(void* ctx_TODO, uint32_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t amount, int8_tArray per_commitment_point, uint32_t htlc) {
1042 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1043 LDKTransaction htlc_tx_ref;
1044 htlc_tx_ref.datalen = htlc_tx.len;
1045 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1046 memcpy(htlc_tx_ref.data, htlc_tx.ptr, htlc_tx_ref.datalen);
1047 htlc_tx_ref.data_is_owned = true;
1048 LDKPublicKey per_commitment_point_ref;
1049 CHECK(per_commitment_point.len == 33);
1050 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.ptr, 33);
1051 LDKHTLCOutputInCommitment htlc_conv;
1052 htlc_conv.inner = (void*)(htlc & (~1));
1053 htlc_conv.is_owned = false;
1054 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1055 *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);
1056 return (long)ret_conv;
1059 uint32_t ChannelKeys_1sign_1closing_1transaction(void* ctx_TODO, uint32_t this_arg, int8_tArray closing_tx) {
1060 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1061 LDKTransaction closing_tx_ref;
1062 closing_tx_ref.datalen = closing_tx.len;
1063 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
1064 memcpy(closing_tx_ref.data, closing_tx.ptr, closing_tx_ref.datalen);
1065 closing_tx_ref.data_is_owned = true;
1066 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1067 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
1068 return (long)ret_conv;
1071 uint32_t ChannelKeys_1sign_1channel_1announcement(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
1072 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1073 LDKUnsignedChannelAnnouncement msg_conv;
1074 msg_conv.inner = (void*)(msg & (~1));
1075 msg_conv.is_owned = false;
1076 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1077 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1078 return (long)ret_conv;
1081 void ChannelKeys_1ready_1channel(void* ctx_TODO, uint32_t this_arg, uint32_t channel_parameters) {
1082 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1083 LDKChannelTransactionParameters channel_parameters_conv;
1084 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
1085 channel_parameters_conv.is_owned = false;
1086 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
1089 int8_tArray ChannelKeys_1write(void* ctx_TODO, uint32_t this_arg) {
1090 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1091 LDKCVec_u8Z arg_var = (this_arg_conv->write)(this_arg_conv->this_arg);
1092 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
1093 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
1094 CVec_u8Z_free(arg_var);
1098 LDKChannelPublicKeys LDKChannelKeys_set_get_pubkeys(LDKChannelKeys* this_arg) {
1099 if (this_arg->set_pubkeys != NULL)
1100 this_arg->set_pubkeys(this_arg);
1101 return this_arg->pubkeys;
1103 uint32_t ChannelKeys_1get_1pubkeys(void* ctx_TODO, uint32_t this_arg) {
1104 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1105 LDKChannelPublicKeys ret_var = LDKChannelKeys_set_get_pubkeys(this_arg_conv);
1106 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1107 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1108 long ret_ref = (long)ret_var.inner;
1109 if (ret_var.is_owned) {
1115 uint32_t LDKC2Tuple_1BlockHashChannelMonitorZ_1new(void* ctx_TODO, int8_tArray a, uint32_t b) {
1116 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
1117 LDKThirtyTwoBytes a_ref;
1119 memcpy(a_ref.data, a.ptr, 32);
1121 LDKChannelMonitor b_conv;
1122 b_conv.inner = (void*)(b & (~1));
1123 b_conv.is_owned = (b & 1) || (b == 0);
1124 // Warning: we may need a move here but can't clone!
1128 int8_tArray LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
1129 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)ptr;
1130 int8_tArray a_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
1131 memcpy(a_arr.ptr, tuple->a.data, 32);
1134 uint32_t LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
1135 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)ptr;
1136 LDKChannelMonitor b_var = tuple->b;
1137 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1138 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1139 long b_ref = (long)b_var.inner & ~1;
1142 jboolean LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1143 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
1145 uint32_t LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1146 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg;
1147 CHECK(val->result_ok);
1148 long res_ref = (long)&(*val->contents.result);
1151 uint32_t LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1152 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg;
1153 CHECK(!val->result_ok);
1154 LDKDecodeError err_var = (*val->contents.err);
1155 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1156 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1157 long err_ref = (long)err_var.inner & ~1;
1160 jboolean LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1161 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1163 uint32_t LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1164 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg;
1165 CHECK(val->result_ok);
1166 long res_ref = (long)&(*val->contents.result);
1169 uint32_t LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1170 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg;
1171 CHECK(!val->result_ok);
1172 LDKDecodeError err_var = (*val->contents.err);
1173 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1174 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1175 long err_ref = (long)err_var.inner & ~1;
1178 jboolean LDKCResult_1ChanKeySignerDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1179 return ((LDKCResult_ChanKeySignerDecodeErrorZ*)arg)->result_ok;
1181 uint32_t LDKCResult_1ChanKeySignerDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1182 LDKCResult_ChanKeySignerDecodeErrorZ *val = (LDKCResult_ChanKeySignerDecodeErrorZ*)arg;
1183 CHECK(val->result_ok);
1184 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1185 *ret = (*val->contents.result);
1188 uint32_t LDKCResult_1ChanKeySignerDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1189 LDKCResult_ChanKeySignerDecodeErrorZ *val = (LDKCResult_ChanKeySignerDecodeErrorZ*)arg;
1190 CHECK(!val->result_ok);
1191 LDKDecodeError err_var = (*val->contents.err);
1192 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1193 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1194 long err_ref = (long)err_var.inner & ~1;
1197 jboolean LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1198 return ((LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg)->result_ok;
1200 uint32_t LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1201 LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg;
1202 CHECK(val->result_ok);
1203 LDKInMemoryChannelKeys res_var = (*val->contents.result);
1204 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1205 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1206 long res_ref = (long)res_var.inner & ~1;
1209 uint32_t LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1210 LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg;
1211 CHECK(!val->result_ok);
1212 LDKDecodeError err_var = (*val->contents.err);
1213 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1214 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1215 long err_ref = (long)err_var.inner & ~1;
1218 jboolean LDKCResult_1TxOutAccessErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1219 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1221 uint32_t LDKCResult_1TxOutAccessErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1222 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1223 CHECK(val->result_ok);
1224 long res_ref = (long)&(*val->contents.result);
1225 return (long)res_ref;
1227 uint32_t LDKCResult_1TxOutAccessErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1228 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1229 CHECK(!val->result_ok);
1230 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
1233 uint32_t LDKAPIError_1ref_1from_1ptr (void* ctx_TODO, uint32_t ptr) {
1234 LDKAPIError *obj = (LDKAPIError*)ptr;
1236 case LDKAPIError_APIMisuseError: {
1237 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
1238 int8_tArray err_arr = { .len = err_var.datalen, .ptr = MALLOC(err_var.datalen, "Native int8_tArray Bytes") };
1239 memcpy(err_arr.ptr, err_var.data, err_var.datalen);
1240 return 0 /* LDKAPIError - APIMisuseError */; (void) err_arr;
1242 case LDKAPIError_FeeRateTooHigh: {
1243 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
1244 int8_tArray err_arr = { .len = err_var.datalen, .ptr = MALLOC(err_var.datalen, "Native int8_tArray Bytes") };
1245 memcpy(err_arr.ptr, err_var.data, err_var.datalen);
1246 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_arr; (void) obj->fee_rate_too_high.feerate;
1248 case LDKAPIError_RouteError: {
1249 LDKStr err_str = obj->route_error.err;
1250 char* err_buf = MALLOC(err_str.len + 1, "str conv buf");
1251 memcpy(err_buf, err_str.chars, err_str.len);
1252 err_buf[err_str.len] = 0;
1253 jstring err_conv = (*env)->NewStringUTF(env, err_str.chars);
1255 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
1257 case LDKAPIError_ChannelUnavailable: {
1258 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
1259 int8_tArray err_arr = { .len = err_var.datalen, .ptr = MALLOC(err_var.datalen, "Native int8_tArray Bytes") };
1260 memcpy(err_arr.ptr, err_var.data, err_var.datalen);
1261 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_arr;
1263 case LDKAPIError_MonitorUpdateFailed: {
1264 return 0 /* LDKAPIError - MonitorUpdateFailed */;
1269 jboolean LDKCResult_1NoneAPIErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1270 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
1272 void LDKCResult_1NoneAPIErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1273 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
1274 CHECK(val->result_ok);
1275 return *val->contents.result;
1277 uint32_t LDKCResult_1NoneAPIErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1278 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
1279 CHECK(!val->result_ok);
1280 long err_ref = (long)&(*val->contents.err);
1283 static inline LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const LDKCResult_NoneAPIErrorZ *orig) {
1284 LDKCResult_NoneAPIErrorZ res = { .result_ok = orig->result_ok };
1285 if (orig->result_ok) {
1286 res.contents.result = NULL;
1288 LDKAPIError* contents = MALLOC(sizeof(LDKAPIError), "LDKAPIError result Err clone");
1289 *contents = APIError_clone(orig->contents.err);
1290 res.contents.err = contents;
1294 uint32_t LDKCVec_1ChannelDetailsZ_1new(void* ctx_TODO, uint32_tArray elems) {
1295 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
1296 ret->datalen = elems.len;
1297 if (ret->datalen == 0) {
1300 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
1301 uint32_t *java_elems = elems.ptr;
1302 for (size_t i = 0; i < ret->datalen; i++) {
1303 uint32_t arr_elem = java_elems[i];
1304 LDKChannelDetails arr_elem_conv;
1305 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1306 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1307 if (arr_elem_conv.inner != NULL)
1308 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
1309 ret->data[i] = arr_elem_conv;
1314 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1315 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1316 for (size_t i = 0; i < ret.datalen; i++) {
1317 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1321 jboolean LDKCResult_1NonePaymentSendFailureZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1322 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
1324 void LDKCResult_1NonePaymentSendFailureZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1325 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
1326 CHECK(val->result_ok);
1327 return *val->contents.result;
1329 uint32_t LDKCResult_1NonePaymentSendFailureZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1330 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
1331 CHECK(!val->result_ok);
1332 LDKPaymentSendFailure err_var = (*val->contents.err);
1333 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1334 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1335 long err_ref = (long)err_var.inner & ~1;
1338 uint32_t LDKNetAddress_1ref_1from_1ptr (void* ctx_TODO, uint32_t ptr) {
1339 LDKNetAddress *obj = (LDKNetAddress*)ptr;
1341 case LDKNetAddress_IPv4: {
1342 int8_tArray addr_arr = { .len = 4, .ptr = MALLOC(4, "Native int8_tArray Bytes") };
1343 memcpy(addr_arr.ptr, obj->i_pv4.addr.data, 4);
1344 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
1346 case LDKNetAddress_IPv6: {
1347 int8_tArray addr_arr = { .len = 16, .ptr = MALLOC(16, "Native int8_tArray Bytes") };
1348 memcpy(addr_arr.ptr, obj->i_pv6.addr.data, 16);
1349 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
1351 case LDKNetAddress_OnionV2: {
1352 int8_tArray addr_arr = { .len = 10, .ptr = MALLOC(10, "Native int8_tArray Bytes") };
1353 memcpy(addr_arr.ptr, obj->onion_v2.addr.data, 10);
1354 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
1356 case LDKNetAddress_OnionV3: {
1357 int8_tArray ed25519_pubkey_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
1358 memcpy(ed25519_pubkey_arr.ptr, obj->onion_v3.ed25519_pubkey.data, 32);
1359 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
1364 uint32_t LDKCVec_1NetAddressZ_1new(void* ctx_TODO, uint32_tArray elems) {
1365 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
1366 ret->datalen = elems.len;
1367 if (ret->datalen == 0) {
1370 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
1371 uint32_t *java_elems = elems.ptr;
1372 for (size_t i = 0; i < ret->datalen; i++) {
1373 uint32_t arr_elem = java_elems[i];
1374 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
1375 FREE((void*)arr_elem);
1376 ret->data[i] = arr_elem_conv;
1381 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
1382 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
1383 for (size_t i = 0; i < ret.datalen; i++) {
1384 ret.data[i] = NetAddress_clone(&orig->data[i]);
1388 uint32_t LDKCVec_1ChannelMonitorZ_1new(void* ctx_TODO, uint32_tArray elems) {
1389 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
1390 ret->datalen = elems.len;
1391 if (ret->datalen == 0) {
1394 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
1395 uint32_t *java_elems = elems.ptr;
1396 for (size_t i = 0; i < ret->datalen; i++) {
1397 uint32_t arr_elem = java_elems[i];
1398 LDKChannelMonitor arr_elem_conv;
1399 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1400 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1401 // Warning: we may need a move here but can't clone!
1402 ret->data[i] = arr_elem_conv;
1407 uint32_t Watch_1watch_1channel(void* ctx_TODO, uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
1408 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
1409 LDKOutPoint funding_txo_conv;
1410 funding_txo_conv.inner = (void*)(funding_txo & (~1));
1411 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
1412 if (funding_txo_conv.inner != NULL)
1413 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
1414 LDKChannelMonitor monitor_conv;
1415 monitor_conv.inner = (void*)(monitor & (~1));
1416 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
1417 // Warning: we may need a move here but can't clone!
1418 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
1419 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
1420 return (long)ret_conv;
1423 uint32_t Watch_1update_1channel(void* ctx_TODO, uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
1424 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
1425 LDKOutPoint funding_txo_conv;
1426 funding_txo_conv.inner = (void*)(funding_txo & (~1));
1427 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
1428 if (funding_txo_conv.inner != NULL)
1429 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
1430 LDKChannelMonitorUpdate update_conv;
1431 update_conv.inner = (void*)(update & (~1));
1432 update_conv.is_owned = (update & 1) || (update == 0);
1433 if (update_conv.inner != NULL)
1434 update_conv = ChannelMonitorUpdate_clone(&update_conv);
1435 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
1436 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
1437 return (long)ret_conv;
1440 uint32_tArray Watch_1release_1pending_1monitor_1events(void* ctx_TODO, uint32_t this_arg) {
1441 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
1442 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
1443 uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
1444 uint32_t *ret_arr_ptr = ret_arr.ptr;
1445 for (size_t o = 0; o < ret_var.datalen; o++) {
1446 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
1447 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1448 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1449 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
1450 if (arr_conv_14_var.is_owned) {
1451 arr_conv_14_ref |= 1;
1453 ret_arr_ptr[o] = arr_conv_14_ref;
1459 void BroadcasterInterface_1broadcast_1transaction(void* ctx_TODO, uint32_t this_arg, int8_tArray tx) {
1460 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
1461 LDKTransaction tx_ref;
1462 tx_ref.datalen = tx.len;
1463 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
1464 memcpy(tx_ref.data, tx.ptr, tx_ref.datalen);
1465 tx_ref.data_is_owned = true;
1466 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
1469 int8_tArray KeysInterface_1get_1node_1secret(void* ctx_TODO, uint32_t this_arg) {
1470 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
1471 int8_tArray arg_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
1472 memcpy(arg_arr.ptr, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
1476 int8_tArray KeysInterface_1get_1destination_1script(void* ctx_TODO, uint32_t this_arg) {
1477 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
1478 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
1479 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
1480 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
1481 CVec_u8Z_free(arg_var);
1485 int8_tArray KeysInterface_1get_1shutdown_1pubkey(void* ctx_TODO, uint32_t this_arg) {
1486 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
1487 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
1488 memcpy(arg_arr.ptr, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form, 33);
1492 uint32_t KeysInterface_1get_1channel_1keys(void* ctx_TODO, uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
1493 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
1494 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1495 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
1499 int8_tArray KeysInterface_1get_1secure_1random_1bytes(void* ctx_TODO, uint32_t this_arg) {
1500 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
1501 int8_tArray arg_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
1502 memcpy(arg_arr.ptr, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
1506 uint32_t KeysInterface_1read_1chan_1signer(void* ctx_TODO, uint32_t this_arg, int8_tArray reader) {
1507 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
1508 LDKu8slice reader_ref;
1509 reader_ref.datalen = reader.len;
1510 reader_ref.data = reader.ptr;
1511 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
1512 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
1513 return (long)ret_conv;
1516 int32_t FeeEstimator_1get_1est_1sat_1per_11000_1weight(void* ctx_TODO, uint32_t this_arg, uint32_t confirmation_target) {
1517 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
1518 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
1519 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
1523 uint32_t LDKC2Tuple_1BlockHashChannelManagerZ_1new(void* ctx_TODO, int8_tArray a, uint32_t b) {
1524 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
1525 LDKThirtyTwoBytes a_ref;
1527 memcpy(a_ref.data, a.ptr, 32);
1529 LDKChannelManager b_conv;
1530 b_conv.inner = (void*)(b & (~1));
1531 b_conv.is_owned = (b & 1) || (b == 0);
1532 // Warning: we may need a move here but can't clone!
1536 int8_tArray LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
1537 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)ptr;
1538 int8_tArray a_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
1539 memcpy(a_arr.ptr, tuple->a.data, 32);
1542 uint32_t LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
1543 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)ptr;
1544 LDKChannelManager b_var = tuple->b;
1545 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1546 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1547 long b_ref = (long)b_var.inner & ~1;
1550 jboolean LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1551 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
1553 uint32_t LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1554 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg;
1555 CHECK(val->result_ok);
1556 long res_ref = (long)&(*val->contents.result);
1559 uint32_t LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1560 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg;
1561 CHECK(!val->result_ok);
1562 LDKDecodeError err_var = (*val->contents.err);
1563 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1564 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1565 long err_ref = (long)err_var.inner & ~1;
1568 jboolean LDKCResult_1NetAddressu8Z_1result_1ok (void* ctx_TODO, uint32_t arg) {
1569 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
1571 uint32_t LDKCResult_1NetAddressu8Z_1get_1ok (void* ctx_TODO, uint32_t arg) {
1572 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)arg;
1573 CHECK(val->result_ok);
1574 long res_ref = (long)&(*val->contents.result);
1577 int8_t LDKCResult_1NetAddressu8Z_1get_1err (void* ctx_TODO, uint32_t arg) {
1578 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)arg;
1579 CHECK(!val->result_ok);
1580 return *val->contents.err;
1582 static inline LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const LDKCResult_NetAddressu8Z *orig) {
1583 LDKCResult_NetAddressu8Z res = { .result_ok = orig->result_ok };
1584 if (orig->result_ok) {
1585 LDKNetAddress* contents = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress result OK clone");
1586 *contents = NetAddress_clone(orig->contents.result);
1587 res.contents.result = contents;
1589 int8_t* contents = MALLOC(sizeof(int8_t), "int8_t result Err clone");
1590 *contents = *orig->contents.err;
1591 res.contents.err = contents;
1595 jboolean LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1596 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
1598 uint32_t LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1599 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg;
1600 CHECK(val->result_ok);
1601 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
1602 *res_conv = (*val->contents.result);
1603 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
1604 return (long)res_conv;
1606 uint32_t LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1607 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg;
1608 CHECK(!val->result_ok);
1609 LDKDecodeError err_var = (*val->contents.err);
1610 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1611 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1612 long err_ref = (long)err_var.inner & ~1;
1615 uint32_t LDKCVec_1u64Z_1new(void* ctx_TODO, int64_tArray elems) {
1616 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
1617 ret->datalen = elems.len;
1618 if (ret->datalen == 0) {
1621 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
1622 int64_t *java_elems = elems.ptr;
1623 for (size_t i = 0; i < ret->datalen; i++) {
1624 ret->data[i] = java_elems[i];
1629 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1630 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1631 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1634 uint32_t LDKCVec_1UpdateAddHTLCZ_1new(void* ctx_TODO, uint32_tArray elems) {
1635 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
1636 ret->datalen = elems.len;
1637 if (ret->datalen == 0) {
1640 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
1641 uint32_t *java_elems = elems.ptr;
1642 for (size_t i = 0; i < ret->datalen; i++) {
1643 uint32_t arr_elem = java_elems[i];
1644 LDKUpdateAddHTLC arr_elem_conv;
1645 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1646 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1647 if (arr_elem_conv.inner != NULL)
1648 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
1649 ret->data[i] = arr_elem_conv;
1654 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
1655 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
1656 for (size_t i = 0; i < ret.datalen; i++) {
1657 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
1661 uint32_t LDKCVec_1UpdateFulfillHTLCZ_1new(void* ctx_TODO, uint32_tArray elems) {
1662 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
1663 ret->datalen = elems.len;
1664 if (ret->datalen == 0) {
1667 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
1668 uint32_t *java_elems = elems.ptr;
1669 for (size_t i = 0; i < ret->datalen; i++) {
1670 uint32_t arr_elem = java_elems[i];
1671 LDKUpdateFulfillHTLC arr_elem_conv;
1672 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1673 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1674 if (arr_elem_conv.inner != NULL)
1675 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
1676 ret->data[i] = arr_elem_conv;
1681 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
1682 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
1683 for (size_t i = 0; i < ret.datalen; i++) {
1684 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
1688 uint32_t LDKCVec_1UpdateFailHTLCZ_1new(void* ctx_TODO, uint32_tArray elems) {
1689 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
1690 ret->datalen = elems.len;
1691 if (ret->datalen == 0) {
1694 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
1695 uint32_t *java_elems = elems.ptr;
1696 for (size_t i = 0; i < ret->datalen; i++) {
1697 uint32_t arr_elem = java_elems[i];
1698 LDKUpdateFailHTLC arr_elem_conv;
1699 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1700 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1701 if (arr_elem_conv.inner != NULL)
1702 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
1703 ret->data[i] = arr_elem_conv;
1708 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
1709 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
1710 for (size_t i = 0; i < ret.datalen; i++) {
1711 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
1715 uint32_t LDKCVec_1UpdateFailMalformedHTLCZ_1new(void* ctx_TODO, uint32_tArray elems) {
1716 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
1717 ret->datalen = elems.len;
1718 if (ret->datalen == 0) {
1721 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
1722 uint32_t *java_elems = elems.ptr;
1723 for (size_t i = 0; i < ret->datalen; i++) {
1724 uint32_t arr_elem = java_elems[i];
1725 LDKUpdateFailMalformedHTLC arr_elem_conv;
1726 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1727 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1728 if (arr_elem_conv.inner != NULL)
1729 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
1730 ret->data[i] = arr_elem_conv;
1735 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
1736 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
1737 for (size_t i = 0; i < ret.datalen; i++) {
1738 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
1742 jboolean LDKCResult_1boolLightningErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1743 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
1745 jboolean LDKCResult_1boolLightningErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1746 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
1747 CHECK(val->result_ok);
1748 return *val->contents.result;
1750 uint32_t LDKCResult_1boolLightningErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1751 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
1752 CHECK(!val->result_ok);
1753 LDKLightningError err_var = (*val->contents.err);
1754 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1755 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1756 long err_ref = (long)err_var.inner & ~1;
1759 uint32_t LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(void* ctx_TODO, uint32_t a, uint32_t b, uint32_t c) {
1760 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
1761 LDKChannelAnnouncement a_conv;
1762 a_conv.inner = (void*)(a & (~1));
1763 a_conv.is_owned = (a & 1) || (a == 0);
1764 if (a_conv.inner != NULL)
1765 a_conv = ChannelAnnouncement_clone(&a_conv);
1767 LDKChannelUpdate b_conv;
1768 b_conv.inner = (void*)(b & (~1));
1769 b_conv.is_owned = (b & 1) || (b == 0);
1770 if (b_conv.inner != NULL)
1771 b_conv = ChannelUpdate_clone(&b_conv);
1773 LDKChannelUpdate c_conv;
1774 c_conv.inner = (void*)(c & (~1));
1775 c_conv.is_owned = (c & 1) || (c == 0);
1776 if (c_conv.inner != NULL)
1777 c_conv = ChannelUpdate_clone(&c_conv);
1781 static inline LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *orig) {
1782 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret = {
1783 .a = ChannelAnnouncement_clone(&orig->a),
1784 .b = ChannelUpdate_clone(&orig->b),
1785 .c = ChannelUpdate_clone(&orig->c),
1789 uint32_t LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
1790 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ptr;
1791 LDKChannelAnnouncement a_var = tuple->a;
1792 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1793 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1794 long a_ref = (long)a_var.inner & ~1;
1797 uint32_t LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
1798 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ptr;
1799 LDKChannelUpdate b_var = tuple->b;
1800 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1801 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1802 long b_ref = (long)b_var.inner & ~1;
1805 uint32_t LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(void* ctx_TODO, uint32_t ptr) {
1806 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ptr;
1807 LDKChannelUpdate c_var = tuple->c;
1808 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1809 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1810 long c_ref = (long)c_var.inner & ~1;
1813 uint32_t LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(void* ctx_TODO, uint32_tArray elems) {
1814 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
1815 ret->datalen = elems.len;
1816 if (ret->datalen == 0) {
1819 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
1820 uint32_t *java_elems = elems.ptr;
1821 for (size_t i = 0; i < ret->datalen; i++) {
1822 uint32_t arr_elem = java_elems[i];
1823 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_elem;
1824 FREE((void*)arr_elem);
1825 ret->data[i] = arr_elem_conv;
1830 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
1831 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
1832 for (size_t i = 0; i < ret.datalen; i++) {
1833 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
1837 uint32_t LDKCVec_1NodeAnnouncementZ_1new(void* ctx_TODO, uint32_tArray elems) {
1838 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
1839 ret->datalen = elems.len;
1840 if (ret->datalen == 0) {
1843 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
1844 uint32_t *java_elems = elems.ptr;
1845 for (size_t i = 0; i < ret->datalen; i++) {
1846 uint32_t arr_elem = java_elems[i];
1847 LDKNodeAnnouncement arr_elem_conv;
1848 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1849 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1850 if (arr_elem_conv.inner != NULL)
1851 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
1852 ret->data[i] = arr_elem_conv;
1857 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
1858 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
1859 for (size_t i = 0; i < ret.datalen; i++) {
1860 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
1864 jboolean LDKCResult_1NoneLightningErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1865 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
1867 void LDKCResult_1NoneLightningErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1868 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)arg;
1869 CHECK(val->result_ok);
1870 return *val->contents.result;
1872 uint32_t LDKCResult_1NoneLightningErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1873 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)arg;
1874 CHECK(!val->result_ok);
1875 LDKLightningError err_var = (*val->contents.err);
1876 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1877 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1878 long err_ref = (long)err_var.inner & ~1;
1881 jboolean LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1882 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
1884 uint32_t LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1885 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)arg;
1886 CHECK(val->result_ok);
1887 LDKChannelReestablish res_var = (*val->contents.result);
1888 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1889 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1890 long res_ref = (long)res_var.inner & ~1;
1893 uint32_t LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1894 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)arg;
1895 CHECK(!val->result_ok);
1896 LDKDecodeError err_var = (*val->contents.err);
1897 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1898 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1899 long err_ref = (long)err_var.inner & ~1;
1902 jboolean LDKCResult_1InitDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1903 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
1905 uint32_t LDKCResult_1InitDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1906 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)arg;
1907 CHECK(val->result_ok);
1908 LDKInit res_var = (*val->contents.result);
1909 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1910 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1911 long res_ref = (long)res_var.inner & ~1;
1914 uint32_t LDKCResult_1InitDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1915 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)arg;
1916 CHECK(!val->result_ok);
1917 LDKDecodeError err_var = (*val->contents.err);
1918 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1919 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1920 long err_ref = (long)err_var.inner & ~1;
1923 jboolean LDKCResult_1PingDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1924 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
1926 uint32_t LDKCResult_1PingDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1927 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)arg;
1928 CHECK(val->result_ok);
1929 LDKPing res_var = (*val->contents.result);
1930 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1931 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1932 long res_ref = (long)res_var.inner & ~1;
1935 uint32_t LDKCResult_1PingDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1936 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)arg;
1937 CHECK(!val->result_ok);
1938 LDKDecodeError err_var = (*val->contents.err);
1939 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1940 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1941 long err_ref = (long)err_var.inner & ~1;
1944 jboolean LDKCResult_1PongDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1945 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
1947 uint32_t LDKCResult_1PongDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1948 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)arg;
1949 CHECK(val->result_ok);
1950 LDKPong res_var = (*val->contents.result);
1951 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1952 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1953 long res_ref = (long)res_var.inner & ~1;
1956 uint32_t LDKCResult_1PongDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1957 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)arg;
1958 CHECK(!val->result_ok);
1959 LDKDecodeError err_var = (*val->contents.err);
1960 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1961 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1962 long err_ref = (long)err_var.inner & ~1;
1965 jboolean LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1966 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
1968 uint32_t LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1969 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg;
1970 CHECK(val->result_ok);
1971 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
1972 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1973 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1974 long res_ref = (long)res_var.inner & ~1;
1977 uint32_t LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1978 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg;
1979 CHECK(!val->result_ok);
1980 LDKDecodeError err_var = (*val->contents.err);
1981 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1982 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1983 long err_ref = (long)err_var.inner & ~1;
1986 jboolean LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1987 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
1989 uint32_t LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1990 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg;
1991 CHECK(val->result_ok);
1992 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
1993 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1994 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1995 long res_ref = (long)res_var.inner & ~1;
1998 uint32_t LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1999 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg;
2000 CHECK(!val->result_ok);
2001 LDKDecodeError err_var = (*val->contents.err);
2002 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2003 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2004 long err_ref = (long)err_var.inner & ~1;
2007 jboolean LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2008 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
2010 uint32_t LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2011 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)arg;
2012 CHECK(val->result_ok);
2013 LDKErrorMessage res_var = (*val->contents.result);
2014 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2015 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2016 long res_ref = (long)res_var.inner & ~1;
2019 uint32_t LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2020 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)arg;
2021 CHECK(!val->result_ok);
2022 LDKDecodeError err_var = (*val->contents.err);
2023 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2024 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2025 long err_ref = (long)err_var.inner & ~1;
2028 jboolean LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2029 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
2031 uint32_t LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2032 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg;
2033 CHECK(val->result_ok);
2034 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
2035 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2036 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2037 long res_ref = (long)res_var.inner & ~1;
2040 uint32_t LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2041 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg;
2042 CHECK(!val->result_ok);
2043 LDKDecodeError err_var = (*val->contents.err);
2044 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2045 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2046 long err_ref = (long)err_var.inner & ~1;
2049 jboolean LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2050 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
2052 uint32_t LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2053 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg;
2054 CHECK(val->result_ok);
2055 LDKQueryShortChannelIds res_var = (*val->contents.result);
2056 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2057 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2058 long res_ref = (long)res_var.inner & ~1;
2061 uint32_t LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2062 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg;
2063 CHECK(!val->result_ok);
2064 LDKDecodeError err_var = (*val->contents.err);
2065 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2066 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2067 long err_ref = (long)err_var.inner & ~1;
2070 jboolean LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2071 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
2073 uint32_t LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2074 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg;
2075 CHECK(val->result_ok);
2076 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
2077 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2078 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2079 long res_ref = (long)res_var.inner & ~1;
2082 uint32_t LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2083 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg;
2084 CHECK(!val->result_ok);
2085 LDKDecodeError err_var = (*val->contents.err);
2086 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2087 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2088 long err_ref = (long)err_var.inner & ~1;
2091 jboolean LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2092 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
2094 uint32_t LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2095 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)arg;
2096 CHECK(val->result_ok);
2097 LDKQueryChannelRange res_var = (*val->contents.result);
2098 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2099 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2100 long res_ref = (long)res_var.inner & ~1;
2103 uint32_t LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2104 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)arg;
2105 CHECK(!val->result_ok);
2106 LDKDecodeError err_var = (*val->contents.err);
2107 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2108 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2109 long err_ref = (long)err_var.inner & ~1;
2112 jboolean LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2113 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
2115 uint32_t LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2116 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg;
2117 CHECK(val->result_ok);
2118 LDKReplyChannelRange res_var = (*val->contents.result);
2119 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2120 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2121 long res_ref = (long)res_var.inner & ~1;
2124 uint32_t LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2125 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg;
2126 CHECK(!val->result_ok);
2127 LDKDecodeError err_var = (*val->contents.err);
2128 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2129 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2130 long err_ref = (long)err_var.inner & ~1;
2133 jboolean LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2134 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
2136 uint32_t LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2137 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg;
2138 CHECK(val->result_ok);
2139 LDKGossipTimestampFilter res_var = (*val->contents.result);
2140 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2141 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2142 long res_ref = (long)res_var.inner & ~1;
2145 uint32_t LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2146 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg;
2147 CHECK(!val->result_ok);
2148 LDKDecodeError err_var = (*val->contents.err);
2149 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2150 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2151 long err_ref = (long)err_var.inner & ~1;
2154 jboolean LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2155 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
2157 int8_tArray LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2158 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
2159 CHECK(val->result_ok);
2160 LDKCVec_u8Z res_var = (*val->contents.result);
2161 int8_tArray res_arr = { .len = res_var.datalen, .ptr = MALLOC(res_var.datalen, "Native int8_tArray Bytes") };
2162 memcpy(res_arr.ptr, res_var.data, res_var.datalen);
2165 uint32_t LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2166 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
2167 CHECK(!val->result_ok);
2168 LDKPeerHandleError err_var = (*val->contents.err);
2169 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2170 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2171 long err_ref = (long)err_var.inner & ~1;
2174 jboolean LDKCResult_1NonePeerHandleErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2175 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
2177 void LDKCResult_1NonePeerHandleErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2178 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
2179 CHECK(val->result_ok);
2180 return *val->contents.result;
2182 uint32_t LDKCResult_1NonePeerHandleErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2183 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
2184 CHECK(!val->result_ok);
2185 LDKPeerHandleError err_var = (*val->contents.err);
2186 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2187 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2188 long err_ref = (long)err_var.inner & ~1;
2191 jboolean LDKCResult_1boolPeerHandleErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2192 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
2194 jboolean LDKCResult_1boolPeerHandleErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2195 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
2196 CHECK(val->result_ok);
2197 return *val->contents.result;
2199 uint32_t LDKCResult_1boolPeerHandleErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2200 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
2201 CHECK(!val->result_ok);
2202 LDKPeerHandleError err_var = (*val->contents.err);
2203 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2204 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2205 long err_ref = (long)err_var.inner & ~1;
2208 jboolean LDKCResult_1SecretKeySecpErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2209 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
2211 int8_tArray LDKCResult_1SecretKeySecpErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2212 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
2213 CHECK(val->result_ok);
2214 int8_tArray res_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
2215 memcpy(res_arr.ptr, (*val->contents.result).bytes, 32);
2218 uint32_t LDKCResult_1SecretKeySecpErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2219 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
2220 CHECK(!val->result_ok);
2221 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
2224 jboolean LDKCResult_1PublicKeySecpErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2225 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
2227 int8_tArray LDKCResult_1PublicKeySecpErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2228 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
2229 CHECK(val->result_ok);
2230 int8_tArray res_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
2231 memcpy(res_arr.ptr, (*val->contents.result).compressed_form, 33);
2234 uint32_t LDKCResult_1PublicKeySecpErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2235 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
2236 CHECK(!val->result_ok);
2237 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
2240 jboolean LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2241 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
2243 uint32_t LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2244 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
2245 CHECK(val->result_ok);
2246 LDKTxCreationKeys res_var = (*val->contents.result);
2247 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2248 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2249 long res_ref = (long)res_var.inner & ~1;
2252 uint32_t LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2253 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
2254 CHECK(!val->result_ok);
2255 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
2258 jboolean LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2259 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
2261 uint32_t LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2262 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)arg;
2263 CHECK(val->result_ok);
2264 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
2265 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2266 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2267 long res_ref = (long)res_var.inner & ~1;
2270 void LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2271 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)arg;
2272 CHECK(!val->result_ok);
2273 return *val->contents.err;
2275 uint32_t LDKCVec_1RouteHopZ_1new(void* ctx_TODO, uint32_tArray elems) {
2276 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
2277 ret->datalen = elems.len;
2278 if (ret->datalen == 0) {
2281 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
2282 uint32_t *java_elems = elems.ptr;
2283 for (size_t i = 0; i < ret->datalen; i++) {
2284 uint32_t arr_elem = java_elems[i];
2285 LDKRouteHop arr_elem_conv;
2286 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2287 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2288 if (arr_elem_conv.inner != NULL)
2289 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
2290 ret->data[i] = arr_elem_conv;
2295 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
2296 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
2297 for (size_t i = 0; i < ret.datalen; i++) {
2298 ret.data[i] = RouteHop_clone(&orig->data[i]);
2302 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
2303 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
2304 for (size_t i = 0; i < ret.datalen; i++) {
2305 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
2309 jboolean LDKCResult_1RouteDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2310 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
2312 uint32_t LDKCResult_1RouteDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2313 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)arg;
2314 CHECK(val->result_ok);
2315 LDKRoute res_var = (*val->contents.result);
2316 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2317 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2318 long res_ref = (long)res_var.inner & ~1;
2321 uint32_t LDKCResult_1RouteDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2322 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)arg;
2323 CHECK(!val->result_ok);
2324 LDKDecodeError err_var = (*val->contents.err);
2325 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2326 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2327 long err_ref = (long)err_var.inner & ~1;
2330 uint32_t LDKCVec_1RouteHintZ_1new(void* ctx_TODO, uint32_tArray elems) {
2331 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
2332 ret->datalen = elems.len;
2333 if (ret->datalen == 0) {
2336 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
2337 uint32_t *java_elems = elems.ptr;
2338 for (size_t i = 0; i < ret->datalen; i++) {
2339 uint32_t arr_elem = java_elems[i];
2340 LDKRouteHint arr_elem_conv;
2341 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2342 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2343 if (arr_elem_conv.inner != NULL)
2344 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
2345 ret->data[i] = arr_elem_conv;
2350 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2351 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2352 for (size_t i = 0; i < ret.datalen; i++) {
2353 ret.data[i] = RouteHint_clone(&orig->data[i]);
2357 jboolean LDKCResult_1RouteLightningErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2358 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
2360 uint32_t LDKCResult_1RouteLightningErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2361 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
2362 CHECK(val->result_ok);
2363 LDKRoute res_var = (*val->contents.result);
2364 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2365 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2366 long res_ref = (long)res_var.inner & ~1;
2369 uint32_t LDKCResult_1RouteLightningErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2370 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
2371 CHECK(!val->result_ok);
2372 LDKLightningError err_var = (*val->contents.err);
2373 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2374 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2375 long err_ref = (long)err_var.inner & ~1;
2378 jboolean LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2379 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
2381 uint32_t LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2382 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)arg;
2383 CHECK(val->result_ok);
2384 LDKRoutingFees res_var = (*val->contents.result);
2385 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2386 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2387 long res_ref = (long)res_var.inner & ~1;
2390 uint32_t LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2391 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)arg;
2392 CHECK(!val->result_ok);
2393 LDKDecodeError err_var = (*val->contents.err);
2394 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2395 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2396 long err_ref = (long)err_var.inner & ~1;
2399 jboolean LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2400 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
2402 uint32_t LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2403 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg;
2404 CHECK(val->result_ok);
2405 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
2406 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2407 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2408 long res_ref = (long)res_var.inner & ~1;
2411 uint32_t LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2412 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg;
2413 CHECK(!val->result_ok);
2414 LDKDecodeError err_var = (*val->contents.err);
2415 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2416 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2417 long err_ref = (long)err_var.inner & ~1;
2420 jboolean LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2421 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
2423 uint32_t LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2424 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)arg;
2425 CHECK(val->result_ok);
2426 LDKNodeInfo res_var = (*val->contents.result);
2427 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2428 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2429 long res_ref = (long)res_var.inner & ~1;
2432 uint32_t LDKCResult_1NodeInfoDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2433 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)arg;
2434 CHECK(!val->result_ok);
2435 LDKDecodeError err_var = (*val->contents.err);
2436 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2437 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2438 long err_ref = (long)err_var.inner & ~1;
2441 jboolean LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2442 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
2444 uint32_t LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2445 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)arg;
2446 CHECK(val->result_ok);
2447 LDKNetworkGraph res_var = (*val->contents.result);
2448 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2449 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2450 long res_ref = (long)res_var.inner & ~1;
2453 uint32_t LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2454 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)arg;
2455 CHECK(!val->result_ok);
2456 LDKDecodeError err_var = (*val->contents.err);
2457 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2458 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2459 long err_ref = (long)err_var.inner & ~1;
2462 uint32_tArray MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(void* ctx_TODO, uint32_t this_arg) {
2463 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
2464 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
2465 uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
2466 uint32_t *ret_arr_ptr = ret_arr.ptr;
2467 for (size_t s = 0; s < ret_var.datalen; s++) {
2468 LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
2469 *arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
2470 long arr_conv_18_ref = (long)arr_conv_18_copy;
2471 ret_arr_ptr[s] = arr_conv_18_ref;
2477 uint32_tArray EventsProvider_1get_1and_1clear_1pending_1events(void* ctx_TODO, uint32_t this_arg) {
2478 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
2479 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
2480 uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
2481 uint32_t *ret_arr_ptr = ret_arr.ptr;
2482 for (size_t h = 0; h < ret_var.datalen; h++) {
2483 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
2484 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
2485 long arr_conv_7_ref = (long)arr_conv_7_copy;
2486 ret_arr_ptr[h] = arr_conv_7_ref;
2492 uint32_t Access_1get_1utxo(void* ctx_TODO, uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
2493 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
2494 unsigned char genesis_hash_arr[32];
2495 CHECK(genesis_hash.len == 32);
2496 memcpy(genesis_hash_arr, genesis_hash.ptr, 32);
2497 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
2498 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
2499 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
2500 return (long)ret_conv;
2503 void Filter_1register_1tx(void* ctx_TODO, uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
2504 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2505 unsigned char txid_arr[32];
2506 CHECK(txid.len == 32);
2507 memcpy(txid_arr, txid.ptr, 32);
2508 unsigned char (*txid_ref)[32] = &txid_arr;
2509 LDKu8slice script_pubkey_ref;
2510 script_pubkey_ref.datalen = script_pubkey.len;
2511 script_pubkey_ref.data = script_pubkey.ptr;
2512 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
2515 void Filter_1register_1output(void* ctx_TODO, uint32_t this_arg, uint32_t outpoint, int8_tArray script_pubkey) {
2516 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2517 LDKOutPoint outpoint_conv;
2518 outpoint_conv.inner = (void*)(outpoint & (~1));
2519 outpoint_conv.is_owned = false;
2520 LDKu8slice script_pubkey_ref;
2521 script_pubkey_ref.datalen = script_pubkey.len;
2522 script_pubkey_ref.data = script_pubkey.ptr;
2523 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
2526 uint32_t Persist_1persist_1new_1channel(void* ctx_TODO, uint32_t this_arg, uint32_t id, uint32_t data) {
2527 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
2528 LDKOutPoint id_conv;
2529 id_conv.inner = (void*)(id & (~1));
2530 id_conv.is_owned = (id & 1) || (id == 0);
2531 if (id_conv.inner != NULL)
2532 id_conv = OutPoint_clone(&id_conv);
2533 LDKChannelMonitor data_conv;
2534 data_conv.inner = (void*)(data & (~1));
2535 data_conv.is_owned = false;
2536 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2537 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
2538 return (long)ret_conv;
2541 uint32_t Persist_1update_1persisted_1channel(void* ctx_TODO, uint32_t this_arg, uint32_t id, uint32_t update, uint32_t data) {
2542 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
2543 LDKOutPoint id_conv;
2544 id_conv.inner = (void*)(id & (~1));
2545 id_conv.is_owned = (id & 1) || (id == 0);
2546 if (id_conv.inner != NULL)
2547 id_conv = OutPoint_clone(&id_conv);
2548 LDKChannelMonitorUpdate update_conv;
2549 update_conv.inner = (void*)(update & (~1));
2550 update_conv.is_owned = false;
2551 LDKChannelMonitor data_conv;
2552 data_conv.inner = (void*)(data & (~1));
2553 data_conv.is_owned = false;
2554 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2555 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
2556 return (long)ret_conv;
2559 void ChannelMessageHandler_1handle_1open_1channel(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
2560 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
2561 LDKPublicKey their_node_id_ref;
2562 CHECK(their_node_id.len == 33);
2563 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2564 LDKInitFeatures their_features_conv;
2565 their_features_conv.inner = (void*)(their_features & (~1));
2566 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
2567 // Warning: we may need a move here but can't clone!
2568 LDKOpenChannel msg_conv;
2569 msg_conv.inner = (void*)(msg & (~1));
2570 msg_conv.is_owned = false;
2571 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
2574 void ChannelMessageHandler_1handle_1accept_1channel(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
2575 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
2576 LDKPublicKey their_node_id_ref;
2577 CHECK(their_node_id.len == 33);
2578 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2579 LDKInitFeatures their_features_conv;
2580 their_features_conv.inner = (void*)(their_features & (~1));
2581 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
2582 // Warning: we may need a move here but can't clone!
2583 LDKAcceptChannel msg_conv;
2584 msg_conv.inner = (void*)(msg & (~1));
2585 msg_conv.is_owned = false;
2586 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
2589 void ChannelMessageHandler_1handle_1funding_1created(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
2590 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
2591 LDKPublicKey their_node_id_ref;
2592 CHECK(their_node_id.len == 33);
2593 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2594 LDKFundingCreated msg_conv;
2595 msg_conv.inner = (void*)(msg & (~1));
2596 msg_conv.is_owned = false;
2597 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
2600 void ChannelMessageHandler_1handle_1funding_1signed(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
2601 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
2602 LDKPublicKey their_node_id_ref;
2603 CHECK(their_node_id.len == 33);
2604 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2605 LDKFundingSigned msg_conv;
2606 msg_conv.inner = (void*)(msg & (~1));
2607 msg_conv.is_owned = false;
2608 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
2611 void ChannelMessageHandler_1handle_1funding_1locked(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
2612 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
2613 LDKPublicKey their_node_id_ref;
2614 CHECK(their_node_id.len == 33);
2615 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2616 LDKFundingLocked msg_conv;
2617 msg_conv.inner = (void*)(msg & (~1));
2618 msg_conv.is_owned = false;
2619 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
2622 void ChannelMessageHandler_1handle_1shutdown(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
2623 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
2624 LDKPublicKey their_node_id_ref;
2625 CHECK(their_node_id.len == 33);
2626 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2627 LDKShutdown msg_conv;
2628 msg_conv.inner = (void*)(msg & (~1));
2629 msg_conv.is_owned = false;
2630 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
2633 void ChannelMessageHandler_1handle_1closing_1signed(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
2634 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
2635 LDKPublicKey their_node_id_ref;
2636 CHECK(their_node_id.len == 33);
2637 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2638 LDKClosingSigned msg_conv;
2639 msg_conv.inner = (void*)(msg & (~1));
2640 msg_conv.is_owned = false;
2641 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
2644 void ChannelMessageHandler_1handle_1update_1add_1htlc(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
2645 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
2646 LDKPublicKey their_node_id_ref;
2647 CHECK(their_node_id.len == 33);
2648 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2649 LDKUpdateAddHTLC msg_conv;
2650 msg_conv.inner = (void*)(msg & (~1));
2651 msg_conv.is_owned = false;
2652 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
2655 void ChannelMessageHandler_1handle_1update_1fulfill_1htlc(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
2656 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
2657 LDKPublicKey their_node_id_ref;
2658 CHECK(their_node_id.len == 33);
2659 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2660 LDKUpdateFulfillHTLC msg_conv;
2661 msg_conv.inner = (void*)(msg & (~1));
2662 msg_conv.is_owned = false;
2663 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
2666 void ChannelMessageHandler_1handle_1update_1fail_1htlc(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
2667 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
2668 LDKPublicKey their_node_id_ref;
2669 CHECK(their_node_id.len == 33);
2670 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2671 LDKUpdateFailHTLC msg_conv;
2672 msg_conv.inner = (void*)(msg & (~1));
2673 msg_conv.is_owned = false;
2674 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
2677 void ChannelMessageHandler_1handle_1update_1fail_1malformed_1htlc(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
2678 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
2679 LDKPublicKey their_node_id_ref;
2680 CHECK(their_node_id.len == 33);
2681 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2682 LDKUpdateFailMalformedHTLC msg_conv;
2683 msg_conv.inner = (void*)(msg & (~1));
2684 msg_conv.is_owned = false;
2685 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
2688 void ChannelMessageHandler_1handle_1commitment_1signed(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
2689 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
2690 LDKPublicKey their_node_id_ref;
2691 CHECK(their_node_id.len == 33);
2692 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2693 LDKCommitmentSigned msg_conv;
2694 msg_conv.inner = (void*)(msg & (~1));
2695 msg_conv.is_owned = false;
2696 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
2699 void ChannelMessageHandler_1handle_1revoke_1and_1ack(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
2700 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
2701 LDKPublicKey their_node_id_ref;
2702 CHECK(their_node_id.len == 33);
2703 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2704 LDKRevokeAndACK msg_conv;
2705 msg_conv.inner = (void*)(msg & (~1));
2706 msg_conv.is_owned = false;
2707 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
2710 void ChannelMessageHandler_1handle_1update_1fee(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
2711 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
2712 LDKPublicKey their_node_id_ref;
2713 CHECK(their_node_id.len == 33);
2714 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2715 LDKUpdateFee msg_conv;
2716 msg_conv.inner = (void*)(msg & (~1));
2717 msg_conv.is_owned = false;
2718 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
2721 void ChannelMessageHandler_1handle_1announcement_1signatures(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
2722 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
2723 LDKPublicKey their_node_id_ref;
2724 CHECK(their_node_id.len == 33);
2725 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2726 LDKAnnouncementSignatures msg_conv;
2727 msg_conv.inner = (void*)(msg & (~1));
2728 msg_conv.is_owned = false;
2729 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
2732 void ChannelMessageHandler_1peer_1disconnected(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
2733 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
2734 LDKPublicKey their_node_id_ref;
2735 CHECK(their_node_id.len == 33);
2736 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2737 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
2740 void ChannelMessageHandler_1peer_1connected(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
2741 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
2742 LDKPublicKey their_node_id_ref;
2743 CHECK(their_node_id.len == 33);
2744 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2746 msg_conv.inner = (void*)(msg & (~1));
2747 msg_conv.is_owned = false;
2748 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
2751 void ChannelMessageHandler_1handle_1channel_1reestablish(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
2752 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
2753 LDKPublicKey their_node_id_ref;
2754 CHECK(their_node_id.len == 33);
2755 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2756 LDKChannelReestablish msg_conv;
2757 msg_conv.inner = (void*)(msg & (~1));
2758 msg_conv.is_owned = false;
2759 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
2762 void ChannelMessageHandler_1handle_1error(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
2763 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
2764 LDKPublicKey their_node_id_ref;
2765 CHECK(their_node_id.len == 33);
2766 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2767 LDKErrorMessage msg_conv;
2768 msg_conv.inner = (void*)(msg & (~1));
2769 msg_conv.is_owned = false;
2770 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
2773 uint32_t RoutingMessageHandler_1handle_1node_1announcement(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
2774 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
2775 LDKNodeAnnouncement msg_conv;
2776 msg_conv.inner = (void*)(msg & (~1));
2777 msg_conv.is_owned = false;
2778 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
2779 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
2780 return (long)ret_conv;
2783 uint32_t RoutingMessageHandler_1handle_1channel_1announcement(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
2784 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
2785 LDKChannelAnnouncement msg_conv;
2786 msg_conv.inner = (void*)(msg & (~1));
2787 msg_conv.is_owned = false;
2788 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
2789 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2790 return (long)ret_conv;
2793 uint32_t RoutingMessageHandler_1handle_1channel_1update(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
2794 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
2795 LDKChannelUpdate msg_conv;
2796 msg_conv.inner = (void*)(msg & (~1));
2797 msg_conv.is_owned = false;
2798 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
2799 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
2800 return (long)ret_conv;
2803 void RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(void* ctx_TODO, uint32_t this_arg, uint32_t update) {
2804 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
2805 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
2806 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
2809 uint32_tArray RoutingMessageHandler_1get_1next_1channel_1announcements(void* ctx_TODO, uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
2810 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
2811 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
2812 uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
2813 uint32_t *ret_arr_ptr = ret_arr.ptr;
2814 for (size_t l = 0; l < ret_var.datalen; l++) {
2815 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arr_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
2816 *arr_conv_63_ref = ret_var.data[l];
2817 arr_conv_63_ref->a = ChannelAnnouncement_clone(&arr_conv_63_ref->a);
2818 arr_conv_63_ref->b = ChannelUpdate_clone(&arr_conv_63_ref->b);
2819 arr_conv_63_ref->c = ChannelUpdate_clone(&arr_conv_63_ref->c);
2820 ret_arr_ptr[l] = (long)arr_conv_63_ref;
2826 uint32_tArray RoutingMessageHandler_1get_1next_1node_1announcements(void* ctx_TODO, uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
2827 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
2828 LDKPublicKey starting_point_ref;
2829 CHECK(starting_point.len == 33);
2830 memcpy(starting_point_ref.compressed_form, starting_point.ptr, 33);
2831 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
2832 uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
2833 uint32_t *ret_arr_ptr = ret_arr.ptr;
2834 for (size_t s = 0; s < ret_var.datalen; s++) {
2835 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
2836 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2837 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2838 long arr_conv_18_ref = (long)arr_conv_18_var.inner;
2839 if (arr_conv_18_var.is_owned) {
2840 arr_conv_18_ref |= 1;
2842 ret_arr_ptr[s] = arr_conv_18_ref;
2848 void RoutingMessageHandler_1sync_1routing_1table(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
2849 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
2850 LDKPublicKey their_node_id_ref;
2851 CHECK(their_node_id.len == 33);
2852 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2854 init_conv.inner = (void*)(init & (~1));
2855 init_conv.is_owned = false;
2856 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
2859 uint32_t RoutingMessageHandler_1handle_1reply_1channel_1range(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
2860 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
2861 LDKPublicKey their_node_id_ref;
2862 CHECK(their_node_id.len == 33);
2863 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2864 LDKReplyChannelRange msg_conv;
2865 msg_conv.inner = (void*)(msg & (~1));
2866 msg_conv.is_owned = (msg & 1) || (msg == 0);
2867 if (msg_conv.inner != NULL)
2868 msg_conv = ReplyChannelRange_clone(&msg_conv);
2869 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
2870 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
2871 return (long)ret_conv;
2874 uint32_t RoutingMessageHandler_1handle_1reply_1short_1channel_1ids_1end(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
2875 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
2876 LDKPublicKey their_node_id_ref;
2877 CHECK(their_node_id.len == 33);
2878 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2879 LDKReplyShortChannelIdsEnd msg_conv;
2880 msg_conv.inner = (void*)(msg & (~1));
2881 msg_conv.is_owned = (msg & 1) || (msg == 0);
2882 if (msg_conv.inner != NULL)
2883 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
2884 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
2885 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
2886 return (long)ret_conv;
2889 uint32_t RoutingMessageHandler_1handle_1query_1channel_1range(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
2890 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
2891 LDKPublicKey their_node_id_ref;
2892 CHECK(their_node_id.len == 33);
2893 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2894 LDKQueryChannelRange msg_conv;
2895 msg_conv.inner = (void*)(msg & (~1));
2896 msg_conv.is_owned = (msg & 1) || (msg == 0);
2897 if (msg_conv.inner != NULL)
2898 msg_conv = QueryChannelRange_clone(&msg_conv);
2899 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
2900 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
2901 return (long)ret_conv;
2904 uint32_t RoutingMessageHandler_1handle_1query_1short_1channel_1ids(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
2905 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
2906 LDKPublicKey their_node_id_ref;
2907 CHECK(their_node_id.len == 33);
2908 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
2909 LDKQueryShortChannelIds msg_conv;
2910 msg_conv.inner = (void*)(msg & (~1));
2911 msg_conv.is_owned = (msg & 1) || (msg == 0);
2912 if (msg_conv.inner != NULL)
2913 msg_conv = QueryShortChannelIds_clone(&msg_conv);
2914 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
2915 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
2916 return (long)ret_conv;
2919 int64_t SocketDescriptor_1send_1data(void* ctx_TODO, uint32_t this_arg, int8_tArray data, jboolean resume_read) {
2920 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
2921 LDKu8slice data_ref;
2922 data_ref.datalen = data.len;
2923 data_ref.data = data.ptr;
2924 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
2928 void SocketDescriptor_1disconnect_1socket(void* ctx_TODO, uint32_t this_arg) {
2929 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
2930 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
2933 int64_t SocketDescriptor_1hash(void* ctx_TODO, uint32_t this_arg) {
2934 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
2935 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
2939 void Transaction_1free(void* ctx_TODO, int8_tArray _res) {
2940 LDKTransaction _res_ref;
2941 _res_ref.datalen = _res.len;
2942 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
2943 memcpy(_res_ref.data, _res.ptr, _res_ref.datalen);
2944 _res_ref.data_is_owned = true;
2945 Transaction_free(_res_ref);
2948 void TxOut_1free(void* ctx_TODO, uint32_t _res) {
2949 LDKTxOut _res_conv = *(LDKTxOut*)_res;
2951 TxOut_free(_res_conv);
2954 void CVec_1SpendableOutputDescriptorZ_1free(void* ctx_TODO, uint32_tArray _res) {
2955 LDKCVec_SpendableOutputDescriptorZ _res_constr;
2956 _res_constr.datalen = _res.len;
2957 if (_res_constr.datalen > 0)
2958 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
2960 _res_constr.data = NULL;
2961 uint32_t* _res_vals = (uint32_t*) _res.ptr;
2962 for (size_t b = 0; b < _res_constr.datalen; b++) {
2963 uint32_t arr_conv_27 = _res_vals[b];
2964 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)arr_conv_27;
2965 FREE((void*)arr_conv_27);
2966 _res_constr.data[b] = arr_conv_27_conv;
2968 CVec_SpendableOutputDescriptorZ_free(_res_constr);
2971 void CVec_1MessageSendEventZ_1free(void* ctx_TODO, uint32_tArray _res) {
2972 LDKCVec_MessageSendEventZ _res_constr;
2973 _res_constr.datalen = _res.len;
2974 if (_res_constr.datalen > 0)
2975 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
2977 _res_constr.data = NULL;
2978 uint32_t* _res_vals = (uint32_t*) _res.ptr;
2979 for (size_t s = 0; s < _res_constr.datalen; s++) {
2980 uint32_t arr_conv_18 = _res_vals[s];
2981 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
2982 FREE((void*)arr_conv_18);
2983 _res_constr.data[s] = arr_conv_18_conv;
2985 CVec_MessageSendEventZ_free(_res_constr);
2988 void CVec_1EventZ_1free(void* ctx_TODO, uint32_tArray _res) {
2989 LDKCVec_EventZ _res_constr;
2990 _res_constr.datalen = _res.len;
2991 if (_res_constr.datalen > 0)
2992 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
2994 _res_constr.data = NULL;
2995 uint32_t* _res_vals = (uint32_t*) _res.ptr;
2996 for (size_t h = 0; h < _res_constr.datalen; h++) {
2997 uint32_t arr_conv_7 = _res_vals[h];
2998 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
2999 FREE((void*)arr_conv_7);
3000 _res_constr.data[h] = arr_conv_7_conv;
3002 CVec_EventZ_free(_res_constr);
3005 void C2Tuple_1usizeTransactionZ_1free(void* ctx_TODO, uint32_t _res) {
3006 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)_res;
3008 C2Tuple_usizeTransactionZ_free(_res_conv);
3011 uint32_t C2Tuple_1usizeTransactionZ_1new(void* ctx_TODO, int64_t a, int8_tArray b) {
3012 LDKTransaction b_ref;
3013 b_ref.datalen = b.len;
3014 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
3015 memcpy(b_ref.data, b.ptr, b_ref.datalen);
3016 b_ref.data_is_owned = true;
3017 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
3018 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
3019 // XXX: We likely need to clone here, but no _clone fn is available for byte[]
3020 return (long)ret_ref;
3023 void CVec_1C2Tuple_1usizeTransactionZZ_1free(void* ctx_TODO, uint32_tArray _res) {
3024 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
3025 _res_constr.datalen = _res.len;
3026 if (_res_constr.datalen > 0)
3027 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
3029 _res_constr.data = NULL;
3030 uint32_t* _res_vals = (uint32_t*) _res.ptr;
3031 for (size_t y = 0; y < _res_constr.datalen; y++) {
3032 uint32_t arr_conv_24 = _res_vals[y];
3033 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
3034 FREE((void*)arr_conv_24);
3035 _res_constr.data[y] = arr_conv_24_conv;
3037 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
3040 uint32_t CResult_1NoneChannelMonitorUpdateErrZ_1ok(void* ctx_TODO) {
3041 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3042 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
3043 return (long)ret_conv;
3046 uint32_t CResult_1NoneChannelMonitorUpdateErrZ_1err(void* ctx_TODO, uint32_t e) {
3047 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
3048 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3049 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
3050 return (long)ret_conv;
3053 void CResult_1NoneChannelMonitorUpdateErrZ_1free(void* ctx_TODO, uint32_t _res) {
3054 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)_res;
3056 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
3059 void CVec_1MonitorEventZ_1free(void* ctx_TODO, uint32_tArray _res) {
3060 LDKCVec_MonitorEventZ _res_constr;
3061 _res_constr.datalen = _res.len;
3062 if (_res_constr.datalen > 0)
3063 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
3065 _res_constr.data = NULL;
3066 uint32_t* _res_vals = (uint32_t*) _res.ptr;
3067 for (size_t o = 0; o < _res_constr.datalen; o++) {
3068 uint32_t arr_conv_14 = _res_vals[o];
3069 LDKMonitorEvent arr_conv_14_conv;
3070 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
3071 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
3072 _res_constr.data[o] = arr_conv_14_conv;
3074 CVec_MonitorEventZ_free(_res_constr);
3077 uint32_t CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
3078 LDKChannelMonitorUpdate o_conv;
3079 o_conv.inner = (void*)(o & (~1));
3080 o_conv.is_owned = (o & 1) || (o == 0);
3081 if (o_conv.inner != NULL)
3082 o_conv = ChannelMonitorUpdate_clone(&o_conv);
3083 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
3084 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
3085 return (long)ret_conv;
3088 uint32_t CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
3089 LDKDecodeError e_conv;
3090 e_conv.inner = (void*)(e & (~1));
3091 e_conv.is_owned = (e & 1) || (e == 0);
3092 // Warning: we may need a move here but can't clone!
3093 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
3094 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
3095 return (long)ret_conv;
3098 void CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
3099 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)_res;
3101 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
3104 uint32_t CResult_1NoneMonitorUpdateErrorZ_1ok(void* ctx_TODO) {
3105 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
3106 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
3107 return (long)ret_conv;
3110 uint32_t CResult_1NoneMonitorUpdateErrorZ_1err(void* ctx_TODO, uint32_t e) {
3111 LDKMonitorUpdateError e_conv;
3112 e_conv.inner = (void*)(e & (~1));
3113 e_conv.is_owned = (e & 1) || (e == 0);
3114 // Warning: we may need a move here but can't clone!
3115 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
3116 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
3117 return (long)ret_conv;
3120 void CResult_1NoneMonitorUpdateErrorZ_1free(void* ctx_TODO, uint32_t _res) {
3121 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)_res;
3123 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
3126 void C2Tuple_1OutPointScriptZ_1free(void* ctx_TODO, uint32_t _res) {
3127 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)_res;
3129 C2Tuple_OutPointScriptZ_free(_res_conv);
3132 uint32_t C2Tuple_1OutPointScriptZ_1new(void* ctx_TODO, uint32_t a, int8_tArray b) {
3134 a_conv.inner = (void*)(a & (~1));
3135 a_conv.is_owned = (a & 1) || (a == 0);
3136 if (a_conv.inner != NULL)
3137 a_conv = OutPoint_clone(&a_conv);
3139 b_ref.datalen = b.len;
3140 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
3141 memcpy(b_ref.data, b.ptr, b_ref.datalen);
3142 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
3143 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
3144 ret_ref->a = OutPoint_clone(&ret_ref->a);
3145 ret_ref->b = CVec_u8Z_clone(&ret_ref->b);
3146 return (long)ret_ref;
3149 void CVec_1TransactionZ_1free(void* ctx_TODO, uint32_tArray _res) {
3150 LDKCVec_TransactionZ _res_constr;
3151 _res_constr.datalen = _res.len;
3152 if (_res_constr.datalen > 0)
3153 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
3155 _res_constr.data = NULL;
3156 int8_tArray* _res_vals = (int8_tArray*) _res.ptr;
3157 for (size_t i = 0; i < _res_constr.datalen; i++) {
3158 int8_tArray arr_conv_8 = _res_vals[i];
3159 LDKTransaction arr_conv_8_ref;
3160 arr_conv_8_ref.datalen = arr_conv_8.len;
3161 arr_conv_8_ref.data = MALLOC(arr_conv_8_ref.datalen, "LDKTransaction Bytes");
3162 memcpy(arr_conv_8_ref.data, arr_conv_8.ptr, arr_conv_8_ref.datalen);
3163 arr_conv_8_ref.data_is_owned = true;
3164 _res_constr.data[i] = arr_conv_8_ref;
3166 CVec_TransactionZ_free(_res_constr);
3169 void C2Tuple_1u32TxOutZ_1free(void* ctx_TODO, uint32_t _res) {
3170 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)_res;
3172 C2Tuple_u32TxOutZ_free(_res_conv);
3175 uint32_t C2Tuple_1u32TxOutZ_1new(void* ctx_TODO, int32_t a, uint32_t b) {
3176 LDKTxOut b_conv = *(LDKTxOut*)b;
3178 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
3179 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
3180 // XXX: We likely need to clone here, but no _clone fn is available for TxOut
3181 return (long)ret_ref;
3184 void CVec_1C2Tuple_1u32TxOutZZ_1free(void* ctx_TODO, uint32_tArray _res) {
3185 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
3186 _res_constr.datalen = _res.len;
3187 if (_res_constr.datalen > 0)
3188 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
3190 _res_constr.data = NULL;
3191 uint32_t* _res_vals = (uint32_t*) _res.ptr;
3192 for (size_t a = 0; a < _res_constr.datalen; a++) {
3193 uint32_t arr_conv_26 = _res_vals[a];
3194 LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)arr_conv_26;
3195 FREE((void*)arr_conv_26);
3196 _res_constr.data[a] = arr_conv_26_conv;
3198 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
3201 void C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(void* ctx_TODO, uint32_t _res) {
3202 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)_res;
3204 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
3207 uint32_t C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(void* ctx_TODO, int8_tArray a, uint32_tArray b) {
3208 LDKThirtyTwoBytes a_ref;
3210 memcpy(a_ref.data, a.ptr, 32);
3211 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
3212 b_constr.datalen = b.len;
3213 if (b_constr.datalen > 0)
3214 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
3216 b_constr.data = NULL;
3217 uint32_t* b_vals = (uint32_t*) b.ptr;
3218 for (size_t a = 0; a < b_constr.datalen; a++) {
3219 uint32_t arr_conv_26 = b_vals[a];
3220 LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)arr_conv_26;
3221 FREE((void*)arr_conv_26);
3222 b_constr.data[a] = arr_conv_26_conv;
3224 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
3225 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
3226 ret_ref->a = ThirtyTwoBytes_clone(&ret_ref->a);
3227 // XXX: We likely need to clone here, but no _clone fn is available for TwoTuple<Integer, TxOut>[]
3228 return (long)ret_ref;
3231 void CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(void* ctx_TODO, uint32_tArray _res) {
3232 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
3233 _res_constr.datalen = _res.len;
3234 if (_res_constr.datalen > 0)
3235 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
3237 _res_constr.data = NULL;
3238 uint32_t* _res_vals = (uint32_t*) _res.ptr;
3239 for (size_t u = 0; u < _res_constr.datalen; u++) {
3240 uint32_t arr_conv_46 = _res_vals[u];
3241 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)arr_conv_46;
3242 FREE((void*)arr_conv_46);
3243 _res_constr.data[u] = arr_conv_46_conv;
3245 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
3248 void C2Tuple_1BlockHashChannelMonitorZ_1free(void* ctx_TODO, uint32_t _res) {
3249 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)_res;
3251 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
3254 uint32_t C2Tuple_1BlockHashChannelMonitorZ_1new(void* ctx_TODO, int8_tArray a, uint32_t b) {
3255 LDKThirtyTwoBytes a_ref;
3257 memcpy(a_ref.data, a.ptr, 32);
3258 LDKChannelMonitor b_conv;
3259 b_conv.inner = (void*)(b & (~1));
3260 b_conv.is_owned = (b & 1) || (b == 0);
3261 // Warning: we may need a move here but can't clone!
3262 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
3263 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
3264 ret_ref->a = ThirtyTwoBytes_clone(&ret_ref->a);
3265 // XXX: We likely need to clone here, but no _clone fn is available for ChannelMonitor
3266 return (long)ret_ref;
3269 uint32_t CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
3270 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)o;
3272 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
3273 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
3274 return (long)ret_conv;
3277 uint32_t CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
3278 LDKDecodeError e_conv;
3279 e_conv.inner = (void*)(e & (~1));
3280 e_conv.is_owned = (e & 1) || (e == 0);
3281 // Warning: we may need a move here but can't clone!
3282 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
3283 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
3284 return (long)ret_conv;
3287 void CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
3288 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)_res;
3290 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
3293 void C2Tuple_1u64u64Z_1free(void* ctx_TODO, uint32_t _res) {
3294 LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)_res;
3296 C2Tuple_u64u64Z_free(_res_conv);
3299 uint32_t C2Tuple_1u64u64Z_1new(void* ctx_TODO, int64_t a, int64_t b) {
3300 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
3301 *ret_ref = C2Tuple_u64u64Z_new(a, b);
3302 return (long)ret_ref;
3305 uint32_t CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
3306 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)o;
3308 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
3309 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
3310 return (long)ret_conv;
3313 uint32_t CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
3314 LDKDecodeError e_conv;
3315 e_conv.inner = (void*)(e & (~1));
3316 e_conv.is_owned = (e & 1) || (e == 0);
3317 // Warning: we may need a move here but can't clone!
3318 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
3319 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
3320 return (long)ret_conv;
3323 void CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
3324 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)_res;
3326 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
3329 void CVec_1SignatureZ_1free(void* ctx_TODO, uint32_tArray _res) {
3330 LDKCVec_SignatureZ _res_constr;
3331 _res_constr.datalen = _res.len;
3332 if (_res_constr.datalen > 0)
3333 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
3335 _res_constr.data = NULL;
3336 int8_tArray* _res_vals = (int8_tArray*) _res.ptr;
3337 for (size_t i = 0; i < _res_constr.datalen; i++) {
3338 int8_tArray arr_conv_8 = _res_vals[i];
3339 LDKSignature arr_conv_8_ref;
3340 CHECK(arr_conv_8.len == 64);
3341 memcpy(arr_conv_8_ref.compact_form, arr_conv_8.ptr, 64);
3342 _res_constr.data[i] = arr_conv_8_ref;
3344 CVec_SignatureZ_free(_res_constr);
3347 void C2Tuple_1SignatureCVec_1SignatureZZ_1free(void* ctx_TODO, uint32_t _res) {
3348 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)_res;
3350 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
3353 uint32_t C2Tuple_1SignatureCVec_1SignatureZZ_1new(void* ctx_TODO, int8_tArray a, uint32_tArray b) {
3356 memcpy(a_ref.compact_form, a.ptr, 64);
3357 LDKCVec_SignatureZ b_constr;
3358 b_constr.datalen = b.len;
3359 if (b_constr.datalen > 0)
3360 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
3362 b_constr.data = NULL;
3363 int8_tArray* b_vals = (int8_tArray*) b.ptr;
3364 for (size_t i = 0; i < b_constr.datalen; i++) {
3365 int8_tArray arr_conv_8 = b_vals[i];
3366 LDKSignature arr_conv_8_ref;
3367 CHECK(arr_conv_8.len == 64);
3368 memcpy(arr_conv_8_ref.compact_form, arr_conv_8.ptr, 64);
3369 b_constr.data[i] = arr_conv_8_ref;
3371 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
3372 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
3373 // XXX: We likely need to clone here, but no _clone fn is available for byte[]
3374 // XXX: We likely need to clone here, but no _clone fn is available for byte[][]
3375 return (long)ret_ref;
3378 uint32_t CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(void* ctx_TODO, uint32_t o) {
3379 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)o;
3381 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3382 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
3383 return (long)ret_conv;
3386 uint32_t CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(void* ctx_TODO) {
3387 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3388 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
3389 return (long)ret_conv;
3392 void CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(void* ctx_TODO, uint32_t _res) {
3393 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)_res;
3395 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
3398 uint32_t CResult_1SignatureNoneZ_1ok(void* ctx_TODO, int8_tArray o) {
3401 memcpy(o_ref.compact_form, o.ptr, 64);
3402 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3403 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
3404 return (long)ret_conv;
3407 uint32_t CResult_1SignatureNoneZ_1err(void* ctx_TODO) {
3408 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3409 *ret_conv = CResult_SignatureNoneZ_err();
3410 return (long)ret_conv;
3413 void CResult_1SignatureNoneZ_1free(void* ctx_TODO, uint32_t _res) {
3414 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)_res;
3416 CResult_SignatureNoneZ_free(_res_conv);
3419 uint32_t CResult_1CVec_1SignatureZNoneZ_1ok(void* ctx_TODO, uint32_tArray o) {
3420 LDKCVec_SignatureZ o_constr;
3421 o_constr.datalen = o.len;
3422 if (o_constr.datalen > 0)
3423 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
3425 o_constr.data = NULL;
3426 int8_tArray* o_vals = (int8_tArray*) o.ptr;
3427 for (size_t i = 0; i < o_constr.datalen; i++) {
3428 int8_tArray arr_conv_8 = o_vals[i];
3429 LDKSignature arr_conv_8_ref;
3430 CHECK(arr_conv_8.len == 64);
3431 memcpy(arr_conv_8_ref.compact_form, arr_conv_8.ptr, 64);
3432 o_constr.data[i] = arr_conv_8_ref;
3434 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
3435 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
3436 return (long)ret_conv;
3439 uint32_t CResult_1CVec_1SignatureZNoneZ_1err(void* ctx_TODO) {
3440 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
3441 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
3442 return (long)ret_conv;
3445 void CResult_1CVec_1SignatureZNoneZ_1free(void* ctx_TODO, uint32_t _res) {
3446 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)_res;
3448 CResult_CVec_SignatureZNoneZ_free(_res_conv);
3451 uint32_t CResult_1ChanKeySignerDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
3452 LDKChannelKeys o_conv = *(LDKChannelKeys*)o;
3453 if (o_conv.free == LDKChannelKeys_JCalls_free) {
3454 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3455 LDKChannelKeys_JCalls_clone(o_conv.this_arg);
3457 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
3458 *ret_conv = CResult_ChanKeySignerDecodeErrorZ_ok(o_conv);
3459 return (long)ret_conv;
3462 uint32_t CResult_1ChanKeySignerDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
3463 LDKDecodeError e_conv;
3464 e_conv.inner = (void*)(e & (~1));
3465 e_conv.is_owned = (e & 1) || (e == 0);
3466 // Warning: we may need a move here but can't clone!
3467 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
3468 *ret_conv = CResult_ChanKeySignerDecodeErrorZ_err(e_conv);
3469 return (long)ret_conv;
3472 void CResult_1ChanKeySignerDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
3473 LDKCResult_ChanKeySignerDecodeErrorZ _res_conv = *(LDKCResult_ChanKeySignerDecodeErrorZ*)_res;
3475 CResult_ChanKeySignerDecodeErrorZ_free(_res_conv);
3478 uint32_t CResult_1InMemoryChannelKeysDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
3479 LDKInMemoryChannelKeys o_conv;
3480 o_conv.inner = (void*)(o & (~1));
3481 o_conv.is_owned = (o & 1) || (o == 0);
3482 if (o_conv.inner != NULL)
3483 o_conv = InMemoryChannelKeys_clone(&o_conv);
3484 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
3485 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_ok(o_conv);
3486 return (long)ret_conv;
3489 uint32_t CResult_1InMemoryChannelKeysDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
3490 LDKDecodeError e_conv;
3491 e_conv.inner = (void*)(e & (~1));
3492 e_conv.is_owned = (e & 1) || (e == 0);
3493 // Warning: we may need a move here but can't clone!
3494 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
3495 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_err(e_conv);
3496 return (long)ret_conv;
3499 void CResult_1InMemoryChannelKeysDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
3500 LDKCResult_InMemoryChannelKeysDecodeErrorZ _res_conv = *(LDKCResult_InMemoryChannelKeysDecodeErrorZ*)_res;
3502 CResult_InMemoryChannelKeysDecodeErrorZ_free(_res_conv);
3505 uint32_t CResult_1TxOutAccessErrorZ_1ok(void* ctx_TODO, uint32_t o) {
3506 LDKTxOut o_conv = *(LDKTxOut*)o;
3508 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3509 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
3510 return (long)ret_conv;
3513 uint32_t CResult_1TxOutAccessErrorZ_1err(void* ctx_TODO, uint32_t e) {
3514 LDKAccessError e_conv = LDKAccessError_from_js(e);
3515 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3516 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
3517 return (long)ret_conv;
3520 void CResult_1TxOutAccessErrorZ_1free(void* ctx_TODO, uint32_t _res) {
3521 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)_res;
3523 CResult_TxOutAccessErrorZ_free(_res_conv);
3526 uint32_t CResult_1NoneAPIErrorZ_1ok(void* ctx_TODO) {
3527 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3528 *ret_conv = CResult_NoneAPIErrorZ_ok();
3529 return (long)ret_conv;
3532 uint32_t CResult_1NoneAPIErrorZ_1err(void* ctx_TODO, uint32_t e) {
3533 LDKAPIError e_conv = *(LDKAPIError*)e;
3535 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3536 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
3537 return (long)ret_conv;
3540 void CResult_1NoneAPIErrorZ_1free(void* ctx_TODO, uint32_t _res) {
3541 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)_res;
3543 CResult_NoneAPIErrorZ_free(_res_conv);
3546 void CVec_1ChannelDetailsZ_1free(void* ctx_TODO, uint32_tArray _res) {
3547 LDKCVec_ChannelDetailsZ _res_constr;
3548 _res_constr.datalen = _res.len;
3549 if (_res_constr.datalen > 0)
3550 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
3552 _res_constr.data = NULL;
3553 uint32_t* _res_vals = (uint32_t*) _res.ptr;
3554 for (size_t q = 0; q < _res_constr.datalen; q++) {
3555 uint32_t arr_conv_16 = _res_vals[q];
3556 LDKChannelDetails arr_conv_16_conv;
3557 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
3558 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
3559 _res_constr.data[q] = arr_conv_16_conv;
3561 CVec_ChannelDetailsZ_free(_res_constr);
3564 uint32_t CResult_1NonePaymentSendFailureZ_1ok(void* ctx_TODO) {
3565 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
3566 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
3567 return (long)ret_conv;
3570 uint32_t CResult_1NonePaymentSendFailureZ_1err(void* ctx_TODO, uint32_t e) {
3571 LDKPaymentSendFailure e_conv;
3572 e_conv.inner = (void*)(e & (~1));
3573 e_conv.is_owned = (e & 1) || (e == 0);
3574 // Warning: we may need a move here but can't clone!
3575 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
3576 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
3577 return (long)ret_conv;
3580 void CResult_1NonePaymentSendFailureZ_1free(void* ctx_TODO, uint32_t _res) {
3581 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)_res;
3583 CResult_NonePaymentSendFailureZ_free(_res_conv);
3586 void CVec_1NetAddressZ_1free(void* ctx_TODO, uint32_tArray _res) {
3587 LDKCVec_NetAddressZ _res_constr;
3588 _res_constr.datalen = _res.len;
3589 if (_res_constr.datalen > 0)
3590 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
3592 _res_constr.data = NULL;
3593 uint32_t* _res_vals = (uint32_t*) _res.ptr;
3594 for (size_t m = 0; m < _res_constr.datalen; m++) {
3595 uint32_t arr_conv_12 = _res_vals[m];
3596 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
3597 FREE((void*)arr_conv_12);
3598 _res_constr.data[m] = arr_conv_12_conv;
3600 CVec_NetAddressZ_free(_res_constr);
3603 void CVec_1ChannelMonitorZ_1free(void* ctx_TODO, uint32_tArray _res) {
3604 LDKCVec_ChannelMonitorZ _res_constr;
3605 _res_constr.datalen = _res.len;
3606 if (_res_constr.datalen > 0)
3607 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
3609 _res_constr.data = NULL;
3610 uint32_t* _res_vals = (uint32_t*) _res.ptr;
3611 for (size_t q = 0; q < _res_constr.datalen; q++) {
3612 uint32_t arr_conv_16 = _res_vals[q];
3613 LDKChannelMonitor arr_conv_16_conv;
3614 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
3615 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
3616 _res_constr.data[q] = arr_conv_16_conv;
3618 CVec_ChannelMonitorZ_free(_res_constr);
3621 void C2Tuple_1BlockHashChannelManagerZ_1free(void* ctx_TODO, uint32_t _res) {
3622 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)_res;
3624 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
3627 uint32_t C2Tuple_1BlockHashChannelManagerZ_1new(void* ctx_TODO, int8_tArray a, uint32_t b) {
3628 LDKThirtyTwoBytes a_ref;
3630 memcpy(a_ref.data, a.ptr, 32);
3631 LDKChannelManager b_conv;
3632 b_conv.inner = (void*)(b & (~1));
3633 b_conv.is_owned = (b & 1) || (b == 0);
3634 // Warning: we may need a move here but can't clone!
3635 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
3636 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
3637 ret_ref->a = ThirtyTwoBytes_clone(&ret_ref->a);
3638 // XXX: We likely need to clone here, but no _clone fn is available for ChannelManager
3639 return (long)ret_ref;
3642 uint32_t CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
3643 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)o;
3645 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
3646 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
3647 return (long)ret_conv;
3650 uint32_t CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
3651 LDKDecodeError e_conv;
3652 e_conv.inner = (void*)(e & (~1));
3653 e_conv.is_owned = (e & 1) || (e == 0);
3654 // Warning: we may need a move here but can't clone!
3655 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
3656 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
3657 return (long)ret_conv;
3660 void CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
3661 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)_res;
3663 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
3666 uint32_t CResult_1NetAddressu8Z_1ok(void* ctx_TODO, uint32_t o) {
3667 LDKNetAddress o_conv = *(LDKNetAddress*)o;
3669 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
3670 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
3671 return (long)ret_conv;
3674 uint32_t CResult_1NetAddressu8Z_1err(void* ctx_TODO, int8_t e) {
3675 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
3676 *ret_conv = CResult_NetAddressu8Z_err(e);
3677 return (long)ret_conv;
3680 void CResult_1NetAddressu8Z_1free(void* ctx_TODO, uint32_t _res) {
3681 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)_res;
3683 CResult_NetAddressu8Z_free(_res_conv);
3686 uint32_t CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
3687 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)o;
3689 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
3690 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
3691 return (long)ret_conv;
3694 uint32_t CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
3695 LDKDecodeError e_conv;
3696 e_conv.inner = (void*)(e & (~1));
3697 e_conv.is_owned = (e & 1) || (e == 0);
3698 // Warning: we may need a move here but can't clone!
3699 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
3700 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
3701 return (long)ret_conv;
3704 void CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
3705 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)_res;
3707 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
3710 void CVec_1u64Z_1free(void* ctx_TODO, int64_tArray _res) {
3711 LDKCVec_u64Z _res_constr;
3712 _res_constr.datalen = _res.len;
3713 if (_res_constr.datalen > 0)
3714 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
3716 _res_constr.data = NULL;
3717 int64_t* _res_vals = (int64_t*) _res.ptr;
3718 for (size_t g = 0; g < _res_constr.datalen; g++) {
3719 int64_t arr_conv_6 = _res_vals[g];
3720 _res_constr.data[g] = arr_conv_6;
3722 CVec_u64Z_free(_res_constr);
3725 void CVec_1UpdateAddHTLCZ_1free(void* ctx_TODO, uint32_tArray _res) {
3726 LDKCVec_UpdateAddHTLCZ _res_constr;
3727 _res_constr.datalen = _res.len;
3728 if (_res_constr.datalen > 0)
3729 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
3731 _res_constr.data = NULL;
3732 uint32_t* _res_vals = (uint32_t*) _res.ptr;
3733 for (size_t p = 0; p < _res_constr.datalen; p++) {
3734 uint32_t arr_conv_15 = _res_vals[p];
3735 LDKUpdateAddHTLC arr_conv_15_conv;
3736 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
3737 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
3738 _res_constr.data[p] = arr_conv_15_conv;
3740 CVec_UpdateAddHTLCZ_free(_res_constr);
3743 void CVec_1UpdateFulfillHTLCZ_1free(void* ctx_TODO, uint32_tArray _res) {
3744 LDKCVec_UpdateFulfillHTLCZ _res_constr;
3745 _res_constr.datalen = _res.len;
3746 if (_res_constr.datalen > 0)
3747 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
3749 _res_constr.data = NULL;
3750 uint32_t* _res_vals = (uint32_t*) _res.ptr;
3751 for (size_t t = 0; t < _res_constr.datalen; t++) {
3752 uint32_t arr_conv_19 = _res_vals[t];
3753 LDKUpdateFulfillHTLC arr_conv_19_conv;
3754 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
3755 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
3756 _res_constr.data[t] = arr_conv_19_conv;
3758 CVec_UpdateFulfillHTLCZ_free(_res_constr);
3761 void CVec_1UpdateFailHTLCZ_1free(void* ctx_TODO, uint32_tArray _res) {
3762 LDKCVec_UpdateFailHTLCZ _res_constr;
3763 _res_constr.datalen = _res.len;
3764 if (_res_constr.datalen > 0)
3765 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
3767 _res_constr.data = NULL;
3768 uint32_t* _res_vals = (uint32_t*) _res.ptr;
3769 for (size_t q = 0; q < _res_constr.datalen; q++) {
3770 uint32_t arr_conv_16 = _res_vals[q];
3771 LDKUpdateFailHTLC arr_conv_16_conv;
3772 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
3773 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
3774 _res_constr.data[q] = arr_conv_16_conv;
3776 CVec_UpdateFailHTLCZ_free(_res_constr);
3779 void CVec_1UpdateFailMalformedHTLCZ_1free(void* ctx_TODO, uint32_tArray _res) {
3780 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
3781 _res_constr.datalen = _res.len;
3782 if (_res_constr.datalen > 0)
3783 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
3785 _res_constr.data = NULL;
3786 uint32_t* _res_vals = (uint32_t*) _res.ptr;
3787 for (size_t z = 0; z < _res_constr.datalen; z++) {
3788 uint32_t arr_conv_25 = _res_vals[z];
3789 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
3790 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
3791 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
3792 _res_constr.data[z] = arr_conv_25_conv;
3794 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
3797 uint32_t CResult_1boolLightningErrorZ_1ok(void* ctx_TODO, jboolean o) {
3798 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3799 *ret_conv = CResult_boolLightningErrorZ_ok(o);
3800 return (long)ret_conv;
3803 uint32_t CResult_1boolLightningErrorZ_1err(void* ctx_TODO, uint32_t e) {
3804 LDKLightningError e_conv;
3805 e_conv.inner = (void*)(e & (~1));
3806 e_conv.is_owned = (e & 1) || (e == 0);
3807 // Warning: we may need a move here but can't clone!
3808 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3809 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
3810 return (long)ret_conv;
3813 void CResult_1boolLightningErrorZ_1free(void* ctx_TODO, uint32_t _res) {
3814 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)_res;
3816 CResult_boolLightningErrorZ_free(_res_conv);
3819 void C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(void* ctx_TODO, uint32_t _res) {
3820 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)_res;
3822 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
3825 uint32_t C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(void* ctx_TODO, uint32_t a, uint32_t b, uint32_t c) {
3826 LDKChannelAnnouncement a_conv;
3827 a_conv.inner = (void*)(a & (~1));
3828 a_conv.is_owned = (a & 1) || (a == 0);
3829 if (a_conv.inner != NULL)
3830 a_conv = ChannelAnnouncement_clone(&a_conv);
3831 LDKChannelUpdate b_conv;
3832 b_conv.inner = (void*)(b & (~1));
3833 b_conv.is_owned = (b & 1) || (b == 0);
3834 if (b_conv.inner != NULL)
3835 b_conv = ChannelUpdate_clone(&b_conv);
3836 LDKChannelUpdate c_conv;
3837 c_conv.inner = (void*)(c & (~1));
3838 c_conv.is_owned = (c & 1) || (c == 0);
3839 if (c_conv.inner != NULL)
3840 c_conv = ChannelUpdate_clone(&c_conv);
3841 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3842 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
3843 ret_ref->a = ChannelAnnouncement_clone(&ret_ref->a);
3844 ret_ref->b = ChannelUpdate_clone(&ret_ref->b);
3845 ret_ref->c = ChannelUpdate_clone(&ret_ref->c);
3846 return (long)ret_ref;
3849 void CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(void* ctx_TODO, uint32_tArray _res) {
3850 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
3851 _res_constr.datalen = _res.len;
3852 if (_res_constr.datalen > 0)
3853 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
3855 _res_constr.data = NULL;
3856 uint32_t* _res_vals = (uint32_t*) _res.ptr;
3857 for (size_t l = 0; l < _res_constr.datalen; l++) {
3858 uint32_t arr_conv_63 = _res_vals[l];
3859 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
3860 FREE((void*)arr_conv_63);
3861 _res_constr.data[l] = arr_conv_63_conv;
3863 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
3866 void CVec_1NodeAnnouncementZ_1free(void* ctx_TODO, uint32_tArray _res) {
3867 LDKCVec_NodeAnnouncementZ _res_constr;
3868 _res_constr.datalen = _res.len;
3869 if (_res_constr.datalen > 0)
3870 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
3872 _res_constr.data = NULL;
3873 uint32_t* _res_vals = (uint32_t*) _res.ptr;
3874 for (size_t s = 0; s < _res_constr.datalen; s++) {
3875 uint32_t arr_conv_18 = _res_vals[s];
3876 LDKNodeAnnouncement arr_conv_18_conv;
3877 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
3878 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
3879 _res_constr.data[s] = arr_conv_18_conv;
3881 CVec_NodeAnnouncementZ_free(_res_constr);
3884 uint32_t CResult_1NoneLightningErrorZ_1ok(void* ctx_TODO) {
3885 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
3886 *ret_conv = CResult_NoneLightningErrorZ_ok();
3887 return (long)ret_conv;
3890 uint32_t CResult_1NoneLightningErrorZ_1err(void* ctx_TODO, uint32_t e) {
3891 LDKLightningError e_conv;
3892 e_conv.inner = (void*)(e & (~1));
3893 e_conv.is_owned = (e & 1) || (e == 0);
3894 // Warning: we may need a move here but can't clone!
3895 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
3896 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
3897 return (long)ret_conv;
3900 void CResult_1NoneLightningErrorZ_1free(void* ctx_TODO, uint32_t _res) {
3901 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)_res;
3903 CResult_NoneLightningErrorZ_free(_res_conv);
3906 uint32_t CResult_1ChannelReestablishDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
3907 LDKChannelReestablish o_conv;
3908 o_conv.inner = (void*)(o & (~1));
3909 o_conv.is_owned = (o & 1) || (o == 0);
3910 if (o_conv.inner != NULL)
3911 o_conv = ChannelReestablish_clone(&o_conv);
3912 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
3913 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
3914 return (long)ret_conv;
3917 uint32_t CResult_1ChannelReestablishDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
3918 LDKDecodeError e_conv;
3919 e_conv.inner = (void*)(e & (~1));
3920 e_conv.is_owned = (e & 1) || (e == 0);
3921 // Warning: we may need a move here but can't clone!
3922 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
3923 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
3924 return (long)ret_conv;
3927 void CResult_1ChannelReestablishDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
3928 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)_res;
3930 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
3933 uint32_t CResult_1InitDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
3935 o_conv.inner = (void*)(o & (~1));
3936 o_conv.is_owned = (o & 1) || (o == 0);
3937 if (o_conv.inner != NULL)
3938 o_conv = Init_clone(&o_conv);
3939 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
3940 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
3941 return (long)ret_conv;
3944 uint32_t CResult_1InitDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
3945 LDKDecodeError e_conv;
3946 e_conv.inner = (void*)(e & (~1));
3947 e_conv.is_owned = (e & 1) || (e == 0);
3948 // Warning: we may need a move here but can't clone!
3949 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
3950 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
3951 return (long)ret_conv;
3954 void CResult_1InitDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
3955 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)_res;
3957 CResult_InitDecodeErrorZ_free(_res_conv);
3960 uint32_t CResult_1PingDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
3962 o_conv.inner = (void*)(o & (~1));
3963 o_conv.is_owned = (o & 1) || (o == 0);
3964 if (o_conv.inner != NULL)
3965 o_conv = Ping_clone(&o_conv);
3966 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
3967 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
3968 return (long)ret_conv;
3971 uint32_t CResult_1PingDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
3972 LDKDecodeError e_conv;
3973 e_conv.inner = (void*)(e & (~1));
3974 e_conv.is_owned = (e & 1) || (e == 0);
3975 // Warning: we may need a move here but can't clone!
3976 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
3977 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
3978 return (long)ret_conv;
3981 void CResult_1PingDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
3982 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)_res;
3984 CResult_PingDecodeErrorZ_free(_res_conv);
3987 uint32_t CResult_1PongDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
3989 o_conv.inner = (void*)(o & (~1));
3990 o_conv.is_owned = (o & 1) || (o == 0);
3991 if (o_conv.inner != NULL)
3992 o_conv = Pong_clone(&o_conv);
3993 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
3994 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
3995 return (long)ret_conv;
3998 uint32_t CResult_1PongDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
3999 LDKDecodeError e_conv;
4000 e_conv.inner = (void*)(e & (~1));
4001 e_conv.is_owned = (e & 1) || (e == 0);
4002 // Warning: we may need a move here but can't clone!
4003 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
4004 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
4005 return (long)ret_conv;
4008 void CResult_1PongDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4009 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)_res;
4011 CResult_PongDecodeErrorZ_free(_res_conv);
4014 uint32_t CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4015 LDKUnsignedChannelAnnouncement o_conv;
4016 o_conv.inner = (void*)(o & (~1));
4017 o_conv.is_owned = (o & 1) || (o == 0);
4018 if (o_conv.inner != NULL)
4019 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
4020 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
4021 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
4022 return (long)ret_conv;
4025 uint32_t CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
4026 LDKDecodeError e_conv;
4027 e_conv.inner = (void*)(e & (~1));
4028 e_conv.is_owned = (e & 1) || (e == 0);
4029 // Warning: we may need a move here but can't clone!
4030 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
4031 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
4032 return (long)ret_conv;
4035 void CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4036 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)_res;
4038 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
4041 uint32_t CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4042 LDKUnsignedChannelUpdate o_conv;
4043 o_conv.inner = (void*)(o & (~1));
4044 o_conv.is_owned = (o & 1) || (o == 0);
4045 if (o_conv.inner != NULL)
4046 o_conv = UnsignedChannelUpdate_clone(&o_conv);
4047 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
4048 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
4049 return (long)ret_conv;
4052 uint32_t CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
4053 LDKDecodeError e_conv;
4054 e_conv.inner = (void*)(e & (~1));
4055 e_conv.is_owned = (e & 1) || (e == 0);
4056 // Warning: we may need a move here but can't clone!
4057 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
4058 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
4059 return (long)ret_conv;
4062 void CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4063 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)_res;
4065 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
4068 uint32_t CResult_1ErrorMessageDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4069 LDKErrorMessage o_conv;
4070 o_conv.inner = (void*)(o & (~1));
4071 o_conv.is_owned = (o & 1) || (o == 0);
4072 if (o_conv.inner != NULL)
4073 o_conv = ErrorMessage_clone(&o_conv);
4074 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
4075 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
4076 return (long)ret_conv;
4079 uint32_t CResult_1ErrorMessageDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
4080 LDKDecodeError e_conv;
4081 e_conv.inner = (void*)(e & (~1));
4082 e_conv.is_owned = (e & 1) || (e == 0);
4083 // Warning: we may need a move here but can't clone!
4084 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
4085 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
4086 return (long)ret_conv;
4089 void CResult_1ErrorMessageDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4090 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)_res;
4092 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
4095 uint32_t CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4096 LDKUnsignedNodeAnnouncement o_conv;
4097 o_conv.inner = (void*)(o & (~1));
4098 o_conv.is_owned = (o & 1) || (o == 0);
4099 if (o_conv.inner != NULL)
4100 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
4101 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
4102 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
4103 return (long)ret_conv;
4106 uint32_t CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
4107 LDKDecodeError e_conv;
4108 e_conv.inner = (void*)(e & (~1));
4109 e_conv.is_owned = (e & 1) || (e == 0);
4110 // Warning: we may need a move here but can't clone!
4111 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
4112 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
4113 return (long)ret_conv;
4116 void CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4117 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)_res;
4119 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
4122 uint32_t CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4123 LDKQueryShortChannelIds o_conv;
4124 o_conv.inner = (void*)(o & (~1));
4125 o_conv.is_owned = (o & 1) || (o == 0);
4126 if (o_conv.inner != NULL)
4127 o_conv = QueryShortChannelIds_clone(&o_conv);
4128 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
4129 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
4130 return (long)ret_conv;
4133 uint32_t CResult_1QueryShortChannelIdsDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
4134 LDKDecodeError e_conv;
4135 e_conv.inner = (void*)(e & (~1));
4136 e_conv.is_owned = (e & 1) || (e == 0);
4137 // Warning: we may need a move here but can't clone!
4138 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
4139 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
4140 return (long)ret_conv;
4143 void CResult_1QueryShortChannelIdsDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4144 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)_res;
4146 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
4149 uint32_t CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4150 LDKReplyShortChannelIdsEnd o_conv;
4151 o_conv.inner = (void*)(o & (~1));
4152 o_conv.is_owned = (o & 1) || (o == 0);
4153 if (o_conv.inner != NULL)
4154 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
4155 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
4156 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
4157 return (long)ret_conv;
4160 uint32_t CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
4161 LDKDecodeError e_conv;
4162 e_conv.inner = (void*)(e & (~1));
4163 e_conv.is_owned = (e & 1) || (e == 0);
4164 // Warning: we may need a move here but can't clone!
4165 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
4166 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
4167 return (long)ret_conv;
4170 void CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4171 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)_res;
4173 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
4176 uint32_t CResult_1QueryChannelRangeDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4177 LDKQueryChannelRange o_conv;
4178 o_conv.inner = (void*)(o & (~1));
4179 o_conv.is_owned = (o & 1) || (o == 0);
4180 if (o_conv.inner != NULL)
4181 o_conv = QueryChannelRange_clone(&o_conv);
4182 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
4183 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
4184 return (long)ret_conv;
4187 uint32_t CResult_1QueryChannelRangeDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
4188 LDKDecodeError e_conv;
4189 e_conv.inner = (void*)(e & (~1));
4190 e_conv.is_owned = (e & 1) || (e == 0);
4191 // Warning: we may need a move here but can't clone!
4192 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
4193 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
4194 return (long)ret_conv;
4197 void CResult_1QueryChannelRangeDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4198 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)_res;
4200 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
4203 uint32_t CResult_1ReplyChannelRangeDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4204 LDKReplyChannelRange o_conv;
4205 o_conv.inner = (void*)(o & (~1));
4206 o_conv.is_owned = (o & 1) || (o == 0);
4207 if (o_conv.inner != NULL)
4208 o_conv = ReplyChannelRange_clone(&o_conv);
4209 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
4210 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
4211 return (long)ret_conv;
4214 uint32_t CResult_1ReplyChannelRangeDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
4215 LDKDecodeError e_conv;
4216 e_conv.inner = (void*)(e & (~1));
4217 e_conv.is_owned = (e & 1) || (e == 0);
4218 // Warning: we may need a move here but can't clone!
4219 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
4220 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
4221 return (long)ret_conv;
4224 void CResult_1ReplyChannelRangeDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4225 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)_res;
4227 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
4230 uint32_t CResult_1GossipTimestampFilterDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4231 LDKGossipTimestampFilter o_conv;
4232 o_conv.inner = (void*)(o & (~1));
4233 o_conv.is_owned = (o & 1) || (o == 0);
4234 if (o_conv.inner != NULL)
4235 o_conv = GossipTimestampFilter_clone(&o_conv);
4236 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
4237 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
4238 return (long)ret_conv;
4241 uint32_t CResult_1GossipTimestampFilterDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
4242 LDKDecodeError e_conv;
4243 e_conv.inner = (void*)(e & (~1));
4244 e_conv.is_owned = (e & 1) || (e == 0);
4245 // Warning: we may need a move here but can't clone!
4246 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
4247 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
4248 return (long)ret_conv;
4251 void CResult_1GossipTimestampFilterDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4252 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)_res;
4254 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
4257 void CVec_1PublicKeyZ_1free(void* ctx_TODO, uint32_tArray _res) {
4258 LDKCVec_PublicKeyZ _res_constr;
4259 _res_constr.datalen = _res.len;
4260 if (_res_constr.datalen > 0)
4261 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
4263 _res_constr.data = NULL;
4264 int8_tArray* _res_vals = (int8_tArray*) _res.ptr;
4265 for (size_t i = 0; i < _res_constr.datalen; i++) {
4266 int8_tArray arr_conv_8 = _res_vals[i];
4267 LDKPublicKey arr_conv_8_ref;
4268 CHECK(arr_conv_8.len == 33);
4269 memcpy(arr_conv_8_ref.compressed_form, arr_conv_8.ptr, 33);
4270 _res_constr.data[i] = arr_conv_8_ref;
4272 CVec_PublicKeyZ_free(_res_constr);
4275 void CVec_1u8Z_1free(void* ctx_TODO, int8_tArray _res) {
4276 LDKCVec_u8Z _res_ref;
4277 _res_ref.datalen = _res.len;
4278 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
4279 memcpy(_res_ref.data, _res.ptr, _res_ref.datalen);
4280 CVec_u8Z_free(_res_ref);
4283 uint32_t CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(void* ctx_TODO, int8_tArray o) {
4285 o_ref.datalen = o.len;
4286 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
4287 memcpy(o_ref.data, o.ptr, o_ref.datalen);
4288 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4289 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
4290 return (long)ret_conv;
4293 uint32_t CResult_1CVec_1u8ZPeerHandleErrorZ_1err(void* ctx_TODO, uint32_t e) {
4294 LDKPeerHandleError e_conv;
4295 e_conv.inner = (void*)(e & (~1));
4296 e_conv.is_owned = (e & 1) || (e == 0);
4297 // Warning: we may need a move here but can't clone!
4298 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4299 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
4300 return (long)ret_conv;
4303 void CResult_1CVec_1u8ZPeerHandleErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4304 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)_res;
4306 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
4309 uint32_t CResult_1NonePeerHandleErrorZ_1ok(void* ctx_TODO) {
4310 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4311 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
4312 return (long)ret_conv;
4315 uint32_t CResult_1NonePeerHandleErrorZ_1err(void* ctx_TODO, uint32_t e) {
4316 LDKPeerHandleError e_conv;
4317 e_conv.inner = (void*)(e & (~1));
4318 e_conv.is_owned = (e & 1) || (e == 0);
4319 // Warning: we may need a move here but can't clone!
4320 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4321 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
4322 return (long)ret_conv;
4325 void CResult_1NonePeerHandleErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4326 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)_res;
4328 CResult_NonePeerHandleErrorZ_free(_res_conv);
4331 uint32_t CResult_1boolPeerHandleErrorZ_1ok(void* ctx_TODO, jboolean o) {
4332 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4333 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
4334 return (long)ret_conv;
4337 uint32_t CResult_1boolPeerHandleErrorZ_1err(void* ctx_TODO, uint32_t e) {
4338 LDKPeerHandleError e_conv;
4339 e_conv.inner = (void*)(e & (~1));
4340 e_conv.is_owned = (e & 1) || (e == 0);
4341 // Warning: we may need a move here but can't clone!
4342 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4343 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
4344 return (long)ret_conv;
4347 void CResult_1boolPeerHandleErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4348 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)_res;
4350 CResult_boolPeerHandleErrorZ_free(_res_conv);
4353 uint32_t CResult_1SecretKeySecpErrorZ_1ok(void* ctx_TODO, int8_tArray o) {
4356 memcpy(o_ref.bytes, o.ptr, 32);
4357 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4358 *ret_conv = CResult_SecretKeySecpErrorZ_ok(o_ref);
4359 return (long)ret_conv;
4362 uint32_t CResult_1SecretKeySecpErrorZ_1err(void* ctx_TODO, uint32_t e) {
4363 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
4364 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4365 *ret_conv = CResult_SecretKeySecpErrorZ_err(e_conv);
4366 return (long)ret_conv;
4369 void CResult_1SecretKeySecpErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4370 LDKCResult_SecretKeySecpErrorZ _res_conv = *(LDKCResult_SecretKeySecpErrorZ*)_res;
4372 CResult_SecretKeySecpErrorZ_free(_res_conv);
4375 uint32_t CResult_1PublicKeySecpErrorZ_1ok(void* ctx_TODO, int8_tArray o) {
4378 memcpy(o_ref.compressed_form, o.ptr, 33);
4379 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4380 *ret_conv = CResult_PublicKeySecpErrorZ_ok(o_ref);
4381 return (long)ret_conv;
4384 uint32_t CResult_1PublicKeySecpErrorZ_1err(void* ctx_TODO, uint32_t e) {
4385 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
4386 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4387 *ret_conv = CResult_PublicKeySecpErrorZ_err(e_conv);
4388 return (long)ret_conv;
4391 void CResult_1PublicKeySecpErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4392 LDKCResult_PublicKeySecpErrorZ _res_conv = *(LDKCResult_PublicKeySecpErrorZ*)_res;
4394 CResult_PublicKeySecpErrorZ_free(_res_conv);
4397 uint32_t CResult_1TxCreationKeysSecpErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4398 LDKTxCreationKeys o_conv;
4399 o_conv.inner = (void*)(o & (~1));
4400 o_conv.is_owned = (o & 1) || (o == 0);
4401 if (o_conv.inner != NULL)
4402 o_conv = TxCreationKeys_clone(&o_conv);
4403 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4404 *ret_conv = CResult_TxCreationKeysSecpErrorZ_ok(o_conv);
4405 return (long)ret_conv;
4408 uint32_t CResult_1TxCreationKeysSecpErrorZ_1err(void* ctx_TODO, uint32_t e) {
4409 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
4410 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4411 *ret_conv = CResult_TxCreationKeysSecpErrorZ_err(e_conv);
4412 return (long)ret_conv;
4415 void CResult_1TxCreationKeysSecpErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4416 LDKCResult_TxCreationKeysSecpErrorZ _res_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)_res;
4418 CResult_TxCreationKeysSecpErrorZ_free(_res_conv);
4421 uint32_t CResult_1TrustedCommitmentTransactionNoneZ_1ok(void* ctx_TODO, uint32_t o) {
4422 LDKTrustedCommitmentTransaction o_conv;
4423 o_conv.inner = (void*)(o & (~1));
4424 o_conv.is_owned = (o & 1) || (o == 0);
4425 // Warning: we may need a move here but can't clone!
4426 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
4427 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
4428 return (long)ret_conv;
4431 uint32_t CResult_1TrustedCommitmentTransactionNoneZ_1err(void* ctx_TODO) {
4432 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
4433 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
4434 return (long)ret_conv;
4437 void CResult_1TrustedCommitmentTransactionNoneZ_1free(void* ctx_TODO, uint32_t _res) {
4438 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)_res;
4440 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
4443 void CVec_1RouteHopZ_1free(void* ctx_TODO, uint32_tArray _res) {
4444 LDKCVec_RouteHopZ _res_constr;
4445 _res_constr.datalen = _res.len;
4446 if (_res_constr.datalen > 0)
4447 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
4449 _res_constr.data = NULL;
4450 uint32_t* _res_vals = (uint32_t*) _res.ptr;
4451 for (size_t k = 0; k < _res_constr.datalen; k++) {
4452 uint32_t arr_conv_10 = _res_vals[k];
4453 LDKRouteHop arr_conv_10_conv;
4454 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
4455 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
4456 _res_constr.data[k] = arr_conv_10_conv;
4458 CVec_RouteHopZ_free(_res_constr);
4461 void CVec_1CVec_1RouteHopZZ_1free(void* ctx_TODO, uint32_tArray _res) {
4462 LDKCVec_CVec_RouteHopZZ _res_constr;
4463 _res_constr.datalen = _res.len;
4464 if (_res_constr.datalen > 0)
4465 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
4467 _res_constr.data = NULL;
4468 uint32_tArray* _res_vals = (uint32_tArray*) _res.ptr;
4469 for (size_t m = 0; m < _res_constr.datalen; m++) {
4470 uint32_tArray arr_conv_12 = _res_vals[m];
4471 LDKCVec_RouteHopZ arr_conv_12_constr;
4472 arr_conv_12_constr.datalen = arr_conv_12.len;
4473 if (arr_conv_12_constr.datalen > 0)
4474 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
4476 arr_conv_12_constr.data = NULL;
4477 uint32_t* arr_conv_12_vals = (uint32_t*) arr_conv_12.ptr;
4478 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
4479 uint32_t arr_conv_10 = arr_conv_12_vals[k];
4480 LDKRouteHop arr_conv_10_conv;
4481 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
4482 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
4483 arr_conv_12_constr.data[k] = arr_conv_10_conv;
4485 _res_constr.data[m] = arr_conv_12_constr;
4487 CVec_CVec_RouteHopZZ_free(_res_constr);
4490 uint32_t CResult_1RouteDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4492 o_conv.inner = (void*)(o & (~1));
4493 o_conv.is_owned = (o & 1) || (o == 0);
4494 if (o_conv.inner != NULL)
4495 o_conv = Route_clone(&o_conv);
4496 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
4497 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
4498 return (long)ret_conv;
4501 uint32_t CResult_1RouteDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
4502 LDKDecodeError e_conv;
4503 e_conv.inner = (void*)(e & (~1));
4504 e_conv.is_owned = (e & 1) || (e == 0);
4505 // Warning: we may need a move here but can't clone!
4506 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
4507 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
4508 return (long)ret_conv;
4511 void CResult_1RouteDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4512 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)_res;
4514 CResult_RouteDecodeErrorZ_free(_res_conv);
4517 void CVec_1RouteHintZ_1free(void* ctx_TODO, uint32_tArray _res) {
4518 LDKCVec_RouteHintZ _res_constr;
4519 _res_constr.datalen = _res.len;
4520 if (_res_constr.datalen > 0)
4521 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
4523 _res_constr.data = NULL;
4524 uint32_t* _res_vals = (uint32_t*) _res.ptr;
4525 for (size_t l = 0; l < _res_constr.datalen; l++) {
4526 uint32_t arr_conv_11 = _res_vals[l];
4527 LDKRouteHint arr_conv_11_conv;
4528 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
4529 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
4530 _res_constr.data[l] = arr_conv_11_conv;
4532 CVec_RouteHintZ_free(_res_constr);
4535 uint32_t CResult_1RouteLightningErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4537 o_conv.inner = (void*)(o & (~1));
4538 o_conv.is_owned = (o & 1) || (o == 0);
4539 if (o_conv.inner != NULL)
4540 o_conv = Route_clone(&o_conv);
4541 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4542 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
4543 return (long)ret_conv;
4546 uint32_t CResult_1RouteLightningErrorZ_1err(void* ctx_TODO, uint32_t e) {
4547 LDKLightningError e_conv;
4548 e_conv.inner = (void*)(e & (~1));
4549 e_conv.is_owned = (e & 1) || (e == 0);
4550 // Warning: we may need a move here but can't clone!
4551 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4552 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
4553 return (long)ret_conv;
4556 void CResult_1RouteLightningErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4557 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)_res;
4559 CResult_RouteLightningErrorZ_free(_res_conv);
4562 uint32_t CResult_1RoutingFeesDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4563 LDKRoutingFees o_conv;
4564 o_conv.inner = (void*)(o & (~1));
4565 o_conv.is_owned = (o & 1) || (o == 0);
4566 if (o_conv.inner != NULL)
4567 o_conv = RoutingFees_clone(&o_conv);
4568 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
4569 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
4570 return (long)ret_conv;
4573 uint32_t CResult_1RoutingFeesDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
4574 LDKDecodeError e_conv;
4575 e_conv.inner = (void*)(e & (~1));
4576 e_conv.is_owned = (e & 1) || (e == 0);
4577 // Warning: we may need a move here but can't clone!
4578 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
4579 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
4580 return (long)ret_conv;
4583 void CResult_1RoutingFeesDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4584 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)_res;
4586 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
4589 uint32_t CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4590 LDKNodeAnnouncementInfo o_conv;
4591 o_conv.inner = (void*)(o & (~1));
4592 o_conv.is_owned = (o & 1) || (o == 0);
4593 // Warning: we may need a move here but can't clone!
4594 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
4595 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
4596 return (long)ret_conv;
4599 uint32_t CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
4600 LDKDecodeError e_conv;
4601 e_conv.inner = (void*)(e & (~1));
4602 e_conv.is_owned = (e & 1) || (e == 0);
4603 // Warning: we may need a move here but can't clone!
4604 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
4605 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
4606 return (long)ret_conv;
4609 void CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4610 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)_res;
4612 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
4615 uint32_t CResult_1NodeInfoDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4617 o_conv.inner = (void*)(o & (~1));
4618 o_conv.is_owned = (o & 1) || (o == 0);
4619 // Warning: we may need a move here but can't clone!
4620 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
4621 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
4622 return (long)ret_conv;
4625 uint32_t CResult_1NodeInfoDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
4626 LDKDecodeError e_conv;
4627 e_conv.inner = (void*)(e & (~1));
4628 e_conv.is_owned = (e & 1) || (e == 0);
4629 // Warning: we may need a move here but can't clone!
4630 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
4631 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
4632 return (long)ret_conv;
4635 void CResult_1NodeInfoDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4636 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)_res;
4638 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
4641 uint32_t CResult_1NetworkGraphDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4642 LDKNetworkGraph o_conv;
4643 o_conv.inner = (void*)(o & (~1));
4644 o_conv.is_owned = (o & 1) || (o == 0);
4645 // Warning: we may need a move here but can't clone!
4646 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
4647 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
4648 return (long)ret_conv;
4651 uint32_t CResult_1NetworkGraphDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
4652 LDKDecodeError e_conv;
4653 e_conv.inner = (void*)(e & (~1));
4654 e_conv.is_owned = (e & 1) || (e == 0);
4655 // Warning: we may need a move here but can't clone!
4656 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
4657 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
4658 return (long)ret_conv;
4661 void CResult_1NetworkGraphDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4662 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)_res;
4664 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
4667 void Event_1free(void* ctx_TODO, uint32_t this_ptr) {
4668 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
4669 FREE((void*)this_ptr);
4670 Event_free(this_ptr_conv);
4673 uint32_t Event_1clone(void* ctx_TODO, uint32_t orig) {
4674 LDKEvent* orig_conv = (LDKEvent*)orig;
4675 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
4676 *ret_copy = Event_clone(orig_conv);
4677 long ret_ref = (long)ret_copy;
4681 int8_tArray Event_1write(void* ctx_TODO, uint32_t obj) {
4682 LDKEvent* obj_conv = (LDKEvent*)obj;
4683 LDKCVec_u8Z arg_var = Event_write(obj_conv);
4684 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
4685 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
4686 CVec_u8Z_free(arg_var);
4690 void MessageSendEvent_1free(void* ctx_TODO, uint32_t this_ptr) {
4691 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
4692 FREE((void*)this_ptr);
4693 MessageSendEvent_free(this_ptr_conv);
4696 uint32_t MessageSendEvent_1clone(void* ctx_TODO, uint32_t orig) {
4697 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
4698 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
4699 *ret_copy = MessageSendEvent_clone(orig_conv);
4700 long ret_ref = (long)ret_copy;
4704 void MessageSendEventsProvider_1free(void* ctx_TODO, uint32_t this_ptr) {
4705 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
4706 FREE((void*)this_ptr);
4707 MessageSendEventsProvider_free(this_ptr_conv);
4710 void EventsProvider_1free(void* ctx_TODO, uint32_t this_ptr) {
4711 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
4712 FREE((void*)this_ptr);
4713 EventsProvider_free(this_ptr_conv);
4716 void APIError_1free(void* ctx_TODO, uint32_t this_ptr) {
4717 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
4718 FREE((void*)this_ptr);
4719 APIError_free(this_ptr_conv);
4722 uint32_t APIError_1clone(void* ctx_TODO, uint32_t orig) {
4723 LDKAPIError* orig_conv = (LDKAPIError*)orig;
4724 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4725 *ret_copy = APIError_clone(orig_conv);
4726 long ret_ref = (long)ret_copy;
4730 uint32_t Level_1clone(void* ctx_TODO, uint32_t orig) {
4731 LDKLevel* orig_conv = (LDKLevel*)orig;
4732 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
4736 uint32_t Level_1max(void* ctx_TODO) {
4737 uint32_t ret_conv = LDKLevel_to_js(Level_max());
4741 void Logger_1free(void* ctx_TODO, uint32_t this_ptr) {
4742 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
4743 FREE((void*)this_ptr);
4744 Logger_free(this_ptr_conv);
4747 void ChannelHandshakeConfig_1free(void* ctx_TODO, uint32_t this_ptr) {
4748 LDKChannelHandshakeConfig this_ptr_conv;
4749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4750 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4751 ChannelHandshakeConfig_free(this_ptr_conv);
4754 uint32_t ChannelHandshakeConfig_1clone(void* ctx_TODO, uint32_t orig) {
4755 LDKChannelHandshakeConfig orig_conv;
4756 orig_conv.inner = (void*)(orig & (~1));
4757 orig_conv.is_owned = false;
4758 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
4759 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4760 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4761 long ret_ref = (long)ret_var.inner;
4762 if (ret_var.is_owned) {
4768 int32_t ChannelHandshakeConfig_1get_1minimum_1depth(void* ctx_TODO, uint32_t this_ptr) {
4769 LDKChannelHandshakeConfig this_ptr_conv;
4770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4771 this_ptr_conv.is_owned = false;
4772 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
4776 void ChannelHandshakeConfig_1set_1minimum_1depth(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
4777 LDKChannelHandshakeConfig this_ptr_conv;
4778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4779 this_ptr_conv.is_owned = false;
4780 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
4783 jshort ChannelHandshakeConfig_1get_1our_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr) {
4784 LDKChannelHandshakeConfig this_ptr_conv;
4785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4786 this_ptr_conv.is_owned = false;
4787 jshort ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
4791 void ChannelHandshakeConfig_1set_1our_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr, jshort val) {
4792 LDKChannelHandshakeConfig this_ptr_conv;
4793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4794 this_ptr_conv.is_owned = false;
4795 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
4798 int64_t ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr) {
4799 LDKChannelHandshakeConfig this_ptr_conv;
4800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4801 this_ptr_conv.is_owned = false;
4802 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
4806 void ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
4807 LDKChannelHandshakeConfig this_ptr_conv;
4808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4809 this_ptr_conv.is_owned = false;
4810 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
4813 uint32_t ChannelHandshakeConfig_1new(void* ctx_TODO, int32_t minimum_depth_arg, jshort our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg) {
4814 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
4815 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4816 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4817 long ret_ref = (long)ret_var.inner;
4818 if (ret_var.is_owned) {
4824 uint32_t ChannelHandshakeConfig_1default(void* ctx_TODO) {
4825 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
4826 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4827 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4828 long ret_ref = (long)ret_var.inner;
4829 if (ret_var.is_owned) {
4835 void ChannelHandshakeLimits_1free(void* ctx_TODO, uint32_t this_ptr) {
4836 LDKChannelHandshakeLimits this_ptr_conv;
4837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4838 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4839 ChannelHandshakeLimits_free(this_ptr_conv);
4842 uint32_t ChannelHandshakeLimits_1clone(void* ctx_TODO, uint32_t orig) {
4843 LDKChannelHandshakeLimits orig_conv;
4844 orig_conv.inner = (void*)(orig & (~1));
4845 orig_conv.is_owned = false;
4846 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
4847 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4848 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4849 long ret_ref = (long)ret_var.inner;
4850 if (ret_var.is_owned) {
4856 int64_t ChannelHandshakeLimits_1get_1min_1funding_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
4857 LDKChannelHandshakeLimits this_ptr_conv;
4858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4859 this_ptr_conv.is_owned = false;
4860 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
4864 void ChannelHandshakeLimits_1set_1min_1funding_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
4865 LDKChannelHandshakeLimits this_ptr_conv;
4866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4867 this_ptr_conv.is_owned = false;
4868 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
4871 int64_t ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr) {
4872 LDKChannelHandshakeLimits this_ptr_conv;
4873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4874 this_ptr_conv.is_owned = false;
4875 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
4879 void ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
4880 LDKChannelHandshakeLimits this_ptr_conv;
4881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4882 this_ptr_conv.is_owned = false;
4883 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
4886 int64_t ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(void* ctx_TODO, uint32_t this_ptr) {
4887 LDKChannelHandshakeLimits this_ptr_conv;
4888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4889 this_ptr_conv.is_owned = false;
4890 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
4894 void ChannelHandshakeLimits_1set_1min_1max_1htlc_1value_1in_1flight_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
4895 LDKChannelHandshakeLimits this_ptr_conv;
4896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4897 this_ptr_conv.is_owned = false;
4898 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
4901 int64_t ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
4902 LDKChannelHandshakeLimits this_ptr_conv;
4903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4904 this_ptr_conv.is_owned = false;
4905 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
4909 void ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
4910 LDKChannelHandshakeLimits this_ptr_conv;
4911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4912 this_ptr_conv.is_owned = false;
4913 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
4916 jshort ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(void* ctx_TODO, uint32_t this_ptr) {
4917 LDKChannelHandshakeLimits this_ptr_conv;
4918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4919 this_ptr_conv.is_owned = false;
4920 jshort ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
4924 void ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(void* ctx_TODO, uint32_t this_ptr, jshort val) {
4925 LDKChannelHandshakeLimits this_ptr_conv;
4926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4927 this_ptr_conv.is_owned = false;
4928 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
4931 int64_t ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
4932 LDKChannelHandshakeLimits this_ptr_conv;
4933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4934 this_ptr_conv.is_owned = false;
4935 int64_t ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
4939 void ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
4940 LDKChannelHandshakeLimits this_ptr_conv;
4941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4942 this_ptr_conv.is_owned = false;
4943 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
4946 int64_t ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
4947 LDKChannelHandshakeLimits this_ptr_conv;
4948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4949 this_ptr_conv.is_owned = false;
4950 int64_t ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
4954 void ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
4955 LDKChannelHandshakeLimits this_ptr_conv;
4956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4957 this_ptr_conv.is_owned = false;
4958 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
4961 int32_t ChannelHandshakeLimits_1get_1max_1minimum_1depth(void* ctx_TODO, uint32_t this_ptr) {
4962 LDKChannelHandshakeLimits this_ptr_conv;
4963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4964 this_ptr_conv.is_owned = false;
4965 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
4969 void ChannelHandshakeLimits_1set_1max_1minimum_1depth(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
4970 LDKChannelHandshakeLimits this_ptr_conv;
4971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4972 this_ptr_conv.is_owned = false;
4973 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
4976 jboolean ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(void* ctx_TODO, uint32_t this_ptr) {
4977 LDKChannelHandshakeLimits this_ptr_conv;
4978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4979 this_ptr_conv.is_owned = false;
4980 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
4984 void ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
4985 LDKChannelHandshakeLimits this_ptr_conv;
4986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4987 this_ptr_conv.is_owned = false;
4988 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
4991 jshort ChannelHandshakeLimits_1get_1their_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr) {
4992 LDKChannelHandshakeLimits this_ptr_conv;
4993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4994 this_ptr_conv.is_owned = false;
4995 jshort ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
4999 void ChannelHandshakeLimits_1set_1their_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr, jshort val) {
5000 LDKChannelHandshakeLimits this_ptr_conv;
5001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5002 this_ptr_conv.is_owned = false;
5003 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
5006 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, jshort 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, jshort their_to_self_delay_arg) {
5007 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);
5008 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5009 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5010 long ret_ref = (long)ret_var.inner;
5011 if (ret_var.is_owned) {
5017 uint32_t ChannelHandshakeLimits_1default(void* ctx_TODO) {
5018 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
5019 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5020 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5021 long ret_ref = (long)ret_var.inner;
5022 if (ret_var.is_owned) {
5028 void ChannelConfig_1free(void* ctx_TODO, uint32_t this_ptr) {
5029 LDKChannelConfig this_ptr_conv;
5030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5031 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5032 ChannelConfig_free(this_ptr_conv);
5035 uint32_t ChannelConfig_1clone(void* ctx_TODO, uint32_t orig) {
5036 LDKChannelConfig orig_conv;
5037 orig_conv.inner = (void*)(orig & (~1));
5038 orig_conv.is_owned = false;
5039 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
5040 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5041 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5042 long ret_ref = (long)ret_var.inner;
5043 if (ret_var.is_owned) {
5049 int32_t ChannelConfig_1get_1fee_1proportional_1millionths(void* ctx_TODO, uint32_t this_ptr) {
5050 LDKChannelConfig this_ptr_conv;
5051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5052 this_ptr_conv.is_owned = false;
5053 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
5057 void ChannelConfig_1set_1fee_1proportional_1millionths(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
5058 LDKChannelConfig this_ptr_conv;
5059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5060 this_ptr_conv.is_owned = false;
5061 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
5064 jboolean ChannelConfig_1get_1announced_1channel(void* ctx_TODO, uint32_t this_ptr) {
5065 LDKChannelConfig this_ptr_conv;
5066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5067 this_ptr_conv.is_owned = false;
5068 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
5072 void ChannelConfig_1set_1announced_1channel(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
5073 LDKChannelConfig this_ptr_conv;
5074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5075 this_ptr_conv.is_owned = false;
5076 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
5079 jboolean ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(void* ctx_TODO, uint32_t this_ptr) {
5080 LDKChannelConfig this_ptr_conv;
5081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5082 this_ptr_conv.is_owned = false;
5083 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
5087 void ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
5088 LDKChannelConfig this_ptr_conv;
5089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5090 this_ptr_conv.is_owned = false;
5091 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
5094 uint32_t ChannelConfig_1new(void* ctx_TODO, int32_t fee_proportional_millionths_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
5095 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
5096 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5097 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5098 long ret_ref = (long)ret_var.inner;
5099 if (ret_var.is_owned) {
5105 uint32_t ChannelConfig_1default(void* ctx_TODO) {
5106 LDKChannelConfig ret_var = ChannelConfig_default();
5107 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5108 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5109 long ret_ref = (long)ret_var.inner;
5110 if (ret_var.is_owned) {
5116 int8_tArray ChannelConfig_1write(void* ctx_TODO, uint32_t obj) {
5117 LDKChannelConfig obj_conv;
5118 obj_conv.inner = (void*)(obj & (~1));
5119 obj_conv.is_owned = false;
5120 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
5121 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
5122 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
5123 CVec_u8Z_free(arg_var);
5127 uint32_t ChannelConfig_1read(void* ctx_TODO, int8_tArray ser) {
5129 ser_ref.datalen = ser.len;
5130 ser_ref.data = ser.ptr;
5131 LDKChannelConfig ret_var = ChannelConfig_read(ser_ref);
5132 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5133 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5134 long ret_ref = (long)ret_var.inner;
5135 if (ret_var.is_owned) {
5141 void UserConfig_1free(void* ctx_TODO, uint32_t this_ptr) {
5142 LDKUserConfig this_ptr_conv;
5143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5144 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5145 UserConfig_free(this_ptr_conv);
5148 uint32_t UserConfig_1clone(void* ctx_TODO, uint32_t orig) {
5149 LDKUserConfig orig_conv;
5150 orig_conv.inner = (void*)(orig & (~1));
5151 orig_conv.is_owned = false;
5152 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
5153 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5154 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5155 long ret_ref = (long)ret_var.inner;
5156 if (ret_var.is_owned) {
5162 uint32_t UserConfig_1get_1own_1channel_1config(void* ctx_TODO, uint32_t this_ptr) {
5163 LDKUserConfig this_ptr_conv;
5164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5165 this_ptr_conv.is_owned = false;
5166 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
5167 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5168 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5169 long ret_ref = (long)ret_var.inner;
5170 if (ret_var.is_owned) {
5176 void UserConfig_1set_1own_1channel_1config(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
5177 LDKUserConfig this_ptr_conv;
5178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5179 this_ptr_conv.is_owned = false;
5180 LDKChannelHandshakeConfig val_conv;
5181 val_conv.inner = (void*)(val & (~1));
5182 val_conv.is_owned = (val & 1) || (val == 0);
5183 if (val_conv.inner != NULL)
5184 val_conv = ChannelHandshakeConfig_clone(&val_conv);
5185 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
5188 uint32_t UserConfig_1get_1peer_1channel_1config_1limits(void* ctx_TODO, uint32_t this_ptr) {
5189 LDKUserConfig this_ptr_conv;
5190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5191 this_ptr_conv.is_owned = false;
5192 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
5193 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5194 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5195 long ret_ref = (long)ret_var.inner;
5196 if (ret_var.is_owned) {
5202 void UserConfig_1set_1peer_1channel_1config_1limits(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
5203 LDKUserConfig this_ptr_conv;
5204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5205 this_ptr_conv.is_owned = false;
5206 LDKChannelHandshakeLimits val_conv;
5207 val_conv.inner = (void*)(val & (~1));
5208 val_conv.is_owned = (val & 1) || (val == 0);
5209 if (val_conv.inner != NULL)
5210 val_conv = ChannelHandshakeLimits_clone(&val_conv);
5211 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
5214 uint32_t UserConfig_1get_1channel_1options(void* ctx_TODO, uint32_t this_ptr) {
5215 LDKUserConfig this_ptr_conv;
5216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5217 this_ptr_conv.is_owned = false;
5218 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
5219 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5220 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5221 long ret_ref = (long)ret_var.inner;
5222 if (ret_var.is_owned) {
5228 void UserConfig_1set_1channel_1options(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
5229 LDKUserConfig this_ptr_conv;
5230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5231 this_ptr_conv.is_owned = false;
5232 LDKChannelConfig val_conv;
5233 val_conv.inner = (void*)(val & (~1));
5234 val_conv.is_owned = (val & 1) || (val == 0);
5235 if (val_conv.inner != NULL)
5236 val_conv = ChannelConfig_clone(&val_conv);
5237 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
5240 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) {
5241 LDKChannelHandshakeConfig own_channel_config_arg_conv;
5242 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
5243 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
5244 if (own_channel_config_arg_conv.inner != NULL)
5245 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
5246 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
5247 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
5248 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
5249 if (peer_channel_config_limits_arg_conv.inner != NULL)
5250 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
5251 LDKChannelConfig channel_options_arg_conv;
5252 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
5253 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
5254 if (channel_options_arg_conv.inner != NULL)
5255 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
5256 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
5257 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5258 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5259 long ret_ref = (long)ret_var.inner;
5260 if (ret_var.is_owned) {
5266 uint32_t UserConfig_1default(void* ctx_TODO) {
5267 LDKUserConfig ret_var = UserConfig_default();
5268 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5269 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5270 long ret_ref = (long)ret_var.inner;
5271 if (ret_var.is_owned) {
5277 uint32_t AccessError_1clone(void* ctx_TODO, uint32_t orig) {
5278 LDKAccessError* orig_conv = (LDKAccessError*)orig;
5279 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
5283 void Access_1free(void* ctx_TODO, uint32_t this_ptr) {
5284 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
5285 FREE((void*)this_ptr);
5286 Access_free(this_ptr_conv);
5289 void Watch_1free(void* ctx_TODO, uint32_t this_ptr) {
5290 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
5291 FREE((void*)this_ptr);
5292 Watch_free(this_ptr_conv);
5295 void Filter_1free(void* ctx_TODO, uint32_t this_ptr) {
5296 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
5297 FREE((void*)this_ptr);
5298 Filter_free(this_ptr_conv);
5301 void BroadcasterInterface_1free(void* ctx_TODO, uint32_t this_ptr) {
5302 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
5303 FREE((void*)this_ptr);
5304 BroadcasterInterface_free(this_ptr_conv);
5307 uint32_t ConfirmationTarget_1clone(void* ctx_TODO, uint32_t orig) {
5308 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)orig;
5309 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
5313 void FeeEstimator_1free(void* ctx_TODO, uint32_t this_ptr) {
5314 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
5315 FREE((void*)this_ptr);
5316 FeeEstimator_free(this_ptr_conv);
5319 void ChainMonitor_1free(void* ctx_TODO, uint32_t this_ptr) {
5320 LDKChainMonitor this_ptr_conv;
5321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5322 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5323 ChainMonitor_free(this_ptr_conv);
5326 void ChainMonitor_1block_1connected(void* ctx_TODO, uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
5327 LDKChainMonitor this_arg_conv;
5328 this_arg_conv.inner = (void*)(this_arg & (~1));
5329 this_arg_conv.is_owned = false;
5330 unsigned char header_arr[80];
5331 CHECK(header.len == 80);
5332 memcpy(header_arr, header.ptr, 80);
5333 unsigned char (*header_ref)[80] = &header_arr;
5334 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
5335 txdata_constr.datalen = txdata.len;
5336 if (txdata_constr.datalen > 0)
5337 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5339 txdata_constr.data = NULL;
5340 uint32_t* txdata_vals = (uint32_t*) txdata.ptr;
5341 for (size_t y = 0; y < txdata_constr.datalen; y++) {
5342 uint32_t arr_conv_24 = txdata_vals[y];
5343 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
5344 FREE((void*)arr_conv_24);
5345 txdata_constr.data[y] = arr_conv_24_conv;
5347 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
5350 void ChainMonitor_1block_1disconnected(void* ctx_TODO, uint32_t this_arg, int8_tArray header, int32_t disconnected_height) {
5351 LDKChainMonitor this_arg_conv;
5352 this_arg_conv.inner = (void*)(this_arg & (~1));
5353 this_arg_conv.is_owned = false;
5354 unsigned char header_arr[80];
5355 CHECK(header.len == 80);
5356 memcpy(header_arr, header.ptr, 80);
5357 unsigned char (*header_ref)[80] = &header_arr;
5358 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
5361 uint32_t ChainMonitor_1new(void* ctx_TODO, uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
5362 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
5363 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5364 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5365 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5366 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5368 LDKLogger logger_conv = *(LDKLogger*)logger;
5369 if (logger_conv.free == LDKLogger_JCalls_free) {
5370 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5371 LDKLogger_JCalls_clone(logger_conv.this_arg);
5373 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
5374 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
5375 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5376 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
5378 LDKPersist persister_conv = *(LDKPersist*)persister;
5379 if (persister_conv.free == LDKPersist_JCalls_free) {
5380 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5381 LDKPersist_JCalls_clone(persister_conv.this_arg);
5383 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
5384 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5385 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5386 long ret_ref = (long)ret_var.inner;
5387 if (ret_var.is_owned) {
5393 uint32_t ChainMonitor_1as_1Watch(void* ctx_TODO, uint32_t this_arg) {
5394 LDKChainMonitor this_arg_conv;
5395 this_arg_conv.inner = (void*)(this_arg & (~1));
5396 this_arg_conv.is_owned = false;
5397 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
5398 *ret = ChainMonitor_as_Watch(&this_arg_conv);
5402 uint32_t ChainMonitor_1as_1EventsProvider(void* ctx_TODO, uint32_t this_arg) {
5403 LDKChainMonitor this_arg_conv;
5404 this_arg_conv.inner = (void*)(this_arg & (~1));
5405 this_arg_conv.is_owned = false;
5406 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5407 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
5411 void ChannelMonitorUpdate_1free(void* ctx_TODO, uint32_t this_ptr) {
5412 LDKChannelMonitorUpdate this_ptr_conv;
5413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5414 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5415 ChannelMonitorUpdate_free(this_ptr_conv);
5418 uint32_t ChannelMonitorUpdate_1clone(void* ctx_TODO, uint32_t orig) {
5419 LDKChannelMonitorUpdate orig_conv;
5420 orig_conv.inner = (void*)(orig & (~1));
5421 orig_conv.is_owned = false;
5422 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
5423 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5424 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5425 long ret_ref = (long)ret_var.inner;
5426 if (ret_var.is_owned) {
5432 int64_t ChannelMonitorUpdate_1get_1update_1id(void* ctx_TODO, uint32_t this_ptr) {
5433 LDKChannelMonitorUpdate this_ptr_conv;
5434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5435 this_ptr_conv.is_owned = false;
5436 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
5440 void ChannelMonitorUpdate_1set_1update_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
5441 LDKChannelMonitorUpdate this_ptr_conv;
5442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5443 this_ptr_conv.is_owned = false;
5444 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
5447 int8_tArray ChannelMonitorUpdate_1write(void* ctx_TODO, uint32_t obj) {
5448 LDKChannelMonitorUpdate obj_conv;
5449 obj_conv.inner = (void*)(obj & (~1));
5450 obj_conv.is_owned = false;
5451 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
5452 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
5453 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
5454 CVec_u8Z_free(arg_var);
5458 uint32_t ChannelMonitorUpdate_1read(void* ctx_TODO, int8_tArray ser) {
5460 ser_ref.datalen = ser.len;
5461 ser_ref.data = ser.ptr;
5462 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
5463 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
5464 return (long)ret_conv;
5467 uint32_t ChannelMonitorUpdateErr_1clone(void* ctx_TODO, uint32_t orig) {
5468 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)orig;
5469 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
5473 void MonitorUpdateError_1free(void* ctx_TODO, uint32_t this_ptr) {
5474 LDKMonitorUpdateError this_ptr_conv;
5475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5476 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5477 MonitorUpdateError_free(this_ptr_conv);
5480 void MonitorEvent_1free(void* ctx_TODO, uint32_t this_ptr) {
5481 LDKMonitorEvent this_ptr_conv;
5482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5483 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5484 MonitorEvent_free(this_ptr_conv);
5487 uint32_t MonitorEvent_1clone(void* ctx_TODO, uint32_t orig) {
5488 LDKMonitorEvent orig_conv;
5489 orig_conv.inner = (void*)(orig & (~1));
5490 orig_conv.is_owned = false;
5491 LDKMonitorEvent ret_var = MonitorEvent_clone(&orig_conv);
5492 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5493 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5494 long ret_ref = (long)ret_var.inner;
5495 if (ret_var.is_owned) {
5501 void HTLCUpdate_1free(void* ctx_TODO, uint32_t this_ptr) {
5502 LDKHTLCUpdate this_ptr_conv;
5503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5504 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5505 HTLCUpdate_free(this_ptr_conv);
5508 uint32_t HTLCUpdate_1clone(void* ctx_TODO, uint32_t orig) {
5509 LDKHTLCUpdate orig_conv;
5510 orig_conv.inner = (void*)(orig & (~1));
5511 orig_conv.is_owned = false;
5512 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
5513 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5514 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5515 long ret_ref = (long)ret_var.inner;
5516 if (ret_var.is_owned) {
5522 int8_tArray HTLCUpdate_1write(void* ctx_TODO, uint32_t obj) {
5523 LDKHTLCUpdate obj_conv;
5524 obj_conv.inner = (void*)(obj & (~1));
5525 obj_conv.is_owned = false;
5526 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
5527 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
5528 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
5529 CVec_u8Z_free(arg_var);
5533 uint32_t HTLCUpdate_1read(void* ctx_TODO, int8_tArray ser) {
5535 ser_ref.datalen = ser.len;
5536 ser_ref.data = ser.ptr;
5537 LDKHTLCUpdate ret_var = HTLCUpdate_read(ser_ref);
5538 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5539 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5540 long ret_ref = (long)ret_var.inner;
5541 if (ret_var.is_owned) {
5547 void ChannelMonitor_1free(void* ctx_TODO, uint32_t this_ptr) {
5548 LDKChannelMonitor this_ptr_conv;
5549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5550 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5551 ChannelMonitor_free(this_ptr_conv);
5554 int8_tArray ChannelMonitor_1write(void* ctx_TODO, uint32_t obj) {
5555 LDKChannelMonitor obj_conv;
5556 obj_conv.inner = (void*)(obj & (~1));
5557 obj_conv.is_owned = false;
5558 LDKCVec_u8Z arg_var = ChannelMonitor_write(&obj_conv);
5559 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
5560 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
5561 CVec_u8Z_free(arg_var);
5565 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) {
5566 LDKChannelMonitor this_arg_conv;
5567 this_arg_conv.inner = (void*)(this_arg & (~1));
5568 this_arg_conv.is_owned = false;
5569 LDKChannelMonitorUpdate updates_conv;
5570 updates_conv.inner = (void*)(updates & (~1));
5571 updates_conv.is_owned = false;
5572 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
5573 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator;
5574 LDKLogger* logger_conv = (LDKLogger*)logger;
5575 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5576 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
5577 return (long)ret_conv;
5580 int64_t ChannelMonitor_1get_1latest_1update_1id(void* ctx_TODO, uint32_t this_arg) {
5581 LDKChannelMonitor this_arg_conv;
5582 this_arg_conv.inner = (void*)(this_arg & (~1));
5583 this_arg_conv.is_owned = false;
5584 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
5588 uint32_t ChannelMonitor_1get_1funding_1txo(void* ctx_TODO, uint32_t this_arg) {
5589 LDKChannelMonitor this_arg_conv;
5590 this_arg_conv.inner = (void*)(this_arg & (~1));
5591 this_arg_conv.is_owned = false;
5592 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5593 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
5594 ret_ref->a = OutPoint_clone(&ret_ref->a);
5595 ret_ref->b = CVec_u8Z_clone(&ret_ref->b);
5596 return (long)ret_ref;
5599 uint32_tArray ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(void* ctx_TODO, uint32_t this_arg) {
5600 LDKChannelMonitor this_arg_conv;
5601 this_arg_conv.inner = (void*)(this_arg & (~1));
5602 this_arg_conv.is_owned = false;
5603 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
5604 uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
5605 uint32_t *ret_arr_ptr = ret_arr.ptr;
5606 for (size_t o = 0; o < ret_var.datalen; o++) {
5607 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
5608 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5609 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5610 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
5611 if (arr_conv_14_var.is_owned) {
5612 arr_conv_14_ref |= 1;
5614 ret_arr_ptr[o] = arr_conv_14_ref;
5620 uint32_tArray ChannelMonitor_1get_1and_1clear_1pending_1events(void* ctx_TODO, uint32_t this_arg) {
5621 LDKChannelMonitor this_arg_conv;
5622 this_arg_conv.inner = (void*)(this_arg & (~1));
5623 this_arg_conv.is_owned = false;
5624 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
5625 uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
5626 uint32_t *ret_arr_ptr = ret_arr.ptr;
5627 for (size_t h = 0; h < ret_var.datalen; h++) {
5628 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
5629 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
5630 long arr_conv_7_ref = (long)arr_conv_7_copy;
5631 ret_arr_ptr[h] = arr_conv_7_ref;
5637 uint32_tArray ChannelMonitor_1get_1latest_1holder_1commitment_1txn(void* ctx_TODO, uint32_t this_arg, uint32_t logger) {
5638 LDKChannelMonitor this_arg_conv;
5639 this_arg_conv.inner = (void*)(this_arg & (~1));
5640 this_arg_conv.is_owned = false;
5641 LDKLogger* logger_conv = (LDKLogger*)logger;
5642 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
5643 uint32_tArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
5644 for (size_t i = 0; i < ret_var.datalen; i++) {
5645 LDKTransaction arr_conv_8_var = ret_var.data[i];
5646 int8_tArray arr_conv_8_arr = { .len = arr_conv_8_var.datalen, .ptr = MALLOC(arr_conv_8_var.datalen, "Native int8_tArray Bytes") };
5647 memcpy(arr_conv_8_arr.ptr, arr_conv_8_var.data, arr_conv_8_var.datalen);
5648 Transaction_free(arr_conv_8_var);
5649 (*env)->SetObjectArrayElement(env, ret_arr, i, arr_conv_8_arr);
5655 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) {
5656 LDKChannelMonitor this_arg_conv;
5657 this_arg_conv.inner = (void*)(this_arg & (~1));
5658 this_arg_conv.is_owned = false;
5659 unsigned char header_arr[80];
5660 CHECK(header.len == 80);
5661 memcpy(header_arr, header.ptr, 80);
5662 unsigned char (*header_ref)[80] = &header_arr;
5663 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
5664 txdata_constr.datalen = txdata.len;
5665 if (txdata_constr.datalen > 0)
5666 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5668 txdata_constr.data = NULL;
5669 uint32_t* txdata_vals = (uint32_t*) txdata.ptr;
5670 for (size_t y = 0; y < txdata_constr.datalen; y++) {
5671 uint32_t arr_conv_24 = txdata_vals[y];
5672 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
5673 FREE((void*)arr_conv_24);
5674 txdata_constr.data[y] = arr_conv_24_conv;
5676 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5677 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5678 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5679 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5681 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5682 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5683 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5684 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5686 LDKLogger logger_conv = *(LDKLogger*)logger;
5687 if (logger_conv.free == LDKLogger_JCalls_free) {
5688 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5689 LDKLogger_JCalls_clone(logger_conv.this_arg);
5691 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);
5692 uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
5693 uint32_t *ret_arr_ptr = ret_arr.ptr;
5694 for (size_t u = 0; u < ret_var.datalen; u++) {
5695 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arr_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
5696 *arr_conv_46_ref = ret_var.data[u];
5697 arr_conv_46_ref->a = ThirtyTwoBytes_clone(&arr_conv_46_ref->a);
5698 // XXX: We likely need to clone here, but no _clone fn is available for TwoTuple<Integer, TxOut>[]
5699 ret_arr_ptr[u] = (long)arr_conv_46_ref;
5705 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) {
5706 LDKChannelMonitor this_arg_conv;
5707 this_arg_conv.inner = (void*)(this_arg & (~1));
5708 this_arg_conv.is_owned = false;
5709 unsigned char header_arr[80];
5710 CHECK(header.len == 80);
5711 memcpy(header_arr, header.ptr, 80);
5712 unsigned char (*header_ref)[80] = &header_arr;
5713 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5714 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5715 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5716 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5718 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5719 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5720 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5721 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5723 LDKLogger logger_conv = *(LDKLogger*)logger;
5724 if (logger_conv.free == LDKLogger_JCalls_free) {
5725 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5726 LDKLogger_JCalls_clone(logger_conv.this_arg);
5728 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
5731 void Persist_1free(void* ctx_TODO, uint32_t this_ptr) {
5732 LDKPersist this_ptr_conv = *(LDKPersist*)this_ptr;
5733 FREE((void*)this_ptr);
5734 Persist_free(this_ptr_conv);
5737 uint32_t C2Tuple_1BlockHashChannelMonitorZ_1read(void* ctx_TODO, int8_tArray ser, uint32_t arg) {
5739 ser_ref.datalen = ser.len;
5740 ser_ref.data = ser.ptr;
5741 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
5742 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
5743 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
5744 return (long)ret_conv;
5747 void OutPoint_1free(void* ctx_TODO, uint32_t this_ptr) {
5748 LDKOutPoint this_ptr_conv;
5749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5750 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5751 OutPoint_free(this_ptr_conv);
5754 uint32_t OutPoint_1clone(void* ctx_TODO, uint32_t orig) {
5755 LDKOutPoint orig_conv;
5756 orig_conv.inner = (void*)(orig & (~1));
5757 orig_conv.is_owned = false;
5758 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
5759 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5760 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5761 long ret_ref = (long)ret_var.inner;
5762 if (ret_var.is_owned) {
5768 int8_tArray OutPoint_1get_1txid(void* ctx_TODO, uint32_t this_ptr) {
5769 LDKOutPoint this_ptr_conv;
5770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5771 this_ptr_conv.is_owned = false;
5772 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
5773 memcpy(ret_arr.ptr, *OutPoint_get_txid(&this_ptr_conv), 32);
5777 void OutPoint_1set_1txid(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
5778 LDKOutPoint this_ptr_conv;
5779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5780 this_ptr_conv.is_owned = false;
5781 LDKThirtyTwoBytes val_ref;
5782 CHECK(val.len == 32);
5783 memcpy(val_ref.data, val.ptr, 32);
5784 OutPoint_set_txid(&this_ptr_conv, val_ref);
5787 jshort OutPoint_1get_1index(void* ctx_TODO, uint32_t this_ptr) {
5788 LDKOutPoint this_ptr_conv;
5789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5790 this_ptr_conv.is_owned = false;
5791 jshort ret_val = OutPoint_get_index(&this_ptr_conv);
5795 void OutPoint_1set_1index(void* ctx_TODO, uint32_t this_ptr, jshort val) {
5796 LDKOutPoint this_ptr_conv;
5797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5798 this_ptr_conv.is_owned = false;
5799 OutPoint_set_index(&this_ptr_conv, val);
5802 uint32_t OutPoint_1new(void* ctx_TODO, int8_tArray txid_arg, jshort index_arg) {
5803 LDKThirtyTwoBytes txid_arg_ref;
5804 CHECK(txid_arg.len == 32);
5805 memcpy(txid_arg_ref.data, txid_arg.ptr, 32);
5806 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
5807 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5808 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5809 long ret_ref = (long)ret_var.inner;
5810 if (ret_var.is_owned) {
5816 int8_tArray OutPoint_1to_1channel_1id(void* ctx_TODO, uint32_t this_arg) {
5817 LDKOutPoint this_arg_conv;
5818 this_arg_conv.inner = (void*)(this_arg & (~1));
5819 this_arg_conv.is_owned = false;
5820 int8_tArray arg_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
5821 memcpy(arg_arr.ptr, OutPoint_to_channel_id(&this_arg_conv).data, 32);
5825 int8_tArray OutPoint_1write(void* ctx_TODO, uint32_t obj) {
5826 LDKOutPoint obj_conv;
5827 obj_conv.inner = (void*)(obj & (~1));
5828 obj_conv.is_owned = false;
5829 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
5830 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
5831 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
5832 CVec_u8Z_free(arg_var);
5836 uint32_t OutPoint_1read(void* ctx_TODO, int8_tArray ser) {
5838 ser_ref.datalen = ser.len;
5839 ser_ref.data = ser.ptr;
5840 LDKOutPoint ret_var = OutPoint_read(ser_ref);
5841 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5842 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5843 long ret_ref = (long)ret_var.inner;
5844 if (ret_var.is_owned) {
5850 void SpendableOutputDescriptor_1free(void* ctx_TODO, uint32_t this_ptr) {
5851 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
5852 FREE((void*)this_ptr);
5853 SpendableOutputDescriptor_free(this_ptr_conv);
5856 uint32_t SpendableOutputDescriptor_1clone(void* ctx_TODO, uint32_t orig) {
5857 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
5858 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
5859 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
5860 long ret_ref = (long)ret_copy;
5864 int8_tArray SpendableOutputDescriptor_1write(void* ctx_TODO, uint32_t obj) {
5865 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
5866 LDKCVec_u8Z arg_var = SpendableOutputDescriptor_write(obj_conv);
5867 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
5868 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
5869 CVec_u8Z_free(arg_var);
5873 uint32_t SpendableOutputDescriptor_1read(void* ctx_TODO, int8_tArray ser) {
5875 ser_ref.datalen = ser.len;
5876 ser_ref.data = ser.ptr;
5877 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
5878 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
5879 return (long)ret_conv;
5882 uint32_t ChannelKeys_1clone(void* ctx_TODO, uint32_t orig) {
5883 LDKChannelKeys* orig_conv = (LDKChannelKeys*)orig;
5884 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
5885 *ret = ChannelKeys_clone(orig_conv);
5889 void ChannelKeys_1free(void* ctx_TODO, uint32_t this_ptr) {
5890 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
5891 FREE((void*)this_ptr);
5892 ChannelKeys_free(this_ptr_conv);
5895 void KeysInterface_1free(void* ctx_TODO, uint32_t this_ptr) {
5896 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
5897 FREE((void*)this_ptr);
5898 KeysInterface_free(this_ptr_conv);
5901 void InMemoryChannelKeys_1free(void* ctx_TODO, uint32_t this_ptr) {
5902 LDKInMemoryChannelKeys this_ptr_conv;
5903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5904 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5905 InMemoryChannelKeys_free(this_ptr_conv);
5908 uint32_t InMemoryChannelKeys_1clone(void* ctx_TODO, uint32_t orig) {
5909 LDKInMemoryChannelKeys orig_conv;
5910 orig_conv.inner = (void*)(orig & (~1));
5911 orig_conv.is_owned = false;
5912 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_clone(&orig_conv);
5913 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5914 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5915 long ret_ref = (long)ret_var.inner;
5916 if (ret_var.is_owned) {
5922 int8_tArray InMemoryChannelKeys_1get_1funding_1key(void* ctx_TODO, uint32_t this_ptr) {
5923 LDKInMemoryChannelKeys this_ptr_conv;
5924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5925 this_ptr_conv.is_owned = false;
5926 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
5927 memcpy(ret_arr.ptr, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv), 32);
5931 void InMemoryChannelKeys_1set_1funding_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
5932 LDKInMemoryChannelKeys this_ptr_conv;
5933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5934 this_ptr_conv.is_owned = false;
5935 LDKSecretKey val_ref;
5936 CHECK(val.len == 32);
5937 memcpy(val_ref.bytes, val.ptr, 32);
5938 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
5941 int8_tArray InMemoryChannelKeys_1get_1revocation_1base_1key(void* ctx_TODO, uint32_t this_ptr) {
5942 LDKInMemoryChannelKeys this_ptr_conv;
5943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5944 this_ptr_conv.is_owned = false;
5945 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
5946 memcpy(ret_arr.ptr, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv), 32);
5950 void InMemoryChannelKeys_1set_1revocation_1base_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
5951 LDKInMemoryChannelKeys this_ptr_conv;
5952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5953 this_ptr_conv.is_owned = false;
5954 LDKSecretKey val_ref;
5955 CHECK(val.len == 32);
5956 memcpy(val_ref.bytes, val.ptr, 32);
5957 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
5960 int8_tArray InMemoryChannelKeys_1get_1payment_1key(void* ctx_TODO, uint32_t this_ptr) {
5961 LDKInMemoryChannelKeys this_ptr_conv;
5962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5963 this_ptr_conv.is_owned = false;
5964 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
5965 memcpy(ret_arr.ptr, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv), 32);
5969 void InMemoryChannelKeys_1set_1payment_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
5970 LDKInMemoryChannelKeys this_ptr_conv;
5971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5972 this_ptr_conv.is_owned = false;
5973 LDKSecretKey val_ref;
5974 CHECK(val.len == 32);
5975 memcpy(val_ref.bytes, val.ptr, 32);
5976 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
5979 int8_tArray InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(void* ctx_TODO, uint32_t this_ptr) {
5980 LDKInMemoryChannelKeys this_ptr_conv;
5981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5982 this_ptr_conv.is_owned = false;
5983 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
5984 memcpy(ret_arr.ptr, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv), 32);
5988 void InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
5989 LDKInMemoryChannelKeys this_ptr_conv;
5990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5991 this_ptr_conv.is_owned = false;
5992 LDKSecretKey val_ref;
5993 CHECK(val.len == 32);
5994 memcpy(val_ref.bytes, val.ptr, 32);
5995 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
5998 int8_tArray InMemoryChannelKeys_1get_1htlc_1base_1key(void* ctx_TODO, uint32_t this_ptr) {
5999 LDKInMemoryChannelKeys this_ptr_conv;
6000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6001 this_ptr_conv.is_owned = false;
6002 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
6003 memcpy(ret_arr.ptr, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv), 32);
6007 void InMemoryChannelKeys_1set_1htlc_1base_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
6008 LDKInMemoryChannelKeys this_ptr_conv;
6009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6010 this_ptr_conv.is_owned = false;
6011 LDKSecretKey val_ref;
6012 CHECK(val.len == 32);
6013 memcpy(val_ref.bytes, val.ptr, 32);
6014 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
6017 int8_tArray InMemoryChannelKeys_1get_1commitment_1seed(void* ctx_TODO, uint32_t this_ptr) {
6018 LDKInMemoryChannelKeys this_ptr_conv;
6019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6020 this_ptr_conv.is_owned = false;
6021 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
6022 memcpy(ret_arr.ptr, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv), 32);
6026 void InMemoryChannelKeys_1set_1commitment_1seed(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
6027 LDKInMemoryChannelKeys this_ptr_conv;
6028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6029 this_ptr_conv.is_owned = false;
6030 LDKThirtyTwoBytes val_ref;
6031 CHECK(val.len == 32);
6032 memcpy(val_ref.data, val.ptr, 32);
6033 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
6036 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) {
6037 LDKSecretKey funding_key_ref;
6038 CHECK(funding_key.len == 32);
6039 memcpy(funding_key_ref.bytes, funding_key.ptr, 32);
6040 LDKSecretKey revocation_base_key_ref;
6041 CHECK(revocation_base_key.len == 32);
6042 memcpy(revocation_base_key_ref.bytes, revocation_base_key.ptr, 32);
6043 LDKSecretKey payment_key_ref;
6044 CHECK(payment_key.len == 32);
6045 memcpy(payment_key_ref.bytes, payment_key.ptr, 32);
6046 LDKSecretKey delayed_payment_base_key_ref;
6047 CHECK(delayed_payment_base_key.len == 32);
6048 memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key.ptr, 32);
6049 LDKSecretKey htlc_base_key_ref;
6050 CHECK(htlc_base_key.len == 32);
6051 memcpy(htlc_base_key_ref.bytes, htlc_base_key.ptr, 32);
6052 LDKThirtyTwoBytes commitment_seed_ref;
6053 CHECK(commitment_seed.len == 32);
6054 memcpy(commitment_seed_ref.data, commitment_seed.ptr, 32);
6055 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
6056 FREE((void*)key_derivation_params);
6057 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);
6058 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6059 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6060 long ret_ref = (long)ret_var.inner;
6061 if (ret_var.is_owned) {
6067 uint32_t InMemoryChannelKeys_1counterparty_1pubkeys(void* ctx_TODO, uint32_t this_arg) {
6068 LDKInMemoryChannelKeys this_arg_conv;
6069 this_arg_conv.inner = (void*)(this_arg & (~1));
6070 this_arg_conv.is_owned = false;
6071 LDKChannelPublicKeys ret_var = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
6072 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6073 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6074 long ret_ref = (long)ret_var.inner;
6075 if (ret_var.is_owned) {
6081 jshort InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(void* ctx_TODO, uint32_t this_arg) {
6082 LDKInMemoryChannelKeys this_arg_conv;
6083 this_arg_conv.inner = (void*)(this_arg & (~1));
6084 this_arg_conv.is_owned = false;
6085 jshort ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
6089 jshort InMemoryChannelKeys_1holder_1selected_1contest_1delay(void* ctx_TODO, uint32_t this_arg) {
6090 LDKInMemoryChannelKeys this_arg_conv;
6091 this_arg_conv.inner = (void*)(this_arg & (~1));
6092 this_arg_conv.is_owned = false;
6093 jshort ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
6097 jboolean InMemoryChannelKeys_1is_1outbound(void* ctx_TODO, uint32_t this_arg) {
6098 LDKInMemoryChannelKeys this_arg_conv;
6099 this_arg_conv.inner = (void*)(this_arg & (~1));
6100 this_arg_conv.is_owned = false;
6101 jboolean ret_val = InMemoryChannelKeys_is_outbound(&this_arg_conv);
6105 uint32_t InMemoryChannelKeys_1funding_1outpoint(void* ctx_TODO, uint32_t this_arg) {
6106 LDKInMemoryChannelKeys this_arg_conv;
6107 this_arg_conv.inner = (void*)(this_arg & (~1));
6108 this_arg_conv.is_owned = false;
6109 LDKOutPoint ret_var = InMemoryChannelKeys_funding_outpoint(&this_arg_conv);
6110 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6111 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6112 long ret_ref = (long)ret_var.inner;
6113 if (ret_var.is_owned) {
6119 uint32_t InMemoryChannelKeys_1get_1channel_1parameters(void* ctx_TODO, uint32_t this_arg) {
6120 LDKInMemoryChannelKeys this_arg_conv;
6121 this_arg_conv.inner = (void*)(this_arg & (~1));
6122 this_arg_conv.is_owned = false;
6123 LDKChannelTransactionParameters ret_var = InMemoryChannelKeys_get_channel_parameters(&this_arg_conv);
6124 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6125 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6126 long ret_ref = (long)ret_var.inner;
6127 if (ret_var.is_owned) {
6133 uint32_t InMemoryChannelKeys_1as_1ChannelKeys(void* ctx_TODO, uint32_t this_arg) {
6134 LDKInMemoryChannelKeys this_arg_conv;
6135 this_arg_conv.inner = (void*)(this_arg & (~1));
6136 this_arg_conv.is_owned = false;
6137 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
6138 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
6142 int8_tArray InMemoryChannelKeys_1write(void* ctx_TODO, uint32_t obj) {
6143 LDKInMemoryChannelKeys obj_conv;
6144 obj_conv.inner = (void*)(obj & (~1));
6145 obj_conv.is_owned = false;
6146 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
6147 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
6148 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
6149 CVec_u8Z_free(arg_var);
6153 uint32_t InMemoryChannelKeys_1read(void* ctx_TODO, int8_tArray ser) {
6155 ser_ref.datalen = ser.len;
6156 ser_ref.data = ser.ptr;
6157 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
6158 *ret_conv = InMemoryChannelKeys_read(ser_ref);
6159 return (long)ret_conv;
6162 void KeysManager_1free(void* ctx_TODO, uint32_t this_ptr) {
6163 LDKKeysManager this_ptr_conv;
6164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6165 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6166 KeysManager_free(this_ptr_conv);
6169 uint32_t KeysManager_1new(void* ctx_TODO, int8_tArray seed, uint32_t network, int64_t starting_time_secs, int32_t starting_time_nanos) {
6170 unsigned char seed_arr[32];
6171 CHECK(seed.len == 32);
6172 memcpy(seed_arr, seed.ptr, 32);
6173 unsigned char (*seed_ref)[32] = &seed_arr;
6174 LDKNetwork network_conv = LDKNetwork_from_js(network);
6175 LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
6176 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6177 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6178 long ret_ref = (long)ret_var.inner;
6179 if (ret_var.is_owned) {
6185 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) {
6186 LDKKeysManager this_arg_conv;
6187 this_arg_conv.inner = (void*)(this_arg & (~1));
6188 this_arg_conv.is_owned = false;
6189 LDKInMemoryChannelKeys ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
6190 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6191 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6192 long ret_ref = (long)ret_var.inner;
6193 if (ret_var.is_owned) {
6199 uint32_t KeysManager_1as_1KeysInterface(void* ctx_TODO, uint32_t this_arg) {
6200 LDKKeysManager this_arg_conv;
6201 this_arg_conv.inner = (void*)(this_arg & (~1));
6202 this_arg_conv.is_owned = false;
6203 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6204 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
6208 void ChannelManager_1free(void* ctx_TODO, uint32_t this_ptr) {
6209 LDKChannelManager this_ptr_conv;
6210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6211 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6212 ChannelManager_free(this_ptr_conv);
6215 void ChannelDetails_1free(void* ctx_TODO, uint32_t this_ptr) {
6216 LDKChannelDetails this_ptr_conv;
6217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6218 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6219 ChannelDetails_free(this_ptr_conv);
6222 uint32_t ChannelDetails_1clone(void* ctx_TODO, uint32_t orig) {
6223 LDKChannelDetails orig_conv;
6224 orig_conv.inner = (void*)(orig & (~1));
6225 orig_conv.is_owned = false;
6226 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
6227 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6228 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6229 long ret_ref = (long)ret_var.inner;
6230 if (ret_var.is_owned) {
6236 int8_tArray ChannelDetails_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
6237 LDKChannelDetails this_ptr_conv;
6238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6239 this_ptr_conv.is_owned = false;
6240 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
6241 memcpy(ret_arr.ptr, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
6245 void ChannelDetails_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
6246 LDKChannelDetails this_ptr_conv;
6247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6248 this_ptr_conv.is_owned = false;
6249 LDKThirtyTwoBytes val_ref;
6250 CHECK(val.len == 32);
6251 memcpy(val_ref.data, val.ptr, 32);
6252 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
6255 int8_tArray ChannelDetails_1get_1remote_1network_1id(void* ctx_TODO, uint32_t this_ptr) {
6256 LDKChannelDetails this_ptr_conv;
6257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6258 this_ptr_conv.is_owned = false;
6259 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
6260 memcpy(arg_arr.ptr, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form, 33);
6264 void ChannelDetails_1set_1remote_1network_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
6265 LDKChannelDetails this_ptr_conv;
6266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6267 this_ptr_conv.is_owned = false;
6268 LDKPublicKey val_ref;
6269 CHECK(val.len == 33);
6270 memcpy(val_ref.compressed_form, val.ptr, 33);
6271 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
6274 uint32_t ChannelDetails_1get_1counterparty_1features(void* ctx_TODO, uint32_t this_ptr) {
6275 LDKChannelDetails this_ptr_conv;
6276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6277 this_ptr_conv.is_owned = false;
6278 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
6279 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6280 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6281 long ret_ref = (long)ret_var.inner;
6282 if (ret_var.is_owned) {
6288 void ChannelDetails_1set_1counterparty_1features(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
6289 LDKChannelDetails this_ptr_conv;
6290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6291 this_ptr_conv.is_owned = false;
6292 LDKInitFeatures val_conv;
6293 val_conv.inner = (void*)(val & (~1));
6294 val_conv.is_owned = (val & 1) || (val == 0);
6295 // Warning: we may need a move here but can't clone!
6296 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
6299 int64_t ChannelDetails_1get_1channel_1value_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
6300 LDKChannelDetails this_ptr_conv;
6301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6302 this_ptr_conv.is_owned = false;
6303 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
6307 void ChannelDetails_1set_1channel_1value_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
6308 LDKChannelDetails this_ptr_conv;
6309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6310 this_ptr_conv.is_owned = false;
6311 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
6314 int64_t ChannelDetails_1get_1user_1id(void* ctx_TODO, uint32_t this_ptr) {
6315 LDKChannelDetails this_ptr_conv;
6316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6317 this_ptr_conv.is_owned = false;
6318 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
6322 void ChannelDetails_1set_1user_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
6323 LDKChannelDetails this_ptr_conv;
6324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6325 this_ptr_conv.is_owned = false;
6326 ChannelDetails_set_user_id(&this_ptr_conv, val);
6329 int64_t ChannelDetails_1get_1outbound_1capacity_1msat(void* ctx_TODO, uint32_t this_ptr) {
6330 LDKChannelDetails this_ptr_conv;
6331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6332 this_ptr_conv.is_owned = false;
6333 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
6337 void ChannelDetails_1set_1outbound_1capacity_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
6338 LDKChannelDetails this_ptr_conv;
6339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6340 this_ptr_conv.is_owned = false;
6341 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
6344 int64_t ChannelDetails_1get_1inbound_1capacity_1msat(void* ctx_TODO, uint32_t this_ptr) {
6345 LDKChannelDetails this_ptr_conv;
6346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6347 this_ptr_conv.is_owned = false;
6348 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
6352 void ChannelDetails_1set_1inbound_1capacity_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
6353 LDKChannelDetails this_ptr_conv;
6354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6355 this_ptr_conv.is_owned = false;
6356 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
6359 jboolean ChannelDetails_1get_1is_1live(void* ctx_TODO, uint32_t this_ptr) {
6360 LDKChannelDetails this_ptr_conv;
6361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6362 this_ptr_conv.is_owned = false;
6363 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
6367 void ChannelDetails_1set_1is_1live(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
6368 LDKChannelDetails this_ptr_conv;
6369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6370 this_ptr_conv.is_owned = false;
6371 ChannelDetails_set_is_live(&this_ptr_conv, val);
6374 void PaymentSendFailure_1free(void* ctx_TODO, uint32_t this_ptr) {
6375 LDKPaymentSendFailure this_ptr_conv;
6376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6377 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6378 PaymentSendFailure_free(this_ptr_conv);
6381 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, int64_t current_blockchain_height) {
6382 LDKNetwork network_conv = LDKNetwork_from_js(network);
6383 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
6384 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
6385 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6386 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
6388 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
6389 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
6390 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6391 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
6393 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
6394 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6395 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6396 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
6398 LDKLogger logger_conv = *(LDKLogger*)logger;
6399 if (logger_conv.free == LDKLogger_JCalls_free) {
6400 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6401 LDKLogger_JCalls_clone(logger_conv.this_arg);
6403 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
6404 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
6405 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6406 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
6408 LDKUserConfig config_conv;
6409 config_conv.inner = (void*)(config & (~1));
6410 config_conv.is_owned = (config & 1) || (config == 0);
6411 if (config_conv.inner != NULL)
6412 config_conv = UserConfig_clone(&config_conv);
6413 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);
6414 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6415 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6416 long ret_ref = (long)ret_var.inner;
6417 if (ret_var.is_owned) {
6423 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) {
6424 LDKChannelManager this_arg_conv;
6425 this_arg_conv.inner = (void*)(this_arg & (~1));
6426 this_arg_conv.is_owned = false;
6427 LDKPublicKey their_network_key_ref;
6428 CHECK(their_network_key.len == 33);
6429 memcpy(their_network_key_ref.compressed_form, their_network_key.ptr, 33);
6430 LDKUserConfig override_config_conv;
6431 override_config_conv.inner = (void*)(override_config & (~1));
6432 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
6433 if (override_config_conv.inner != NULL)
6434 override_config_conv = UserConfig_clone(&override_config_conv);
6435 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6436 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
6437 return (long)ret_conv;
6440 uint32_tArray ChannelManager_1list_1channels(void* ctx_TODO, uint32_t this_arg) {
6441 LDKChannelManager this_arg_conv;
6442 this_arg_conv.inner = (void*)(this_arg & (~1));
6443 this_arg_conv.is_owned = false;
6444 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
6445 uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
6446 uint32_t *ret_arr_ptr = ret_arr.ptr;
6447 for (size_t q = 0; q < ret_var.datalen; q++) {
6448 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
6449 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6450 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6451 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
6452 if (arr_conv_16_var.is_owned) {
6453 arr_conv_16_ref |= 1;
6455 ret_arr_ptr[q] = arr_conv_16_ref;
6461 uint32_tArray ChannelManager_1list_1usable_1channels(void* ctx_TODO, uint32_t this_arg) {
6462 LDKChannelManager this_arg_conv;
6463 this_arg_conv.inner = (void*)(this_arg & (~1));
6464 this_arg_conv.is_owned = false;
6465 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
6466 uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
6467 uint32_t *ret_arr_ptr = ret_arr.ptr;
6468 for (size_t q = 0; q < ret_var.datalen; q++) {
6469 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
6470 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6471 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6472 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
6473 if (arr_conv_16_var.is_owned) {
6474 arr_conv_16_ref |= 1;
6476 ret_arr_ptr[q] = arr_conv_16_ref;
6482 uint32_t ChannelManager_1close_1channel(void* ctx_TODO, uint32_t this_arg, int8_tArray channel_id) {
6483 LDKChannelManager this_arg_conv;
6484 this_arg_conv.inner = (void*)(this_arg & (~1));
6485 this_arg_conv.is_owned = false;
6486 unsigned char channel_id_arr[32];
6487 CHECK(channel_id.len == 32);
6488 memcpy(channel_id_arr, channel_id.ptr, 32);
6489 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
6490 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6491 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
6492 return (long)ret_conv;
6495 void ChannelManager_1force_1close_1channel(void* ctx_TODO, uint32_t this_arg, int8_tArray channel_id) {
6496 LDKChannelManager this_arg_conv;
6497 this_arg_conv.inner = (void*)(this_arg & (~1));
6498 this_arg_conv.is_owned = false;
6499 unsigned char channel_id_arr[32];
6500 CHECK(channel_id.len == 32);
6501 memcpy(channel_id_arr, channel_id.ptr, 32);
6502 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
6503 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
6506 void ChannelManager_1force_1close_1all_1channels(void* ctx_TODO, uint32_t this_arg) {
6507 LDKChannelManager this_arg_conv;
6508 this_arg_conv.inner = (void*)(this_arg & (~1));
6509 this_arg_conv.is_owned = false;
6510 ChannelManager_force_close_all_channels(&this_arg_conv);
6513 uint32_t ChannelManager_1send_1payment(void* ctx_TODO, uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
6514 LDKChannelManager this_arg_conv;
6515 this_arg_conv.inner = (void*)(this_arg & (~1));
6516 this_arg_conv.is_owned = false;
6517 LDKRoute route_conv;
6518 route_conv.inner = (void*)(route & (~1));
6519 route_conv.is_owned = false;
6520 LDKThirtyTwoBytes payment_hash_ref;
6521 CHECK(payment_hash.len == 32);
6522 memcpy(payment_hash_ref.data, payment_hash.ptr, 32);
6523 LDKThirtyTwoBytes payment_secret_ref;
6524 CHECK(payment_secret.len == 32);
6525 memcpy(payment_secret_ref.data, payment_secret.ptr, 32);
6526 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6527 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
6528 return (long)ret_conv;
6531 void ChannelManager_1funding_1transaction_1generated(void* ctx_TODO, uint32_t this_arg, int8_tArray temporary_channel_id, uint32_t funding_txo) {
6532 LDKChannelManager this_arg_conv;
6533 this_arg_conv.inner = (void*)(this_arg & (~1));
6534 this_arg_conv.is_owned = false;
6535 unsigned char temporary_channel_id_arr[32];
6536 CHECK(temporary_channel_id.len == 32);
6537 memcpy(temporary_channel_id_arr, temporary_channel_id.ptr, 32);
6538 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
6539 LDKOutPoint funding_txo_conv;
6540 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6541 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6542 if (funding_txo_conv.inner != NULL)
6543 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6544 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
6547 void ChannelManager_1broadcast_1node_1announcement(void* ctx_TODO, uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
6548 LDKChannelManager this_arg_conv;
6549 this_arg_conv.inner = (void*)(this_arg & (~1));
6550 this_arg_conv.is_owned = false;
6551 LDKThreeBytes rgb_ref;
6552 CHECK(rgb.len == 3);
6553 memcpy(rgb_ref.data, rgb.ptr, 3);
6554 LDKThirtyTwoBytes alias_ref;
6555 CHECK(alias.len == 32);
6556 memcpy(alias_ref.data, alias.ptr, 32);
6557 LDKCVec_NetAddressZ addresses_constr;
6558 addresses_constr.datalen = addresses.len;
6559 if (addresses_constr.datalen > 0)
6560 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
6562 addresses_constr.data = NULL;
6563 uint32_t* addresses_vals = (uint32_t*) addresses.ptr;
6564 for (size_t m = 0; m < addresses_constr.datalen; m++) {
6565 uint32_t arr_conv_12 = addresses_vals[m];
6566 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
6567 FREE((void*)arr_conv_12);
6568 addresses_constr.data[m] = arr_conv_12_conv;
6570 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
6573 void ChannelManager_1process_1pending_1htlc_1forwards(void* ctx_TODO, uint32_t this_arg) {
6574 LDKChannelManager this_arg_conv;
6575 this_arg_conv.inner = (void*)(this_arg & (~1));
6576 this_arg_conv.is_owned = false;
6577 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
6580 void ChannelManager_1timer_1chan_1freshness_1every_1min(void* ctx_TODO, uint32_t this_arg) {
6581 LDKChannelManager this_arg_conv;
6582 this_arg_conv.inner = (void*)(this_arg & (~1));
6583 this_arg_conv.is_owned = false;
6584 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
6587 jboolean ChannelManager_1fail_1htlc_1backwards(void* ctx_TODO, uint32_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
6588 LDKChannelManager this_arg_conv;
6589 this_arg_conv.inner = (void*)(this_arg & (~1));
6590 this_arg_conv.is_owned = false;
6591 unsigned char payment_hash_arr[32];
6592 CHECK(payment_hash.len == 32);
6593 memcpy(payment_hash_arr, payment_hash.ptr, 32);
6594 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
6595 LDKThirtyTwoBytes payment_secret_ref;
6596 CHECK(payment_secret.len == 32);
6597 memcpy(payment_secret_ref.data, payment_secret.ptr, 32);
6598 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
6602 jboolean ChannelManager_1claim_1funds(void* ctx_TODO, uint32_t this_arg, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t expected_amount) {
6603 LDKChannelManager this_arg_conv;
6604 this_arg_conv.inner = (void*)(this_arg & (~1));
6605 this_arg_conv.is_owned = false;
6606 LDKThirtyTwoBytes payment_preimage_ref;
6607 CHECK(payment_preimage.len == 32);
6608 memcpy(payment_preimage_ref.data, payment_preimage.ptr, 32);
6609 LDKThirtyTwoBytes payment_secret_ref;
6610 CHECK(payment_secret.len == 32);
6611 memcpy(payment_secret_ref.data, payment_secret.ptr, 32);
6612 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
6616 int8_tArray ChannelManager_1get_1our_1node_1id(void* ctx_TODO, uint32_t this_arg) {
6617 LDKChannelManager this_arg_conv;
6618 this_arg_conv.inner = (void*)(this_arg & (~1));
6619 this_arg_conv.is_owned = false;
6620 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
6621 memcpy(arg_arr.ptr, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
6625 void ChannelManager_1channel_1monitor_1updated(void* ctx_TODO, uint32_t this_arg, uint32_t funding_txo, int64_t highest_applied_update_id) {
6626 LDKChannelManager this_arg_conv;
6627 this_arg_conv.inner = (void*)(this_arg & (~1));
6628 this_arg_conv.is_owned = false;
6629 LDKOutPoint funding_txo_conv;
6630 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6631 funding_txo_conv.is_owned = false;
6632 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
6635 uint32_t ChannelManager_1as_1MessageSendEventsProvider(void* ctx_TODO, uint32_t this_arg) {
6636 LDKChannelManager this_arg_conv;
6637 this_arg_conv.inner = (void*)(this_arg & (~1));
6638 this_arg_conv.is_owned = false;
6639 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6640 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
6644 uint32_t ChannelManager_1as_1EventsProvider(void* ctx_TODO, uint32_t this_arg) {
6645 LDKChannelManager this_arg_conv;
6646 this_arg_conv.inner = (void*)(this_arg & (~1));
6647 this_arg_conv.is_owned = false;
6648 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6649 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
6653 void ChannelManager_1block_1connected(void* ctx_TODO, uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
6654 LDKChannelManager this_arg_conv;
6655 this_arg_conv.inner = (void*)(this_arg & (~1));
6656 this_arg_conv.is_owned = false;
6657 unsigned char header_arr[80];
6658 CHECK(header.len == 80);
6659 memcpy(header_arr, header.ptr, 80);
6660 unsigned char (*header_ref)[80] = &header_arr;
6661 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6662 txdata_constr.datalen = txdata.len;
6663 if (txdata_constr.datalen > 0)
6664 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6666 txdata_constr.data = NULL;
6667 uint32_t* txdata_vals = (uint32_t*) txdata.ptr;
6668 for (size_t y = 0; y < txdata_constr.datalen; y++) {
6669 uint32_t arr_conv_24 = txdata_vals[y];
6670 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
6671 FREE((void*)arr_conv_24);
6672 txdata_constr.data[y] = arr_conv_24_conv;
6674 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
6677 void ChannelManager_1block_1disconnected(void* ctx_TODO, uint32_t this_arg, int8_tArray header) {
6678 LDKChannelManager this_arg_conv;
6679 this_arg_conv.inner = (void*)(this_arg & (~1));
6680 this_arg_conv.is_owned = false;
6681 unsigned char header_arr[80];
6682 CHECK(header.len == 80);
6683 memcpy(header_arr, header.ptr, 80);
6684 unsigned char (*header_ref)[80] = &header_arr;
6685 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
6688 uint32_t ChannelManager_1as_1ChannelMessageHandler(void* ctx_TODO, uint32_t this_arg) {
6689 LDKChannelManager this_arg_conv;
6690 this_arg_conv.inner = (void*)(this_arg & (~1));
6691 this_arg_conv.is_owned = false;
6692 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
6693 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
6697 int8_tArray ChannelManager_1write(void* ctx_TODO, uint32_t obj) {
6698 LDKChannelManager obj_conv;
6699 obj_conv.inner = (void*)(obj & (~1));
6700 obj_conv.is_owned = false;
6701 LDKCVec_u8Z arg_var = ChannelManager_write(&obj_conv);
6702 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
6703 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
6704 CVec_u8Z_free(arg_var);
6708 void ChannelManagerReadArgs_1free(void* ctx_TODO, uint32_t this_ptr) {
6709 LDKChannelManagerReadArgs this_ptr_conv;
6710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6711 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6712 ChannelManagerReadArgs_free(this_ptr_conv);
6715 uint32_t ChannelManagerReadArgs_1get_1keys_1manager(void* ctx_TODO, uint32_t this_ptr) {
6716 LDKChannelManagerReadArgs this_ptr_conv;
6717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6718 this_ptr_conv.is_owned = false;
6719 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
6723 void ChannelManagerReadArgs_1set_1keys_1manager(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
6724 LDKChannelManagerReadArgs this_ptr_conv;
6725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6726 this_ptr_conv.is_owned = false;
6727 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
6728 if (val_conv.free == LDKKeysInterface_JCalls_free) {
6729 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6730 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
6732 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
6735 uint32_t ChannelManagerReadArgs_1get_1fee_1estimator(void* ctx_TODO, uint32_t this_ptr) {
6736 LDKChannelManagerReadArgs this_ptr_conv;
6737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6738 this_ptr_conv.is_owned = false;
6739 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
6743 void ChannelManagerReadArgs_1set_1fee_1estimator(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
6744 LDKChannelManagerReadArgs this_ptr_conv;
6745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6746 this_ptr_conv.is_owned = false;
6747 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
6748 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
6749 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6750 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
6752 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
6755 uint32_t ChannelManagerReadArgs_1get_1chain_1monitor(void* ctx_TODO, uint32_t this_ptr) {
6756 LDKChannelManagerReadArgs this_ptr_conv;
6757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6758 this_ptr_conv.is_owned = false;
6759 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
6763 void ChannelManagerReadArgs_1set_1chain_1monitor(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
6764 LDKChannelManagerReadArgs this_ptr_conv;
6765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6766 this_ptr_conv.is_owned = false;
6767 LDKWatch val_conv = *(LDKWatch*)val;
6768 if (val_conv.free == LDKWatch_JCalls_free) {
6769 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6770 LDKWatch_JCalls_clone(val_conv.this_arg);
6772 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
6775 uint32_t ChannelManagerReadArgs_1get_1tx_1broadcaster(void* ctx_TODO, uint32_t this_ptr) {
6776 LDKChannelManagerReadArgs this_ptr_conv;
6777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6778 this_ptr_conv.is_owned = false;
6779 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
6783 void ChannelManagerReadArgs_1set_1tx_1broadcaster(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
6784 LDKChannelManagerReadArgs this_ptr_conv;
6785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6786 this_ptr_conv.is_owned = false;
6787 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
6788 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
6789 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6790 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
6792 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
6795 uint32_t ChannelManagerReadArgs_1get_1logger(void* ctx_TODO, uint32_t this_ptr) {
6796 LDKChannelManagerReadArgs this_ptr_conv;
6797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6798 this_ptr_conv.is_owned = false;
6799 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
6803 void ChannelManagerReadArgs_1set_1logger(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
6804 LDKChannelManagerReadArgs this_ptr_conv;
6805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6806 this_ptr_conv.is_owned = false;
6807 LDKLogger val_conv = *(LDKLogger*)val;
6808 if (val_conv.free == LDKLogger_JCalls_free) {
6809 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6810 LDKLogger_JCalls_clone(val_conv.this_arg);
6812 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
6815 uint32_t ChannelManagerReadArgs_1get_1default_1config(void* ctx_TODO, uint32_t this_ptr) {
6816 LDKChannelManagerReadArgs this_ptr_conv;
6817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6818 this_ptr_conv.is_owned = false;
6819 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
6820 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6821 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6822 long ret_ref = (long)ret_var.inner;
6823 if (ret_var.is_owned) {
6829 void ChannelManagerReadArgs_1set_1default_1config(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
6830 LDKChannelManagerReadArgs this_ptr_conv;
6831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6832 this_ptr_conv.is_owned = false;
6833 LDKUserConfig val_conv;
6834 val_conv.inner = (void*)(val & (~1));
6835 val_conv.is_owned = (val & 1) || (val == 0);
6836 if (val_conv.inner != NULL)
6837 val_conv = UserConfig_clone(&val_conv);
6838 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
6841 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) {
6842 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
6843 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
6844 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6845 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
6847 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6848 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6849 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6850 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6852 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
6853 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
6854 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6855 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
6857 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
6858 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6859 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6860 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
6862 LDKLogger logger_conv = *(LDKLogger*)logger;
6863 if (logger_conv.free == LDKLogger_JCalls_free) {
6864 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6865 LDKLogger_JCalls_clone(logger_conv.this_arg);
6867 LDKUserConfig default_config_conv;
6868 default_config_conv.inner = (void*)(default_config & (~1));
6869 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
6870 if (default_config_conv.inner != NULL)
6871 default_config_conv = UserConfig_clone(&default_config_conv);
6872 LDKCVec_ChannelMonitorZ channel_monitors_constr;
6873 channel_monitors_constr.datalen = channel_monitors.len;
6874 if (channel_monitors_constr.datalen > 0)
6875 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
6877 channel_monitors_constr.data = NULL;
6878 uint32_t* channel_monitors_vals = (uint32_t*) channel_monitors.ptr;
6879 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
6880 uint32_t arr_conv_16 = channel_monitors_vals[q];
6881 LDKChannelMonitor arr_conv_16_conv;
6882 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
6883 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
6884 // Warning: we may need a move here but can't clone!
6885 channel_monitors_constr.data[q] = arr_conv_16_conv;
6887 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);
6888 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6889 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6890 long ret_ref = (long)ret_var.inner;
6891 if (ret_var.is_owned) {
6897 uint32_t C2Tuple_1BlockHashChannelManagerZ_1read(void* ctx_TODO, int8_tArray ser, uint32_t arg) {
6899 ser_ref.datalen = ser.len;
6900 ser_ref.data = ser.ptr;
6901 LDKChannelManagerReadArgs arg_conv;
6902 arg_conv.inner = (void*)(arg & (~1));
6903 arg_conv.is_owned = (arg & 1) || (arg == 0);
6904 // Warning: we may need a move here but can't clone!
6905 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
6906 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
6907 return (long)ret_conv;
6910 void DecodeError_1free(void* ctx_TODO, uint32_t this_ptr) {
6911 LDKDecodeError this_ptr_conv;
6912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6913 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6914 DecodeError_free(this_ptr_conv);
6917 void Init_1free(void* ctx_TODO, uint32_t this_ptr) {
6918 LDKInit this_ptr_conv;
6919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6920 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6921 Init_free(this_ptr_conv);
6924 uint32_t Init_1clone(void* ctx_TODO, uint32_t orig) {
6926 orig_conv.inner = (void*)(orig & (~1));
6927 orig_conv.is_owned = false;
6928 LDKInit ret_var = Init_clone(&orig_conv);
6929 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6930 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6931 long ret_ref = (long)ret_var.inner;
6932 if (ret_var.is_owned) {
6938 void ErrorMessage_1free(void* ctx_TODO, uint32_t this_ptr) {
6939 LDKErrorMessage this_ptr_conv;
6940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6941 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6942 ErrorMessage_free(this_ptr_conv);
6945 uint32_t ErrorMessage_1clone(void* ctx_TODO, uint32_t orig) {
6946 LDKErrorMessage orig_conv;
6947 orig_conv.inner = (void*)(orig & (~1));
6948 orig_conv.is_owned = false;
6949 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
6950 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6951 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6952 long ret_ref = (long)ret_var.inner;
6953 if (ret_var.is_owned) {
6959 int8_tArray ErrorMessage_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
6960 LDKErrorMessage this_ptr_conv;
6961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6962 this_ptr_conv.is_owned = false;
6963 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
6964 memcpy(ret_arr.ptr, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
6968 void ErrorMessage_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
6969 LDKErrorMessage this_ptr_conv;
6970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6971 this_ptr_conv.is_owned = false;
6972 LDKThirtyTwoBytes val_ref;
6973 CHECK(val.len == 32);
6974 memcpy(val_ref.data, val.ptr, 32);
6975 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
6978 jstring ErrorMessage_1get_1data(void* ctx_TODO, uint32_t this_ptr) {
6979 LDKErrorMessage this_ptr_conv;
6980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6981 this_ptr_conv.is_owned = false;
6982 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
6983 char* _buf = MALLOC(_str.len + 1, "str conv buf");
6984 memcpy(_buf, _str.chars, _str.len);
6986 jstring _conv = (*env)->NewStringUTF(env, _str.chars);
6991 void ErrorMessage_1set_1data(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
6992 LDKErrorMessage this_ptr_conv;
6993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6994 this_ptr_conv.is_owned = false;
6995 LDKCVec_u8Z val_ref;
6996 val_ref.datalen = val.len;
6997 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
6998 memcpy(val_ref.data, val.ptr, val_ref.datalen);
6999 ErrorMessage_set_data(&this_ptr_conv, val_ref);
7002 uint32_t ErrorMessage_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray data_arg) {
7003 LDKThirtyTwoBytes channel_id_arg_ref;
7004 CHECK(channel_id_arg.len == 32);
7005 memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
7006 LDKCVec_u8Z data_arg_ref;
7007 data_arg_ref.datalen = data_arg.len;
7008 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
7009 memcpy(data_arg_ref.data, data_arg.ptr, data_arg_ref.datalen);
7010 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
7011 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7012 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7013 long ret_ref = (long)ret_var.inner;
7014 if (ret_var.is_owned) {
7020 void Ping_1free(void* ctx_TODO, uint32_t this_ptr) {
7021 LDKPing this_ptr_conv;
7022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7023 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7024 Ping_free(this_ptr_conv);
7027 uint32_t Ping_1clone(void* ctx_TODO, uint32_t orig) {
7029 orig_conv.inner = (void*)(orig & (~1));
7030 orig_conv.is_owned = false;
7031 LDKPing ret_var = Ping_clone(&orig_conv);
7032 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7033 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7034 long ret_ref = (long)ret_var.inner;
7035 if (ret_var.is_owned) {
7041 jshort Ping_1get_1ponglen(void* ctx_TODO, uint32_t this_ptr) {
7042 LDKPing this_ptr_conv;
7043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7044 this_ptr_conv.is_owned = false;
7045 jshort ret_val = Ping_get_ponglen(&this_ptr_conv);
7049 void Ping_1set_1ponglen(void* ctx_TODO, uint32_t this_ptr, jshort val) {
7050 LDKPing this_ptr_conv;
7051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7052 this_ptr_conv.is_owned = false;
7053 Ping_set_ponglen(&this_ptr_conv, val);
7056 jshort Ping_1get_1byteslen(void* ctx_TODO, uint32_t this_ptr) {
7057 LDKPing this_ptr_conv;
7058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7059 this_ptr_conv.is_owned = false;
7060 jshort ret_val = Ping_get_byteslen(&this_ptr_conv);
7064 void Ping_1set_1byteslen(void* ctx_TODO, uint32_t this_ptr, jshort val) {
7065 LDKPing this_ptr_conv;
7066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7067 this_ptr_conv.is_owned = false;
7068 Ping_set_byteslen(&this_ptr_conv, val);
7071 uint32_t Ping_1new(void* ctx_TODO, jshort ponglen_arg, jshort byteslen_arg) {
7072 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
7073 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7074 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7075 long ret_ref = (long)ret_var.inner;
7076 if (ret_var.is_owned) {
7082 void Pong_1free(void* ctx_TODO, uint32_t this_ptr) {
7083 LDKPong this_ptr_conv;
7084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7085 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7086 Pong_free(this_ptr_conv);
7089 uint32_t Pong_1clone(void* ctx_TODO, uint32_t orig) {
7091 orig_conv.inner = (void*)(orig & (~1));
7092 orig_conv.is_owned = false;
7093 LDKPong ret_var = Pong_clone(&orig_conv);
7094 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7095 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7096 long ret_ref = (long)ret_var.inner;
7097 if (ret_var.is_owned) {
7103 jshort Pong_1get_1byteslen(void* ctx_TODO, uint32_t this_ptr) {
7104 LDKPong this_ptr_conv;
7105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7106 this_ptr_conv.is_owned = false;
7107 jshort ret_val = Pong_get_byteslen(&this_ptr_conv);
7111 void Pong_1set_1byteslen(void* ctx_TODO, uint32_t this_ptr, jshort val) {
7112 LDKPong this_ptr_conv;
7113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7114 this_ptr_conv.is_owned = false;
7115 Pong_set_byteslen(&this_ptr_conv, val);
7118 uint32_t Pong_1new(void* ctx_TODO, jshort byteslen_arg) {
7119 LDKPong ret_var = Pong_new(byteslen_arg);
7120 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7121 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7122 long ret_ref = (long)ret_var.inner;
7123 if (ret_var.is_owned) {
7129 void OpenChannel_1free(void* ctx_TODO, uint32_t this_ptr) {
7130 LDKOpenChannel this_ptr_conv;
7131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7132 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7133 OpenChannel_free(this_ptr_conv);
7136 uint32_t OpenChannel_1clone(void* ctx_TODO, uint32_t orig) {
7137 LDKOpenChannel orig_conv;
7138 orig_conv.inner = (void*)(orig & (~1));
7139 orig_conv.is_owned = false;
7140 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
7141 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7142 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7143 long ret_ref = (long)ret_var.inner;
7144 if (ret_var.is_owned) {
7150 int8_tArray OpenChannel_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
7151 LDKOpenChannel this_ptr_conv;
7152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7153 this_ptr_conv.is_owned = false;
7154 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
7155 memcpy(ret_arr.ptr, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
7159 void OpenChannel_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7160 LDKOpenChannel this_ptr_conv;
7161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7162 this_ptr_conv.is_owned = false;
7163 LDKThirtyTwoBytes val_ref;
7164 CHECK(val.len == 32);
7165 memcpy(val_ref.data, val.ptr, 32);
7166 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
7169 int8_tArray OpenChannel_1get_1temporary_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
7170 LDKOpenChannel this_ptr_conv;
7171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7172 this_ptr_conv.is_owned = false;
7173 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
7174 memcpy(ret_arr.ptr, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
7178 void OpenChannel_1set_1temporary_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7179 LDKOpenChannel this_ptr_conv;
7180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7181 this_ptr_conv.is_owned = false;
7182 LDKThirtyTwoBytes val_ref;
7183 CHECK(val.len == 32);
7184 memcpy(val_ref.data, val.ptr, 32);
7185 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
7188 int64_t OpenChannel_1get_1funding_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
7189 LDKOpenChannel this_ptr_conv;
7190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7191 this_ptr_conv.is_owned = false;
7192 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
7196 void OpenChannel_1set_1funding_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
7197 LDKOpenChannel this_ptr_conv;
7198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7199 this_ptr_conv.is_owned = false;
7200 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
7203 int64_t OpenChannel_1get_1push_1msat(void* ctx_TODO, uint32_t this_ptr) {
7204 LDKOpenChannel this_ptr_conv;
7205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7206 this_ptr_conv.is_owned = false;
7207 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
7211 void OpenChannel_1set_1push_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
7212 LDKOpenChannel this_ptr_conv;
7213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7214 this_ptr_conv.is_owned = false;
7215 OpenChannel_set_push_msat(&this_ptr_conv, val);
7218 int64_t OpenChannel_1get_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
7219 LDKOpenChannel this_ptr_conv;
7220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7221 this_ptr_conv.is_owned = false;
7222 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
7226 void OpenChannel_1set_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
7227 LDKOpenChannel this_ptr_conv;
7228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7229 this_ptr_conv.is_owned = false;
7230 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
7233 int64_t OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(void* ctx_TODO, uint32_t this_ptr) {
7234 LDKOpenChannel this_ptr_conv;
7235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7236 this_ptr_conv.is_owned = false;
7237 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
7241 void OpenChannel_1set_1max_1htlc_1value_1in_1flight_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
7242 LDKOpenChannel this_ptr_conv;
7243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7244 this_ptr_conv.is_owned = false;
7245 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7248 int64_t OpenChannel_1get_1channel_1reserve_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
7249 LDKOpenChannel this_ptr_conv;
7250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7251 this_ptr_conv.is_owned = false;
7252 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
7256 void OpenChannel_1set_1channel_1reserve_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
7257 LDKOpenChannel this_ptr_conv;
7258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7259 this_ptr_conv.is_owned = false;
7260 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
7263 int64_t OpenChannel_1get_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr) {
7264 LDKOpenChannel this_ptr_conv;
7265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7266 this_ptr_conv.is_owned = false;
7267 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
7271 void OpenChannel_1set_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
7272 LDKOpenChannel this_ptr_conv;
7273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7274 this_ptr_conv.is_owned = false;
7275 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
7278 int32_t OpenChannel_1get_1feerate_1per_1kw(void* ctx_TODO, uint32_t this_ptr) {
7279 LDKOpenChannel this_ptr_conv;
7280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7281 this_ptr_conv.is_owned = false;
7282 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
7286 void OpenChannel_1set_1feerate_1per_1kw(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
7287 LDKOpenChannel this_ptr_conv;
7288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7289 this_ptr_conv.is_owned = false;
7290 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
7293 jshort OpenChannel_1get_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr) {
7294 LDKOpenChannel this_ptr_conv;
7295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7296 this_ptr_conv.is_owned = false;
7297 jshort ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
7301 void OpenChannel_1set_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr, jshort val) {
7302 LDKOpenChannel this_ptr_conv;
7303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7304 this_ptr_conv.is_owned = false;
7305 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
7308 jshort OpenChannel_1get_1max_1accepted_1htlcs(void* ctx_TODO, uint32_t this_ptr) {
7309 LDKOpenChannel this_ptr_conv;
7310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7311 this_ptr_conv.is_owned = false;
7312 jshort ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
7316 void OpenChannel_1set_1max_1accepted_1htlcs(void* ctx_TODO, uint32_t this_ptr, jshort val) {
7317 LDKOpenChannel this_ptr_conv;
7318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7319 this_ptr_conv.is_owned = false;
7320 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
7323 int8_tArray OpenChannel_1get_1funding_1pubkey(void* ctx_TODO, uint32_t this_ptr) {
7324 LDKOpenChannel this_ptr_conv;
7325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7326 this_ptr_conv.is_owned = false;
7327 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
7328 memcpy(arg_arr.ptr, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
7332 void OpenChannel_1set_1funding_1pubkey(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7333 LDKOpenChannel this_ptr_conv;
7334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7335 this_ptr_conv.is_owned = false;
7336 LDKPublicKey val_ref;
7337 CHECK(val.len == 33);
7338 memcpy(val_ref.compressed_form, val.ptr, 33);
7339 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
7342 int8_tArray OpenChannel_1get_1revocation_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
7343 LDKOpenChannel this_ptr_conv;
7344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7345 this_ptr_conv.is_owned = false;
7346 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
7347 memcpy(arg_arr.ptr, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
7351 void OpenChannel_1set_1revocation_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7352 LDKOpenChannel this_ptr_conv;
7353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7354 this_ptr_conv.is_owned = false;
7355 LDKPublicKey val_ref;
7356 CHECK(val.len == 33);
7357 memcpy(val_ref.compressed_form, val.ptr, 33);
7358 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
7361 int8_tArray OpenChannel_1get_1payment_1point(void* ctx_TODO, uint32_t this_ptr) {
7362 LDKOpenChannel this_ptr_conv;
7363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7364 this_ptr_conv.is_owned = false;
7365 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
7366 memcpy(arg_arr.ptr, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
7370 void OpenChannel_1set_1payment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7371 LDKOpenChannel this_ptr_conv;
7372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7373 this_ptr_conv.is_owned = false;
7374 LDKPublicKey val_ref;
7375 CHECK(val.len == 33);
7376 memcpy(val_ref.compressed_form, val.ptr, 33);
7377 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
7380 int8_tArray OpenChannel_1get_1delayed_1payment_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
7381 LDKOpenChannel this_ptr_conv;
7382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7383 this_ptr_conv.is_owned = false;
7384 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
7385 memcpy(arg_arr.ptr, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
7389 void OpenChannel_1set_1delayed_1payment_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7390 LDKOpenChannel this_ptr_conv;
7391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7392 this_ptr_conv.is_owned = false;
7393 LDKPublicKey val_ref;
7394 CHECK(val.len == 33);
7395 memcpy(val_ref.compressed_form, val.ptr, 33);
7396 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
7399 int8_tArray OpenChannel_1get_1htlc_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
7400 LDKOpenChannel this_ptr_conv;
7401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7402 this_ptr_conv.is_owned = false;
7403 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
7404 memcpy(arg_arr.ptr, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
7408 void OpenChannel_1set_1htlc_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7409 LDKOpenChannel this_ptr_conv;
7410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7411 this_ptr_conv.is_owned = false;
7412 LDKPublicKey val_ref;
7413 CHECK(val.len == 33);
7414 memcpy(val_ref.compressed_form, val.ptr, 33);
7415 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
7418 int8_tArray OpenChannel_1get_1first_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr) {
7419 LDKOpenChannel this_ptr_conv;
7420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7421 this_ptr_conv.is_owned = false;
7422 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
7423 memcpy(arg_arr.ptr, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
7427 void OpenChannel_1set_1first_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7428 LDKOpenChannel this_ptr_conv;
7429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7430 this_ptr_conv.is_owned = false;
7431 LDKPublicKey val_ref;
7432 CHECK(val.len == 33);
7433 memcpy(val_ref.compressed_form, val.ptr, 33);
7434 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
7437 int8_t OpenChannel_1get_1channel_1flags(void* ctx_TODO, uint32_t this_ptr) {
7438 LDKOpenChannel this_ptr_conv;
7439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7440 this_ptr_conv.is_owned = false;
7441 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
7445 void OpenChannel_1set_1channel_1flags(void* ctx_TODO, uint32_t this_ptr, int8_t val) {
7446 LDKOpenChannel this_ptr_conv;
7447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7448 this_ptr_conv.is_owned = false;
7449 OpenChannel_set_channel_flags(&this_ptr_conv, val);
7452 void AcceptChannel_1free(void* ctx_TODO, uint32_t this_ptr) {
7453 LDKAcceptChannel this_ptr_conv;
7454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7455 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7456 AcceptChannel_free(this_ptr_conv);
7459 uint32_t AcceptChannel_1clone(void* ctx_TODO, uint32_t orig) {
7460 LDKAcceptChannel orig_conv;
7461 orig_conv.inner = (void*)(orig & (~1));
7462 orig_conv.is_owned = false;
7463 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
7464 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7465 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7466 long ret_ref = (long)ret_var.inner;
7467 if (ret_var.is_owned) {
7473 int8_tArray AcceptChannel_1get_1temporary_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
7474 LDKAcceptChannel this_ptr_conv;
7475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7476 this_ptr_conv.is_owned = false;
7477 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
7478 memcpy(ret_arr.ptr, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
7482 void AcceptChannel_1set_1temporary_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7483 LDKAcceptChannel this_ptr_conv;
7484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7485 this_ptr_conv.is_owned = false;
7486 LDKThirtyTwoBytes val_ref;
7487 CHECK(val.len == 32);
7488 memcpy(val_ref.data, val.ptr, 32);
7489 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
7492 int64_t AcceptChannel_1get_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
7493 LDKAcceptChannel this_ptr_conv;
7494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7495 this_ptr_conv.is_owned = false;
7496 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
7500 void AcceptChannel_1set_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
7501 LDKAcceptChannel this_ptr_conv;
7502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7503 this_ptr_conv.is_owned = false;
7504 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
7507 int64_t AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(void* ctx_TODO, uint32_t this_ptr) {
7508 LDKAcceptChannel this_ptr_conv;
7509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7510 this_ptr_conv.is_owned = false;
7511 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
7515 void AcceptChannel_1set_1max_1htlc_1value_1in_1flight_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
7516 LDKAcceptChannel this_ptr_conv;
7517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7518 this_ptr_conv.is_owned = false;
7519 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7522 int64_t AcceptChannel_1get_1channel_1reserve_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
7523 LDKAcceptChannel this_ptr_conv;
7524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7525 this_ptr_conv.is_owned = false;
7526 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
7530 void AcceptChannel_1set_1channel_1reserve_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
7531 LDKAcceptChannel this_ptr_conv;
7532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7533 this_ptr_conv.is_owned = false;
7534 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
7537 int64_t AcceptChannel_1get_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr) {
7538 LDKAcceptChannel this_ptr_conv;
7539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7540 this_ptr_conv.is_owned = false;
7541 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
7545 void AcceptChannel_1set_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
7546 LDKAcceptChannel this_ptr_conv;
7547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7548 this_ptr_conv.is_owned = false;
7549 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
7552 int32_t AcceptChannel_1get_1minimum_1depth(void* ctx_TODO, uint32_t this_ptr) {
7553 LDKAcceptChannel this_ptr_conv;
7554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7555 this_ptr_conv.is_owned = false;
7556 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
7560 void AcceptChannel_1set_1minimum_1depth(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
7561 LDKAcceptChannel this_ptr_conv;
7562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7563 this_ptr_conv.is_owned = false;
7564 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
7567 jshort AcceptChannel_1get_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr) {
7568 LDKAcceptChannel this_ptr_conv;
7569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7570 this_ptr_conv.is_owned = false;
7571 jshort ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
7575 void AcceptChannel_1set_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr, jshort val) {
7576 LDKAcceptChannel this_ptr_conv;
7577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7578 this_ptr_conv.is_owned = false;
7579 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
7582 jshort AcceptChannel_1get_1max_1accepted_1htlcs(void* ctx_TODO, uint32_t this_ptr) {
7583 LDKAcceptChannel this_ptr_conv;
7584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7585 this_ptr_conv.is_owned = false;
7586 jshort ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
7590 void AcceptChannel_1set_1max_1accepted_1htlcs(void* ctx_TODO, uint32_t this_ptr, jshort val) {
7591 LDKAcceptChannel this_ptr_conv;
7592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7593 this_ptr_conv.is_owned = false;
7594 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
7597 int8_tArray AcceptChannel_1get_1funding_1pubkey(void* ctx_TODO, uint32_t this_ptr) {
7598 LDKAcceptChannel this_ptr_conv;
7599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7600 this_ptr_conv.is_owned = false;
7601 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
7602 memcpy(arg_arr.ptr, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
7606 void AcceptChannel_1set_1funding_1pubkey(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7607 LDKAcceptChannel this_ptr_conv;
7608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7609 this_ptr_conv.is_owned = false;
7610 LDKPublicKey val_ref;
7611 CHECK(val.len == 33);
7612 memcpy(val_ref.compressed_form, val.ptr, 33);
7613 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
7616 int8_tArray AcceptChannel_1get_1revocation_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
7617 LDKAcceptChannel this_ptr_conv;
7618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7619 this_ptr_conv.is_owned = false;
7620 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
7621 memcpy(arg_arr.ptr, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
7625 void AcceptChannel_1set_1revocation_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7626 LDKAcceptChannel this_ptr_conv;
7627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7628 this_ptr_conv.is_owned = false;
7629 LDKPublicKey val_ref;
7630 CHECK(val.len == 33);
7631 memcpy(val_ref.compressed_form, val.ptr, 33);
7632 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
7635 int8_tArray AcceptChannel_1get_1payment_1point(void* ctx_TODO, uint32_t this_ptr) {
7636 LDKAcceptChannel this_ptr_conv;
7637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7638 this_ptr_conv.is_owned = false;
7639 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
7640 memcpy(arg_arr.ptr, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
7644 void AcceptChannel_1set_1payment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7645 LDKAcceptChannel this_ptr_conv;
7646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7647 this_ptr_conv.is_owned = false;
7648 LDKPublicKey val_ref;
7649 CHECK(val.len == 33);
7650 memcpy(val_ref.compressed_form, val.ptr, 33);
7651 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
7654 int8_tArray AcceptChannel_1get_1delayed_1payment_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
7655 LDKAcceptChannel this_ptr_conv;
7656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7657 this_ptr_conv.is_owned = false;
7658 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
7659 memcpy(arg_arr.ptr, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
7663 void AcceptChannel_1set_1delayed_1payment_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7664 LDKAcceptChannel this_ptr_conv;
7665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7666 this_ptr_conv.is_owned = false;
7667 LDKPublicKey val_ref;
7668 CHECK(val.len == 33);
7669 memcpy(val_ref.compressed_form, val.ptr, 33);
7670 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
7673 int8_tArray AcceptChannel_1get_1htlc_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
7674 LDKAcceptChannel this_ptr_conv;
7675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7676 this_ptr_conv.is_owned = false;
7677 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
7678 memcpy(arg_arr.ptr, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
7682 void AcceptChannel_1set_1htlc_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7683 LDKAcceptChannel this_ptr_conv;
7684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7685 this_ptr_conv.is_owned = false;
7686 LDKPublicKey val_ref;
7687 CHECK(val.len == 33);
7688 memcpy(val_ref.compressed_form, val.ptr, 33);
7689 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
7692 int8_tArray AcceptChannel_1get_1first_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr) {
7693 LDKAcceptChannel this_ptr_conv;
7694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7695 this_ptr_conv.is_owned = false;
7696 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
7697 memcpy(arg_arr.ptr, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
7701 void AcceptChannel_1set_1first_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7702 LDKAcceptChannel this_ptr_conv;
7703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7704 this_ptr_conv.is_owned = false;
7705 LDKPublicKey val_ref;
7706 CHECK(val.len == 33);
7707 memcpy(val_ref.compressed_form, val.ptr, 33);
7708 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
7711 void FundingCreated_1free(void* ctx_TODO, uint32_t this_ptr) {
7712 LDKFundingCreated this_ptr_conv;
7713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7714 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7715 FundingCreated_free(this_ptr_conv);
7718 uint32_t FundingCreated_1clone(void* ctx_TODO, uint32_t orig) {
7719 LDKFundingCreated orig_conv;
7720 orig_conv.inner = (void*)(orig & (~1));
7721 orig_conv.is_owned = false;
7722 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
7723 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7724 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7725 long ret_ref = (long)ret_var.inner;
7726 if (ret_var.is_owned) {
7732 int8_tArray FundingCreated_1get_1temporary_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
7733 LDKFundingCreated this_ptr_conv;
7734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7735 this_ptr_conv.is_owned = false;
7736 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
7737 memcpy(ret_arr.ptr, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
7741 void FundingCreated_1set_1temporary_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7742 LDKFundingCreated this_ptr_conv;
7743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7744 this_ptr_conv.is_owned = false;
7745 LDKThirtyTwoBytes val_ref;
7746 CHECK(val.len == 32);
7747 memcpy(val_ref.data, val.ptr, 32);
7748 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
7751 int8_tArray FundingCreated_1get_1funding_1txid(void* ctx_TODO, uint32_t this_ptr) {
7752 LDKFundingCreated this_ptr_conv;
7753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7754 this_ptr_conv.is_owned = false;
7755 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
7756 memcpy(ret_arr.ptr, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
7760 void FundingCreated_1set_1funding_1txid(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7761 LDKFundingCreated this_ptr_conv;
7762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7763 this_ptr_conv.is_owned = false;
7764 LDKThirtyTwoBytes val_ref;
7765 CHECK(val.len == 32);
7766 memcpy(val_ref.data, val.ptr, 32);
7767 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
7770 jshort FundingCreated_1get_1funding_1output_1index(void* ctx_TODO, uint32_t this_ptr) {
7771 LDKFundingCreated this_ptr_conv;
7772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7773 this_ptr_conv.is_owned = false;
7774 jshort ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
7778 void FundingCreated_1set_1funding_1output_1index(void* ctx_TODO, uint32_t this_ptr, jshort val) {
7779 LDKFundingCreated this_ptr_conv;
7780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7781 this_ptr_conv.is_owned = false;
7782 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
7785 int8_tArray FundingCreated_1get_1signature(void* ctx_TODO, uint32_t this_ptr) {
7786 LDKFundingCreated this_ptr_conv;
7787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7788 this_ptr_conv.is_owned = false;
7789 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
7790 memcpy(arg_arr.ptr, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
7794 void FundingCreated_1set_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7795 LDKFundingCreated this_ptr_conv;
7796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7797 this_ptr_conv.is_owned = false;
7798 LDKSignature val_ref;
7799 CHECK(val.len == 64);
7800 memcpy(val_ref.compact_form, val.ptr, 64);
7801 FundingCreated_set_signature(&this_ptr_conv, val_ref);
7804 uint32_t FundingCreated_1new(void* ctx_TODO, int8_tArray temporary_channel_id_arg, int8_tArray funding_txid_arg, jshort funding_output_index_arg, int8_tArray signature_arg) {
7805 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
7806 CHECK(temporary_channel_id_arg.len == 32);
7807 memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg.ptr, 32);
7808 LDKThirtyTwoBytes funding_txid_arg_ref;
7809 CHECK(funding_txid_arg.len == 32);
7810 memcpy(funding_txid_arg_ref.data, funding_txid_arg.ptr, 32);
7811 LDKSignature signature_arg_ref;
7812 CHECK(signature_arg.len == 64);
7813 memcpy(signature_arg_ref.compact_form, signature_arg.ptr, 64);
7814 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
7815 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7816 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7817 long ret_ref = (long)ret_var.inner;
7818 if (ret_var.is_owned) {
7824 void FundingSigned_1free(void* ctx_TODO, uint32_t this_ptr) {
7825 LDKFundingSigned this_ptr_conv;
7826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7827 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7828 FundingSigned_free(this_ptr_conv);
7831 uint32_t FundingSigned_1clone(void* ctx_TODO, uint32_t orig) {
7832 LDKFundingSigned orig_conv;
7833 orig_conv.inner = (void*)(orig & (~1));
7834 orig_conv.is_owned = false;
7835 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
7836 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7837 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7838 long ret_ref = (long)ret_var.inner;
7839 if (ret_var.is_owned) {
7845 int8_tArray FundingSigned_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
7846 LDKFundingSigned this_ptr_conv;
7847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7848 this_ptr_conv.is_owned = false;
7849 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
7850 memcpy(ret_arr.ptr, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
7854 void FundingSigned_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7855 LDKFundingSigned this_ptr_conv;
7856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7857 this_ptr_conv.is_owned = false;
7858 LDKThirtyTwoBytes val_ref;
7859 CHECK(val.len == 32);
7860 memcpy(val_ref.data, val.ptr, 32);
7861 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
7864 int8_tArray FundingSigned_1get_1signature(void* ctx_TODO, uint32_t this_ptr) {
7865 LDKFundingSigned this_ptr_conv;
7866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7867 this_ptr_conv.is_owned = false;
7868 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
7869 memcpy(arg_arr.ptr, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
7873 void FundingSigned_1set_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7874 LDKFundingSigned this_ptr_conv;
7875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7876 this_ptr_conv.is_owned = false;
7877 LDKSignature val_ref;
7878 CHECK(val.len == 64);
7879 memcpy(val_ref.compact_form, val.ptr, 64);
7880 FundingSigned_set_signature(&this_ptr_conv, val_ref);
7883 uint32_t FundingSigned_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray signature_arg) {
7884 LDKThirtyTwoBytes channel_id_arg_ref;
7885 CHECK(channel_id_arg.len == 32);
7886 memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
7887 LDKSignature signature_arg_ref;
7888 CHECK(signature_arg.len == 64);
7889 memcpy(signature_arg_ref.compact_form, signature_arg.ptr, 64);
7890 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
7891 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7892 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7893 long ret_ref = (long)ret_var.inner;
7894 if (ret_var.is_owned) {
7900 void FundingLocked_1free(void* ctx_TODO, uint32_t this_ptr) {
7901 LDKFundingLocked 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 FundingLocked_free(this_ptr_conv);
7907 uint32_t FundingLocked_1clone(void* ctx_TODO, uint32_t orig) {
7908 LDKFundingLocked orig_conv;
7909 orig_conv.inner = (void*)(orig & (~1));
7910 orig_conv.is_owned = false;
7911 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
7912 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7913 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7914 long ret_ref = (long)ret_var.inner;
7915 if (ret_var.is_owned) {
7921 int8_tArray FundingLocked_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
7922 LDKFundingLocked this_ptr_conv;
7923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7924 this_ptr_conv.is_owned = false;
7925 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
7926 memcpy(ret_arr.ptr, *FundingLocked_get_channel_id(&this_ptr_conv), 32);
7930 void FundingLocked_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7931 LDKFundingLocked this_ptr_conv;
7932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7933 this_ptr_conv.is_owned = false;
7934 LDKThirtyTwoBytes val_ref;
7935 CHECK(val.len == 32);
7936 memcpy(val_ref.data, val.ptr, 32);
7937 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
7940 int8_tArray FundingLocked_1get_1next_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr) {
7941 LDKFundingLocked this_ptr_conv;
7942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7943 this_ptr_conv.is_owned = false;
7944 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
7945 memcpy(arg_arr.ptr, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
7949 void FundingLocked_1set_1next_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7950 LDKFundingLocked this_ptr_conv;
7951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7952 this_ptr_conv.is_owned = false;
7953 LDKPublicKey val_ref;
7954 CHECK(val.len == 33);
7955 memcpy(val_ref.compressed_form, val.ptr, 33);
7956 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
7959 uint32_t FundingLocked_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
7960 LDKThirtyTwoBytes channel_id_arg_ref;
7961 CHECK(channel_id_arg.len == 32);
7962 memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
7963 LDKPublicKey next_per_commitment_point_arg_ref;
7964 CHECK(next_per_commitment_point_arg.len == 33);
7965 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg.ptr, 33);
7966 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
7967 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7968 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7969 long ret_ref = (long)ret_var.inner;
7970 if (ret_var.is_owned) {
7976 void Shutdown_1free(void* ctx_TODO, uint32_t this_ptr) {
7977 LDKShutdown this_ptr_conv;
7978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7979 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7980 Shutdown_free(this_ptr_conv);
7983 uint32_t Shutdown_1clone(void* ctx_TODO, uint32_t orig) {
7984 LDKShutdown orig_conv;
7985 orig_conv.inner = (void*)(orig & (~1));
7986 orig_conv.is_owned = false;
7987 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
7988 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7989 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7990 long ret_ref = (long)ret_var.inner;
7991 if (ret_var.is_owned) {
7997 int8_tArray Shutdown_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
7998 LDKShutdown this_ptr_conv;
7999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8000 this_ptr_conv.is_owned = false;
8001 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
8002 memcpy(ret_arr.ptr, *Shutdown_get_channel_id(&this_ptr_conv), 32);
8006 void Shutdown_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8007 LDKShutdown this_ptr_conv;
8008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8009 this_ptr_conv.is_owned = false;
8010 LDKThirtyTwoBytes val_ref;
8011 CHECK(val.len == 32);
8012 memcpy(val_ref.data, val.ptr, 32);
8013 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
8016 int8_tArray Shutdown_1get_1scriptpubkey(void* ctx_TODO, uint32_t this_ptr) {
8017 LDKShutdown this_ptr_conv;
8018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8019 this_ptr_conv.is_owned = false;
8020 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
8021 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
8022 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
8026 void Shutdown_1set_1scriptpubkey(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8027 LDKShutdown this_ptr_conv;
8028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8029 this_ptr_conv.is_owned = false;
8030 LDKCVec_u8Z val_ref;
8031 val_ref.datalen = val.len;
8032 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
8033 memcpy(val_ref.data, val.ptr, val_ref.datalen);
8034 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
8037 uint32_t Shutdown_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
8038 LDKThirtyTwoBytes channel_id_arg_ref;
8039 CHECK(channel_id_arg.len == 32);
8040 memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
8041 LDKCVec_u8Z scriptpubkey_arg_ref;
8042 scriptpubkey_arg_ref.datalen = scriptpubkey_arg.len;
8043 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
8044 memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg.ptr, scriptpubkey_arg_ref.datalen);
8045 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
8046 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8047 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8048 long ret_ref = (long)ret_var.inner;
8049 if (ret_var.is_owned) {
8055 void ClosingSigned_1free(void* ctx_TODO, uint32_t this_ptr) {
8056 LDKClosingSigned this_ptr_conv;
8057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8058 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8059 ClosingSigned_free(this_ptr_conv);
8062 uint32_t ClosingSigned_1clone(void* ctx_TODO, uint32_t orig) {
8063 LDKClosingSigned orig_conv;
8064 orig_conv.inner = (void*)(orig & (~1));
8065 orig_conv.is_owned = false;
8066 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
8067 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8068 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8069 long ret_ref = (long)ret_var.inner;
8070 if (ret_var.is_owned) {
8076 int8_tArray ClosingSigned_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
8077 LDKClosingSigned this_ptr_conv;
8078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8079 this_ptr_conv.is_owned = false;
8080 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
8081 memcpy(ret_arr.ptr, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
8085 void ClosingSigned_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8086 LDKClosingSigned this_ptr_conv;
8087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8088 this_ptr_conv.is_owned = false;
8089 LDKThirtyTwoBytes val_ref;
8090 CHECK(val.len == 32);
8091 memcpy(val_ref.data, val.ptr, 32);
8092 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
8095 int64_t ClosingSigned_1get_1fee_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
8096 LDKClosingSigned this_ptr_conv;
8097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8098 this_ptr_conv.is_owned = false;
8099 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
8103 void ClosingSigned_1set_1fee_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8104 LDKClosingSigned this_ptr_conv;
8105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8106 this_ptr_conv.is_owned = false;
8107 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
8110 int8_tArray ClosingSigned_1get_1signature(void* ctx_TODO, uint32_t this_ptr) {
8111 LDKClosingSigned this_ptr_conv;
8112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8113 this_ptr_conv.is_owned = false;
8114 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
8115 memcpy(arg_arr.ptr, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
8119 void ClosingSigned_1set_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8120 LDKClosingSigned this_ptr_conv;
8121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8122 this_ptr_conv.is_owned = false;
8123 LDKSignature val_ref;
8124 CHECK(val.len == 64);
8125 memcpy(val_ref.compact_form, val.ptr, 64);
8126 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
8129 uint32_t ClosingSigned_1new(void* ctx_TODO, int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg) {
8130 LDKThirtyTwoBytes channel_id_arg_ref;
8131 CHECK(channel_id_arg.len == 32);
8132 memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
8133 LDKSignature signature_arg_ref;
8134 CHECK(signature_arg.len == 64);
8135 memcpy(signature_arg_ref.compact_form, signature_arg.ptr, 64);
8136 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
8137 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8138 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8139 long ret_ref = (long)ret_var.inner;
8140 if (ret_var.is_owned) {
8146 void UpdateAddHTLC_1free(void* ctx_TODO, uint32_t this_ptr) {
8147 LDKUpdateAddHTLC this_ptr_conv;
8148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8149 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8150 UpdateAddHTLC_free(this_ptr_conv);
8153 uint32_t UpdateAddHTLC_1clone(void* ctx_TODO, uint32_t orig) {
8154 LDKUpdateAddHTLC orig_conv;
8155 orig_conv.inner = (void*)(orig & (~1));
8156 orig_conv.is_owned = false;
8157 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
8158 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8159 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8160 long ret_ref = (long)ret_var.inner;
8161 if (ret_var.is_owned) {
8167 int8_tArray UpdateAddHTLC_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
8168 LDKUpdateAddHTLC this_ptr_conv;
8169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8170 this_ptr_conv.is_owned = false;
8171 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
8172 memcpy(ret_arr.ptr, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
8176 void UpdateAddHTLC_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8177 LDKUpdateAddHTLC this_ptr_conv;
8178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8179 this_ptr_conv.is_owned = false;
8180 LDKThirtyTwoBytes val_ref;
8181 CHECK(val.len == 32);
8182 memcpy(val_ref.data, val.ptr, 32);
8183 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
8186 int64_t UpdateAddHTLC_1get_1htlc_1id(void* ctx_TODO, uint32_t this_ptr) {
8187 LDKUpdateAddHTLC this_ptr_conv;
8188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8189 this_ptr_conv.is_owned = false;
8190 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
8194 void UpdateAddHTLC_1set_1htlc_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8195 LDKUpdateAddHTLC this_ptr_conv;
8196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8197 this_ptr_conv.is_owned = false;
8198 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
8201 int64_t UpdateAddHTLC_1get_1amount_1msat(void* ctx_TODO, uint32_t this_ptr) {
8202 LDKUpdateAddHTLC this_ptr_conv;
8203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8204 this_ptr_conv.is_owned = false;
8205 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
8209 void UpdateAddHTLC_1set_1amount_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8210 LDKUpdateAddHTLC this_ptr_conv;
8211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8212 this_ptr_conv.is_owned = false;
8213 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
8216 int8_tArray UpdateAddHTLC_1get_1payment_1hash(void* ctx_TODO, uint32_t this_ptr) {
8217 LDKUpdateAddHTLC this_ptr_conv;
8218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8219 this_ptr_conv.is_owned = false;
8220 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
8221 memcpy(ret_arr.ptr, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
8225 void UpdateAddHTLC_1set_1payment_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8226 LDKUpdateAddHTLC this_ptr_conv;
8227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8228 this_ptr_conv.is_owned = false;
8229 LDKThirtyTwoBytes val_ref;
8230 CHECK(val.len == 32);
8231 memcpy(val_ref.data, val.ptr, 32);
8232 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
8235 int32_t UpdateAddHTLC_1get_1cltv_1expiry(void* ctx_TODO, uint32_t this_ptr) {
8236 LDKUpdateAddHTLC this_ptr_conv;
8237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8238 this_ptr_conv.is_owned = false;
8239 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
8243 void UpdateAddHTLC_1set_1cltv_1expiry(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
8244 LDKUpdateAddHTLC this_ptr_conv;
8245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8246 this_ptr_conv.is_owned = false;
8247 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
8250 void UpdateFulfillHTLC_1free(void* ctx_TODO, uint32_t this_ptr) {
8251 LDKUpdateFulfillHTLC this_ptr_conv;
8252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8253 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8254 UpdateFulfillHTLC_free(this_ptr_conv);
8257 uint32_t UpdateFulfillHTLC_1clone(void* ctx_TODO, uint32_t orig) {
8258 LDKUpdateFulfillHTLC orig_conv;
8259 orig_conv.inner = (void*)(orig & (~1));
8260 orig_conv.is_owned = false;
8261 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
8262 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8263 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8264 long ret_ref = (long)ret_var.inner;
8265 if (ret_var.is_owned) {
8271 int8_tArray UpdateFulfillHTLC_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
8272 LDKUpdateFulfillHTLC this_ptr_conv;
8273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8274 this_ptr_conv.is_owned = false;
8275 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
8276 memcpy(ret_arr.ptr, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
8280 void UpdateFulfillHTLC_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8281 LDKUpdateFulfillHTLC this_ptr_conv;
8282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8283 this_ptr_conv.is_owned = false;
8284 LDKThirtyTwoBytes val_ref;
8285 CHECK(val.len == 32);
8286 memcpy(val_ref.data, val.ptr, 32);
8287 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
8290 int64_t UpdateFulfillHTLC_1get_1htlc_1id(void* ctx_TODO, uint32_t this_ptr) {
8291 LDKUpdateFulfillHTLC this_ptr_conv;
8292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8293 this_ptr_conv.is_owned = false;
8294 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
8298 void UpdateFulfillHTLC_1set_1htlc_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8299 LDKUpdateFulfillHTLC this_ptr_conv;
8300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8301 this_ptr_conv.is_owned = false;
8302 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
8305 int8_tArray UpdateFulfillHTLC_1get_1payment_1preimage(void* ctx_TODO, uint32_t this_ptr) {
8306 LDKUpdateFulfillHTLC this_ptr_conv;
8307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8308 this_ptr_conv.is_owned = false;
8309 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
8310 memcpy(ret_arr.ptr, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
8314 void UpdateFulfillHTLC_1set_1payment_1preimage(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8315 LDKUpdateFulfillHTLC this_ptr_conv;
8316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8317 this_ptr_conv.is_owned = false;
8318 LDKThirtyTwoBytes val_ref;
8319 CHECK(val.len == 32);
8320 memcpy(val_ref.data, val.ptr, 32);
8321 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
8324 uint32_t UpdateFulfillHTLC_1new(void* ctx_TODO, int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
8325 LDKThirtyTwoBytes channel_id_arg_ref;
8326 CHECK(channel_id_arg.len == 32);
8327 memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
8328 LDKThirtyTwoBytes payment_preimage_arg_ref;
8329 CHECK(payment_preimage_arg.len == 32);
8330 memcpy(payment_preimage_arg_ref.data, payment_preimage_arg.ptr, 32);
8331 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
8332 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8333 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8334 long ret_ref = (long)ret_var.inner;
8335 if (ret_var.is_owned) {
8341 void UpdateFailHTLC_1free(void* ctx_TODO, uint32_t this_ptr) {
8342 LDKUpdateFailHTLC this_ptr_conv;
8343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8344 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8345 UpdateFailHTLC_free(this_ptr_conv);
8348 uint32_t UpdateFailHTLC_1clone(void* ctx_TODO, uint32_t orig) {
8349 LDKUpdateFailHTLC orig_conv;
8350 orig_conv.inner = (void*)(orig & (~1));
8351 orig_conv.is_owned = false;
8352 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
8353 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8354 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8355 long ret_ref = (long)ret_var.inner;
8356 if (ret_var.is_owned) {
8362 int8_tArray UpdateFailHTLC_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
8363 LDKUpdateFailHTLC this_ptr_conv;
8364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8365 this_ptr_conv.is_owned = false;
8366 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
8367 memcpy(ret_arr.ptr, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
8371 void UpdateFailHTLC_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8372 LDKUpdateFailHTLC this_ptr_conv;
8373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8374 this_ptr_conv.is_owned = false;
8375 LDKThirtyTwoBytes val_ref;
8376 CHECK(val.len == 32);
8377 memcpy(val_ref.data, val.ptr, 32);
8378 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
8381 int64_t UpdateFailHTLC_1get_1htlc_1id(void* ctx_TODO, uint32_t this_ptr) {
8382 LDKUpdateFailHTLC this_ptr_conv;
8383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8384 this_ptr_conv.is_owned = false;
8385 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
8389 void UpdateFailHTLC_1set_1htlc_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8390 LDKUpdateFailHTLC this_ptr_conv;
8391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8392 this_ptr_conv.is_owned = false;
8393 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
8396 void UpdateFailMalformedHTLC_1free(void* ctx_TODO, uint32_t this_ptr) {
8397 LDKUpdateFailMalformedHTLC this_ptr_conv;
8398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8399 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8400 UpdateFailMalformedHTLC_free(this_ptr_conv);
8403 uint32_t UpdateFailMalformedHTLC_1clone(void* ctx_TODO, uint32_t orig) {
8404 LDKUpdateFailMalformedHTLC orig_conv;
8405 orig_conv.inner = (void*)(orig & (~1));
8406 orig_conv.is_owned = false;
8407 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
8408 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8409 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8410 long ret_ref = (long)ret_var.inner;
8411 if (ret_var.is_owned) {
8417 int8_tArray UpdateFailMalformedHTLC_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
8418 LDKUpdateFailMalformedHTLC this_ptr_conv;
8419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8420 this_ptr_conv.is_owned = false;
8421 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
8422 memcpy(ret_arr.ptr, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
8426 void UpdateFailMalformedHTLC_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8427 LDKUpdateFailMalformedHTLC this_ptr_conv;
8428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8429 this_ptr_conv.is_owned = false;
8430 LDKThirtyTwoBytes val_ref;
8431 CHECK(val.len == 32);
8432 memcpy(val_ref.data, val.ptr, 32);
8433 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
8436 int64_t UpdateFailMalformedHTLC_1get_1htlc_1id(void* ctx_TODO, uint32_t this_ptr) {
8437 LDKUpdateFailMalformedHTLC this_ptr_conv;
8438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8439 this_ptr_conv.is_owned = false;
8440 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
8444 void UpdateFailMalformedHTLC_1set_1htlc_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8445 LDKUpdateFailMalformedHTLC this_ptr_conv;
8446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8447 this_ptr_conv.is_owned = false;
8448 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
8451 jshort UpdateFailMalformedHTLC_1get_1failure_1code(void* ctx_TODO, uint32_t this_ptr) {
8452 LDKUpdateFailMalformedHTLC this_ptr_conv;
8453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8454 this_ptr_conv.is_owned = false;
8455 jshort ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
8459 void UpdateFailMalformedHTLC_1set_1failure_1code(void* ctx_TODO, uint32_t this_ptr, jshort val) {
8460 LDKUpdateFailMalformedHTLC this_ptr_conv;
8461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8462 this_ptr_conv.is_owned = false;
8463 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
8466 void CommitmentSigned_1free(void* ctx_TODO, uint32_t this_ptr) {
8467 LDKCommitmentSigned this_ptr_conv;
8468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8469 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8470 CommitmentSigned_free(this_ptr_conv);
8473 uint32_t CommitmentSigned_1clone(void* ctx_TODO, uint32_t orig) {
8474 LDKCommitmentSigned orig_conv;
8475 orig_conv.inner = (void*)(orig & (~1));
8476 orig_conv.is_owned = false;
8477 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
8478 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8479 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8480 long ret_ref = (long)ret_var.inner;
8481 if (ret_var.is_owned) {
8487 int8_tArray CommitmentSigned_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
8488 LDKCommitmentSigned this_ptr_conv;
8489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8490 this_ptr_conv.is_owned = false;
8491 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
8492 memcpy(ret_arr.ptr, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
8496 void CommitmentSigned_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8497 LDKCommitmentSigned this_ptr_conv;
8498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8499 this_ptr_conv.is_owned = false;
8500 LDKThirtyTwoBytes val_ref;
8501 CHECK(val.len == 32);
8502 memcpy(val_ref.data, val.ptr, 32);
8503 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
8506 int8_tArray CommitmentSigned_1get_1signature(void* ctx_TODO, uint32_t this_ptr) {
8507 LDKCommitmentSigned this_ptr_conv;
8508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8509 this_ptr_conv.is_owned = false;
8510 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
8511 memcpy(arg_arr.ptr, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
8515 void CommitmentSigned_1set_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8516 LDKCommitmentSigned this_ptr_conv;
8517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8518 this_ptr_conv.is_owned = false;
8519 LDKSignature val_ref;
8520 CHECK(val.len == 64);
8521 memcpy(val_ref.compact_form, val.ptr, 64);
8522 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
8525 void CommitmentSigned_1set_1htlc_1signatures(void* ctx_TODO, uint32_t this_ptr, uint32_tArray val) {
8526 LDKCommitmentSigned this_ptr_conv;
8527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8528 this_ptr_conv.is_owned = false;
8529 LDKCVec_SignatureZ val_constr;
8530 val_constr.datalen = val.len;
8531 if (val_constr.datalen > 0)
8532 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8534 val_constr.data = NULL;
8535 int8_tArray* val_vals = (int8_tArray*) val.ptr;
8536 for (size_t i = 0; i < val_constr.datalen; i++) {
8537 int8_tArray arr_conv_8 = val_vals[i];
8538 LDKSignature arr_conv_8_ref;
8539 CHECK(arr_conv_8.len == 64);
8540 memcpy(arr_conv_8_ref.compact_form, arr_conv_8.ptr, 64);
8541 val_constr.data[i] = arr_conv_8_ref;
8543 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
8546 uint32_t CommitmentSigned_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray signature_arg, uint32_tArray htlc_signatures_arg) {
8547 LDKThirtyTwoBytes channel_id_arg_ref;
8548 CHECK(channel_id_arg.len == 32);
8549 memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
8550 LDKSignature signature_arg_ref;
8551 CHECK(signature_arg.len == 64);
8552 memcpy(signature_arg_ref.compact_form, signature_arg.ptr, 64);
8553 LDKCVec_SignatureZ htlc_signatures_arg_constr;
8554 htlc_signatures_arg_constr.datalen = htlc_signatures_arg.len;
8555 if (htlc_signatures_arg_constr.datalen > 0)
8556 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8558 htlc_signatures_arg_constr.data = NULL;
8559 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*) htlc_signatures_arg.ptr;
8560 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
8561 int8_tArray arr_conv_8 = htlc_signatures_arg_vals[i];
8562 LDKSignature arr_conv_8_ref;
8563 CHECK(arr_conv_8.len == 64);
8564 memcpy(arr_conv_8_ref.compact_form, arr_conv_8.ptr, 64);
8565 htlc_signatures_arg_constr.data[i] = arr_conv_8_ref;
8567 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
8568 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8569 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8570 long ret_ref = (long)ret_var.inner;
8571 if (ret_var.is_owned) {
8577 void RevokeAndACK_1free(void* ctx_TODO, uint32_t this_ptr) {
8578 LDKRevokeAndACK this_ptr_conv;
8579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8580 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8581 RevokeAndACK_free(this_ptr_conv);
8584 uint32_t RevokeAndACK_1clone(void* ctx_TODO, uint32_t orig) {
8585 LDKRevokeAndACK orig_conv;
8586 orig_conv.inner = (void*)(orig & (~1));
8587 orig_conv.is_owned = false;
8588 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
8589 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8590 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8591 long ret_ref = (long)ret_var.inner;
8592 if (ret_var.is_owned) {
8598 int8_tArray RevokeAndACK_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
8599 LDKRevokeAndACK this_ptr_conv;
8600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8601 this_ptr_conv.is_owned = false;
8602 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
8603 memcpy(ret_arr.ptr, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
8607 void RevokeAndACK_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8608 LDKRevokeAndACK this_ptr_conv;
8609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8610 this_ptr_conv.is_owned = false;
8611 LDKThirtyTwoBytes val_ref;
8612 CHECK(val.len == 32);
8613 memcpy(val_ref.data, val.ptr, 32);
8614 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
8617 int8_tArray RevokeAndACK_1get_1per_1commitment_1secret(void* ctx_TODO, uint32_t this_ptr) {
8618 LDKRevokeAndACK this_ptr_conv;
8619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8620 this_ptr_conv.is_owned = false;
8621 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
8622 memcpy(ret_arr.ptr, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
8626 void RevokeAndACK_1set_1per_1commitment_1secret(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8627 LDKRevokeAndACK this_ptr_conv;
8628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8629 this_ptr_conv.is_owned = false;
8630 LDKThirtyTwoBytes val_ref;
8631 CHECK(val.len == 32);
8632 memcpy(val_ref.data, val.ptr, 32);
8633 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
8636 int8_tArray RevokeAndACK_1get_1next_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr) {
8637 LDKRevokeAndACK this_ptr_conv;
8638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8639 this_ptr_conv.is_owned = false;
8640 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
8641 memcpy(arg_arr.ptr, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
8645 void RevokeAndACK_1set_1next_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8646 LDKRevokeAndACK this_ptr_conv;
8647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8648 this_ptr_conv.is_owned = false;
8649 LDKPublicKey val_ref;
8650 CHECK(val.len == 33);
8651 memcpy(val_ref.compressed_form, val.ptr, 33);
8652 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8655 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) {
8656 LDKThirtyTwoBytes channel_id_arg_ref;
8657 CHECK(channel_id_arg.len == 32);
8658 memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
8659 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
8660 CHECK(per_commitment_secret_arg.len == 32);
8661 memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg.ptr, 32);
8662 LDKPublicKey next_per_commitment_point_arg_ref;
8663 CHECK(next_per_commitment_point_arg.len == 33);
8664 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg.ptr, 33);
8665 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
8666 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8667 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8668 long ret_ref = (long)ret_var.inner;
8669 if (ret_var.is_owned) {
8675 void UpdateFee_1free(void* ctx_TODO, uint32_t this_ptr) {
8676 LDKUpdateFee this_ptr_conv;
8677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8678 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8679 UpdateFee_free(this_ptr_conv);
8682 uint32_t UpdateFee_1clone(void* ctx_TODO, uint32_t orig) {
8683 LDKUpdateFee orig_conv;
8684 orig_conv.inner = (void*)(orig & (~1));
8685 orig_conv.is_owned = false;
8686 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
8687 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8688 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8689 long ret_ref = (long)ret_var.inner;
8690 if (ret_var.is_owned) {
8696 int8_tArray UpdateFee_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
8697 LDKUpdateFee this_ptr_conv;
8698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8699 this_ptr_conv.is_owned = false;
8700 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
8701 memcpy(ret_arr.ptr, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
8705 void UpdateFee_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8706 LDKUpdateFee this_ptr_conv;
8707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8708 this_ptr_conv.is_owned = false;
8709 LDKThirtyTwoBytes val_ref;
8710 CHECK(val.len == 32);
8711 memcpy(val_ref.data, val.ptr, 32);
8712 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
8715 int32_t UpdateFee_1get_1feerate_1per_1kw(void* ctx_TODO, uint32_t this_ptr) {
8716 LDKUpdateFee this_ptr_conv;
8717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8718 this_ptr_conv.is_owned = false;
8719 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
8723 void UpdateFee_1set_1feerate_1per_1kw(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
8724 LDKUpdateFee this_ptr_conv;
8725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8726 this_ptr_conv.is_owned = false;
8727 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
8730 uint32_t UpdateFee_1new(void* ctx_TODO, int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
8731 LDKThirtyTwoBytes channel_id_arg_ref;
8732 CHECK(channel_id_arg.len == 32);
8733 memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
8734 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
8735 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8736 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8737 long ret_ref = (long)ret_var.inner;
8738 if (ret_var.is_owned) {
8744 void DataLossProtect_1free(void* ctx_TODO, uint32_t this_ptr) {
8745 LDKDataLossProtect this_ptr_conv;
8746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8747 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8748 DataLossProtect_free(this_ptr_conv);
8751 uint32_t DataLossProtect_1clone(void* ctx_TODO, uint32_t orig) {
8752 LDKDataLossProtect orig_conv;
8753 orig_conv.inner = (void*)(orig & (~1));
8754 orig_conv.is_owned = false;
8755 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
8756 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8757 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8758 long ret_ref = (long)ret_var.inner;
8759 if (ret_var.is_owned) {
8765 int8_tArray DataLossProtect_1get_1your_1last_1per_1commitment_1secret(void* ctx_TODO, uint32_t this_ptr) {
8766 LDKDataLossProtect this_ptr_conv;
8767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8768 this_ptr_conv.is_owned = false;
8769 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
8770 memcpy(ret_arr.ptr, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
8774 void DataLossProtect_1set_1your_1last_1per_1commitment_1secret(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8775 LDKDataLossProtect this_ptr_conv;
8776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8777 this_ptr_conv.is_owned = false;
8778 LDKThirtyTwoBytes val_ref;
8779 CHECK(val.len == 32);
8780 memcpy(val_ref.data, val.ptr, 32);
8781 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
8784 int8_tArray DataLossProtect_1get_1my_1current_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr) {
8785 LDKDataLossProtect this_ptr_conv;
8786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8787 this_ptr_conv.is_owned = false;
8788 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
8789 memcpy(arg_arr.ptr, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
8793 void DataLossProtect_1set_1my_1current_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8794 LDKDataLossProtect this_ptr_conv;
8795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8796 this_ptr_conv.is_owned = false;
8797 LDKPublicKey val_ref;
8798 CHECK(val.len == 33);
8799 memcpy(val_ref.compressed_form, val.ptr, 33);
8800 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
8803 uint32_t DataLossProtect_1new(void* ctx_TODO, int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
8804 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
8805 CHECK(your_last_per_commitment_secret_arg.len == 32);
8806 memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg.ptr, 32);
8807 LDKPublicKey my_current_per_commitment_point_arg_ref;
8808 CHECK(my_current_per_commitment_point_arg.len == 33);
8809 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, my_current_per_commitment_point_arg.ptr, 33);
8810 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
8811 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8812 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8813 long ret_ref = (long)ret_var.inner;
8814 if (ret_var.is_owned) {
8820 void ChannelReestablish_1free(void* ctx_TODO, uint32_t this_ptr) {
8821 LDKChannelReestablish this_ptr_conv;
8822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8823 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8824 ChannelReestablish_free(this_ptr_conv);
8827 uint32_t ChannelReestablish_1clone(void* ctx_TODO, uint32_t orig) {
8828 LDKChannelReestablish orig_conv;
8829 orig_conv.inner = (void*)(orig & (~1));
8830 orig_conv.is_owned = false;
8831 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
8832 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8833 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8834 long ret_ref = (long)ret_var.inner;
8835 if (ret_var.is_owned) {
8841 int8_tArray ChannelReestablish_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
8842 LDKChannelReestablish this_ptr_conv;
8843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8844 this_ptr_conv.is_owned = false;
8845 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
8846 memcpy(ret_arr.ptr, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
8850 void ChannelReestablish_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8851 LDKChannelReestablish this_ptr_conv;
8852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8853 this_ptr_conv.is_owned = false;
8854 LDKThirtyTwoBytes val_ref;
8855 CHECK(val.len == 32);
8856 memcpy(val_ref.data, val.ptr, 32);
8857 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
8860 int64_t ChannelReestablish_1get_1next_1local_1commitment_1number(void* ctx_TODO, uint32_t this_ptr) {
8861 LDKChannelReestablish this_ptr_conv;
8862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8863 this_ptr_conv.is_owned = false;
8864 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
8868 void ChannelReestablish_1set_1next_1local_1commitment_1number(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8869 LDKChannelReestablish this_ptr_conv;
8870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8871 this_ptr_conv.is_owned = false;
8872 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
8875 int64_t ChannelReestablish_1get_1next_1remote_1commitment_1number(void* ctx_TODO, uint32_t this_ptr) {
8876 LDKChannelReestablish this_ptr_conv;
8877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8878 this_ptr_conv.is_owned = false;
8879 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
8883 void ChannelReestablish_1set_1next_1remote_1commitment_1number(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8884 LDKChannelReestablish this_ptr_conv;
8885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8886 this_ptr_conv.is_owned = false;
8887 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
8890 void AnnouncementSignatures_1free(void* ctx_TODO, uint32_t this_ptr) {
8891 LDKAnnouncementSignatures this_ptr_conv;
8892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8893 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8894 AnnouncementSignatures_free(this_ptr_conv);
8897 uint32_t AnnouncementSignatures_1clone(void* ctx_TODO, uint32_t orig) {
8898 LDKAnnouncementSignatures orig_conv;
8899 orig_conv.inner = (void*)(orig & (~1));
8900 orig_conv.is_owned = false;
8901 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
8902 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8903 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8904 long ret_ref = (long)ret_var.inner;
8905 if (ret_var.is_owned) {
8911 int8_tArray AnnouncementSignatures_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
8912 LDKAnnouncementSignatures this_ptr_conv;
8913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8914 this_ptr_conv.is_owned = false;
8915 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
8916 memcpy(ret_arr.ptr, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
8920 void AnnouncementSignatures_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8921 LDKAnnouncementSignatures this_ptr_conv;
8922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8923 this_ptr_conv.is_owned = false;
8924 LDKThirtyTwoBytes val_ref;
8925 CHECK(val.len == 32);
8926 memcpy(val_ref.data, val.ptr, 32);
8927 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
8930 int64_t AnnouncementSignatures_1get_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
8931 LDKAnnouncementSignatures this_ptr_conv;
8932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8933 this_ptr_conv.is_owned = false;
8934 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
8938 void AnnouncementSignatures_1set_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8939 LDKAnnouncementSignatures this_ptr_conv;
8940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8941 this_ptr_conv.is_owned = false;
8942 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
8945 int8_tArray AnnouncementSignatures_1get_1node_1signature(void* ctx_TODO, uint32_t this_ptr) {
8946 LDKAnnouncementSignatures this_ptr_conv;
8947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8948 this_ptr_conv.is_owned = false;
8949 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
8950 memcpy(arg_arr.ptr, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
8954 void AnnouncementSignatures_1set_1node_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8955 LDKAnnouncementSignatures this_ptr_conv;
8956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8957 this_ptr_conv.is_owned = false;
8958 LDKSignature val_ref;
8959 CHECK(val.len == 64);
8960 memcpy(val_ref.compact_form, val.ptr, 64);
8961 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
8964 int8_tArray AnnouncementSignatures_1get_1bitcoin_1signature(void* ctx_TODO, uint32_t this_ptr) {
8965 LDKAnnouncementSignatures this_ptr_conv;
8966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8967 this_ptr_conv.is_owned = false;
8968 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
8969 memcpy(arg_arr.ptr, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
8973 void AnnouncementSignatures_1set_1bitcoin_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8974 LDKAnnouncementSignatures this_ptr_conv;
8975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8976 this_ptr_conv.is_owned = false;
8977 LDKSignature val_ref;
8978 CHECK(val.len == 64);
8979 memcpy(val_ref.compact_form, val.ptr, 64);
8980 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
8983 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) {
8984 LDKThirtyTwoBytes channel_id_arg_ref;
8985 CHECK(channel_id_arg.len == 32);
8986 memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
8987 LDKSignature node_signature_arg_ref;
8988 CHECK(node_signature_arg.len == 64);
8989 memcpy(node_signature_arg_ref.compact_form, node_signature_arg.ptr, 64);
8990 LDKSignature bitcoin_signature_arg_ref;
8991 CHECK(bitcoin_signature_arg.len == 64);
8992 memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg.ptr, 64);
8993 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
8994 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8995 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8996 long ret_ref = (long)ret_var.inner;
8997 if (ret_var.is_owned) {
9003 void NetAddress_1free(void* ctx_TODO, uint32_t this_ptr) {
9004 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
9005 FREE((void*)this_ptr);
9006 NetAddress_free(this_ptr_conv);
9009 uint32_t NetAddress_1clone(void* ctx_TODO, uint32_t orig) {
9010 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
9011 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
9012 *ret_copy = NetAddress_clone(orig_conv);
9013 long ret_ref = (long)ret_copy;
9017 int8_tArray NetAddress_1write(void* ctx_TODO, uint32_t obj) {
9018 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
9019 LDKCVec_u8Z arg_var = NetAddress_write(obj_conv);
9020 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
9021 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
9022 CVec_u8Z_free(arg_var);
9026 uint32_t Result_1read(void* ctx_TODO, int8_tArray ser) {
9028 ser_ref.datalen = ser.len;
9029 ser_ref.data = ser.ptr;
9030 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
9031 *ret_conv = Result_read(ser_ref);
9032 return (long)ret_conv;
9035 void UnsignedNodeAnnouncement_1free(void* ctx_TODO, uint32_t this_ptr) {
9036 LDKUnsignedNodeAnnouncement this_ptr_conv;
9037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9038 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9039 UnsignedNodeAnnouncement_free(this_ptr_conv);
9042 uint32_t UnsignedNodeAnnouncement_1clone(void* ctx_TODO, uint32_t orig) {
9043 LDKUnsignedNodeAnnouncement orig_conv;
9044 orig_conv.inner = (void*)(orig & (~1));
9045 orig_conv.is_owned = false;
9046 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
9047 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9048 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9049 long ret_ref = (long)ret_var.inner;
9050 if (ret_var.is_owned) {
9056 uint32_t UnsignedNodeAnnouncement_1get_1features(void* ctx_TODO, uint32_t this_ptr) {
9057 LDKUnsignedNodeAnnouncement this_ptr_conv;
9058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9059 this_ptr_conv.is_owned = false;
9060 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
9061 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9062 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9063 long ret_ref = (long)ret_var.inner;
9064 if (ret_var.is_owned) {
9070 void UnsignedNodeAnnouncement_1set_1features(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
9071 LDKUnsignedNodeAnnouncement this_ptr_conv;
9072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9073 this_ptr_conv.is_owned = false;
9074 LDKNodeFeatures val_conv;
9075 val_conv.inner = (void*)(val & (~1));
9076 val_conv.is_owned = (val & 1) || (val == 0);
9077 // Warning: we may need a move here but can't clone!
9078 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
9081 int32_t UnsignedNodeAnnouncement_1get_1timestamp(void* ctx_TODO, uint32_t this_ptr) {
9082 LDKUnsignedNodeAnnouncement this_ptr_conv;
9083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9084 this_ptr_conv.is_owned = false;
9085 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
9089 void UnsignedNodeAnnouncement_1set_1timestamp(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
9090 LDKUnsignedNodeAnnouncement this_ptr_conv;
9091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9092 this_ptr_conv.is_owned = false;
9093 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
9096 int8_tArray UnsignedNodeAnnouncement_1get_1node_1id(void* ctx_TODO, uint32_t this_ptr) {
9097 LDKUnsignedNodeAnnouncement this_ptr_conv;
9098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9099 this_ptr_conv.is_owned = false;
9100 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
9101 memcpy(arg_arr.ptr, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
9105 void UnsignedNodeAnnouncement_1set_1node_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9106 LDKUnsignedNodeAnnouncement this_ptr_conv;
9107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9108 this_ptr_conv.is_owned = false;
9109 LDKPublicKey val_ref;
9110 CHECK(val.len == 33);
9111 memcpy(val_ref.compressed_form, val.ptr, 33);
9112 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
9115 int8_tArray UnsignedNodeAnnouncement_1get_1rgb(void* ctx_TODO, uint32_t this_ptr) {
9116 LDKUnsignedNodeAnnouncement this_ptr_conv;
9117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9118 this_ptr_conv.is_owned = false;
9119 int8_tArray ret_arr = { .len = 3, .ptr = MALLOC(3, "Native int8_tArray Bytes") };
9120 memcpy(ret_arr.ptr, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
9124 void UnsignedNodeAnnouncement_1set_1rgb(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9125 LDKUnsignedNodeAnnouncement this_ptr_conv;
9126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9127 this_ptr_conv.is_owned = false;
9128 LDKThreeBytes val_ref;
9129 CHECK(val.len == 3);
9130 memcpy(val_ref.data, val.ptr, 3);
9131 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
9134 int8_tArray UnsignedNodeAnnouncement_1get_1alias(void* ctx_TODO, uint32_t this_ptr) {
9135 LDKUnsignedNodeAnnouncement this_ptr_conv;
9136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9137 this_ptr_conv.is_owned = false;
9138 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
9139 memcpy(ret_arr.ptr, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
9143 void UnsignedNodeAnnouncement_1set_1alias(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9144 LDKUnsignedNodeAnnouncement this_ptr_conv;
9145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9146 this_ptr_conv.is_owned = false;
9147 LDKThirtyTwoBytes val_ref;
9148 CHECK(val.len == 32);
9149 memcpy(val_ref.data, val.ptr, 32);
9150 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
9153 void UnsignedNodeAnnouncement_1set_1addresses(void* ctx_TODO, uint32_t this_ptr, uint32_tArray val) {
9154 LDKUnsignedNodeAnnouncement this_ptr_conv;
9155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9156 this_ptr_conv.is_owned = false;
9157 LDKCVec_NetAddressZ val_constr;
9158 val_constr.datalen = val.len;
9159 if (val_constr.datalen > 0)
9160 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
9162 val_constr.data = NULL;
9163 uint32_t* val_vals = (uint32_t*) val.ptr;
9164 for (size_t m = 0; m < val_constr.datalen; m++) {
9165 uint32_t arr_conv_12 = val_vals[m];
9166 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
9167 FREE((void*)arr_conv_12);
9168 val_constr.data[m] = arr_conv_12_conv;
9170 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
9173 void NodeAnnouncement_1free(void* ctx_TODO, uint32_t this_ptr) {
9174 LDKNodeAnnouncement this_ptr_conv;
9175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9176 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9177 NodeAnnouncement_free(this_ptr_conv);
9180 uint32_t NodeAnnouncement_1clone(void* ctx_TODO, uint32_t orig) {
9181 LDKNodeAnnouncement orig_conv;
9182 orig_conv.inner = (void*)(orig & (~1));
9183 orig_conv.is_owned = false;
9184 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
9185 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9186 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9187 long ret_ref = (long)ret_var.inner;
9188 if (ret_var.is_owned) {
9194 int8_tArray NodeAnnouncement_1get_1signature(void* ctx_TODO, uint32_t this_ptr) {
9195 LDKNodeAnnouncement this_ptr_conv;
9196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9197 this_ptr_conv.is_owned = false;
9198 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
9199 memcpy(arg_arr.ptr, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
9203 void NodeAnnouncement_1set_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9204 LDKNodeAnnouncement this_ptr_conv;
9205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9206 this_ptr_conv.is_owned = false;
9207 LDKSignature val_ref;
9208 CHECK(val.len == 64);
9209 memcpy(val_ref.compact_form, val.ptr, 64);
9210 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
9213 uint32_t NodeAnnouncement_1get_1contents(void* ctx_TODO, uint32_t this_ptr) {
9214 LDKNodeAnnouncement this_ptr_conv;
9215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9216 this_ptr_conv.is_owned = false;
9217 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
9218 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9219 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9220 long ret_ref = (long)ret_var.inner;
9221 if (ret_var.is_owned) {
9227 void NodeAnnouncement_1set_1contents(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
9228 LDKNodeAnnouncement this_ptr_conv;
9229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9230 this_ptr_conv.is_owned = false;
9231 LDKUnsignedNodeAnnouncement val_conv;
9232 val_conv.inner = (void*)(val & (~1));
9233 val_conv.is_owned = (val & 1) || (val == 0);
9234 if (val_conv.inner != NULL)
9235 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
9236 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
9239 uint32_t NodeAnnouncement_1new(void* ctx_TODO, int8_tArray signature_arg, uint32_t contents_arg) {
9240 LDKSignature signature_arg_ref;
9241 CHECK(signature_arg.len == 64);
9242 memcpy(signature_arg_ref.compact_form, signature_arg.ptr, 64);
9243 LDKUnsignedNodeAnnouncement contents_arg_conv;
9244 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9245 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9246 if (contents_arg_conv.inner != NULL)
9247 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
9248 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
9249 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9250 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9251 long ret_ref = (long)ret_var.inner;
9252 if (ret_var.is_owned) {
9258 void UnsignedChannelAnnouncement_1free(void* ctx_TODO, uint32_t this_ptr) {
9259 LDKUnsignedChannelAnnouncement this_ptr_conv;
9260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9261 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9262 UnsignedChannelAnnouncement_free(this_ptr_conv);
9265 uint32_t UnsignedChannelAnnouncement_1clone(void* ctx_TODO, uint32_t orig) {
9266 LDKUnsignedChannelAnnouncement orig_conv;
9267 orig_conv.inner = (void*)(orig & (~1));
9268 orig_conv.is_owned = false;
9269 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
9270 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9271 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9272 long ret_ref = (long)ret_var.inner;
9273 if (ret_var.is_owned) {
9279 uint32_t UnsignedChannelAnnouncement_1get_1features(void* ctx_TODO, uint32_t this_ptr) {
9280 LDKUnsignedChannelAnnouncement this_ptr_conv;
9281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9282 this_ptr_conv.is_owned = false;
9283 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
9284 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9285 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9286 long ret_ref = (long)ret_var.inner;
9287 if (ret_var.is_owned) {
9293 void UnsignedChannelAnnouncement_1set_1features(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
9294 LDKUnsignedChannelAnnouncement this_ptr_conv;
9295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9296 this_ptr_conv.is_owned = false;
9297 LDKChannelFeatures val_conv;
9298 val_conv.inner = (void*)(val & (~1));
9299 val_conv.is_owned = (val & 1) || (val == 0);
9300 // Warning: we may need a move here but can't clone!
9301 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
9304 int8_tArray UnsignedChannelAnnouncement_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
9305 LDKUnsignedChannelAnnouncement this_ptr_conv;
9306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9307 this_ptr_conv.is_owned = false;
9308 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
9309 memcpy(ret_arr.ptr, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
9313 void UnsignedChannelAnnouncement_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9314 LDKUnsignedChannelAnnouncement this_ptr_conv;
9315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9316 this_ptr_conv.is_owned = false;
9317 LDKThirtyTwoBytes val_ref;
9318 CHECK(val.len == 32);
9319 memcpy(val_ref.data, val.ptr, 32);
9320 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
9323 int64_t UnsignedChannelAnnouncement_1get_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9324 LDKUnsignedChannelAnnouncement this_ptr_conv;
9325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9326 this_ptr_conv.is_owned = false;
9327 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
9331 void UnsignedChannelAnnouncement_1set_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
9332 LDKUnsignedChannelAnnouncement this_ptr_conv;
9333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9334 this_ptr_conv.is_owned = false;
9335 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
9338 int8_tArray UnsignedChannelAnnouncement_1get_1node_1id_11(void* ctx_TODO, uint32_t this_ptr) {
9339 LDKUnsignedChannelAnnouncement this_ptr_conv;
9340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9341 this_ptr_conv.is_owned = false;
9342 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
9343 memcpy(arg_arr.ptr, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
9347 void UnsignedChannelAnnouncement_1set_1node_1id_11(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9348 LDKUnsignedChannelAnnouncement this_ptr_conv;
9349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9350 this_ptr_conv.is_owned = false;
9351 LDKPublicKey val_ref;
9352 CHECK(val.len == 33);
9353 memcpy(val_ref.compressed_form, val.ptr, 33);
9354 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
9357 int8_tArray UnsignedChannelAnnouncement_1get_1node_1id_12(void* ctx_TODO, uint32_t this_ptr) {
9358 LDKUnsignedChannelAnnouncement this_ptr_conv;
9359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9360 this_ptr_conv.is_owned = false;
9361 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
9362 memcpy(arg_arr.ptr, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
9366 void UnsignedChannelAnnouncement_1set_1node_1id_12(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9367 LDKUnsignedChannelAnnouncement this_ptr_conv;
9368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9369 this_ptr_conv.is_owned = false;
9370 LDKPublicKey val_ref;
9371 CHECK(val.len == 33);
9372 memcpy(val_ref.compressed_form, val.ptr, 33);
9373 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
9376 int8_tArray UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(void* ctx_TODO, uint32_t this_ptr) {
9377 LDKUnsignedChannelAnnouncement this_ptr_conv;
9378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9379 this_ptr_conv.is_owned = false;
9380 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
9381 memcpy(arg_arr.ptr, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
9385 void UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9386 LDKUnsignedChannelAnnouncement this_ptr_conv;
9387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9388 this_ptr_conv.is_owned = false;
9389 LDKPublicKey val_ref;
9390 CHECK(val.len == 33);
9391 memcpy(val_ref.compressed_form, val.ptr, 33);
9392 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
9395 int8_tArray UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(void* ctx_TODO, uint32_t this_ptr) {
9396 LDKUnsignedChannelAnnouncement this_ptr_conv;
9397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9398 this_ptr_conv.is_owned = false;
9399 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
9400 memcpy(arg_arr.ptr, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
9404 void UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9405 LDKUnsignedChannelAnnouncement this_ptr_conv;
9406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9407 this_ptr_conv.is_owned = false;
9408 LDKPublicKey val_ref;
9409 CHECK(val.len == 33);
9410 memcpy(val_ref.compressed_form, val.ptr, 33);
9411 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
9414 void ChannelAnnouncement_1free(void* ctx_TODO, uint32_t this_ptr) {
9415 LDKChannelAnnouncement this_ptr_conv;
9416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9417 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9418 ChannelAnnouncement_free(this_ptr_conv);
9421 uint32_t ChannelAnnouncement_1clone(void* ctx_TODO, uint32_t orig) {
9422 LDKChannelAnnouncement orig_conv;
9423 orig_conv.inner = (void*)(orig & (~1));
9424 orig_conv.is_owned = false;
9425 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
9426 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9427 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9428 long ret_ref = (long)ret_var.inner;
9429 if (ret_var.is_owned) {
9435 int8_tArray ChannelAnnouncement_1get_1node_1signature_11(void* ctx_TODO, uint32_t this_ptr) {
9436 LDKChannelAnnouncement this_ptr_conv;
9437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9438 this_ptr_conv.is_owned = false;
9439 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
9440 memcpy(arg_arr.ptr, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
9444 void ChannelAnnouncement_1set_1node_1signature_11(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9445 LDKChannelAnnouncement this_ptr_conv;
9446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9447 this_ptr_conv.is_owned = false;
9448 LDKSignature val_ref;
9449 CHECK(val.len == 64);
9450 memcpy(val_ref.compact_form, val.ptr, 64);
9451 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
9454 int8_tArray ChannelAnnouncement_1get_1node_1signature_12(void* ctx_TODO, uint32_t this_ptr) {
9455 LDKChannelAnnouncement this_ptr_conv;
9456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9457 this_ptr_conv.is_owned = false;
9458 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
9459 memcpy(arg_arr.ptr, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
9463 void ChannelAnnouncement_1set_1node_1signature_12(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9464 LDKChannelAnnouncement this_ptr_conv;
9465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9466 this_ptr_conv.is_owned = false;
9467 LDKSignature val_ref;
9468 CHECK(val.len == 64);
9469 memcpy(val_ref.compact_form, val.ptr, 64);
9470 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
9473 int8_tArray ChannelAnnouncement_1get_1bitcoin_1signature_11(void* ctx_TODO, uint32_t this_ptr) {
9474 LDKChannelAnnouncement this_ptr_conv;
9475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9476 this_ptr_conv.is_owned = false;
9477 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
9478 memcpy(arg_arr.ptr, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
9482 void ChannelAnnouncement_1set_1bitcoin_1signature_11(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9483 LDKChannelAnnouncement this_ptr_conv;
9484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9485 this_ptr_conv.is_owned = false;
9486 LDKSignature val_ref;
9487 CHECK(val.len == 64);
9488 memcpy(val_ref.compact_form, val.ptr, 64);
9489 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
9492 int8_tArray ChannelAnnouncement_1get_1bitcoin_1signature_12(void* ctx_TODO, uint32_t this_ptr) {
9493 LDKChannelAnnouncement this_ptr_conv;
9494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9495 this_ptr_conv.is_owned = false;
9496 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
9497 memcpy(arg_arr.ptr, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
9501 void ChannelAnnouncement_1set_1bitcoin_1signature_12(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9502 LDKChannelAnnouncement this_ptr_conv;
9503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9504 this_ptr_conv.is_owned = false;
9505 LDKSignature val_ref;
9506 CHECK(val.len == 64);
9507 memcpy(val_ref.compact_form, val.ptr, 64);
9508 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
9511 uint32_t ChannelAnnouncement_1get_1contents(void* ctx_TODO, uint32_t this_ptr) {
9512 LDKChannelAnnouncement this_ptr_conv;
9513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9514 this_ptr_conv.is_owned = false;
9515 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
9516 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9517 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9518 long ret_ref = (long)ret_var.inner;
9519 if (ret_var.is_owned) {
9525 void ChannelAnnouncement_1set_1contents(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
9526 LDKChannelAnnouncement this_ptr_conv;
9527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9528 this_ptr_conv.is_owned = false;
9529 LDKUnsignedChannelAnnouncement val_conv;
9530 val_conv.inner = (void*)(val & (~1));
9531 val_conv.is_owned = (val & 1) || (val == 0);
9532 if (val_conv.inner != NULL)
9533 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
9534 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
9537 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) {
9538 LDKSignature node_signature_1_arg_ref;
9539 CHECK(node_signature_1_arg.len == 64);
9540 memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg.ptr, 64);
9541 LDKSignature node_signature_2_arg_ref;
9542 CHECK(node_signature_2_arg.len == 64);
9543 memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg.ptr, 64);
9544 LDKSignature bitcoin_signature_1_arg_ref;
9545 CHECK(bitcoin_signature_1_arg.len == 64);
9546 memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg.ptr, 64);
9547 LDKSignature bitcoin_signature_2_arg_ref;
9548 CHECK(bitcoin_signature_2_arg.len == 64);
9549 memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg.ptr, 64);
9550 LDKUnsignedChannelAnnouncement contents_arg_conv;
9551 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9552 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9553 if (contents_arg_conv.inner != NULL)
9554 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
9555 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);
9556 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9557 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9558 long ret_ref = (long)ret_var.inner;
9559 if (ret_var.is_owned) {
9565 void UnsignedChannelUpdate_1free(void* ctx_TODO, uint32_t this_ptr) {
9566 LDKUnsignedChannelUpdate this_ptr_conv;
9567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9568 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9569 UnsignedChannelUpdate_free(this_ptr_conv);
9572 uint32_t UnsignedChannelUpdate_1clone(void* ctx_TODO, uint32_t orig) {
9573 LDKUnsignedChannelUpdate orig_conv;
9574 orig_conv.inner = (void*)(orig & (~1));
9575 orig_conv.is_owned = false;
9576 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
9577 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9578 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9579 long ret_ref = (long)ret_var.inner;
9580 if (ret_var.is_owned) {
9586 int8_tArray UnsignedChannelUpdate_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
9587 LDKUnsignedChannelUpdate this_ptr_conv;
9588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9589 this_ptr_conv.is_owned = false;
9590 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
9591 memcpy(ret_arr.ptr, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
9595 void UnsignedChannelUpdate_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9596 LDKUnsignedChannelUpdate this_ptr_conv;
9597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9598 this_ptr_conv.is_owned = false;
9599 LDKThirtyTwoBytes val_ref;
9600 CHECK(val.len == 32);
9601 memcpy(val_ref.data, val.ptr, 32);
9602 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
9605 int64_t UnsignedChannelUpdate_1get_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9606 LDKUnsignedChannelUpdate this_ptr_conv;
9607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9608 this_ptr_conv.is_owned = false;
9609 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
9613 void UnsignedChannelUpdate_1set_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
9614 LDKUnsignedChannelUpdate this_ptr_conv;
9615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9616 this_ptr_conv.is_owned = false;
9617 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
9620 int32_t UnsignedChannelUpdate_1get_1timestamp(void* ctx_TODO, uint32_t this_ptr) {
9621 LDKUnsignedChannelUpdate this_ptr_conv;
9622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9623 this_ptr_conv.is_owned = false;
9624 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
9628 void UnsignedChannelUpdate_1set_1timestamp(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
9629 LDKUnsignedChannelUpdate this_ptr_conv;
9630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9631 this_ptr_conv.is_owned = false;
9632 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
9635 int8_t UnsignedChannelUpdate_1get_1flags(void* ctx_TODO, uint32_t this_ptr) {
9636 LDKUnsignedChannelUpdate this_ptr_conv;
9637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9638 this_ptr_conv.is_owned = false;
9639 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
9643 void UnsignedChannelUpdate_1set_1flags(void* ctx_TODO, uint32_t this_ptr, int8_t val) {
9644 LDKUnsignedChannelUpdate this_ptr_conv;
9645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9646 this_ptr_conv.is_owned = false;
9647 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
9650 jshort UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr) {
9651 LDKUnsignedChannelUpdate this_ptr_conv;
9652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9653 this_ptr_conv.is_owned = false;
9654 jshort ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
9658 void UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr, jshort val) {
9659 LDKUnsignedChannelUpdate this_ptr_conv;
9660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9661 this_ptr_conv.is_owned = false;
9662 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
9665 int64_t UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr) {
9666 LDKUnsignedChannelUpdate this_ptr_conv;
9667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9668 this_ptr_conv.is_owned = false;
9669 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
9673 void UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
9674 LDKUnsignedChannelUpdate this_ptr_conv;
9675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9676 this_ptr_conv.is_owned = false;
9677 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
9680 int32_t UnsignedChannelUpdate_1get_1fee_1base_1msat(void* ctx_TODO, uint32_t this_ptr) {
9681 LDKUnsignedChannelUpdate this_ptr_conv;
9682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9683 this_ptr_conv.is_owned = false;
9684 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
9688 void UnsignedChannelUpdate_1set_1fee_1base_1msat(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
9689 LDKUnsignedChannelUpdate this_ptr_conv;
9690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9691 this_ptr_conv.is_owned = false;
9692 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
9695 int32_t UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(void* ctx_TODO, uint32_t this_ptr) {
9696 LDKUnsignedChannelUpdate this_ptr_conv;
9697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9698 this_ptr_conv.is_owned = false;
9699 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
9703 void UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
9704 LDKUnsignedChannelUpdate this_ptr_conv;
9705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9706 this_ptr_conv.is_owned = false;
9707 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
9710 void ChannelUpdate_1free(void* ctx_TODO, uint32_t this_ptr) {
9711 LDKChannelUpdate this_ptr_conv;
9712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9713 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9714 ChannelUpdate_free(this_ptr_conv);
9717 uint32_t ChannelUpdate_1clone(void* ctx_TODO, uint32_t orig) {
9718 LDKChannelUpdate orig_conv;
9719 orig_conv.inner = (void*)(orig & (~1));
9720 orig_conv.is_owned = false;
9721 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
9722 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9723 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9724 long ret_ref = (long)ret_var.inner;
9725 if (ret_var.is_owned) {
9731 int8_tArray ChannelUpdate_1get_1signature(void* ctx_TODO, uint32_t this_ptr) {
9732 LDKChannelUpdate this_ptr_conv;
9733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9734 this_ptr_conv.is_owned = false;
9735 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
9736 memcpy(arg_arr.ptr, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
9740 void ChannelUpdate_1set_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9741 LDKChannelUpdate this_ptr_conv;
9742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9743 this_ptr_conv.is_owned = false;
9744 LDKSignature val_ref;
9745 CHECK(val.len == 64);
9746 memcpy(val_ref.compact_form, val.ptr, 64);
9747 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
9750 uint32_t ChannelUpdate_1get_1contents(void* ctx_TODO, uint32_t this_ptr) {
9751 LDKChannelUpdate this_ptr_conv;
9752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9753 this_ptr_conv.is_owned = false;
9754 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
9755 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9756 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9757 long ret_ref = (long)ret_var.inner;
9758 if (ret_var.is_owned) {
9764 void ChannelUpdate_1set_1contents(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
9765 LDKChannelUpdate this_ptr_conv;
9766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9767 this_ptr_conv.is_owned = false;
9768 LDKUnsignedChannelUpdate val_conv;
9769 val_conv.inner = (void*)(val & (~1));
9770 val_conv.is_owned = (val & 1) || (val == 0);
9771 if (val_conv.inner != NULL)
9772 val_conv = UnsignedChannelUpdate_clone(&val_conv);
9773 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
9776 uint32_t ChannelUpdate_1new(void* ctx_TODO, int8_tArray signature_arg, uint32_t contents_arg) {
9777 LDKSignature signature_arg_ref;
9778 CHECK(signature_arg.len == 64);
9779 memcpy(signature_arg_ref.compact_form, signature_arg.ptr, 64);
9780 LDKUnsignedChannelUpdate contents_arg_conv;
9781 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9782 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9783 if (contents_arg_conv.inner != NULL)
9784 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
9785 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
9786 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9787 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9788 long ret_ref = (long)ret_var.inner;
9789 if (ret_var.is_owned) {
9795 void QueryChannelRange_1free(void* ctx_TODO, uint32_t this_ptr) {
9796 LDKQueryChannelRange this_ptr_conv;
9797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9798 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9799 QueryChannelRange_free(this_ptr_conv);
9802 uint32_t QueryChannelRange_1clone(void* ctx_TODO, uint32_t orig) {
9803 LDKQueryChannelRange orig_conv;
9804 orig_conv.inner = (void*)(orig & (~1));
9805 orig_conv.is_owned = false;
9806 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
9807 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9808 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9809 long ret_ref = (long)ret_var.inner;
9810 if (ret_var.is_owned) {
9816 int8_tArray QueryChannelRange_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
9817 LDKQueryChannelRange this_ptr_conv;
9818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9819 this_ptr_conv.is_owned = false;
9820 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
9821 memcpy(ret_arr.ptr, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
9825 void QueryChannelRange_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9826 LDKQueryChannelRange this_ptr_conv;
9827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9828 this_ptr_conv.is_owned = false;
9829 LDKThirtyTwoBytes val_ref;
9830 CHECK(val.len == 32);
9831 memcpy(val_ref.data, val.ptr, 32);
9832 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
9835 int32_t QueryChannelRange_1get_1first_1blocknum(void* ctx_TODO, uint32_t this_ptr) {
9836 LDKQueryChannelRange this_ptr_conv;
9837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9838 this_ptr_conv.is_owned = false;
9839 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
9843 void QueryChannelRange_1set_1first_1blocknum(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
9844 LDKQueryChannelRange this_ptr_conv;
9845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9846 this_ptr_conv.is_owned = false;
9847 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
9850 int32_t QueryChannelRange_1get_1number_1of_1blocks(void* ctx_TODO, uint32_t this_ptr) {
9851 LDKQueryChannelRange this_ptr_conv;
9852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9853 this_ptr_conv.is_owned = false;
9854 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
9858 void QueryChannelRange_1set_1number_1of_1blocks(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
9859 LDKQueryChannelRange this_ptr_conv;
9860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9861 this_ptr_conv.is_owned = false;
9862 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
9865 uint32_t QueryChannelRange_1new(void* ctx_TODO, int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
9866 LDKThirtyTwoBytes chain_hash_arg_ref;
9867 CHECK(chain_hash_arg.len == 32);
9868 memcpy(chain_hash_arg_ref.data, chain_hash_arg.ptr, 32);
9869 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
9870 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9871 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9872 long ret_ref = (long)ret_var.inner;
9873 if (ret_var.is_owned) {
9879 void ReplyChannelRange_1free(void* ctx_TODO, uint32_t this_ptr) {
9880 LDKReplyChannelRange this_ptr_conv;
9881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9882 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9883 ReplyChannelRange_free(this_ptr_conv);
9886 uint32_t ReplyChannelRange_1clone(void* ctx_TODO, uint32_t orig) {
9887 LDKReplyChannelRange orig_conv;
9888 orig_conv.inner = (void*)(orig & (~1));
9889 orig_conv.is_owned = false;
9890 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
9891 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9892 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9893 long ret_ref = (long)ret_var.inner;
9894 if (ret_var.is_owned) {
9900 int8_tArray ReplyChannelRange_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
9901 LDKReplyChannelRange this_ptr_conv;
9902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9903 this_ptr_conv.is_owned = false;
9904 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
9905 memcpy(ret_arr.ptr, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
9909 void ReplyChannelRange_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9910 LDKReplyChannelRange this_ptr_conv;
9911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9912 this_ptr_conv.is_owned = false;
9913 LDKThirtyTwoBytes val_ref;
9914 CHECK(val.len == 32);
9915 memcpy(val_ref.data, val.ptr, 32);
9916 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
9919 int32_t ReplyChannelRange_1get_1first_1blocknum(void* ctx_TODO, uint32_t this_ptr) {
9920 LDKReplyChannelRange this_ptr_conv;
9921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9922 this_ptr_conv.is_owned = false;
9923 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
9927 void ReplyChannelRange_1set_1first_1blocknum(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
9928 LDKReplyChannelRange this_ptr_conv;
9929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9930 this_ptr_conv.is_owned = false;
9931 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
9934 int32_t ReplyChannelRange_1get_1number_1of_1blocks(void* ctx_TODO, uint32_t this_ptr) {
9935 LDKReplyChannelRange this_ptr_conv;
9936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9937 this_ptr_conv.is_owned = false;
9938 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
9942 void ReplyChannelRange_1set_1number_1of_1blocks(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
9943 LDKReplyChannelRange this_ptr_conv;
9944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9945 this_ptr_conv.is_owned = false;
9946 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
9949 jboolean ReplyChannelRange_1get_1full_1information(void* ctx_TODO, uint32_t this_ptr) {
9950 LDKReplyChannelRange this_ptr_conv;
9951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9952 this_ptr_conv.is_owned = false;
9953 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
9957 void ReplyChannelRange_1set_1full_1information(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
9958 LDKReplyChannelRange this_ptr_conv;
9959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9960 this_ptr_conv.is_owned = false;
9961 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
9964 void ReplyChannelRange_1set_1short_1channel_1ids(void* ctx_TODO, uint32_t this_ptr, int64_tArray val) {
9965 LDKReplyChannelRange this_ptr_conv;
9966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9967 this_ptr_conv.is_owned = false;
9968 LDKCVec_u64Z val_constr;
9969 val_constr.datalen = val.len;
9970 if (val_constr.datalen > 0)
9971 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
9973 val_constr.data = NULL;
9974 int64_t* val_vals = (int64_t*) val.ptr;
9975 for (size_t g = 0; g < val_constr.datalen; g++) {
9976 int64_t arr_conv_6 = val_vals[g];
9977 val_constr.data[g] = arr_conv_6;
9979 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
9982 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) {
9983 LDKThirtyTwoBytes chain_hash_arg_ref;
9984 CHECK(chain_hash_arg.len == 32);
9985 memcpy(chain_hash_arg_ref.data, chain_hash_arg.ptr, 32);
9986 LDKCVec_u64Z short_channel_ids_arg_constr;
9987 short_channel_ids_arg_constr.datalen = short_channel_ids_arg.len;
9988 if (short_channel_ids_arg_constr.datalen > 0)
9989 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
9991 short_channel_ids_arg_constr.data = NULL;
9992 int64_t* short_channel_ids_arg_vals = (int64_t*) short_channel_ids_arg.ptr;
9993 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
9994 int64_t arr_conv_6 = short_channel_ids_arg_vals[g];
9995 short_channel_ids_arg_constr.data[g] = arr_conv_6;
9997 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
9998 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9999 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10000 long ret_ref = (long)ret_var.inner;
10001 if (ret_var.is_owned) {
10007 void QueryShortChannelIds_1free(void* ctx_TODO, uint32_t this_ptr) {
10008 LDKQueryShortChannelIds this_ptr_conv;
10009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10010 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10011 QueryShortChannelIds_free(this_ptr_conv);
10014 uint32_t QueryShortChannelIds_1clone(void* ctx_TODO, uint32_t orig) {
10015 LDKQueryShortChannelIds orig_conv;
10016 orig_conv.inner = (void*)(orig & (~1));
10017 orig_conv.is_owned = false;
10018 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
10019 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10020 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10021 long ret_ref = (long)ret_var.inner;
10022 if (ret_var.is_owned) {
10028 int8_tArray QueryShortChannelIds_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
10029 LDKQueryShortChannelIds this_ptr_conv;
10030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10031 this_ptr_conv.is_owned = false;
10032 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
10033 memcpy(ret_arr.ptr, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
10037 void QueryShortChannelIds_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10038 LDKQueryShortChannelIds this_ptr_conv;
10039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10040 this_ptr_conv.is_owned = false;
10041 LDKThirtyTwoBytes val_ref;
10042 CHECK(val.len == 32);
10043 memcpy(val_ref.data, val.ptr, 32);
10044 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
10047 void QueryShortChannelIds_1set_1short_1channel_1ids(void* ctx_TODO, uint32_t this_ptr, int64_tArray val) {
10048 LDKQueryShortChannelIds this_ptr_conv;
10049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10050 this_ptr_conv.is_owned = false;
10051 LDKCVec_u64Z val_constr;
10052 val_constr.datalen = val.len;
10053 if (val_constr.datalen > 0)
10054 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
10056 val_constr.data = NULL;
10057 int64_t* val_vals = (int64_t*) val.ptr;
10058 for (size_t g = 0; g < val_constr.datalen; g++) {
10059 int64_t arr_conv_6 = val_vals[g];
10060 val_constr.data[g] = arr_conv_6;
10062 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
10065 uint32_t QueryShortChannelIds_1new(void* ctx_TODO, int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
10066 LDKThirtyTwoBytes chain_hash_arg_ref;
10067 CHECK(chain_hash_arg.len == 32);
10068 memcpy(chain_hash_arg_ref.data, chain_hash_arg.ptr, 32);
10069 LDKCVec_u64Z short_channel_ids_arg_constr;
10070 short_channel_ids_arg_constr.datalen = short_channel_ids_arg.len;
10071 if (short_channel_ids_arg_constr.datalen > 0)
10072 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
10074 short_channel_ids_arg_constr.data = NULL;
10075 int64_t* short_channel_ids_arg_vals = (int64_t*) short_channel_ids_arg.ptr;
10076 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
10077 int64_t arr_conv_6 = short_channel_ids_arg_vals[g];
10078 short_channel_ids_arg_constr.data[g] = arr_conv_6;
10080 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
10081 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10082 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10083 long ret_ref = (long)ret_var.inner;
10084 if (ret_var.is_owned) {
10090 void ReplyShortChannelIdsEnd_1free(void* ctx_TODO, uint32_t this_ptr) {
10091 LDKReplyShortChannelIdsEnd this_ptr_conv;
10092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10093 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10094 ReplyShortChannelIdsEnd_free(this_ptr_conv);
10097 uint32_t ReplyShortChannelIdsEnd_1clone(void* ctx_TODO, uint32_t orig) {
10098 LDKReplyShortChannelIdsEnd orig_conv;
10099 orig_conv.inner = (void*)(orig & (~1));
10100 orig_conv.is_owned = false;
10101 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
10102 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10103 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10104 long ret_ref = (long)ret_var.inner;
10105 if (ret_var.is_owned) {
10111 int8_tArray ReplyShortChannelIdsEnd_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
10112 LDKReplyShortChannelIdsEnd this_ptr_conv;
10113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10114 this_ptr_conv.is_owned = false;
10115 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
10116 memcpy(ret_arr.ptr, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
10120 void ReplyShortChannelIdsEnd_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10121 LDKReplyShortChannelIdsEnd this_ptr_conv;
10122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10123 this_ptr_conv.is_owned = false;
10124 LDKThirtyTwoBytes val_ref;
10125 CHECK(val.len == 32);
10126 memcpy(val_ref.data, val.ptr, 32);
10127 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
10130 jboolean ReplyShortChannelIdsEnd_1get_1full_1information(void* ctx_TODO, uint32_t this_ptr) {
10131 LDKReplyShortChannelIdsEnd this_ptr_conv;
10132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10133 this_ptr_conv.is_owned = false;
10134 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
10138 void ReplyShortChannelIdsEnd_1set_1full_1information(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
10139 LDKReplyShortChannelIdsEnd this_ptr_conv;
10140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10141 this_ptr_conv.is_owned = false;
10142 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
10145 uint32_t ReplyShortChannelIdsEnd_1new(void* ctx_TODO, int8_tArray chain_hash_arg, jboolean full_information_arg) {
10146 LDKThirtyTwoBytes chain_hash_arg_ref;
10147 CHECK(chain_hash_arg.len == 32);
10148 memcpy(chain_hash_arg_ref.data, chain_hash_arg.ptr, 32);
10149 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
10150 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10151 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10152 long ret_ref = (long)ret_var.inner;
10153 if (ret_var.is_owned) {
10159 void GossipTimestampFilter_1free(void* ctx_TODO, uint32_t this_ptr) {
10160 LDKGossipTimestampFilter this_ptr_conv;
10161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10162 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10163 GossipTimestampFilter_free(this_ptr_conv);
10166 uint32_t GossipTimestampFilter_1clone(void* ctx_TODO, uint32_t orig) {
10167 LDKGossipTimestampFilter orig_conv;
10168 orig_conv.inner = (void*)(orig & (~1));
10169 orig_conv.is_owned = false;
10170 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
10171 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10172 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10173 long ret_ref = (long)ret_var.inner;
10174 if (ret_var.is_owned) {
10180 int8_tArray GossipTimestampFilter_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
10181 LDKGossipTimestampFilter this_ptr_conv;
10182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10183 this_ptr_conv.is_owned = false;
10184 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
10185 memcpy(ret_arr.ptr, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
10189 void GossipTimestampFilter_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10190 LDKGossipTimestampFilter this_ptr_conv;
10191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10192 this_ptr_conv.is_owned = false;
10193 LDKThirtyTwoBytes val_ref;
10194 CHECK(val.len == 32);
10195 memcpy(val_ref.data, val.ptr, 32);
10196 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
10199 int32_t GossipTimestampFilter_1get_1first_1timestamp(void* ctx_TODO, uint32_t this_ptr) {
10200 LDKGossipTimestampFilter this_ptr_conv;
10201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10202 this_ptr_conv.is_owned = false;
10203 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
10207 void GossipTimestampFilter_1set_1first_1timestamp(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
10208 LDKGossipTimestampFilter this_ptr_conv;
10209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10210 this_ptr_conv.is_owned = false;
10211 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
10214 int32_t GossipTimestampFilter_1get_1timestamp_1range(void* ctx_TODO, uint32_t this_ptr) {
10215 LDKGossipTimestampFilter this_ptr_conv;
10216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10217 this_ptr_conv.is_owned = false;
10218 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
10222 void GossipTimestampFilter_1set_1timestamp_1range(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
10223 LDKGossipTimestampFilter this_ptr_conv;
10224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10225 this_ptr_conv.is_owned = false;
10226 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
10229 uint32_t GossipTimestampFilter_1new(void* ctx_TODO, int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
10230 LDKThirtyTwoBytes chain_hash_arg_ref;
10231 CHECK(chain_hash_arg.len == 32);
10232 memcpy(chain_hash_arg_ref.data, chain_hash_arg.ptr, 32);
10233 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
10234 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10235 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10236 long ret_ref = (long)ret_var.inner;
10237 if (ret_var.is_owned) {
10243 void ErrorAction_1free(void* ctx_TODO, uint32_t this_ptr) {
10244 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
10245 FREE((void*)this_ptr);
10246 ErrorAction_free(this_ptr_conv);
10249 uint32_t ErrorAction_1clone(void* ctx_TODO, uint32_t orig) {
10250 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
10251 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
10252 *ret_copy = ErrorAction_clone(orig_conv);
10253 long ret_ref = (long)ret_copy;
10257 void LightningError_1free(void* ctx_TODO, uint32_t this_ptr) {
10258 LDKLightningError this_ptr_conv;
10259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10260 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10261 LightningError_free(this_ptr_conv);
10264 jstring LightningError_1get_1err(void* ctx_TODO, uint32_t this_ptr) {
10265 LDKLightningError this_ptr_conv;
10266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10267 this_ptr_conv.is_owned = false;
10268 LDKStr _str = LightningError_get_err(&this_ptr_conv);
10269 char* _buf = MALLOC(_str.len + 1, "str conv buf");
10270 memcpy(_buf, _str.chars, _str.len);
10271 _buf[_str.len] = 0;
10272 jstring _conv = (*env)->NewStringUTF(env, _str.chars);
10277 void LightningError_1set_1err(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10278 LDKLightningError this_ptr_conv;
10279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10280 this_ptr_conv.is_owned = false;
10281 LDKCVec_u8Z val_ref;
10282 val_ref.datalen = val.len;
10283 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
10284 memcpy(val_ref.data, val.ptr, val_ref.datalen);
10285 LightningError_set_err(&this_ptr_conv, val_ref);
10288 uint32_t LightningError_1get_1action(void* ctx_TODO, uint32_t this_ptr) {
10289 LDKLightningError this_ptr_conv;
10290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10291 this_ptr_conv.is_owned = false;
10292 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
10293 *ret_copy = LightningError_get_action(&this_ptr_conv);
10294 long ret_ref = (long)ret_copy;
10298 void LightningError_1set_1action(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
10299 LDKLightningError this_ptr_conv;
10300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10301 this_ptr_conv.is_owned = false;
10302 LDKErrorAction val_conv = *(LDKErrorAction*)val;
10304 LightningError_set_action(&this_ptr_conv, val_conv);
10307 uint32_t LightningError_1new(void* ctx_TODO, int8_tArray err_arg, uint32_t action_arg) {
10308 LDKCVec_u8Z err_arg_ref;
10309 err_arg_ref.datalen = err_arg.len;
10310 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
10311 memcpy(err_arg_ref.data, err_arg.ptr, err_arg_ref.datalen);
10312 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
10313 FREE((void*)action_arg);
10314 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
10315 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10316 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10317 long ret_ref = (long)ret_var.inner;
10318 if (ret_var.is_owned) {
10324 void CommitmentUpdate_1free(void* ctx_TODO, uint32_t this_ptr) {
10325 LDKCommitmentUpdate this_ptr_conv;
10326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10327 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10328 CommitmentUpdate_free(this_ptr_conv);
10331 uint32_t CommitmentUpdate_1clone(void* ctx_TODO, uint32_t orig) {
10332 LDKCommitmentUpdate orig_conv;
10333 orig_conv.inner = (void*)(orig & (~1));
10334 orig_conv.is_owned = false;
10335 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
10336 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10337 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10338 long ret_ref = (long)ret_var.inner;
10339 if (ret_var.is_owned) {
10345 void CommitmentUpdate_1set_1update_1add_1htlcs(void* ctx_TODO, uint32_t this_ptr, uint32_tArray val) {
10346 LDKCommitmentUpdate this_ptr_conv;
10347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10348 this_ptr_conv.is_owned = false;
10349 LDKCVec_UpdateAddHTLCZ val_constr;
10350 val_constr.datalen = val.len;
10351 if (val_constr.datalen > 0)
10352 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
10354 val_constr.data = NULL;
10355 uint32_t* val_vals = (uint32_t*) val.ptr;
10356 for (size_t p = 0; p < val_constr.datalen; p++) {
10357 uint32_t arr_conv_15 = val_vals[p];
10358 LDKUpdateAddHTLC arr_conv_15_conv;
10359 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
10360 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
10361 if (arr_conv_15_conv.inner != NULL)
10362 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
10363 val_constr.data[p] = arr_conv_15_conv;
10365 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
10368 void CommitmentUpdate_1set_1update_1fulfill_1htlcs(void* ctx_TODO, uint32_t this_ptr, uint32_tArray val) {
10369 LDKCommitmentUpdate this_ptr_conv;
10370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10371 this_ptr_conv.is_owned = false;
10372 LDKCVec_UpdateFulfillHTLCZ val_constr;
10373 val_constr.datalen = val.len;
10374 if (val_constr.datalen > 0)
10375 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
10377 val_constr.data = NULL;
10378 uint32_t* val_vals = (uint32_t*) val.ptr;
10379 for (size_t t = 0; t < val_constr.datalen; t++) {
10380 uint32_t arr_conv_19 = val_vals[t];
10381 LDKUpdateFulfillHTLC arr_conv_19_conv;
10382 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
10383 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
10384 if (arr_conv_19_conv.inner != NULL)
10385 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
10386 val_constr.data[t] = arr_conv_19_conv;
10388 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
10391 void CommitmentUpdate_1set_1update_1fail_1htlcs(void* ctx_TODO, uint32_t this_ptr, uint32_tArray val) {
10392 LDKCommitmentUpdate this_ptr_conv;
10393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10394 this_ptr_conv.is_owned = false;
10395 LDKCVec_UpdateFailHTLCZ val_constr;
10396 val_constr.datalen = val.len;
10397 if (val_constr.datalen > 0)
10398 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
10400 val_constr.data = NULL;
10401 uint32_t* val_vals = (uint32_t*) val.ptr;
10402 for (size_t q = 0; q < val_constr.datalen; q++) {
10403 uint32_t arr_conv_16 = val_vals[q];
10404 LDKUpdateFailHTLC arr_conv_16_conv;
10405 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
10406 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
10407 if (arr_conv_16_conv.inner != NULL)
10408 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
10409 val_constr.data[q] = arr_conv_16_conv;
10411 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
10414 void CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(void* ctx_TODO, uint32_t this_ptr, uint32_tArray val) {
10415 LDKCommitmentUpdate this_ptr_conv;
10416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10417 this_ptr_conv.is_owned = false;
10418 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
10419 val_constr.datalen = val.len;
10420 if (val_constr.datalen > 0)
10421 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
10423 val_constr.data = NULL;
10424 uint32_t* val_vals = (uint32_t*) val.ptr;
10425 for (size_t z = 0; z < val_constr.datalen; z++) {
10426 uint32_t arr_conv_25 = val_vals[z];
10427 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
10428 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
10429 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
10430 if (arr_conv_25_conv.inner != NULL)
10431 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
10432 val_constr.data[z] = arr_conv_25_conv;
10434 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
10437 uint32_t CommitmentUpdate_1get_1update_1fee(void* ctx_TODO, uint32_t this_ptr) {
10438 LDKCommitmentUpdate this_ptr_conv;
10439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10440 this_ptr_conv.is_owned = false;
10441 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
10442 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10443 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10444 long ret_ref = (long)ret_var.inner;
10445 if (ret_var.is_owned) {
10451 void CommitmentUpdate_1set_1update_1fee(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
10452 LDKCommitmentUpdate this_ptr_conv;
10453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10454 this_ptr_conv.is_owned = false;
10455 LDKUpdateFee val_conv;
10456 val_conv.inner = (void*)(val & (~1));
10457 val_conv.is_owned = (val & 1) || (val == 0);
10458 if (val_conv.inner != NULL)
10459 val_conv = UpdateFee_clone(&val_conv);
10460 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
10463 uint32_t CommitmentUpdate_1get_1commitment_1signed(void* ctx_TODO, uint32_t this_ptr) {
10464 LDKCommitmentUpdate this_ptr_conv;
10465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10466 this_ptr_conv.is_owned = false;
10467 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
10468 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10469 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10470 long ret_ref = (long)ret_var.inner;
10471 if (ret_var.is_owned) {
10477 void CommitmentUpdate_1set_1commitment_1signed(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
10478 LDKCommitmentUpdate this_ptr_conv;
10479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10480 this_ptr_conv.is_owned = false;
10481 LDKCommitmentSigned val_conv;
10482 val_conv.inner = (void*)(val & (~1));
10483 val_conv.is_owned = (val & 1) || (val == 0);
10484 if (val_conv.inner != NULL)
10485 val_conv = CommitmentSigned_clone(&val_conv);
10486 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
10489 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) {
10490 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
10491 update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg.len;
10492 if (update_add_htlcs_arg_constr.datalen > 0)
10493 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
10495 update_add_htlcs_arg_constr.data = NULL;
10496 uint32_t* update_add_htlcs_arg_vals = (uint32_t*) update_add_htlcs_arg.ptr;
10497 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
10498 uint32_t arr_conv_15 = update_add_htlcs_arg_vals[p];
10499 LDKUpdateAddHTLC arr_conv_15_conv;
10500 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
10501 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
10502 if (arr_conv_15_conv.inner != NULL)
10503 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
10504 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
10506 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
10507 update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg.len;
10508 if (update_fulfill_htlcs_arg_constr.datalen > 0)
10509 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
10511 update_fulfill_htlcs_arg_constr.data = NULL;
10512 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*) update_fulfill_htlcs_arg.ptr;
10513 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
10514 uint32_t arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
10515 LDKUpdateFulfillHTLC arr_conv_19_conv;
10516 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
10517 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
10518 if (arr_conv_19_conv.inner != NULL)
10519 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
10520 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
10522 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
10523 update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg.len;
10524 if (update_fail_htlcs_arg_constr.datalen > 0)
10525 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
10527 update_fail_htlcs_arg_constr.data = NULL;
10528 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*) update_fail_htlcs_arg.ptr;
10529 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
10530 uint32_t arr_conv_16 = update_fail_htlcs_arg_vals[q];
10531 LDKUpdateFailHTLC arr_conv_16_conv;
10532 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
10533 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
10534 if (arr_conv_16_conv.inner != NULL)
10535 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
10536 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
10538 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
10539 update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg.len;
10540 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
10541 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
10543 update_fail_malformed_htlcs_arg_constr.data = NULL;
10544 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*) update_fail_malformed_htlcs_arg.ptr;
10545 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
10546 uint32_t arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
10547 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
10548 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
10549 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
10550 if (arr_conv_25_conv.inner != NULL)
10551 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
10552 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
10554 LDKUpdateFee update_fee_arg_conv;
10555 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
10556 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
10557 if (update_fee_arg_conv.inner != NULL)
10558 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
10559 LDKCommitmentSigned commitment_signed_arg_conv;
10560 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
10561 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
10562 if (commitment_signed_arg_conv.inner != NULL)
10563 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
10564 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);
10565 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10566 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10567 long ret_ref = (long)ret_var.inner;
10568 if (ret_var.is_owned) {
10574 void HTLCFailChannelUpdate_1free(void* ctx_TODO, uint32_t this_ptr) {
10575 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
10576 FREE((void*)this_ptr);
10577 HTLCFailChannelUpdate_free(this_ptr_conv);
10580 uint32_t HTLCFailChannelUpdate_1clone(void* ctx_TODO, uint32_t orig) {
10581 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
10582 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
10583 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
10584 long ret_ref = (long)ret_copy;
10588 void ChannelMessageHandler_1free(void* ctx_TODO, uint32_t this_ptr) {
10589 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
10590 FREE((void*)this_ptr);
10591 ChannelMessageHandler_free(this_ptr_conv);
10594 void RoutingMessageHandler_1free(void* ctx_TODO, uint32_t this_ptr) {
10595 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
10596 FREE((void*)this_ptr);
10597 RoutingMessageHandler_free(this_ptr_conv);
10600 int8_tArray AcceptChannel_1write(void* ctx_TODO, uint32_t obj) {
10601 LDKAcceptChannel obj_conv;
10602 obj_conv.inner = (void*)(obj & (~1));
10603 obj_conv.is_owned = false;
10604 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
10605 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
10606 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
10607 CVec_u8Z_free(arg_var);
10611 uint32_t AcceptChannel_1read(void* ctx_TODO, int8_tArray ser) {
10612 LDKu8slice ser_ref;
10613 ser_ref.datalen = ser.len;
10614 ser_ref.data = ser.ptr;
10615 LDKAcceptChannel ret_var = AcceptChannel_read(ser_ref);
10616 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10617 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10618 long ret_ref = (long)ret_var.inner;
10619 if (ret_var.is_owned) {
10625 int8_tArray AnnouncementSignatures_1write(void* ctx_TODO, uint32_t obj) {
10626 LDKAnnouncementSignatures obj_conv;
10627 obj_conv.inner = (void*)(obj & (~1));
10628 obj_conv.is_owned = false;
10629 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
10630 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
10631 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
10632 CVec_u8Z_free(arg_var);
10636 uint32_t AnnouncementSignatures_1read(void* ctx_TODO, int8_tArray ser) {
10637 LDKu8slice ser_ref;
10638 ser_ref.datalen = ser.len;
10639 ser_ref.data = ser.ptr;
10640 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_read(ser_ref);
10641 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10642 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10643 long ret_ref = (long)ret_var.inner;
10644 if (ret_var.is_owned) {
10650 int8_tArray ChannelReestablish_1write(void* ctx_TODO, uint32_t obj) {
10651 LDKChannelReestablish obj_conv;
10652 obj_conv.inner = (void*)(obj & (~1));
10653 obj_conv.is_owned = false;
10654 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
10655 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
10656 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
10657 CVec_u8Z_free(arg_var);
10661 uint32_t ChannelReestablish_1read(void* ctx_TODO, int8_tArray ser) {
10662 LDKu8slice ser_ref;
10663 ser_ref.datalen = ser.len;
10664 ser_ref.data = ser.ptr;
10665 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
10666 *ret_conv = ChannelReestablish_read(ser_ref);
10667 return (long)ret_conv;
10670 int8_tArray ClosingSigned_1write(void* ctx_TODO, uint32_t obj) {
10671 LDKClosingSigned obj_conv;
10672 obj_conv.inner = (void*)(obj & (~1));
10673 obj_conv.is_owned = false;
10674 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
10675 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
10676 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
10677 CVec_u8Z_free(arg_var);
10681 uint32_t ClosingSigned_1read(void* ctx_TODO, int8_tArray ser) {
10682 LDKu8slice ser_ref;
10683 ser_ref.datalen = ser.len;
10684 ser_ref.data = ser.ptr;
10685 LDKClosingSigned ret_var = ClosingSigned_read(ser_ref);
10686 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10687 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10688 long ret_ref = (long)ret_var.inner;
10689 if (ret_var.is_owned) {
10695 int8_tArray CommitmentSigned_1write(void* ctx_TODO, uint32_t obj) {
10696 LDKCommitmentSigned obj_conv;
10697 obj_conv.inner = (void*)(obj & (~1));
10698 obj_conv.is_owned = false;
10699 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
10700 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
10701 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
10702 CVec_u8Z_free(arg_var);
10706 uint32_t CommitmentSigned_1read(void* ctx_TODO, int8_tArray ser) {
10707 LDKu8slice ser_ref;
10708 ser_ref.datalen = ser.len;
10709 ser_ref.data = ser.ptr;
10710 LDKCommitmentSigned ret_var = CommitmentSigned_read(ser_ref);
10711 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10712 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10713 long ret_ref = (long)ret_var.inner;
10714 if (ret_var.is_owned) {
10720 int8_tArray FundingCreated_1write(void* ctx_TODO, uint32_t obj) {
10721 LDKFundingCreated obj_conv;
10722 obj_conv.inner = (void*)(obj & (~1));
10723 obj_conv.is_owned = false;
10724 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
10725 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
10726 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
10727 CVec_u8Z_free(arg_var);
10731 uint32_t FundingCreated_1read(void* ctx_TODO, int8_tArray ser) {
10732 LDKu8slice ser_ref;
10733 ser_ref.datalen = ser.len;
10734 ser_ref.data = ser.ptr;
10735 LDKFundingCreated ret_var = FundingCreated_read(ser_ref);
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 int8_tArray FundingSigned_1write(void* ctx_TODO, uint32_t obj) {
10746 LDKFundingSigned obj_conv;
10747 obj_conv.inner = (void*)(obj & (~1));
10748 obj_conv.is_owned = false;
10749 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
10750 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
10751 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
10752 CVec_u8Z_free(arg_var);
10756 uint32_t FundingSigned_1read(void* ctx_TODO, int8_tArray ser) {
10757 LDKu8slice ser_ref;
10758 ser_ref.datalen = ser.len;
10759 ser_ref.data = ser.ptr;
10760 LDKFundingSigned ret_var = FundingSigned_read(ser_ref);
10761 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10762 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10763 long ret_ref = (long)ret_var.inner;
10764 if (ret_var.is_owned) {
10770 int8_tArray FundingLocked_1write(void* ctx_TODO, uint32_t obj) {
10771 LDKFundingLocked obj_conv;
10772 obj_conv.inner = (void*)(obj & (~1));
10773 obj_conv.is_owned = false;
10774 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
10775 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
10776 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
10777 CVec_u8Z_free(arg_var);
10781 uint32_t FundingLocked_1read(void* ctx_TODO, int8_tArray ser) {
10782 LDKu8slice ser_ref;
10783 ser_ref.datalen = ser.len;
10784 ser_ref.data = ser.ptr;
10785 LDKFundingLocked ret_var = FundingLocked_read(ser_ref);
10786 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10787 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10788 long ret_ref = (long)ret_var.inner;
10789 if (ret_var.is_owned) {
10795 int8_tArray Init_1write(void* ctx_TODO, uint32_t obj) {
10797 obj_conv.inner = (void*)(obj & (~1));
10798 obj_conv.is_owned = false;
10799 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
10800 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
10801 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
10802 CVec_u8Z_free(arg_var);
10806 uint32_t Init_1read(void* ctx_TODO, int8_tArray ser) {
10807 LDKu8slice ser_ref;
10808 ser_ref.datalen = ser.len;
10809 ser_ref.data = ser.ptr;
10810 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
10811 *ret_conv = Init_read(ser_ref);
10812 return (long)ret_conv;
10815 int8_tArray OpenChannel_1write(void* ctx_TODO, uint32_t obj) {
10816 LDKOpenChannel obj_conv;
10817 obj_conv.inner = (void*)(obj & (~1));
10818 obj_conv.is_owned = false;
10819 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
10820 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
10821 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
10822 CVec_u8Z_free(arg_var);
10826 uint32_t OpenChannel_1read(void* ctx_TODO, int8_tArray ser) {
10827 LDKu8slice ser_ref;
10828 ser_ref.datalen = ser.len;
10829 ser_ref.data = ser.ptr;
10830 LDKOpenChannel ret_var = OpenChannel_read(ser_ref);
10831 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10832 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10833 long ret_ref = (long)ret_var.inner;
10834 if (ret_var.is_owned) {
10840 int8_tArray RevokeAndACK_1write(void* ctx_TODO, uint32_t obj) {
10841 LDKRevokeAndACK obj_conv;
10842 obj_conv.inner = (void*)(obj & (~1));
10843 obj_conv.is_owned = false;
10844 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
10845 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
10846 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
10847 CVec_u8Z_free(arg_var);
10851 uint32_t RevokeAndACK_1read(void* ctx_TODO, int8_tArray ser) {
10852 LDKu8slice ser_ref;
10853 ser_ref.datalen = ser.len;
10854 ser_ref.data = ser.ptr;
10855 LDKRevokeAndACK ret_var = RevokeAndACK_read(ser_ref);
10856 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10857 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10858 long ret_ref = (long)ret_var.inner;
10859 if (ret_var.is_owned) {
10865 int8_tArray Shutdown_1write(void* ctx_TODO, uint32_t obj) {
10866 LDKShutdown obj_conv;
10867 obj_conv.inner = (void*)(obj & (~1));
10868 obj_conv.is_owned = false;
10869 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
10870 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
10871 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
10872 CVec_u8Z_free(arg_var);
10876 uint32_t Shutdown_1read(void* ctx_TODO, int8_tArray ser) {
10877 LDKu8slice ser_ref;
10878 ser_ref.datalen = ser.len;
10879 ser_ref.data = ser.ptr;
10880 LDKShutdown ret_var = Shutdown_read(ser_ref);
10881 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10882 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10883 long ret_ref = (long)ret_var.inner;
10884 if (ret_var.is_owned) {
10890 int8_tArray UpdateFailHTLC_1write(void* ctx_TODO, uint32_t obj) {
10891 LDKUpdateFailHTLC obj_conv;
10892 obj_conv.inner = (void*)(obj & (~1));
10893 obj_conv.is_owned = false;
10894 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
10895 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
10896 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
10897 CVec_u8Z_free(arg_var);
10901 uint32_t UpdateFailHTLC_1read(void* ctx_TODO, int8_tArray ser) {
10902 LDKu8slice ser_ref;
10903 ser_ref.datalen = ser.len;
10904 ser_ref.data = ser.ptr;
10905 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_read(ser_ref);
10906 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10907 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10908 long ret_ref = (long)ret_var.inner;
10909 if (ret_var.is_owned) {
10915 int8_tArray UpdateFailMalformedHTLC_1write(void* ctx_TODO, uint32_t obj) {
10916 LDKUpdateFailMalformedHTLC obj_conv;
10917 obj_conv.inner = (void*)(obj & (~1));
10918 obj_conv.is_owned = false;
10919 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
10920 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
10921 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
10922 CVec_u8Z_free(arg_var);
10926 uint32_t UpdateFailMalformedHTLC_1read(void* ctx_TODO, int8_tArray ser) {
10927 LDKu8slice ser_ref;
10928 ser_ref.datalen = ser.len;
10929 ser_ref.data = ser.ptr;
10930 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_read(ser_ref);
10931 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10932 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10933 long ret_ref = (long)ret_var.inner;
10934 if (ret_var.is_owned) {
10940 int8_tArray UpdateFee_1write(void* ctx_TODO, uint32_t obj) {
10941 LDKUpdateFee obj_conv;
10942 obj_conv.inner = (void*)(obj & (~1));
10943 obj_conv.is_owned = false;
10944 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
10945 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
10946 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
10947 CVec_u8Z_free(arg_var);
10951 uint32_t UpdateFee_1read(void* ctx_TODO, int8_tArray ser) {
10952 LDKu8slice ser_ref;
10953 ser_ref.datalen = ser.len;
10954 ser_ref.data = ser.ptr;
10955 LDKUpdateFee ret_var = UpdateFee_read(ser_ref);
10956 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10957 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10958 long ret_ref = (long)ret_var.inner;
10959 if (ret_var.is_owned) {
10965 int8_tArray UpdateFulfillHTLC_1write(void* ctx_TODO, uint32_t obj) {
10966 LDKUpdateFulfillHTLC obj_conv;
10967 obj_conv.inner = (void*)(obj & (~1));
10968 obj_conv.is_owned = false;
10969 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
10970 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
10971 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
10972 CVec_u8Z_free(arg_var);
10976 uint32_t UpdateFulfillHTLC_1read(void* ctx_TODO, int8_tArray ser) {
10977 LDKu8slice ser_ref;
10978 ser_ref.datalen = ser.len;
10979 ser_ref.data = ser.ptr;
10980 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_read(ser_ref);
10981 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10982 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10983 long ret_ref = (long)ret_var.inner;
10984 if (ret_var.is_owned) {
10990 int8_tArray UpdateAddHTLC_1write(void* ctx_TODO, uint32_t obj) {
10991 LDKUpdateAddHTLC obj_conv;
10992 obj_conv.inner = (void*)(obj & (~1));
10993 obj_conv.is_owned = false;
10994 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
10995 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
10996 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
10997 CVec_u8Z_free(arg_var);
11001 uint32_t UpdateAddHTLC_1read(void* ctx_TODO, int8_tArray ser) {
11002 LDKu8slice ser_ref;
11003 ser_ref.datalen = ser.len;
11004 ser_ref.data = ser.ptr;
11005 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_read(ser_ref);
11006 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11007 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11008 long ret_ref = (long)ret_var.inner;
11009 if (ret_var.is_owned) {
11015 int8_tArray Ping_1write(void* ctx_TODO, uint32_t obj) {
11017 obj_conv.inner = (void*)(obj & (~1));
11018 obj_conv.is_owned = false;
11019 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
11020 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
11021 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
11022 CVec_u8Z_free(arg_var);
11026 uint32_t Ping_1read(void* ctx_TODO, int8_tArray ser) {
11027 LDKu8slice ser_ref;
11028 ser_ref.datalen = ser.len;
11029 ser_ref.data = ser.ptr;
11030 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
11031 *ret_conv = Ping_read(ser_ref);
11032 return (long)ret_conv;
11035 int8_tArray Pong_1write(void* ctx_TODO, uint32_t obj) {
11037 obj_conv.inner = (void*)(obj & (~1));
11038 obj_conv.is_owned = false;
11039 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
11040 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
11041 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
11042 CVec_u8Z_free(arg_var);
11046 uint32_t Pong_1read(void* ctx_TODO, int8_tArray ser) {
11047 LDKu8slice ser_ref;
11048 ser_ref.datalen = ser.len;
11049 ser_ref.data = ser.ptr;
11050 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
11051 *ret_conv = Pong_read(ser_ref);
11052 return (long)ret_conv;
11055 int8_tArray UnsignedChannelAnnouncement_1write(void* ctx_TODO, uint32_t obj) {
11056 LDKUnsignedChannelAnnouncement obj_conv;
11057 obj_conv.inner = (void*)(obj & (~1));
11058 obj_conv.is_owned = false;
11059 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
11060 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
11061 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
11062 CVec_u8Z_free(arg_var);
11066 uint32_t UnsignedChannelAnnouncement_1read(void* ctx_TODO, int8_tArray ser) {
11067 LDKu8slice ser_ref;
11068 ser_ref.datalen = ser.len;
11069 ser_ref.data = ser.ptr;
11070 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
11071 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
11072 return (long)ret_conv;
11075 int8_tArray ChannelAnnouncement_1write(void* ctx_TODO, uint32_t obj) {
11076 LDKChannelAnnouncement obj_conv;
11077 obj_conv.inner = (void*)(obj & (~1));
11078 obj_conv.is_owned = false;
11079 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
11080 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
11081 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
11082 CVec_u8Z_free(arg_var);
11086 uint32_t ChannelAnnouncement_1read(void* ctx_TODO, int8_tArray ser) {
11087 LDKu8slice ser_ref;
11088 ser_ref.datalen = ser.len;
11089 ser_ref.data = ser.ptr;
11090 LDKChannelAnnouncement ret_var = ChannelAnnouncement_read(ser_ref);
11091 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11092 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11093 long ret_ref = (long)ret_var.inner;
11094 if (ret_var.is_owned) {
11100 int8_tArray UnsignedChannelUpdate_1write(void* ctx_TODO, uint32_t obj) {
11101 LDKUnsignedChannelUpdate obj_conv;
11102 obj_conv.inner = (void*)(obj & (~1));
11103 obj_conv.is_owned = false;
11104 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
11105 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
11106 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
11107 CVec_u8Z_free(arg_var);
11111 uint32_t UnsignedChannelUpdate_1read(void* ctx_TODO, int8_tArray ser) {
11112 LDKu8slice ser_ref;
11113 ser_ref.datalen = ser.len;
11114 ser_ref.data = ser.ptr;
11115 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
11116 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
11117 return (long)ret_conv;
11120 int8_tArray ChannelUpdate_1write(void* ctx_TODO, uint32_t obj) {
11121 LDKChannelUpdate obj_conv;
11122 obj_conv.inner = (void*)(obj & (~1));
11123 obj_conv.is_owned = false;
11124 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
11125 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
11126 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
11127 CVec_u8Z_free(arg_var);
11131 uint32_t ChannelUpdate_1read(void* ctx_TODO, int8_tArray ser) {
11132 LDKu8slice ser_ref;
11133 ser_ref.datalen = ser.len;
11134 ser_ref.data = ser.ptr;
11135 LDKChannelUpdate ret_var = ChannelUpdate_read(ser_ref);
11136 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11137 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11138 long ret_ref = (long)ret_var.inner;
11139 if (ret_var.is_owned) {
11145 int8_tArray ErrorMessage_1write(void* ctx_TODO, uint32_t obj) {
11146 LDKErrorMessage obj_conv;
11147 obj_conv.inner = (void*)(obj & (~1));
11148 obj_conv.is_owned = false;
11149 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
11150 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
11151 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
11152 CVec_u8Z_free(arg_var);
11156 uint32_t ErrorMessage_1read(void* ctx_TODO, int8_tArray ser) {
11157 LDKu8slice ser_ref;
11158 ser_ref.datalen = ser.len;
11159 ser_ref.data = ser.ptr;
11160 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
11161 *ret_conv = ErrorMessage_read(ser_ref);
11162 return (long)ret_conv;
11165 int8_tArray UnsignedNodeAnnouncement_1write(void* ctx_TODO, uint32_t obj) {
11166 LDKUnsignedNodeAnnouncement obj_conv;
11167 obj_conv.inner = (void*)(obj & (~1));
11168 obj_conv.is_owned = false;
11169 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
11170 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
11171 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
11172 CVec_u8Z_free(arg_var);
11176 uint32_t UnsignedNodeAnnouncement_1read(void* ctx_TODO, int8_tArray ser) {
11177 LDKu8slice ser_ref;
11178 ser_ref.datalen = ser.len;
11179 ser_ref.data = ser.ptr;
11180 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
11181 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
11182 return (long)ret_conv;
11185 int8_tArray NodeAnnouncement_1write(void* ctx_TODO, uint32_t obj) {
11186 LDKNodeAnnouncement obj_conv;
11187 obj_conv.inner = (void*)(obj & (~1));
11188 obj_conv.is_owned = false;
11189 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
11190 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
11191 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
11192 CVec_u8Z_free(arg_var);
11196 uint32_t NodeAnnouncement_1read(void* ctx_TODO, int8_tArray ser) {
11197 LDKu8slice ser_ref;
11198 ser_ref.datalen = ser.len;
11199 ser_ref.data = ser.ptr;
11200 LDKNodeAnnouncement ret_var = NodeAnnouncement_read(ser_ref);
11201 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11202 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11203 long ret_ref = (long)ret_var.inner;
11204 if (ret_var.is_owned) {
11210 uint32_t QueryShortChannelIds_1read(void* ctx_TODO, int8_tArray ser) {
11211 LDKu8slice ser_ref;
11212 ser_ref.datalen = ser.len;
11213 ser_ref.data = ser.ptr;
11214 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
11215 *ret_conv = QueryShortChannelIds_read(ser_ref);
11216 return (long)ret_conv;
11219 int8_tArray QueryShortChannelIds_1write(void* ctx_TODO, uint32_t obj) {
11220 LDKQueryShortChannelIds obj_conv;
11221 obj_conv.inner = (void*)(obj & (~1));
11222 obj_conv.is_owned = false;
11223 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
11224 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
11225 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
11226 CVec_u8Z_free(arg_var);
11230 uint32_t ReplyShortChannelIdsEnd_1read(void* ctx_TODO, int8_tArray ser) {
11231 LDKu8slice ser_ref;
11232 ser_ref.datalen = ser.len;
11233 ser_ref.data = ser.ptr;
11234 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
11235 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
11236 return (long)ret_conv;
11239 int8_tArray ReplyShortChannelIdsEnd_1write(void* ctx_TODO, uint32_t obj) {
11240 LDKReplyShortChannelIdsEnd obj_conv;
11241 obj_conv.inner = (void*)(obj & (~1));
11242 obj_conv.is_owned = false;
11243 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
11244 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
11245 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
11246 CVec_u8Z_free(arg_var);
11250 uint32_t QueryChannelRange_1read(void* ctx_TODO, int8_tArray ser) {
11251 LDKu8slice ser_ref;
11252 ser_ref.datalen = ser.len;
11253 ser_ref.data = ser.ptr;
11254 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
11255 *ret_conv = QueryChannelRange_read(ser_ref);
11256 return (long)ret_conv;
11259 int8_tArray QueryChannelRange_1write(void* ctx_TODO, uint32_t obj) {
11260 LDKQueryChannelRange obj_conv;
11261 obj_conv.inner = (void*)(obj & (~1));
11262 obj_conv.is_owned = false;
11263 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
11264 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
11265 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
11266 CVec_u8Z_free(arg_var);
11270 uint32_t ReplyChannelRange_1read(void* ctx_TODO, int8_tArray ser) {
11271 LDKu8slice ser_ref;
11272 ser_ref.datalen = ser.len;
11273 ser_ref.data = ser.ptr;
11274 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
11275 *ret_conv = ReplyChannelRange_read(ser_ref);
11276 return (long)ret_conv;
11279 int8_tArray ReplyChannelRange_1write(void* ctx_TODO, uint32_t obj) {
11280 LDKReplyChannelRange obj_conv;
11281 obj_conv.inner = (void*)(obj & (~1));
11282 obj_conv.is_owned = false;
11283 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
11284 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
11285 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
11286 CVec_u8Z_free(arg_var);
11290 uint32_t GossipTimestampFilter_1read(void* ctx_TODO, int8_tArray ser) {
11291 LDKu8slice ser_ref;
11292 ser_ref.datalen = ser.len;
11293 ser_ref.data = ser.ptr;
11294 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
11295 *ret_conv = GossipTimestampFilter_read(ser_ref);
11296 return (long)ret_conv;
11299 int8_tArray GossipTimestampFilter_1write(void* ctx_TODO, uint32_t obj) {
11300 LDKGossipTimestampFilter obj_conv;
11301 obj_conv.inner = (void*)(obj & (~1));
11302 obj_conv.is_owned = false;
11303 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
11304 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
11305 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
11306 CVec_u8Z_free(arg_var);
11310 void MessageHandler_1free(void* ctx_TODO, uint32_t this_ptr) {
11311 LDKMessageHandler this_ptr_conv;
11312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11313 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11314 MessageHandler_free(this_ptr_conv);
11317 uint32_t MessageHandler_1get_1chan_1handler(void* ctx_TODO, uint32_t this_ptr) {
11318 LDKMessageHandler this_ptr_conv;
11319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11320 this_ptr_conv.is_owned = false;
11321 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
11325 void MessageHandler_1set_1chan_1handler(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
11326 LDKMessageHandler this_ptr_conv;
11327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11328 this_ptr_conv.is_owned = false;
11329 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
11330 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
11331 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11332 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
11334 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
11337 uint32_t MessageHandler_1get_1route_1handler(void* ctx_TODO, uint32_t this_ptr) {
11338 LDKMessageHandler this_ptr_conv;
11339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11340 this_ptr_conv.is_owned = false;
11341 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
11345 void MessageHandler_1set_1route_1handler(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
11346 LDKMessageHandler this_ptr_conv;
11347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11348 this_ptr_conv.is_owned = false;
11349 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
11350 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
11351 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11352 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
11354 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
11357 uint32_t MessageHandler_1new(void* ctx_TODO, uint32_t chan_handler_arg, uint32_t route_handler_arg) {
11358 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
11359 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
11360 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11361 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
11363 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
11364 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
11365 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11366 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
11368 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
11369 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11370 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11371 long ret_ref = (long)ret_var.inner;
11372 if (ret_var.is_owned) {
11378 uint32_t SocketDescriptor_1clone(void* ctx_TODO, uint32_t orig) {
11379 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig;
11380 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
11381 *ret = SocketDescriptor_clone(orig_conv);
11385 void SocketDescriptor_1free(void* ctx_TODO, uint32_t this_ptr) {
11386 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
11387 FREE((void*)this_ptr);
11388 SocketDescriptor_free(this_ptr_conv);
11391 void PeerHandleError_1free(void* ctx_TODO, uint32_t this_ptr) {
11392 LDKPeerHandleError this_ptr_conv;
11393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11394 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11395 PeerHandleError_free(this_ptr_conv);
11398 jboolean PeerHandleError_1get_1no_1connection_1possible(void* ctx_TODO, uint32_t this_ptr) {
11399 LDKPeerHandleError this_ptr_conv;
11400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11401 this_ptr_conv.is_owned = false;
11402 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
11406 void PeerHandleError_1set_1no_1connection_1possible(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
11407 LDKPeerHandleError this_ptr_conv;
11408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11409 this_ptr_conv.is_owned = false;
11410 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
11413 uint32_t PeerHandleError_1new(void* ctx_TODO, jboolean no_connection_possible_arg) {
11414 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
11415 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11416 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11417 long ret_ref = (long)ret_var.inner;
11418 if (ret_var.is_owned) {
11424 void PeerManager_1free(void* ctx_TODO, uint32_t this_ptr) {
11425 LDKPeerManager this_ptr_conv;
11426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11427 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11428 PeerManager_free(this_ptr_conv);
11431 uint32_t PeerManager_1new(void* ctx_TODO, uint32_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, uint32_t logger) {
11432 LDKMessageHandler message_handler_conv;
11433 message_handler_conv.inner = (void*)(message_handler & (~1));
11434 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
11435 // Warning: we may need a move here but can't clone!
11436 LDKSecretKey our_node_secret_ref;
11437 CHECK(our_node_secret.len == 32);
11438 memcpy(our_node_secret_ref.bytes, our_node_secret.ptr, 32);
11439 unsigned char ephemeral_random_data_arr[32];
11440 CHECK(ephemeral_random_data.len == 32);
11441 memcpy(ephemeral_random_data_arr, ephemeral_random_data.ptr, 32);
11442 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
11443 LDKLogger logger_conv = *(LDKLogger*)logger;
11444 if (logger_conv.free == LDKLogger_JCalls_free) {
11445 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11446 LDKLogger_JCalls_clone(logger_conv.this_arg);
11448 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
11449 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11450 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11451 long ret_ref = (long)ret_var.inner;
11452 if (ret_var.is_owned) {
11458 uint32_tArray PeerManager_1get_1peer_1node_1ids(void* ctx_TODO, uint32_t this_arg) {
11459 LDKPeerManager this_arg_conv;
11460 this_arg_conv.inner = (void*)(this_arg & (~1));
11461 this_arg_conv.is_owned = false;
11462 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
11463 uint32_tArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
11464 for (size_t i = 0; i < ret_var.datalen; i++) {
11465 int8_tArray arr_conv_8_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
11466 memcpy(arr_conv_8_arr.ptr, ret_var.data[i].compressed_form, 33);
11467 (*env)->SetObjectArrayElement(env, ret_arr, i, arr_conv_8_arr);
11469 FREE(ret_var.data);
11473 uint32_t PeerManager_1new_1outbound_1connection(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
11474 LDKPeerManager this_arg_conv;
11475 this_arg_conv.inner = (void*)(this_arg & (~1));
11476 this_arg_conv.is_owned = false;
11477 LDKPublicKey their_node_id_ref;
11478 CHECK(their_node_id.len == 33);
11479 memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
11480 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
11481 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
11482 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11483 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
11485 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11486 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
11487 return (long)ret_conv;
11490 uint32_t PeerManager_1new_1inbound_1connection(void* ctx_TODO, uint32_t this_arg, uint32_t descriptor) {
11491 LDKPeerManager this_arg_conv;
11492 this_arg_conv.inner = (void*)(this_arg & (~1));
11493 this_arg_conv.is_owned = false;
11494 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
11495 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
11496 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11497 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
11499 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11500 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
11501 return (long)ret_conv;
11504 uint32_t PeerManager_1write_1buffer_1space_1avail(void* ctx_TODO, uint32_t this_arg, uint32_t descriptor) {
11505 LDKPeerManager this_arg_conv;
11506 this_arg_conv.inner = (void*)(this_arg & (~1));
11507 this_arg_conv.is_owned = false;
11508 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
11509 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11510 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
11511 return (long)ret_conv;
11514 uint32_t PeerManager_1read_1event(void* ctx_TODO, uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
11515 LDKPeerManager this_arg_conv;
11516 this_arg_conv.inner = (void*)(this_arg & (~1));
11517 this_arg_conv.is_owned = false;
11518 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
11519 LDKu8slice data_ref;
11520 data_ref.datalen = data.len;
11521 data_ref.data = data.ptr;
11522 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11523 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
11524 return (long)ret_conv;
11527 void PeerManager_1process_1events(void* ctx_TODO, uint32_t this_arg) {
11528 LDKPeerManager this_arg_conv;
11529 this_arg_conv.inner = (void*)(this_arg & (~1));
11530 this_arg_conv.is_owned = false;
11531 PeerManager_process_events(&this_arg_conv);
11534 void PeerManager_1socket_1disconnected(void* ctx_TODO, uint32_t this_arg, uint32_t descriptor) {
11535 LDKPeerManager this_arg_conv;
11536 this_arg_conv.inner = (void*)(this_arg & (~1));
11537 this_arg_conv.is_owned = false;
11538 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
11539 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
11542 void PeerManager_1timer_1tick_1occured(void* ctx_TODO, uint32_t this_arg) {
11543 LDKPeerManager this_arg_conv;
11544 this_arg_conv.inner = (void*)(this_arg & (~1));
11545 this_arg_conv.is_owned = false;
11546 PeerManager_timer_tick_occured(&this_arg_conv);
11549 int8_tArray build_1commitment_1secret(void* ctx_TODO, int8_tArray commitment_seed, int64_t idx) {
11550 unsigned char commitment_seed_arr[32];
11551 CHECK(commitment_seed.len == 32);
11552 memcpy(commitment_seed_arr, commitment_seed.ptr, 32);
11553 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
11554 int8_tArray arg_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
11555 memcpy(arg_arr.ptr, build_commitment_secret(commitment_seed_ref, idx).data, 32);
11559 uint32_t derive_1private_1key(void* ctx_TODO, int8_tArray per_commitment_point, int8_tArray base_secret) {
11560 LDKPublicKey per_commitment_point_ref;
11561 CHECK(per_commitment_point.len == 33);
11562 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.ptr, 33);
11563 unsigned char base_secret_arr[32];
11564 CHECK(base_secret.len == 32);
11565 memcpy(base_secret_arr, base_secret.ptr, 32);
11566 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
11567 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
11568 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
11569 return (long)ret_conv;
11572 uint32_t derive_1public_1key(void* ctx_TODO, int8_tArray per_commitment_point, int8_tArray base_point) {
11573 LDKPublicKey per_commitment_point_ref;
11574 CHECK(per_commitment_point.len == 33);
11575 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.ptr, 33);
11576 LDKPublicKey base_point_ref;
11577 CHECK(base_point.len == 33);
11578 memcpy(base_point_ref.compressed_form, base_point.ptr, 33);
11579 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
11580 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
11581 return (long)ret_conv;
11584 uint32_t derive_1private_1revocation_1key(void* ctx_TODO, int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
11585 unsigned char per_commitment_secret_arr[32];
11586 CHECK(per_commitment_secret.len == 32);
11587 memcpy(per_commitment_secret_arr, per_commitment_secret.ptr, 32);
11588 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
11589 unsigned char countersignatory_revocation_base_secret_arr[32];
11590 CHECK(countersignatory_revocation_base_secret.len == 32);
11591 memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret.ptr, 32);
11592 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
11593 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
11594 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
11595 return (long)ret_conv;
11598 uint32_t derive_1public_1revocation_1key(void* ctx_TODO, int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
11599 LDKPublicKey per_commitment_point_ref;
11600 CHECK(per_commitment_point.len == 33);
11601 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.ptr, 33);
11602 LDKPublicKey countersignatory_revocation_base_point_ref;
11603 CHECK(countersignatory_revocation_base_point.len == 33);
11604 memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point.ptr, 33);
11605 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
11606 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
11607 return (long)ret_conv;
11610 void TxCreationKeys_1free(void* ctx_TODO, uint32_t this_ptr) {
11611 LDKTxCreationKeys this_ptr_conv;
11612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11613 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11614 TxCreationKeys_free(this_ptr_conv);
11617 uint32_t TxCreationKeys_1clone(void* ctx_TODO, uint32_t orig) {
11618 LDKTxCreationKeys orig_conv;
11619 orig_conv.inner = (void*)(orig & (~1));
11620 orig_conv.is_owned = false;
11621 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
11622 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11623 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11624 long ret_ref = (long)ret_var.inner;
11625 if (ret_var.is_owned) {
11631 int8_tArray TxCreationKeys_1get_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr) {
11632 LDKTxCreationKeys this_ptr_conv;
11633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11634 this_ptr_conv.is_owned = false;
11635 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
11636 memcpy(arg_arr.ptr, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
11640 void TxCreationKeys_1set_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11641 LDKTxCreationKeys this_ptr_conv;
11642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11643 this_ptr_conv.is_owned = false;
11644 LDKPublicKey val_ref;
11645 CHECK(val.len == 33);
11646 memcpy(val_ref.compressed_form, val.ptr, 33);
11647 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
11650 int8_tArray TxCreationKeys_1get_1revocation_1key(void* ctx_TODO, uint32_t this_ptr) {
11651 LDKTxCreationKeys this_ptr_conv;
11652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11653 this_ptr_conv.is_owned = false;
11654 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
11655 memcpy(arg_arr.ptr, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
11659 void TxCreationKeys_1set_1revocation_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11660 LDKTxCreationKeys this_ptr_conv;
11661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11662 this_ptr_conv.is_owned = false;
11663 LDKPublicKey val_ref;
11664 CHECK(val.len == 33);
11665 memcpy(val_ref.compressed_form, val.ptr, 33);
11666 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
11669 int8_tArray TxCreationKeys_1get_1broadcaster_1htlc_1key(void* ctx_TODO, uint32_t this_ptr) {
11670 LDKTxCreationKeys this_ptr_conv;
11671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11672 this_ptr_conv.is_owned = false;
11673 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
11674 memcpy(arg_arr.ptr, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
11678 void TxCreationKeys_1set_1broadcaster_1htlc_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11679 LDKTxCreationKeys this_ptr_conv;
11680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11681 this_ptr_conv.is_owned = false;
11682 LDKPublicKey val_ref;
11683 CHECK(val.len == 33);
11684 memcpy(val_ref.compressed_form, val.ptr, 33);
11685 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
11688 int8_tArray TxCreationKeys_1get_1countersignatory_1htlc_1key(void* ctx_TODO, uint32_t this_ptr) {
11689 LDKTxCreationKeys this_ptr_conv;
11690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11691 this_ptr_conv.is_owned = false;
11692 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
11693 memcpy(arg_arr.ptr, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
11697 void TxCreationKeys_1set_1countersignatory_1htlc_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11698 LDKTxCreationKeys this_ptr_conv;
11699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11700 this_ptr_conv.is_owned = false;
11701 LDKPublicKey val_ref;
11702 CHECK(val.len == 33);
11703 memcpy(val_ref.compressed_form, val.ptr, 33);
11704 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
11707 int8_tArray TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(void* ctx_TODO, uint32_t this_ptr) {
11708 LDKTxCreationKeys this_ptr_conv;
11709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11710 this_ptr_conv.is_owned = false;
11711 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
11712 memcpy(arg_arr.ptr, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
11716 void TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11717 LDKTxCreationKeys this_ptr_conv;
11718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11719 this_ptr_conv.is_owned = false;
11720 LDKPublicKey val_ref;
11721 CHECK(val.len == 33);
11722 memcpy(val_ref.compressed_form, val.ptr, 33);
11723 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
11726 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) {
11727 LDKPublicKey per_commitment_point_arg_ref;
11728 CHECK(per_commitment_point_arg.len == 33);
11729 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg.ptr, 33);
11730 LDKPublicKey revocation_key_arg_ref;
11731 CHECK(revocation_key_arg.len == 33);
11732 memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg.ptr, 33);
11733 LDKPublicKey broadcaster_htlc_key_arg_ref;
11734 CHECK(broadcaster_htlc_key_arg.len == 33);
11735 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg.ptr, 33);
11736 LDKPublicKey countersignatory_htlc_key_arg_ref;
11737 CHECK(countersignatory_htlc_key_arg.len == 33);
11738 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg.ptr, 33);
11739 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
11740 CHECK(broadcaster_delayed_payment_key_arg.len == 33);
11741 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg.ptr, 33);
11742 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);
11743 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11744 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11745 long ret_ref = (long)ret_var.inner;
11746 if (ret_var.is_owned) {
11752 int8_tArray TxCreationKeys_1write(void* ctx_TODO, uint32_t obj) {
11753 LDKTxCreationKeys obj_conv;
11754 obj_conv.inner = (void*)(obj & (~1));
11755 obj_conv.is_owned = false;
11756 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
11757 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
11758 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
11759 CVec_u8Z_free(arg_var);
11763 uint32_t TxCreationKeys_1read(void* ctx_TODO, int8_tArray ser) {
11764 LDKu8slice ser_ref;
11765 ser_ref.datalen = ser.len;
11766 ser_ref.data = ser.ptr;
11767 LDKTxCreationKeys ret_var = TxCreationKeys_read(ser_ref);
11768 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11769 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11770 long ret_ref = (long)ret_var.inner;
11771 if (ret_var.is_owned) {
11777 void ChannelPublicKeys_1free(void* ctx_TODO, uint32_t this_ptr) {
11778 LDKChannelPublicKeys this_ptr_conv;
11779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11780 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11781 ChannelPublicKeys_free(this_ptr_conv);
11784 uint32_t ChannelPublicKeys_1clone(void* ctx_TODO, uint32_t orig) {
11785 LDKChannelPublicKeys orig_conv;
11786 orig_conv.inner = (void*)(orig & (~1));
11787 orig_conv.is_owned = false;
11788 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
11789 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11790 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11791 long ret_ref = (long)ret_var.inner;
11792 if (ret_var.is_owned) {
11798 int8_tArray ChannelPublicKeys_1get_1funding_1pubkey(void* ctx_TODO, uint32_t this_ptr) {
11799 LDKChannelPublicKeys this_ptr_conv;
11800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11801 this_ptr_conv.is_owned = false;
11802 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
11803 memcpy(arg_arr.ptr, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
11807 void ChannelPublicKeys_1set_1funding_1pubkey(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11808 LDKChannelPublicKeys this_ptr_conv;
11809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11810 this_ptr_conv.is_owned = false;
11811 LDKPublicKey val_ref;
11812 CHECK(val.len == 33);
11813 memcpy(val_ref.compressed_form, val.ptr, 33);
11814 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
11817 int8_tArray ChannelPublicKeys_1get_1revocation_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
11818 LDKChannelPublicKeys this_ptr_conv;
11819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11820 this_ptr_conv.is_owned = false;
11821 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
11822 memcpy(arg_arr.ptr, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
11826 void ChannelPublicKeys_1set_1revocation_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11827 LDKChannelPublicKeys this_ptr_conv;
11828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11829 this_ptr_conv.is_owned = false;
11830 LDKPublicKey val_ref;
11831 CHECK(val.len == 33);
11832 memcpy(val_ref.compressed_form, val.ptr, 33);
11833 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
11836 int8_tArray ChannelPublicKeys_1get_1payment_1point(void* ctx_TODO, uint32_t this_ptr) {
11837 LDKChannelPublicKeys this_ptr_conv;
11838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11839 this_ptr_conv.is_owned = false;
11840 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
11841 memcpy(arg_arr.ptr, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
11845 void ChannelPublicKeys_1set_1payment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11846 LDKChannelPublicKeys this_ptr_conv;
11847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11848 this_ptr_conv.is_owned = false;
11849 LDKPublicKey val_ref;
11850 CHECK(val.len == 33);
11851 memcpy(val_ref.compressed_form, val.ptr, 33);
11852 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
11855 int8_tArray ChannelPublicKeys_1get_1delayed_1payment_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
11856 LDKChannelPublicKeys this_ptr_conv;
11857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11858 this_ptr_conv.is_owned = false;
11859 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
11860 memcpy(arg_arr.ptr, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
11864 void ChannelPublicKeys_1set_1delayed_1payment_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11865 LDKChannelPublicKeys this_ptr_conv;
11866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11867 this_ptr_conv.is_owned = false;
11868 LDKPublicKey val_ref;
11869 CHECK(val.len == 33);
11870 memcpy(val_ref.compressed_form, val.ptr, 33);
11871 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
11874 int8_tArray ChannelPublicKeys_1get_1htlc_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
11875 LDKChannelPublicKeys this_ptr_conv;
11876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11877 this_ptr_conv.is_owned = false;
11878 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
11879 memcpy(arg_arr.ptr, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
11883 void ChannelPublicKeys_1set_1htlc_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11884 LDKChannelPublicKeys this_ptr_conv;
11885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11886 this_ptr_conv.is_owned = false;
11887 LDKPublicKey val_ref;
11888 CHECK(val.len == 33);
11889 memcpy(val_ref.compressed_form, val.ptr, 33);
11890 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
11893 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) {
11894 LDKPublicKey funding_pubkey_arg_ref;
11895 CHECK(funding_pubkey_arg.len == 33);
11896 memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg.ptr, 33);
11897 LDKPublicKey revocation_basepoint_arg_ref;
11898 CHECK(revocation_basepoint_arg.len == 33);
11899 memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg.ptr, 33);
11900 LDKPublicKey payment_point_arg_ref;
11901 CHECK(payment_point_arg.len == 33);
11902 memcpy(payment_point_arg_ref.compressed_form, payment_point_arg.ptr, 33);
11903 LDKPublicKey delayed_payment_basepoint_arg_ref;
11904 CHECK(delayed_payment_basepoint_arg.len == 33);
11905 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg.ptr, 33);
11906 LDKPublicKey htlc_basepoint_arg_ref;
11907 CHECK(htlc_basepoint_arg.len == 33);
11908 memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg.ptr, 33);
11909 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);
11910 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11911 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11912 long ret_ref = (long)ret_var.inner;
11913 if (ret_var.is_owned) {
11919 int8_tArray ChannelPublicKeys_1write(void* ctx_TODO, uint32_t obj) {
11920 LDKChannelPublicKeys obj_conv;
11921 obj_conv.inner = (void*)(obj & (~1));
11922 obj_conv.is_owned = false;
11923 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
11924 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
11925 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
11926 CVec_u8Z_free(arg_var);
11930 uint32_t ChannelPublicKeys_1read(void* ctx_TODO, int8_tArray ser) {
11931 LDKu8slice ser_ref;
11932 ser_ref.datalen = ser.len;
11933 ser_ref.data = ser.ptr;
11934 LDKChannelPublicKeys ret_var = ChannelPublicKeys_read(ser_ref);
11935 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11936 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11937 long ret_ref = (long)ret_var.inner;
11938 if (ret_var.is_owned) {
11944 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) {
11945 LDKPublicKey per_commitment_point_ref;
11946 CHECK(per_commitment_point.len == 33);
11947 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.ptr, 33);
11948 LDKPublicKey broadcaster_delayed_payment_base_ref;
11949 CHECK(broadcaster_delayed_payment_base.len == 33);
11950 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base.ptr, 33);
11951 LDKPublicKey broadcaster_htlc_base_ref;
11952 CHECK(broadcaster_htlc_base.len == 33);
11953 memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base.ptr, 33);
11954 LDKPublicKey countersignatory_revocation_base_ref;
11955 CHECK(countersignatory_revocation_base.len == 33);
11956 memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base.ptr, 33);
11957 LDKPublicKey countersignatory_htlc_base_ref;
11958 CHECK(countersignatory_htlc_base.len == 33);
11959 memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base.ptr, 33);
11960 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
11961 *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);
11962 return (long)ret_conv;
11965 uint32_t TxCreationKeys_1from_1channel_1static_1keys(void* ctx_TODO, int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
11966 LDKPublicKey per_commitment_point_ref;
11967 CHECK(per_commitment_point.len == 33);
11968 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.ptr, 33);
11969 LDKChannelPublicKeys broadcaster_keys_conv;
11970 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
11971 broadcaster_keys_conv.is_owned = false;
11972 LDKChannelPublicKeys countersignatory_keys_conv;
11973 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
11974 countersignatory_keys_conv.is_owned = false;
11975 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
11976 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
11977 return (long)ret_conv;
11980 int8_tArray get_1revokeable_1redeemscript(void* ctx_TODO, int8_tArray revocation_key, jshort contest_delay, int8_tArray broadcaster_delayed_payment_key) {
11981 LDKPublicKey revocation_key_ref;
11982 CHECK(revocation_key.len == 33);
11983 memcpy(revocation_key_ref.compressed_form, revocation_key.ptr, 33);
11984 LDKPublicKey broadcaster_delayed_payment_key_ref;
11985 CHECK(broadcaster_delayed_payment_key.len == 33);
11986 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key.ptr, 33);
11987 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
11988 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
11989 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
11990 CVec_u8Z_free(arg_var);
11994 void HTLCOutputInCommitment_1free(void* ctx_TODO, uint32_t this_ptr) {
11995 LDKHTLCOutputInCommitment this_ptr_conv;
11996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11997 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11998 HTLCOutputInCommitment_free(this_ptr_conv);
12001 uint32_t HTLCOutputInCommitment_1clone(void* ctx_TODO, uint32_t orig) {
12002 LDKHTLCOutputInCommitment orig_conv;
12003 orig_conv.inner = (void*)(orig & (~1));
12004 orig_conv.is_owned = false;
12005 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
12006 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12007 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12008 long ret_ref = (long)ret_var.inner;
12009 if (ret_var.is_owned) {
12015 jboolean HTLCOutputInCommitment_1get_1offered(void* ctx_TODO, uint32_t this_ptr) {
12016 LDKHTLCOutputInCommitment this_ptr_conv;
12017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12018 this_ptr_conv.is_owned = false;
12019 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
12023 void HTLCOutputInCommitment_1set_1offered(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
12024 LDKHTLCOutputInCommitment this_ptr_conv;
12025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12026 this_ptr_conv.is_owned = false;
12027 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
12030 int64_t HTLCOutputInCommitment_1get_1amount_1msat(void* ctx_TODO, uint32_t this_ptr) {
12031 LDKHTLCOutputInCommitment this_ptr_conv;
12032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12033 this_ptr_conv.is_owned = false;
12034 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
12038 void HTLCOutputInCommitment_1set_1amount_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
12039 LDKHTLCOutputInCommitment this_ptr_conv;
12040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12041 this_ptr_conv.is_owned = false;
12042 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
12045 int32_t HTLCOutputInCommitment_1get_1cltv_1expiry(void* ctx_TODO, uint32_t this_ptr) {
12046 LDKHTLCOutputInCommitment this_ptr_conv;
12047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12048 this_ptr_conv.is_owned = false;
12049 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
12053 void HTLCOutputInCommitment_1set_1cltv_1expiry(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
12054 LDKHTLCOutputInCommitment this_ptr_conv;
12055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12056 this_ptr_conv.is_owned = false;
12057 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
12060 int8_tArray HTLCOutputInCommitment_1get_1payment_1hash(void* ctx_TODO, uint32_t this_ptr) {
12061 LDKHTLCOutputInCommitment this_ptr_conv;
12062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12063 this_ptr_conv.is_owned = false;
12064 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
12065 memcpy(ret_arr.ptr, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
12069 void HTLCOutputInCommitment_1set_1payment_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
12070 LDKHTLCOutputInCommitment this_ptr_conv;
12071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12072 this_ptr_conv.is_owned = false;
12073 LDKThirtyTwoBytes val_ref;
12074 CHECK(val.len == 32);
12075 memcpy(val_ref.data, val.ptr, 32);
12076 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
12079 int8_tArray HTLCOutputInCommitment_1write(void* ctx_TODO, uint32_t obj) {
12080 LDKHTLCOutputInCommitment obj_conv;
12081 obj_conv.inner = (void*)(obj & (~1));
12082 obj_conv.is_owned = false;
12083 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
12084 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12085 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12086 CVec_u8Z_free(arg_var);
12090 uint32_t HTLCOutputInCommitment_1read(void* ctx_TODO, int8_tArray ser) {
12091 LDKu8slice ser_ref;
12092 ser_ref.datalen = ser.len;
12093 ser_ref.data = ser.ptr;
12094 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_read(ser_ref);
12095 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12096 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12097 long ret_ref = (long)ret_var.inner;
12098 if (ret_var.is_owned) {
12104 int8_tArray get_1htlc_1redeemscript(void* ctx_TODO, uint32_t htlc, uint32_t keys) {
12105 LDKHTLCOutputInCommitment htlc_conv;
12106 htlc_conv.inner = (void*)(htlc & (~1));
12107 htlc_conv.is_owned = false;
12108 LDKTxCreationKeys keys_conv;
12109 keys_conv.inner = (void*)(keys & (~1));
12110 keys_conv.is_owned = false;
12111 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
12112 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12113 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12114 CVec_u8Z_free(arg_var);
12118 int8_tArray make_1funding_1redeemscript(void* ctx_TODO, int8_tArray broadcaster, int8_tArray countersignatory) {
12119 LDKPublicKey broadcaster_ref;
12120 CHECK(broadcaster.len == 33);
12121 memcpy(broadcaster_ref.compressed_form, broadcaster.ptr, 33);
12122 LDKPublicKey countersignatory_ref;
12123 CHECK(countersignatory.len == 33);
12124 memcpy(countersignatory_ref.compressed_form, countersignatory.ptr, 33);
12125 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
12126 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12127 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12128 CVec_u8Z_free(arg_var);
12132 int8_tArray build_1htlc_1transaction(void* ctx_TODO, int8_tArray prev_hash, int32_t feerate_per_kw, jshort contest_delay, uint32_t htlc, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
12133 unsigned char prev_hash_arr[32];
12134 CHECK(prev_hash.len == 32);
12135 memcpy(prev_hash_arr, prev_hash.ptr, 32);
12136 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
12137 LDKHTLCOutputInCommitment htlc_conv;
12138 htlc_conv.inner = (void*)(htlc & (~1));
12139 htlc_conv.is_owned = false;
12140 LDKPublicKey broadcaster_delayed_payment_key_ref;
12141 CHECK(broadcaster_delayed_payment_key.len == 33);
12142 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key.ptr, 33);
12143 LDKPublicKey revocation_key_ref;
12144 CHECK(revocation_key.len == 33);
12145 memcpy(revocation_key_ref.compressed_form, revocation_key.ptr, 33);
12146 LDKTransaction arg_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
12147 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12148 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12149 Transaction_free(arg_var);
12153 void ChannelTransactionParameters_1free(void* ctx_TODO, uint32_t this_ptr) {
12154 LDKChannelTransactionParameters this_ptr_conv;
12155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12156 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12157 ChannelTransactionParameters_free(this_ptr_conv);
12160 uint32_t ChannelTransactionParameters_1clone(void* ctx_TODO, uint32_t orig) {
12161 LDKChannelTransactionParameters orig_conv;
12162 orig_conv.inner = (void*)(orig & (~1));
12163 orig_conv.is_owned = false;
12164 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
12165 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12166 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12167 long ret_ref = (long)ret_var.inner;
12168 if (ret_var.is_owned) {
12174 uint32_t ChannelTransactionParameters_1get_1holder_1pubkeys(void* ctx_TODO, uint32_t this_ptr) {
12175 LDKChannelTransactionParameters this_ptr_conv;
12176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12177 this_ptr_conv.is_owned = false;
12178 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
12179 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12180 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12181 long ret_ref = (long)ret_var.inner;
12182 if (ret_var.is_owned) {
12188 void ChannelTransactionParameters_1set_1holder_1pubkeys(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
12189 LDKChannelTransactionParameters this_ptr_conv;
12190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12191 this_ptr_conv.is_owned = false;
12192 LDKChannelPublicKeys val_conv;
12193 val_conv.inner = (void*)(val & (~1));
12194 val_conv.is_owned = (val & 1) || (val == 0);
12195 if (val_conv.inner != NULL)
12196 val_conv = ChannelPublicKeys_clone(&val_conv);
12197 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
12200 jshort ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(void* ctx_TODO, uint32_t this_ptr) {
12201 LDKChannelTransactionParameters this_ptr_conv;
12202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12203 this_ptr_conv.is_owned = false;
12204 jshort ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
12208 void ChannelTransactionParameters_1set_1holder_1selected_1contest_1delay(void* ctx_TODO, uint32_t this_ptr, jshort val) {
12209 LDKChannelTransactionParameters this_ptr_conv;
12210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12211 this_ptr_conv.is_owned = false;
12212 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
12215 jboolean ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(void* ctx_TODO, uint32_t this_ptr) {
12216 LDKChannelTransactionParameters this_ptr_conv;
12217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12218 this_ptr_conv.is_owned = false;
12219 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
12223 void ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
12224 LDKChannelTransactionParameters this_ptr_conv;
12225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12226 this_ptr_conv.is_owned = false;
12227 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
12230 uint32_t ChannelTransactionParameters_1get_1counterparty_1parameters(void* ctx_TODO, uint32_t this_ptr) {
12231 LDKChannelTransactionParameters this_ptr_conv;
12232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12233 this_ptr_conv.is_owned = false;
12234 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
12235 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12236 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12237 long ret_ref = (long)ret_var.inner;
12238 if (ret_var.is_owned) {
12244 void ChannelTransactionParameters_1set_1counterparty_1parameters(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
12245 LDKChannelTransactionParameters this_ptr_conv;
12246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12247 this_ptr_conv.is_owned = false;
12248 LDKCounterpartyChannelTransactionParameters val_conv;
12249 val_conv.inner = (void*)(val & (~1));
12250 val_conv.is_owned = (val & 1) || (val == 0);
12251 if (val_conv.inner != NULL)
12252 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
12253 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
12256 uint32_t ChannelTransactionParameters_1get_1funding_1outpoint(void* ctx_TODO, uint32_t this_ptr) {
12257 LDKChannelTransactionParameters this_ptr_conv;
12258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12259 this_ptr_conv.is_owned = false;
12260 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
12261 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12262 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12263 long ret_ref = (long)ret_var.inner;
12264 if (ret_var.is_owned) {
12270 void ChannelTransactionParameters_1set_1funding_1outpoint(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
12271 LDKChannelTransactionParameters this_ptr_conv;
12272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12273 this_ptr_conv.is_owned = false;
12274 LDKOutPoint val_conv;
12275 val_conv.inner = (void*)(val & (~1));
12276 val_conv.is_owned = (val & 1) || (val == 0);
12277 if (val_conv.inner != NULL)
12278 val_conv = OutPoint_clone(&val_conv);
12279 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
12282 uint32_t ChannelTransactionParameters_1new(void* ctx_TODO, uint32_t holder_pubkeys_arg, jshort holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, uint32_t counterparty_parameters_arg, uint32_t funding_outpoint_arg) {
12283 LDKChannelPublicKeys holder_pubkeys_arg_conv;
12284 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
12285 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
12286 if (holder_pubkeys_arg_conv.inner != NULL)
12287 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
12288 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
12289 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
12290 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
12291 if (counterparty_parameters_arg_conv.inner != NULL)
12292 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
12293 LDKOutPoint funding_outpoint_arg_conv;
12294 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
12295 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
12296 if (funding_outpoint_arg_conv.inner != NULL)
12297 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
12298 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);
12299 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12300 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12301 long ret_ref = (long)ret_var.inner;
12302 if (ret_var.is_owned) {
12308 void CounterpartyChannelTransactionParameters_1free(void* ctx_TODO, uint32_t this_ptr) {
12309 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
12310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12311 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12312 CounterpartyChannelTransactionParameters_free(this_ptr_conv);
12315 uint32_t CounterpartyChannelTransactionParameters_1clone(void* ctx_TODO, uint32_t orig) {
12316 LDKCounterpartyChannelTransactionParameters orig_conv;
12317 orig_conv.inner = (void*)(orig & (~1));
12318 orig_conv.is_owned = false;
12319 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
12320 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12321 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12322 long ret_ref = (long)ret_var.inner;
12323 if (ret_var.is_owned) {
12329 uint32_t CounterpartyChannelTransactionParameters_1get_1pubkeys(void* ctx_TODO, uint32_t this_ptr) {
12330 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
12331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12332 this_ptr_conv.is_owned = false;
12333 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
12334 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12335 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12336 long ret_ref = (long)ret_var.inner;
12337 if (ret_var.is_owned) {
12343 void CounterpartyChannelTransactionParameters_1set_1pubkeys(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
12344 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
12345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12346 this_ptr_conv.is_owned = false;
12347 LDKChannelPublicKeys val_conv;
12348 val_conv.inner = (void*)(val & (~1));
12349 val_conv.is_owned = (val & 1) || (val == 0);
12350 if (val_conv.inner != NULL)
12351 val_conv = ChannelPublicKeys_clone(&val_conv);
12352 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
12355 jshort CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(void* ctx_TODO, uint32_t this_ptr) {
12356 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
12357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12358 this_ptr_conv.is_owned = false;
12359 jshort ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
12363 void CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(void* ctx_TODO, uint32_t this_ptr, jshort val) {
12364 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
12365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12366 this_ptr_conv.is_owned = false;
12367 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
12370 uint32_t CounterpartyChannelTransactionParameters_1new(void* ctx_TODO, uint32_t pubkeys_arg, jshort selected_contest_delay_arg) {
12371 LDKChannelPublicKeys pubkeys_arg_conv;
12372 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
12373 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
12374 if (pubkeys_arg_conv.inner != NULL)
12375 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
12376 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
12377 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12378 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12379 long ret_ref = (long)ret_var.inner;
12380 if (ret_var.is_owned) {
12386 jboolean ChannelTransactionParameters_1is_1populated(void* ctx_TODO, uint32_t this_arg) {
12387 LDKChannelTransactionParameters this_arg_conv;
12388 this_arg_conv.inner = (void*)(this_arg & (~1));
12389 this_arg_conv.is_owned = false;
12390 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
12394 uint32_t ChannelTransactionParameters_1as_1holder_1broadcastable(void* ctx_TODO, uint32_t this_arg) {
12395 LDKChannelTransactionParameters this_arg_conv;
12396 this_arg_conv.inner = (void*)(this_arg & (~1));
12397 this_arg_conv.is_owned = false;
12398 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
12399 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12400 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12401 long ret_ref = (long)ret_var.inner;
12402 if (ret_var.is_owned) {
12408 uint32_t ChannelTransactionParameters_1as_1counterparty_1broadcastable(void* ctx_TODO, uint32_t this_arg) {
12409 LDKChannelTransactionParameters this_arg_conv;
12410 this_arg_conv.inner = (void*)(this_arg & (~1));
12411 this_arg_conv.is_owned = false;
12412 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
12413 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12414 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12415 long ret_ref = (long)ret_var.inner;
12416 if (ret_var.is_owned) {
12422 int8_tArray CounterpartyChannelTransactionParameters_1write(void* ctx_TODO, uint32_t obj) {
12423 LDKCounterpartyChannelTransactionParameters obj_conv;
12424 obj_conv.inner = (void*)(obj & (~1));
12425 obj_conv.is_owned = false;
12426 LDKCVec_u8Z arg_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
12427 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12428 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12429 CVec_u8Z_free(arg_var);
12433 uint32_t CounterpartyChannelTransactionParameters_1read(void* ctx_TODO, int8_tArray ser) {
12434 LDKu8slice ser_ref;
12435 ser_ref.datalen = ser.len;
12436 ser_ref.data = ser.ptr;
12437 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_read(ser_ref);
12438 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12439 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12440 long ret_ref = (long)ret_var.inner;
12441 if (ret_var.is_owned) {
12447 int8_tArray ChannelTransactionParameters_1write(void* ctx_TODO, uint32_t obj) {
12448 LDKChannelTransactionParameters obj_conv;
12449 obj_conv.inner = (void*)(obj & (~1));
12450 obj_conv.is_owned = false;
12451 LDKCVec_u8Z arg_var = ChannelTransactionParameters_write(&obj_conv);
12452 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12453 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12454 CVec_u8Z_free(arg_var);
12458 uint32_t ChannelTransactionParameters_1read(void* ctx_TODO, int8_tArray ser) {
12459 LDKu8slice ser_ref;
12460 ser_ref.datalen = ser.len;
12461 ser_ref.data = ser.ptr;
12462 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_read(ser_ref);
12463 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12464 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12465 long ret_ref = (long)ret_var.inner;
12466 if (ret_var.is_owned) {
12472 void DirectedChannelTransactionParameters_1free(void* ctx_TODO, uint32_t this_ptr) {
12473 LDKDirectedChannelTransactionParameters this_ptr_conv;
12474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12475 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12476 DirectedChannelTransactionParameters_free(this_ptr_conv);
12479 uint32_t DirectedChannelTransactionParameters_1broadcaster_1pubkeys(void* ctx_TODO, uint32_t this_arg) {
12480 LDKDirectedChannelTransactionParameters this_arg_conv;
12481 this_arg_conv.inner = (void*)(this_arg & (~1));
12482 this_arg_conv.is_owned = false;
12483 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
12484 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12485 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12486 long ret_ref = (long)ret_var.inner;
12487 if (ret_var.is_owned) {
12493 uint32_t DirectedChannelTransactionParameters_1countersignatory_1pubkeys(void* ctx_TODO, uint32_t this_arg) {
12494 LDKDirectedChannelTransactionParameters this_arg_conv;
12495 this_arg_conv.inner = (void*)(this_arg & (~1));
12496 this_arg_conv.is_owned = false;
12497 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
12498 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12499 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12500 long ret_ref = (long)ret_var.inner;
12501 if (ret_var.is_owned) {
12507 jshort DirectedChannelTransactionParameters_1contest_1delay(void* ctx_TODO, uint32_t this_arg) {
12508 LDKDirectedChannelTransactionParameters this_arg_conv;
12509 this_arg_conv.inner = (void*)(this_arg & (~1));
12510 this_arg_conv.is_owned = false;
12511 jshort ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
12515 jboolean DirectedChannelTransactionParameters_1is_1outbound(void* ctx_TODO, uint32_t this_arg) {
12516 LDKDirectedChannelTransactionParameters this_arg_conv;
12517 this_arg_conv.inner = (void*)(this_arg & (~1));
12518 this_arg_conv.is_owned = false;
12519 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
12523 uint32_t DirectedChannelTransactionParameters_1funding_1outpoint(void* ctx_TODO, uint32_t this_arg) {
12524 LDKDirectedChannelTransactionParameters this_arg_conv;
12525 this_arg_conv.inner = (void*)(this_arg & (~1));
12526 this_arg_conv.is_owned = false;
12527 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
12528 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12529 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12530 long ret_ref = (long)ret_var.inner;
12531 if (ret_var.is_owned) {
12537 void HolderCommitmentTransaction_1free(void* ctx_TODO, uint32_t this_ptr) {
12538 LDKHolderCommitmentTransaction this_ptr_conv;
12539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12540 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12541 HolderCommitmentTransaction_free(this_ptr_conv);
12544 uint32_t HolderCommitmentTransaction_1clone(void* ctx_TODO, uint32_t orig) {
12545 LDKHolderCommitmentTransaction orig_conv;
12546 orig_conv.inner = (void*)(orig & (~1));
12547 orig_conv.is_owned = false;
12548 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
12549 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12550 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12551 long ret_ref = (long)ret_var.inner;
12552 if (ret_var.is_owned) {
12558 int8_tArray HolderCommitmentTransaction_1get_1counterparty_1sig(void* ctx_TODO, uint32_t this_ptr) {
12559 LDKHolderCommitmentTransaction this_ptr_conv;
12560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12561 this_ptr_conv.is_owned = false;
12562 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
12563 memcpy(arg_arr.ptr, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
12567 void HolderCommitmentTransaction_1set_1counterparty_1sig(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
12568 LDKHolderCommitmentTransaction this_ptr_conv;
12569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12570 this_ptr_conv.is_owned = false;
12571 LDKSignature val_ref;
12572 CHECK(val.len == 64);
12573 memcpy(val_ref.compact_form, val.ptr, 64);
12574 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
12577 void HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(void* ctx_TODO, uint32_t this_ptr, uint32_tArray val) {
12578 LDKHolderCommitmentTransaction this_ptr_conv;
12579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12580 this_ptr_conv.is_owned = false;
12581 LDKCVec_SignatureZ val_constr;
12582 val_constr.datalen = val.len;
12583 if (val_constr.datalen > 0)
12584 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12586 val_constr.data = NULL;
12587 int8_tArray* val_vals = (int8_tArray*) val.ptr;
12588 for (size_t i = 0; i < val_constr.datalen; i++) {
12589 int8_tArray arr_conv_8 = val_vals[i];
12590 LDKSignature arr_conv_8_ref;
12591 CHECK(arr_conv_8.len == 64);
12592 memcpy(arr_conv_8_ref.compact_form, arr_conv_8.ptr, 64);
12593 val_constr.data[i] = arr_conv_8_ref;
12595 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
12598 int8_tArray HolderCommitmentTransaction_1write(void* ctx_TODO, uint32_t obj) {
12599 LDKHolderCommitmentTransaction obj_conv;
12600 obj_conv.inner = (void*)(obj & (~1));
12601 obj_conv.is_owned = false;
12602 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
12603 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12604 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12605 CVec_u8Z_free(arg_var);
12609 uint32_t HolderCommitmentTransaction_1read(void* ctx_TODO, int8_tArray ser) {
12610 LDKu8slice ser_ref;
12611 ser_ref.datalen = ser.len;
12612 ser_ref.data = ser.ptr;
12613 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_read(ser_ref);
12614 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12615 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12616 long ret_ref = (long)ret_var.inner;
12617 if (ret_var.is_owned) {
12623 uint32_t HolderCommitmentTransaction_1new(void* ctx_TODO, uint32_t commitment_tx, int8_tArray counterparty_sig, uint32_tArray counterparty_htlc_sigs, int8_tArray holder_funding_key, int8_tArray counterparty_funding_key) {
12624 LDKCommitmentTransaction commitment_tx_conv;
12625 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
12626 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
12627 if (commitment_tx_conv.inner != NULL)
12628 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
12629 LDKSignature counterparty_sig_ref;
12630 CHECK(counterparty_sig.len == 64);
12631 memcpy(counterparty_sig_ref.compact_form, counterparty_sig.ptr, 64);
12632 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
12633 counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs.len;
12634 if (counterparty_htlc_sigs_constr.datalen > 0)
12635 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12637 counterparty_htlc_sigs_constr.data = NULL;
12638 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*) counterparty_htlc_sigs.ptr;
12639 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
12640 int8_tArray arr_conv_8 = counterparty_htlc_sigs_vals[i];
12641 LDKSignature arr_conv_8_ref;
12642 CHECK(arr_conv_8.len == 64);
12643 memcpy(arr_conv_8_ref.compact_form, arr_conv_8.ptr, 64);
12644 counterparty_htlc_sigs_constr.data[i] = arr_conv_8_ref;
12646 LDKPublicKey holder_funding_key_ref;
12647 CHECK(holder_funding_key.len == 33);
12648 memcpy(holder_funding_key_ref.compressed_form, holder_funding_key.ptr, 33);
12649 LDKPublicKey counterparty_funding_key_ref;
12650 CHECK(counterparty_funding_key.len == 33);
12651 memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key.ptr, 33);
12652 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
12653 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12654 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12655 long ret_ref = (long)ret_var.inner;
12656 if (ret_var.is_owned) {
12662 void BuiltCommitmentTransaction_1free(void* ctx_TODO, uint32_t this_ptr) {
12663 LDKBuiltCommitmentTransaction this_ptr_conv;
12664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12665 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12666 BuiltCommitmentTransaction_free(this_ptr_conv);
12669 uint32_t BuiltCommitmentTransaction_1clone(void* ctx_TODO, uint32_t orig) {
12670 LDKBuiltCommitmentTransaction orig_conv;
12671 orig_conv.inner = (void*)(orig & (~1));
12672 orig_conv.is_owned = false;
12673 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
12674 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12675 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12676 long ret_ref = (long)ret_var.inner;
12677 if (ret_var.is_owned) {
12683 int8_tArray BuiltCommitmentTransaction_1get_1transaction(void* ctx_TODO, uint32_t this_ptr) {
12684 LDKBuiltCommitmentTransaction this_ptr_conv;
12685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12686 this_ptr_conv.is_owned = false;
12687 LDKTransaction arg_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
12688 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12689 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12690 Transaction_free(arg_var);
12694 void BuiltCommitmentTransaction_1set_1transaction(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
12695 LDKBuiltCommitmentTransaction this_ptr_conv;
12696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12697 this_ptr_conv.is_owned = false;
12698 LDKTransaction val_ref;
12699 val_ref.datalen = val.len;
12700 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
12701 memcpy(val_ref.data, val.ptr, val_ref.datalen);
12702 val_ref.data_is_owned = true;
12703 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
12706 int8_tArray BuiltCommitmentTransaction_1get_1txid(void* ctx_TODO, uint32_t this_ptr) {
12707 LDKBuiltCommitmentTransaction this_ptr_conv;
12708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12709 this_ptr_conv.is_owned = false;
12710 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
12711 memcpy(ret_arr.ptr, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
12715 void BuiltCommitmentTransaction_1set_1txid(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
12716 LDKBuiltCommitmentTransaction this_ptr_conv;
12717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12718 this_ptr_conv.is_owned = false;
12719 LDKThirtyTwoBytes val_ref;
12720 CHECK(val.len == 32);
12721 memcpy(val_ref.data, val.ptr, 32);
12722 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
12725 uint32_t BuiltCommitmentTransaction_1new(void* ctx_TODO, int8_tArray transaction_arg, int8_tArray txid_arg) {
12726 LDKTransaction transaction_arg_ref;
12727 transaction_arg_ref.datalen = transaction_arg.len;
12728 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
12729 memcpy(transaction_arg_ref.data, transaction_arg.ptr, transaction_arg_ref.datalen);
12730 transaction_arg_ref.data_is_owned = true;
12731 LDKThirtyTwoBytes txid_arg_ref;
12732 CHECK(txid_arg.len == 32);
12733 memcpy(txid_arg_ref.data, txid_arg.ptr, 32);
12734 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
12735 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12736 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12737 long ret_ref = (long)ret_var.inner;
12738 if (ret_var.is_owned) {
12744 int8_tArray BuiltCommitmentTransaction_1write(void* ctx_TODO, uint32_t obj) {
12745 LDKBuiltCommitmentTransaction obj_conv;
12746 obj_conv.inner = (void*)(obj & (~1));
12747 obj_conv.is_owned = false;
12748 LDKCVec_u8Z arg_var = BuiltCommitmentTransaction_write(&obj_conv);
12749 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12750 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12751 CVec_u8Z_free(arg_var);
12755 uint32_t BuiltCommitmentTransaction_1read(void* ctx_TODO, int8_tArray ser) {
12756 LDKu8slice ser_ref;
12757 ser_ref.datalen = ser.len;
12758 ser_ref.data = ser.ptr;
12759 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_read(ser_ref);
12760 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12761 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12762 long ret_ref = (long)ret_var.inner;
12763 if (ret_var.is_owned) {
12769 int8_tArray BuiltCommitmentTransaction_1get_1sighash_1all(void* ctx_TODO, uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
12770 LDKBuiltCommitmentTransaction this_arg_conv;
12771 this_arg_conv.inner = (void*)(this_arg & (~1));
12772 this_arg_conv.is_owned = false;
12773 LDKu8slice funding_redeemscript_ref;
12774 funding_redeemscript_ref.datalen = funding_redeemscript.len;
12775 funding_redeemscript_ref.data = funding_redeemscript.ptr;
12776 int8_tArray arg_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
12777 memcpy(arg_arr.ptr, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
12781 int8_tArray BuiltCommitmentTransaction_1sign(void* ctx_TODO, uint32_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
12782 LDKBuiltCommitmentTransaction this_arg_conv;
12783 this_arg_conv.inner = (void*)(this_arg & (~1));
12784 this_arg_conv.is_owned = false;
12785 unsigned char funding_key_arr[32];
12786 CHECK(funding_key.len == 32);
12787 memcpy(funding_key_arr, funding_key.ptr, 32);
12788 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
12789 LDKu8slice funding_redeemscript_ref;
12790 funding_redeemscript_ref.datalen = funding_redeemscript.len;
12791 funding_redeemscript_ref.data = funding_redeemscript.ptr;
12792 int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
12793 memcpy(arg_arr.ptr, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
12797 void CommitmentTransaction_1free(void* ctx_TODO, uint32_t this_ptr) {
12798 LDKCommitmentTransaction this_ptr_conv;
12799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12800 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12801 CommitmentTransaction_free(this_ptr_conv);
12804 uint32_t CommitmentTransaction_1clone(void* ctx_TODO, uint32_t orig) {
12805 LDKCommitmentTransaction orig_conv;
12806 orig_conv.inner = (void*)(orig & (~1));
12807 orig_conv.is_owned = false;
12808 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
12809 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12810 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12811 long ret_ref = (long)ret_var.inner;
12812 if (ret_var.is_owned) {
12818 int8_tArray CommitmentTransaction_1write(void* ctx_TODO, uint32_t obj) {
12819 LDKCommitmentTransaction obj_conv;
12820 obj_conv.inner = (void*)(obj & (~1));
12821 obj_conv.is_owned = false;
12822 LDKCVec_u8Z arg_var = CommitmentTransaction_write(&obj_conv);
12823 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
12824 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
12825 CVec_u8Z_free(arg_var);
12829 uint32_t CommitmentTransaction_1read(void* ctx_TODO, int8_tArray ser) {
12830 LDKu8slice ser_ref;
12831 ser_ref.datalen = ser.len;
12832 ser_ref.data = ser.ptr;
12833 LDKCommitmentTransaction ret_var = CommitmentTransaction_read(ser_ref);
12834 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12835 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12836 long ret_ref = (long)ret_var.inner;
12837 if (ret_var.is_owned) {
12843 int64_t CommitmentTransaction_1commitment_1number(void* ctx_TODO, uint32_t this_arg) {
12844 LDKCommitmentTransaction this_arg_conv;
12845 this_arg_conv.inner = (void*)(this_arg & (~1));
12846 this_arg_conv.is_owned = false;
12847 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
12851 int64_t CommitmentTransaction_1to_1broadcaster_1value_1sat(void* ctx_TODO, uint32_t this_arg) {
12852 LDKCommitmentTransaction this_arg_conv;
12853 this_arg_conv.inner = (void*)(this_arg & (~1));
12854 this_arg_conv.is_owned = false;
12855 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
12859 int64_t CommitmentTransaction_1to_1countersignatory_1value_1sat(void* ctx_TODO, uint32_t this_arg) {
12860 LDKCommitmentTransaction this_arg_conv;
12861 this_arg_conv.inner = (void*)(this_arg & (~1));
12862 this_arg_conv.is_owned = false;
12863 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
12867 int32_t CommitmentTransaction_1feerate_1per_1kw(void* ctx_TODO, uint32_t this_arg) {
12868 LDKCommitmentTransaction this_arg_conv;
12869 this_arg_conv.inner = (void*)(this_arg & (~1));
12870 this_arg_conv.is_owned = false;
12871 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
12875 uint32_t CommitmentTransaction_1trust(void* ctx_TODO, uint32_t this_arg) {
12876 LDKCommitmentTransaction this_arg_conv;
12877 this_arg_conv.inner = (void*)(this_arg & (~1));
12878 this_arg_conv.is_owned = false;
12879 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
12880 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12881 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12882 long ret_ref = (long)ret_var.inner;
12883 if (ret_var.is_owned) {
12889 uint32_t CommitmentTransaction_1verify(void* ctx_TODO, uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
12890 LDKCommitmentTransaction this_arg_conv;
12891 this_arg_conv.inner = (void*)(this_arg & (~1));
12892 this_arg_conv.is_owned = false;
12893 LDKDirectedChannelTransactionParameters channel_parameters_conv;
12894 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
12895 channel_parameters_conv.is_owned = false;
12896 LDKChannelPublicKeys broadcaster_keys_conv;
12897 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
12898 broadcaster_keys_conv.is_owned = false;
12899 LDKChannelPublicKeys countersignatory_keys_conv;
12900 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
12901 countersignatory_keys_conv.is_owned = false;
12902 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12903 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
12904 return (long)ret_conv;
12907 void TrustedCommitmentTransaction_1free(void* ctx_TODO, uint32_t this_ptr) {
12908 LDKTrustedCommitmentTransaction this_ptr_conv;
12909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12910 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12911 TrustedCommitmentTransaction_free(this_ptr_conv);
12914 int8_tArray TrustedCommitmentTransaction_1txid(void* ctx_TODO, uint32_t this_arg) {
12915 LDKTrustedCommitmentTransaction this_arg_conv;
12916 this_arg_conv.inner = (void*)(this_arg & (~1));
12917 this_arg_conv.is_owned = false;
12918 int8_tArray arg_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
12919 memcpy(arg_arr.ptr, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
12923 uint32_t TrustedCommitmentTransaction_1built_1transaction(void* ctx_TODO, uint32_t this_arg) {
12924 LDKTrustedCommitmentTransaction this_arg_conv;
12925 this_arg_conv.inner = (void*)(this_arg & (~1));
12926 this_arg_conv.is_owned = false;
12927 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
12928 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12929 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12930 long ret_ref = (long)ret_var.inner;
12931 if (ret_var.is_owned) {
12937 uint32_t TrustedCommitmentTransaction_1keys(void* ctx_TODO, uint32_t this_arg) {
12938 LDKTrustedCommitmentTransaction this_arg_conv;
12939 this_arg_conv.inner = (void*)(this_arg & (~1));
12940 this_arg_conv.is_owned = false;
12941 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
12942 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12943 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12944 long ret_ref = (long)ret_var.inner;
12945 if (ret_var.is_owned) {
12951 uint32_t TrustedCommitmentTransaction_1get_1htlc_1sigs(void* ctx_TODO, uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
12952 LDKTrustedCommitmentTransaction this_arg_conv;
12953 this_arg_conv.inner = (void*)(this_arg & (~1));
12954 this_arg_conv.is_owned = false;
12955 unsigned char htlc_base_key_arr[32];
12956 CHECK(htlc_base_key.len == 32);
12957 memcpy(htlc_base_key_arr, htlc_base_key.ptr, 32);
12958 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
12959 LDKDirectedChannelTransactionParameters channel_parameters_conv;
12960 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
12961 channel_parameters_conv.is_owned = false;
12962 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12963 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
12964 return (long)ret_conv;
12967 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) {
12968 LDKPublicKey broadcaster_payment_basepoint_ref;
12969 CHECK(broadcaster_payment_basepoint.len == 33);
12970 memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint.ptr, 33);
12971 LDKPublicKey countersignatory_payment_basepoint_ref;
12972 CHECK(countersignatory_payment_basepoint.len == 33);
12973 memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint.ptr, 33);
12974 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
12978 void InitFeatures_1free(void* ctx_TODO, uint32_t this_ptr) {
12979 LDKInitFeatures this_ptr_conv;
12980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12981 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12982 InitFeatures_free(this_ptr_conv);
12985 void NodeFeatures_1free(void* ctx_TODO, uint32_t this_ptr) {
12986 LDKNodeFeatures this_ptr_conv;
12987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12988 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12989 NodeFeatures_free(this_ptr_conv);
12992 void ChannelFeatures_1free(void* ctx_TODO, uint32_t this_ptr) {
12993 LDKChannelFeatures this_ptr_conv;
12994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12995 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12996 ChannelFeatures_free(this_ptr_conv);
12999 void RouteHop_1free(void* ctx_TODO, uint32_t this_ptr) {
13000 LDKRouteHop this_ptr_conv;
13001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13002 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13003 RouteHop_free(this_ptr_conv);
13006 uint32_t RouteHop_1clone(void* ctx_TODO, uint32_t orig) {
13007 LDKRouteHop orig_conv;
13008 orig_conv.inner = (void*)(orig & (~1));
13009 orig_conv.is_owned = false;
13010 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
13011 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13012 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13013 long ret_ref = (long)ret_var.inner;
13014 if (ret_var.is_owned) {
13020 int8_tArray RouteHop_1get_1pubkey(void* ctx_TODO, uint32_t this_ptr) {
13021 LDKRouteHop this_ptr_conv;
13022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13023 this_ptr_conv.is_owned = false;
13024 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
13025 memcpy(arg_arr.ptr, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
13029 void RouteHop_1set_1pubkey(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13030 LDKRouteHop this_ptr_conv;
13031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13032 this_ptr_conv.is_owned = false;
13033 LDKPublicKey val_ref;
13034 CHECK(val.len == 33);
13035 memcpy(val_ref.compressed_form, val.ptr, 33);
13036 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
13039 uint32_t RouteHop_1get_1node_1features(void* ctx_TODO, uint32_t this_ptr) {
13040 LDKRouteHop this_ptr_conv;
13041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13042 this_ptr_conv.is_owned = false;
13043 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
13044 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13045 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13046 long ret_ref = (long)ret_var.inner;
13047 if (ret_var.is_owned) {
13053 void RouteHop_1set_1node_1features(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
13054 LDKRouteHop this_ptr_conv;
13055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13056 this_ptr_conv.is_owned = false;
13057 LDKNodeFeatures val_conv;
13058 val_conv.inner = (void*)(val & (~1));
13059 val_conv.is_owned = (val & 1) || (val == 0);
13060 // Warning: we may need a move here but can't clone!
13061 RouteHop_set_node_features(&this_ptr_conv, val_conv);
13064 int64_t RouteHop_1get_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
13065 LDKRouteHop this_ptr_conv;
13066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13067 this_ptr_conv.is_owned = false;
13068 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
13072 void RouteHop_1set_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
13073 LDKRouteHop this_ptr_conv;
13074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13075 this_ptr_conv.is_owned = false;
13076 RouteHop_set_short_channel_id(&this_ptr_conv, val);
13079 uint32_t RouteHop_1get_1channel_1features(void* ctx_TODO, uint32_t this_ptr) {
13080 LDKRouteHop this_ptr_conv;
13081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13082 this_ptr_conv.is_owned = false;
13083 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
13084 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13085 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13086 long ret_ref = (long)ret_var.inner;
13087 if (ret_var.is_owned) {
13093 void RouteHop_1set_1channel_1features(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
13094 LDKRouteHop this_ptr_conv;
13095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13096 this_ptr_conv.is_owned = false;
13097 LDKChannelFeatures val_conv;
13098 val_conv.inner = (void*)(val & (~1));
13099 val_conv.is_owned = (val & 1) || (val == 0);
13100 // Warning: we may need a move here but can't clone!
13101 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
13104 int64_t RouteHop_1get_1fee_1msat(void* ctx_TODO, uint32_t this_ptr) {
13105 LDKRouteHop this_ptr_conv;
13106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13107 this_ptr_conv.is_owned = false;
13108 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
13112 void RouteHop_1set_1fee_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
13113 LDKRouteHop this_ptr_conv;
13114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13115 this_ptr_conv.is_owned = false;
13116 RouteHop_set_fee_msat(&this_ptr_conv, val);
13119 int32_t RouteHop_1get_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr) {
13120 LDKRouteHop this_ptr_conv;
13121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13122 this_ptr_conv.is_owned = false;
13123 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
13127 void RouteHop_1set_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
13128 LDKRouteHop this_ptr_conv;
13129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13130 this_ptr_conv.is_owned = false;
13131 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
13134 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) {
13135 LDKPublicKey pubkey_arg_ref;
13136 CHECK(pubkey_arg.len == 33);
13137 memcpy(pubkey_arg_ref.compressed_form, pubkey_arg.ptr, 33);
13138 LDKNodeFeatures node_features_arg_conv;
13139 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
13140 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
13141 // Warning: we may need a move here but can't clone!
13142 LDKChannelFeatures channel_features_arg_conv;
13143 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
13144 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
13145 // Warning: we may need a move here but can't clone!
13146 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);
13147 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13148 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13149 long ret_ref = (long)ret_var.inner;
13150 if (ret_var.is_owned) {
13156 void Route_1free(void* ctx_TODO, uint32_t this_ptr) {
13157 LDKRoute this_ptr_conv;
13158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13159 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13160 Route_free(this_ptr_conv);
13163 uint32_t Route_1clone(void* ctx_TODO, uint32_t orig) {
13164 LDKRoute orig_conv;
13165 orig_conv.inner = (void*)(orig & (~1));
13166 orig_conv.is_owned = false;
13167 LDKRoute ret_var = Route_clone(&orig_conv);
13168 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13169 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13170 long ret_ref = (long)ret_var.inner;
13171 if (ret_var.is_owned) {
13177 void Route_1set_1paths(void* ctx_TODO, uint32_t this_ptr, uint32_tArray val) {
13178 LDKRoute this_ptr_conv;
13179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13180 this_ptr_conv.is_owned = false;
13181 LDKCVec_CVec_RouteHopZZ val_constr;
13182 val_constr.datalen = val.len;
13183 if (val_constr.datalen > 0)
13184 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13186 val_constr.data = NULL;
13187 uint32_tArray* val_vals = (uint32_tArray*) val.ptr;
13188 for (size_t m = 0; m < val_constr.datalen; m++) {
13189 uint32_tArray arr_conv_12 = val_vals[m];
13190 LDKCVec_RouteHopZ arr_conv_12_constr;
13191 arr_conv_12_constr.datalen = arr_conv_12.len;
13192 if (arr_conv_12_constr.datalen > 0)
13193 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13195 arr_conv_12_constr.data = NULL;
13196 uint32_t* arr_conv_12_vals = (uint32_t*) arr_conv_12.ptr;
13197 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
13198 uint32_t arr_conv_10 = arr_conv_12_vals[k];
13199 LDKRouteHop arr_conv_10_conv;
13200 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
13201 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
13202 if (arr_conv_10_conv.inner != NULL)
13203 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
13204 arr_conv_12_constr.data[k] = arr_conv_10_conv;
13206 val_constr.data[m] = arr_conv_12_constr;
13208 Route_set_paths(&this_ptr_conv, val_constr);
13211 uint32_t Route_1new(void* ctx_TODO, uint32_tArray paths_arg) {
13212 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
13213 paths_arg_constr.datalen = paths_arg.len;
13214 if (paths_arg_constr.datalen > 0)
13215 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13217 paths_arg_constr.data = NULL;
13218 uint32_tArray* paths_arg_vals = (uint32_tArray*) paths_arg.ptr;
13219 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
13220 uint32_tArray arr_conv_12 = paths_arg_vals[m];
13221 LDKCVec_RouteHopZ arr_conv_12_constr;
13222 arr_conv_12_constr.datalen = arr_conv_12.len;
13223 if (arr_conv_12_constr.datalen > 0)
13224 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13226 arr_conv_12_constr.data = NULL;
13227 uint32_t* arr_conv_12_vals = (uint32_t*) arr_conv_12.ptr;
13228 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
13229 uint32_t arr_conv_10 = arr_conv_12_vals[k];
13230 LDKRouteHop arr_conv_10_conv;
13231 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
13232 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
13233 if (arr_conv_10_conv.inner != NULL)
13234 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
13235 arr_conv_12_constr.data[k] = arr_conv_10_conv;
13237 paths_arg_constr.data[m] = arr_conv_12_constr;
13239 LDKRoute ret_var = Route_new(paths_arg_constr);
13240 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13241 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13242 long ret_ref = (long)ret_var.inner;
13243 if (ret_var.is_owned) {
13249 int8_tArray Route_1write(void* ctx_TODO, uint32_t obj) {
13251 obj_conv.inner = (void*)(obj & (~1));
13252 obj_conv.is_owned = false;
13253 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
13254 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
13255 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
13256 CVec_u8Z_free(arg_var);
13260 uint32_t Route_1read(void* ctx_TODO, int8_tArray ser) {
13261 LDKu8slice ser_ref;
13262 ser_ref.datalen = ser.len;
13263 ser_ref.data = ser.ptr;
13264 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13265 *ret_conv = Route_read(ser_ref);
13266 return (long)ret_conv;
13269 void RouteHint_1free(void* ctx_TODO, uint32_t this_ptr) {
13270 LDKRouteHint this_ptr_conv;
13271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13272 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13273 RouteHint_free(this_ptr_conv);
13276 uint32_t RouteHint_1clone(void* ctx_TODO, uint32_t orig) {
13277 LDKRouteHint orig_conv;
13278 orig_conv.inner = (void*)(orig & (~1));
13279 orig_conv.is_owned = false;
13280 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
13281 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13282 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13283 long ret_ref = (long)ret_var.inner;
13284 if (ret_var.is_owned) {
13290 int8_tArray RouteHint_1get_1src_1node_1id(void* ctx_TODO, uint32_t this_ptr) {
13291 LDKRouteHint this_ptr_conv;
13292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13293 this_ptr_conv.is_owned = false;
13294 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
13295 memcpy(arg_arr.ptr, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form, 33);
13299 void RouteHint_1set_1src_1node_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13300 LDKRouteHint this_ptr_conv;
13301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13302 this_ptr_conv.is_owned = false;
13303 LDKPublicKey val_ref;
13304 CHECK(val.len == 33);
13305 memcpy(val_ref.compressed_form, val.ptr, 33);
13306 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
13309 int64_t RouteHint_1get_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
13310 LDKRouteHint this_ptr_conv;
13311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13312 this_ptr_conv.is_owned = false;
13313 int64_t ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
13317 void RouteHint_1set_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
13318 LDKRouteHint this_ptr_conv;
13319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13320 this_ptr_conv.is_owned = false;
13321 RouteHint_set_short_channel_id(&this_ptr_conv, val);
13324 uint32_t RouteHint_1get_1fees(void* ctx_TODO, uint32_t this_ptr) {
13325 LDKRouteHint this_ptr_conv;
13326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13327 this_ptr_conv.is_owned = false;
13328 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
13329 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13330 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13331 long ret_ref = (long)ret_var.inner;
13332 if (ret_var.is_owned) {
13338 void RouteHint_1set_1fees(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
13339 LDKRouteHint this_ptr_conv;
13340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13341 this_ptr_conv.is_owned = false;
13342 LDKRoutingFees val_conv;
13343 val_conv.inner = (void*)(val & (~1));
13344 val_conv.is_owned = (val & 1) || (val == 0);
13345 if (val_conv.inner != NULL)
13346 val_conv = RoutingFees_clone(&val_conv);
13347 RouteHint_set_fees(&this_ptr_conv, val_conv);
13350 jshort RouteHint_1get_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr) {
13351 LDKRouteHint this_ptr_conv;
13352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13353 this_ptr_conv.is_owned = false;
13354 jshort ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
13358 void RouteHint_1set_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr, jshort val) {
13359 LDKRouteHint this_ptr_conv;
13360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13361 this_ptr_conv.is_owned = false;
13362 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
13365 int64_t RouteHint_1get_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr) {
13366 LDKRouteHint this_ptr_conv;
13367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13368 this_ptr_conv.is_owned = false;
13369 int64_t ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
13373 void RouteHint_1set_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
13374 LDKRouteHint this_ptr_conv;
13375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13376 this_ptr_conv.is_owned = false;
13377 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
13380 uint32_t RouteHint_1new(void* ctx_TODO, int8_tArray src_node_id_arg, int64_t short_channel_id_arg, uint32_t fees_arg, jshort cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg) {
13381 LDKPublicKey src_node_id_arg_ref;
13382 CHECK(src_node_id_arg.len == 33);
13383 memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg.ptr, 33);
13384 LDKRoutingFees fees_arg_conv;
13385 fees_arg_conv.inner = (void*)(fees_arg & (~1));
13386 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
13387 if (fees_arg_conv.inner != NULL)
13388 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
13389 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);
13390 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13391 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13392 long ret_ref = (long)ret_var.inner;
13393 if (ret_var.is_owned) {
13399 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) {
13400 LDKPublicKey our_node_id_ref;
13401 CHECK(our_node_id.len == 33);
13402 memcpy(our_node_id_ref.compressed_form, our_node_id.ptr, 33);
13403 LDKNetworkGraph network_conv;
13404 network_conv.inner = (void*)(network & (~1));
13405 network_conv.is_owned = false;
13406 LDKPublicKey target_ref;
13407 CHECK(target.len == 33);
13408 memcpy(target_ref.compressed_form, target.ptr, 33);
13409 LDKCVec_ChannelDetailsZ first_hops_constr;
13410 first_hops_constr.datalen = first_hops.len;
13411 if (first_hops_constr.datalen > 0)
13412 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13414 first_hops_constr.data = NULL;
13415 uint32_t* first_hops_vals = (uint32_t*) first_hops.ptr;
13416 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
13417 uint32_t arr_conv_16 = first_hops_vals[q];
13418 LDKChannelDetails arr_conv_16_conv;
13419 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
13420 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
13421 first_hops_constr.data[q] = arr_conv_16_conv;
13423 LDKCVec_RouteHintZ last_hops_constr;
13424 last_hops_constr.datalen = last_hops.len;
13425 if (last_hops_constr.datalen > 0)
13426 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
13428 last_hops_constr.data = NULL;
13429 uint32_t* last_hops_vals = (uint32_t*) last_hops.ptr;
13430 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
13431 uint32_t arr_conv_11 = last_hops_vals[l];
13432 LDKRouteHint arr_conv_11_conv;
13433 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
13434 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
13435 if (arr_conv_11_conv.inner != NULL)
13436 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
13437 last_hops_constr.data[l] = arr_conv_11_conv;
13439 LDKLogger logger_conv = *(LDKLogger*)logger;
13440 if (logger_conv.free == LDKLogger_JCalls_free) {
13441 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13442 LDKLogger_JCalls_clone(logger_conv.this_arg);
13444 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13445 *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);
13446 FREE(first_hops_constr.data);
13447 return (long)ret_conv;
13450 void NetworkGraph_1free(void* ctx_TODO, uint32_t this_ptr) {
13451 LDKNetworkGraph this_ptr_conv;
13452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13453 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13454 NetworkGraph_free(this_ptr_conv);
13457 void LockedNetworkGraph_1free(void* ctx_TODO, uint32_t this_ptr) {
13458 LDKLockedNetworkGraph this_ptr_conv;
13459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13460 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13461 LockedNetworkGraph_free(this_ptr_conv);
13464 void NetGraphMsgHandler_1free(void* ctx_TODO, uint32_t this_ptr) {
13465 LDKNetGraphMsgHandler this_ptr_conv;
13466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13467 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13468 NetGraphMsgHandler_free(this_ptr_conv);
13471 uint32_t NetGraphMsgHandler_1new(void* ctx_TODO, int8_tArray genesis_hash, uint32_t chain_access, uint32_t logger) {
13472 LDKThirtyTwoBytes genesis_hash_ref;
13473 CHECK(genesis_hash.len == 32);
13474 memcpy(genesis_hash_ref.data, genesis_hash.ptr, 32);
13475 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
13476 LDKLogger logger_conv = *(LDKLogger*)logger;
13477 if (logger_conv.free == LDKLogger_JCalls_free) {
13478 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13479 LDKLogger_JCalls_clone(logger_conv.this_arg);
13481 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv, logger_conv);
13482 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13483 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13484 long ret_ref = (long)ret_var.inner;
13485 if (ret_var.is_owned) {
13491 uint32_t NetGraphMsgHandler_1from_1net_1graph(void* ctx_TODO, uint32_t chain_access, uint32_t logger, uint32_t network_graph) {
13492 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
13493 LDKLogger logger_conv = *(LDKLogger*)logger;
13494 if (logger_conv.free == LDKLogger_JCalls_free) {
13495 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13496 LDKLogger_JCalls_clone(logger_conv.this_arg);
13498 LDKNetworkGraph network_graph_conv;
13499 network_graph_conv.inner = (void*)(network_graph & (~1));
13500 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
13501 // Warning: we may need a move here but can't clone!
13502 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
13503 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13504 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13505 long ret_ref = (long)ret_var.inner;
13506 if (ret_var.is_owned) {
13512 uint32_t NetGraphMsgHandler_1read_1locked_1graph(void* ctx_TODO, uint32_t this_arg) {
13513 LDKNetGraphMsgHandler this_arg_conv;
13514 this_arg_conv.inner = (void*)(this_arg & (~1));
13515 this_arg_conv.is_owned = false;
13516 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
13517 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13518 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13519 long ret_ref = (long)ret_var.inner;
13520 if (ret_var.is_owned) {
13526 uint32_t LockedNetworkGraph_1graph(void* ctx_TODO, uint32_t this_arg) {
13527 LDKLockedNetworkGraph this_arg_conv;
13528 this_arg_conv.inner = (void*)(this_arg & (~1));
13529 this_arg_conv.is_owned = false;
13530 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
13531 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13532 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13533 long ret_ref = (long)ret_var.inner;
13534 if (ret_var.is_owned) {
13540 uint32_t NetGraphMsgHandler_1as_1RoutingMessageHandler(void* ctx_TODO, uint32_t this_arg) {
13541 LDKNetGraphMsgHandler this_arg_conv;
13542 this_arg_conv.inner = (void*)(this_arg & (~1));
13543 this_arg_conv.is_owned = false;
13544 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
13545 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
13549 uint32_t NetGraphMsgHandler_1as_1MessageSendEventsProvider(void* ctx_TODO, uint32_t this_arg) {
13550 LDKNetGraphMsgHandler this_arg_conv;
13551 this_arg_conv.inner = (void*)(this_arg & (~1));
13552 this_arg_conv.is_owned = false;
13553 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
13554 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
13558 void DirectionalChannelInfo_1free(void* ctx_TODO, uint32_t this_ptr) {
13559 LDKDirectionalChannelInfo this_ptr_conv;
13560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13561 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13562 DirectionalChannelInfo_free(this_ptr_conv);
13565 int32_t DirectionalChannelInfo_1get_1last_1update(void* ctx_TODO, uint32_t this_ptr) {
13566 LDKDirectionalChannelInfo this_ptr_conv;
13567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13568 this_ptr_conv.is_owned = false;
13569 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
13573 void DirectionalChannelInfo_1set_1last_1update(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
13574 LDKDirectionalChannelInfo this_ptr_conv;
13575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13576 this_ptr_conv.is_owned = false;
13577 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
13580 jboolean DirectionalChannelInfo_1get_1enabled(void* ctx_TODO, uint32_t this_ptr) {
13581 LDKDirectionalChannelInfo this_ptr_conv;
13582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13583 this_ptr_conv.is_owned = false;
13584 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
13588 void DirectionalChannelInfo_1set_1enabled(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
13589 LDKDirectionalChannelInfo this_ptr_conv;
13590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13591 this_ptr_conv.is_owned = false;
13592 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
13595 jshort DirectionalChannelInfo_1get_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr) {
13596 LDKDirectionalChannelInfo this_ptr_conv;
13597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13598 this_ptr_conv.is_owned = false;
13599 jshort ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
13603 void DirectionalChannelInfo_1set_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr, jshort val) {
13604 LDKDirectionalChannelInfo this_ptr_conv;
13605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13606 this_ptr_conv.is_owned = false;
13607 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
13610 int64_t DirectionalChannelInfo_1get_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr) {
13611 LDKDirectionalChannelInfo this_ptr_conv;
13612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13613 this_ptr_conv.is_owned = false;
13614 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
13618 void DirectionalChannelInfo_1set_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
13619 LDKDirectionalChannelInfo this_ptr_conv;
13620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13621 this_ptr_conv.is_owned = false;
13622 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
13625 uint32_t DirectionalChannelInfo_1get_1fees(void* ctx_TODO, uint32_t this_ptr) {
13626 LDKDirectionalChannelInfo this_ptr_conv;
13627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13628 this_ptr_conv.is_owned = false;
13629 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
13630 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13631 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13632 long ret_ref = (long)ret_var.inner;
13633 if (ret_var.is_owned) {
13639 void DirectionalChannelInfo_1set_1fees(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
13640 LDKDirectionalChannelInfo this_ptr_conv;
13641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13642 this_ptr_conv.is_owned = false;
13643 LDKRoutingFees val_conv;
13644 val_conv.inner = (void*)(val & (~1));
13645 val_conv.is_owned = (val & 1) || (val == 0);
13646 if (val_conv.inner != NULL)
13647 val_conv = RoutingFees_clone(&val_conv);
13648 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
13651 uint32_t DirectionalChannelInfo_1get_1last_1update_1message(void* ctx_TODO, uint32_t this_ptr) {
13652 LDKDirectionalChannelInfo this_ptr_conv;
13653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13654 this_ptr_conv.is_owned = false;
13655 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
13656 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13657 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13658 long ret_ref = (long)ret_var.inner;
13659 if (ret_var.is_owned) {
13665 void DirectionalChannelInfo_1set_1last_1update_1message(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
13666 LDKDirectionalChannelInfo this_ptr_conv;
13667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13668 this_ptr_conv.is_owned = false;
13669 LDKChannelUpdate val_conv;
13670 val_conv.inner = (void*)(val & (~1));
13671 val_conv.is_owned = (val & 1) || (val == 0);
13672 if (val_conv.inner != NULL)
13673 val_conv = ChannelUpdate_clone(&val_conv);
13674 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
13677 int8_tArray DirectionalChannelInfo_1write(void* ctx_TODO, uint32_t obj) {
13678 LDKDirectionalChannelInfo obj_conv;
13679 obj_conv.inner = (void*)(obj & (~1));
13680 obj_conv.is_owned = false;
13681 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
13682 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
13683 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
13684 CVec_u8Z_free(arg_var);
13688 uint32_t DirectionalChannelInfo_1read(void* ctx_TODO, int8_tArray ser) {
13689 LDKu8slice ser_ref;
13690 ser_ref.datalen = ser.len;
13691 ser_ref.data = ser.ptr;
13692 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_read(ser_ref);
13693 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13694 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13695 long ret_ref = (long)ret_var.inner;
13696 if (ret_var.is_owned) {
13702 void ChannelInfo_1free(void* ctx_TODO, uint32_t this_ptr) {
13703 LDKChannelInfo this_ptr_conv;
13704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13705 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13706 ChannelInfo_free(this_ptr_conv);
13709 uint32_t ChannelInfo_1get_1features(void* ctx_TODO, uint32_t this_ptr) {
13710 LDKChannelInfo this_ptr_conv;
13711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13712 this_ptr_conv.is_owned = false;
13713 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
13714 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13715 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13716 long ret_ref = (long)ret_var.inner;
13717 if (ret_var.is_owned) {
13723 void ChannelInfo_1set_1features(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
13724 LDKChannelInfo this_ptr_conv;
13725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13726 this_ptr_conv.is_owned = false;
13727 LDKChannelFeatures val_conv;
13728 val_conv.inner = (void*)(val & (~1));
13729 val_conv.is_owned = (val & 1) || (val == 0);
13730 // Warning: we may need a move here but can't clone!
13731 ChannelInfo_set_features(&this_ptr_conv, val_conv);
13734 int8_tArray ChannelInfo_1get_1node_1one(void* ctx_TODO, uint32_t this_ptr) {
13735 LDKChannelInfo this_ptr_conv;
13736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13737 this_ptr_conv.is_owned = false;
13738 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
13739 memcpy(arg_arr.ptr, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form, 33);
13743 void ChannelInfo_1set_1node_1one(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13744 LDKChannelInfo this_ptr_conv;
13745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13746 this_ptr_conv.is_owned = false;
13747 LDKPublicKey val_ref;
13748 CHECK(val.len == 33);
13749 memcpy(val_ref.compressed_form, val.ptr, 33);
13750 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
13753 uint32_t ChannelInfo_1get_1one_1to_1two(void* ctx_TODO, uint32_t this_ptr) {
13754 LDKChannelInfo this_ptr_conv;
13755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13756 this_ptr_conv.is_owned = false;
13757 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
13758 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13759 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13760 long ret_ref = (long)ret_var.inner;
13761 if (ret_var.is_owned) {
13767 void ChannelInfo_1set_1one_1to_1two(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
13768 LDKChannelInfo this_ptr_conv;
13769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13770 this_ptr_conv.is_owned = false;
13771 LDKDirectionalChannelInfo val_conv;
13772 val_conv.inner = (void*)(val & (~1));
13773 val_conv.is_owned = (val & 1) || (val == 0);
13774 // Warning: we may need a move here but can't clone!
13775 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
13778 int8_tArray ChannelInfo_1get_1node_1two(void* ctx_TODO, uint32_t this_ptr) {
13779 LDKChannelInfo this_ptr_conv;
13780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13781 this_ptr_conv.is_owned = false;
13782 int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
13783 memcpy(arg_arr.ptr, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form, 33);
13787 void ChannelInfo_1set_1node_1two(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13788 LDKChannelInfo this_ptr_conv;
13789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13790 this_ptr_conv.is_owned = false;
13791 LDKPublicKey val_ref;
13792 CHECK(val.len == 33);
13793 memcpy(val_ref.compressed_form, val.ptr, 33);
13794 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
13797 uint32_t ChannelInfo_1get_1two_1to_1one(void* ctx_TODO, uint32_t this_ptr) {
13798 LDKChannelInfo this_ptr_conv;
13799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13800 this_ptr_conv.is_owned = false;
13801 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
13802 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13803 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13804 long ret_ref = (long)ret_var.inner;
13805 if (ret_var.is_owned) {
13811 void ChannelInfo_1set_1two_1to_1one(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
13812 LDKChannelInfo this_ptr_conv;
13813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13814 this_ptr_conv.is_owned = false;
13815 LDKDirectionalChannelInfo val_conv;
13816 val_conv.inner = (void*)(val & (~1));
13817 val_conv.is_owned = (val & 1) || (val == 0);
13818 // Warning: we may need a move here but can't clone!
13819 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
13822 uint32_t ChannelInfo_1get_1announcement_1message(void* ctx_TODO, uint32_t this_ptr) {
13823 LDKChannelInfo this_ptr_conv;
13824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13825 this_ptr_conv.is_owned = false;
13826 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
13827 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13828 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13829 long ret_ref = (long)ret_var.inner;
13830 if (ret_var.is_owned) {
13836 void ChannelInfo_1set_1announcement_1message(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
13837 LDKChannelInfo this_ptr_conv;
13838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13839 this_ptr_conv.is_owned = false;
13840 LDKChannelAnnouncement val_conv;
13841 val_conv.inner = (void*)(val & (~1));
13842 val_conv.is_owned = (val & 1) || (val == 0);
13843 if (val_conv.inner != NULL)
13844 val_conv = ChannelAnnouncement_clone(&val_conv);
13845 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
13848 int8_tArray ChannelInfo_1write(void* ctx_TODO, uint32_t obj) {
13849 LDKChannelInfo obj_conv;
13850 obj_conv.inner = (void*)(obj & (~1));
13851 obj_conv.is_owned = false;
13852 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
13853 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
13854 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
13855 CVec_u8Z_free(arg_var);
13859 uint32_t ChannelInfo_1read(void* ctx_TODO, int8_tArray ser) {
13860 LDKu8slice ser_ref;
13861 ser_ref.datalen = ser.len;
13862 ser_ref.data = ser.ptr;
13863 LDKChannelInfo ret_var = ChannelInfo_read(ser_ref);
13864 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13865 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13866 long ret_ref = (long)ret_var.inner;
13867 if (ret_var.is_owned) {
13873 void RoutingFees_1free(void* ctx_TODO, uint32_t this_ptr) {
13874 LDKRoutingFees this_ptr_conv;
13875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13876 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13877 RoutingFees_free(this_ptr_conv);
13880 uint32_t RoutingFees_1clone(void* ctx_TODO, uint32_t orig) {
13881 LDKRoutingFees orig_conv;
13882 orig_conv.inner = (void*)(orig & (~1));
13883 orig_conv.is_owned = false;
13884 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
13885 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13886 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13887 long ret_ref = (long)ret_var.inner;
13888 if (ret_var.is_owned) {
13894 int32_t RoutingFees_1get_1base_1msat(void* ctx_TODO, uint32_t this_ptr) {
13895 LDKRoutingFees this_ptr_conv;
13896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13897 this_ptr_conv.is_owned = false;
13898 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
13902 void RoutingFees_1set_1base_1msat(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
13903 LDKRoutingFees this_ptr_conv;
13904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13905 this_ptr_conv.is_owned = false;
13906 RoutingFees_set_base_msat(&this_ptr_conv, val);
13909 int32_t RoutingFees_1get_1proportional_1millionths(void* ctx_TODO, uint32_t this_ptr) {
13910 LDKRoutingFees this_ptr_conv;
13911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13912 this_ptr_conv.is_owned = false;
13913 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
13917 void RoutingFees_1set_1proportional_1millionths(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
13918 LDKRoutingFees this_ptr_conv;
13919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13920 this_ptr_conv.is_owned = false;
13921 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
13924 uint32_t RoutingFees_1new(void* ctx_TODO, int32_t base_msat_arg, int32_t proportional_millionths_arg) {
13925 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
13926 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13927 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13928 long ret_ref = (long)ret_var.inner;
13929 if (ret_var.is_owned) {
13935 uint32_t RoutingFees_1read(void* ctx_TODO, int8_tArray ser) {
13936 LDKu8slice ser_ref;
13937 ser_ref.datalen = ser.len;
13938 ser_ref.data = ser.ptr;
13939 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13940 *ret_conv = RoutingFees_read(ser_ref);
13941 return (long)ret_conv;
13944 int8_tArray RoutingFees_1write(void* ctx_TODO, uint32_t obj) {
13945 LDKRoutingFees obj_conv;
13946 obj_conv.inner = (void*)(obj & (~1));
13947 obj_conv.is_owned = false;
13948 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
13949 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
13950 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
13951 CVec_u8Z_free(arg_var);
13955 void NodeAnnouncementInfo_1free(void* ctx_TODO, uint32_t this_ptr) {
13956 LDKNodeAnnouncementInfo this_ptr_conv;
13957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13958 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13959 NodeAnnouncementInfo_free(this_ptr_conv);
13962 uint32_t NodeAnnouncementInfo_1get_1features(void* ctx_TODO, uint32_t this_ptr) {
13963 LDKNodeAnnouncementInfo this_ptr_conv;
13964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13965 this_ptr_conv.is_owned = false;
13966 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_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 NodeAnnouncementInfo_1set_1features(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
13977 LDKNodeAnnouncementInfo this_ptr_conv;
13978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13979 this_ptr_conv.is_owned = false;
13980 LDKNodeFeatures val_conv;
13981 val_conv.inner = (void*)(val & (~1));
13982 val_conv.is_owned = (val & 1) || (val == 0);
13983 // Warning: we may need a move here but can't clone!
13984 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
13987 int32_t NodeAnnouncementInfo_1get_1last_1update(void* ctx_TODO, uint32_t this_ptr) {
13988 LDKNodeAnnouncementInfo this_ptr_conv;
13989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13990 this_ptr_conv.is_owned = false;
13991 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
13995 void NodeAnnouncementInfo_1set_1last_1update(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
13996 LDKNodeAnnouncementInfo this_ptr_conv;
13997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13998 this_ptr_conv.is_owned = false;
13999 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
14002 int8_tArray NodeAnnouncementInfo_1get_1rgb(void* ctx_TODO, uint32_t this_ptr) {
14003 LDKNodeAnnouncementInfo this_ptr_conv;
14004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14005 this_ptr_conv.is_owned = false;
14006 int8_tArray ret_arr = { .len = 3, .ptr = MALLOC(3, "Native int8_tArray Bytes") };
14007 memcpy(ret_arr.ptr, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
14011 void NodeAnnouncementInfo_1set_1rgb(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
14012 LDKNodeAnnouncementInfo this_ptr_conv;
14013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14014 this_ptr_conv.is_owned = false;
14015 LDKThreeBytes val_ref;
14016 CHECK(val.len == 3);
14017 memcpy(val_ref.data, val.ptr, 3);
14018 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
14021 int8_tArray NodeAnnouncementInfo_1get_1alias(void* ctx_TODO, uint32_t this_ptr) {
14022 LDKNodeAnnouncementInfo this_ptr_conv;
14023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14024 this_ptr_conv.is_owned = false;
14025 int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
14026 memcpy(ret_arr.ptr, *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
14030 void NodeAnnouncementInfo_1set_1alias(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
14031 LDKNodeAnnouncementInfo this_ptr_conv;
14032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14033 this_ptr_conv.is_owned = false;
14034 LDKThirtyTwoBytes val_ref;
14035 CHECK(val.len == 32);
14036 memcpy(val_ref.data, val.ptr, 32);
14037 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
14040 void NodeAnnouncementInfo_1set_1addresses(void* ctx_TODO, uint32_t this_ptr, uint32_tArray val) {
14041 LDKNodeAnnouncementInfo this_ptr_conv;
14042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14043 this_ptr_conv.is_owned = false;
14044 LDKCVec_NetAddressZ val_constr;
14045 val_constr.datalen = val.len;
14046 if (val_constr.datalen > 0)
14047 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14049 val_constr.data = NULL;
14050 uint32_t* val_vals = (uint32_t*) val.ptr;
14051 for (size_t m = 0; m < val_constr.datalen; m++) {
14052 uint32_t arr_conv_12 = val_vals[m];
14053 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
14054 FREE((void*)arr_conv_12);
14055 val_constr.data[m] = arr_conv_12_conv;
14057 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
14060 uint32_t NodeAnnouncementInfo_1get_1announcement_1message(void* ctx_TODO, uint32_t this_ptr) {
14061 LDKNodeAnnouncementInfo this_ptr_conv;
14062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14063 this_ptr_conv.is_owned = false;
14064 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
14065 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14066 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14067 long ret_ref = (long)ret_var.inner;
14068 if (ret_var.is_owned) {
14074 void NodeAnnouncementInfo_1set_1announcement_1message(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
14075 LDKNodeAnnouncementInfo this_ptr_conv;
14076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14077 this_ptr_conv.is_owned = false;
14078 LDKNodeAnnouncement val_conv;
14079 val_conv.inner = (void*)(val & (~1));
14080 val_conv.is_owned = (val & 1) || (val == 0);
14081 if (val_conv.inner != NULL)
14082 val_conv = NodeAnnouncement_clone(&val_conv);
14083 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
14086 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) {
14087 LDKNodeFeatures features_arg_conv;
14088 features_arg_conv.inner = (void*)(features_arg & (~1));
14089 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
14090 // Warning: we may need a move here but can't clone!
14091 LDKThreeBytes rgb_arg_ref;
14092 CHECK(rgb_arg.len == 3);
14093 memcpy(rgb_arg_ref.data, rgb_arg.ptr, 3);
14094 LDKThirtyTwoBytes alias_arg_ref;
14095 CHECK(alias_arg.len == 32);
14096 memcpy(alias_arg_ref.data, alias_arg.ptr, 32);
14097 LDKCVec_NetAddressZ addresses_arg_constr;
14098 addresses_arg_constr.datalen = addresses_arg.len;
14099 if (addresses_arg_constr.datalen > 0)
14100 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14102 addresses_arg_constr.data = NULL;
14103 uint32_t* addresses_arg_vals = (uint32_t*) addresses_arg.ptr;
14104 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
14105 uint32_t arr_conv_12 = addresses_arg_vals[m];
14106 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
14107 FREE((void*)arr_conv_12);
14108 addresses_arg_constr.data[m] = arr_conv_12_conv;
14110 LDKNodeAnnouncement announcement_message_arg_conv;
14111 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
14112 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
14113 if (announcement_message_arg_conv.inner != NULL)
14114 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
14115 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
14116 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14117 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14118 long ret_ref = (long)ret_var.inner;
14119 if (ret_var.is_owned) {
14125 int8_tArray NodeAnnouncementInfo_1write(void* ctx_TODO, uint32_t obj) {
14126 LDKNodeAnnouncementInfo obj_conv;
14127 obj_conv.inner = (void*)(obj & (~1));
14128 obj_conv.is_owned = false;
14129 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
14130 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
14131 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
14132 CVec_u8Z_free(arg_var);
14136 uint32_t NodeAnnouncementInfo_1read(void* ctx_TODO, int8_tArray ser) {
14137 LDKu8slice ser_ref;
14138 ser_ref.datalen = ser.len;
14139 ser_ref.data = ser.ptr;
14140 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14141 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
14142 return (long)ret_conv;
14145 void NodeInfo_1free(void* ctx_TODO, uint32_t this_ptr) {
14146 LDKNodeInfo this_ptr_conv;
14147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14148 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14149 NodeInfo_free(this_ptr_conv);
14152 void NodeInfo_1set_1channels(void* ctx_TODO, uint32_t this_ptr, int64_tArray val) {
14153 LDKNodeInfo this_ptr_conv;
14154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14155 this_ptr_conv.is_owned = false;
14156 LDKCVec_u64Z val_constr;
14157 val_constr.datalen = val.len;
14158 if (val_constr.datalen > 0)
14159 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14161 val_constr.data = NULL;
14162 int64_t* val_vals = (int64_t*) val.ptr;
14163 for (size_t g = 0; g < val_constr.datalen; g++) {
14164 int64_t arr_conv_6 = val_vals[g];
14165 val_constr.data[g] = arr_conv_6;
14167 NodeInfo_set_channels(&this_ptr_conv, val_constr);
14170 uint32_t NodeInfo_1get_1lowest_1inbound_1channel_1fees(void* ctx_TODO, uint32_t this_ptr) {
14171 LDKNodeInfo this_ptr_conv;
14172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14173 this_ptr_conv.is_owned = false;
14174 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
14175 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14176 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14177 long ret_ref = (long)ret_var.inner;
14178 if (ret_var.is_owned) {
14184 void NodeInfo_1set_1lowest_1inbound_1channel_1fees(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
14185 LDKNodeInfo this_ptr_conv;
14186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14187 this_ptr_conv.is_owned = false;
14188 LDKRoutingFees val_conv;
14189 val_conv.inner = (void*)(val & (~1));
14190 val_conv.is_owned = (val & 1) || (val == 0);
14191 if (val_conv.inner != NULL)
14192 val_conv = RoutingFees_clone(&val_conv);
14193 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
14196 uint32_t NodeInfo_1get_1announcement_1info(void* ctx_TODO, uint32_t this_ptr) {
14197 LDKNodeInfo this_ptr_conv;
14198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14199 this_ptr_conv.is_owned = false;
14200 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
14201 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14202 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14203 long ret_ref = (long)ret_var.inner;
14204 if (ret_var.is_owned) {
14210 void NodeInfo_1set_1announcement_1info(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
14211 LDKNodeInfo this_ptr_conv;
14212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14213 this_ptr_conv.is_owned = false;
14214 LDKNodeAnnouncementInfo val_conv;
14215 val_conv.inner = (void*)(val & (~1));
14216 val_conv.is_owned = (val & 1) || (val == 0);
14217 // Warning: we may need a move here but can't clone!
14218 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
14221 uint32_t NodeInfo_1new(void* ctx_TODO, int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
14222 LDKCVec_u64Z channels_arg_constr;
14223 channels_arg_constr.datalen = channels_arg.len;
14224 if (channels_arg_constr.datalen > 0)
14225 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14227 channels_arg_constr.data = NULL;
14228 int64_t* channels_arg_vals = (int64_t*) channels_arg.ptr;
14229 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
14230 int64_t arr_conv_6 = channels_arg_vals[g];
14231 channels_arg_constr.data[g] = arr_conv_6;
14233 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
14234 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
14235 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
14236 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
14237 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
14238 LDKNodeAnnouncementInfo announcement_info_arg_conv;
14239 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
14240 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
14241 // Warning: we may need a move here but can't clone!
14242 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
14243 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14244 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14245 long ret_ref = (long)ret_var.inner;
14246 if (ret_var.is_owned) {
14252 int8_tArray NodeInfo_1write(void* ctx_TODO, uint32_t obj) {
14253 LDKNodeInfo obj_conv;
14254 obj_conv.inner = (void*)(obj & (~1));
14255 obj_conv.is_owned = false;
14256 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
14257 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
14258 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
14259 CVec_u8Z_free(arg_var);
14263 uint32_t NodeInfo_1read(void* ctx_TODO, int8_tArray ser) {
14264 LDKu8slice ser_ref;
14265 ser_ref.datalen = ser.len;
14266 ser_ref.data = ser.ptr;
14267 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14268 *ret_conv = NodeInfo_read(ser_ref);
14269 return (long)ret_conv;
14272 int8_tArray NetworkGraph_1write(void* ctx_TODO, uint32_t obj) {
14273 LDKNetworkGraph obj_conv;
14274 obj_conv.inner = (void*)(obj & (~1));
14275 obj_conv.is_owned = false;
14276 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
14277 int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
14278 memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
14279 CVec_u8Z_free(arg_var);
14283 uint32_t NetworkGraph_1read(void* ctx_TODO, int8_tArray ser) {
14284 LDKu8slice ser_ref;
14285 ser_ref.datalen = ser.len;
14286 ser_ref.data = ser.ptr;
14287 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14288 *ret_conv = NetworkGraph_read(ser_ref);
14289 return (long)ret_conv;
14292 uint32_t NetworkGraph_1new(void* ctx_TODO, int8_tArray genesis_hash) {
14293 LDKThirtyTwoBytes genesis_hash_ref;
14294 CHECK(genesis_hash.len == 32);
14295 memcpy(genesis_hash_ref.data, genesis_hash.ptr, 32);
14296 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
14297 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14298 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14299 long ret_ref = (long)ret_var.inner;
14300 if (ret_var.is_owned) {
14306 uint32_t NetworkGraph_1update_1node_1from_1announcement(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
14307 LDKNetworkGraph this_arg_conv;
14308 this_arg_conv.inner = (void*)(this_arg & (~1));
14309 this_arg_conv.is_owned = false;
14310 LDKNodeAnnouncement msg_conv;
14311 msg_conv.inner = (void*)(msg & (~1));
14312 msg_conv.is_owned = false;
14313 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14314 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
14315 return (long)ret_conv;
14318 uint32_t NetworkGraph_1update_1node_1from_1unsigned_1announcement(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
14319 LDKNetworkGraph this_arg_conv;
14320 this_arg_conv.inner = (void*)(this_arg & (~1));
14321 this_arg_conv.is_owned = false;
14322 LDKUnsignedNodeAnnouncement msg_conv;
14323 msg_conv.inner = (void*)(msg & (~1));
14324 msg_conv.is_owned = false;
14325 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14326 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
14327 return (long)ret_conv;
14330 uint32_t NetworkGraph_1update_1channel_1from_1announcement(void* ctx_TODO, uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
14331 LDKNetworkGraph this_arg_conv;
14332 this_arg_conv.inner = (void*)(this_arg & (~1));
14333 this_arg_conv.is_owned = false;
14334 LDKChannelAnnouncement msg_conv;
14335 msg_conv.inner = (void*)(msg & (~1));
14336 msg_conv.is_owned = false;
14337 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
14338 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14339 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
14340 return (long)ret_conv;
14343 uint32_t NetworkGraph_1update_1channel_1from_1unsigned_1announcement(void* ctx_TODO, uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
14344 LDKNetworkGraph this_arg_conv;
14345 this_arg_conv.inner = (void*)(this_arg & (~1));
14346 this_arg_conv.is_owned = false;
14347 LDKUnsignedChannelAnnouncement msg_conv;
14348 msg_conv.inner = (void*)(msg & (~1));
14349 msg_conv.is_owned = false;
14350 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
14351 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14352 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
14353 return (long)ret_conv;
14356 void NetworkGraph_1close_1channel_1from_1update(void* ctx_TODO, uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
14357 LDKNetworkGraph this_arg_conv;
14358 this_arg_conv.inner = (void*)(this_arg & (~1));
14359 this_arg_conv.is_owned = false;
14360 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
14363 uint32_t NetworkGraph_1update_1channel(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
14364 LDKNetworkGraph this_arg_conv;
14365 this_arg_conv.inner = (void*)(this_arg & (~1));
14366 this_arg_conv.is_owned = false;
14367 LDKChannelUpdate msg_conv;
14368 msg_conv.inner = (void*)(msg & (~1));
14369 msg_conv.is_owned = false;
14370 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14371 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
14372 return (long)ret_conv;
14375 uint32_t NetworkGraph_1update_1channel_1unsigned(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
14376 LDKNetworkGraph this_arg_conv;
14377 this_arg_conv.inner = (void*)(this_arg & (~1));
14378 this_arg_conv.is_owned = false;
14379 LDKUnsignedChannelUpdate msg_conv;
14380 msg_conv.inner = (void*)(msg & (~1));
14381 msg_conv.is_owned = false;
14382 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14383 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
14384 return (long)ret_conv;