1 #include <rust_types.h>
6 // These should be provided...somehow...
7 void *memset(void *s, int c, size_t n);
8 void *memcpy(void *dest, const void *src, size_t n);
9 int memcmp(const void *s1, const void *s2, size_t n);
11 void __attribute__((noreturn)) abort(void);
12 static inline void assert(bool expression) {
13 if (!expression) { abort(); }
16 // Always run a, then assert it is true:
17 #define DO_ASSERT(a) do { bool _assert_val = (a); assert(_assert_val); } while(0)
18 // Assert a is true or do nothing
19 #define CHECK(a) DO_ASSERT(a)
21 // Running a leak check across all the allocations and frees of the JDK is a mess,
22 // so instead we implement our own naive leak checker here, relying on the -wrap
23 // linker option to wrap malloc/calloc/realloc/free, tracking everyhing allocated
24 // and free'd in Rust or C across the generated bindings shared library.
27 typedef struct allocation {
28 struct allocation* next;
30 const char* struct_name;
32 static allocation* allocation_ll = NULL;
34 void* __real_malloc(size_t len);
35 void* __real_calloc(size_t nmemb, size_t len);
36 static void new_allocation(void* res, const char* struct_name) {
37 allocation* new_alloc = __real_malloc(sizeof(allocation));
39 new_alloc->struct_name = struct_name;
40 new_alloc->next = allocation_ll;
41 allocation_ll = new_alloc;
43 static void* MALLOC(size_t len, const char* struct_name) {
44 void* res = __real_malloc(len);
45 new_allocation(res, struct_name);
48 void __real_free(void* ptr);
49 static void alloc_freed(void* ptr) {
51 allocation* it = allocation_ll;
52 while (it->ptr != ptr) {
53 p = it; it = it->next;
55 //XXX: fprintf(stderr, "Tried to free unknown pointer %p\n", ptr);
56 return; // addrsan should catch malloc-unknown and print more info than we have
59 if (p) { p->next = it->next; } else { allocation_ll = it->next; }
60 DO_ASSERT(it->ptr == ptr);
63 static void FREE(void* ptr) {
64 if ((long)ptr < 1024) return; // Rust loves to create pointers to the NULL page for dummys
69 void* __wrap_malloc(size_t len) {
70 void* res = __real_malloc(len);
71 new_allocation(res, "malloc call");
74 void* __wrap_calloc(size_t nmemb, size_t len) {
75 void* res = __real_calloc(nmemb, len);
76 new_allocation(res, "calloc call");
79 void __wrap_free(void* ptr) {
80 if (ptr == NULL) return;
85 void* __real_realloc(void* ptr, size_t newlen);
86 void* __wrap_realloc(void* ptr, size_t len) {
87 if (ptr != NULL) alloc_freed(ptr);
88 void* res = __real_realloc(ptr, len);
89 new_allocation(res, "realloc call");
92 void __wrap_reallocarray(void* ptr, size_t new_sz) {
93 // Rust doesn't seem to use reallocarray currently
97 void __attribute__((destructor)) check_leaks() {
98 for (allocation* a = allocation_ll; a != NULL; a = a->next) {
99 //XXX: fprintf(stderr, "%s %p remains\n", a->struct_name, a->ptr);
101 DO_ASSERT(allocation_ll == NULL);
104 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
105 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
106 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
107 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
109 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
111 typedef uint32_t int64_tArray;
112 typedef uint32_t int8_tArray;
113 typedef uint32_t uint32_tArray;
114 typedef uint32_t ptrArray;
115 typedef uint32_t jstring;
117 static inline uint32_t init_arr(size_t arr_len, size_t elem_size, const char *type_desc) {
118 uint32_t *elems = (uint32_t*)MALLOC(arr_len * elem_size + 4, type_desc);
120 return (uint32_t)elems;
123 jstring str_ref_to_ts(const char* chars, size_t len) {
124 char* err_buf = MALLOC(len + 4, "str conv buf");
125 *((uint32_t*)err_buf) = len;
126 memcpy(err_buf + 4, chars, len);
127 return (uint32_t) err_buf;
130 typedef bool jboolean;
132 uint32_t __attribute__((visibility("default"))) TS_malloc(uint32_t size) {
133 return (uint32_t)MALLOC(size, "JS-Called malloc");
135 void __attribute__((visibility("default"))) TS_free(uint32_t ptr) {
138 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
139 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
141 case 0: return LDKAccessError_UnknownChain;
142 case 1: return LDKAccessError_UnknownTx;
146 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
148 case LDKAccessError_UnknownChain: return 0;
149 case LDKAccessError_UnknownTx: return 1;
153 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
155 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
156 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
160 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
162 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
163 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
167 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
169 case 0: return LDKConfirmationTarget_Background;
170 case 1: return LDKConfirmationTarget_Normal;
171 case 2: return LDKConfirmationTarget_HighPriority;
175 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
177 case LDKConfirmationTarget_Background: return 0;
178 case LDKConfirmationTarget_Normal: return 1;
179 case LDKConfirmationTarget_HighPriority: return 2;
183 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
185 case 0: return LDKLevel_Off;
186 case 1: return LDKLevel_Error;
187 case 2: return LDKLevel_Warn;
188 case 3: return LDKLevel_Info;
189 case 4: return LDKLevel_Debug;
190 case 5: return LDKLevel_Trace;
194 static inline int32_t LDKLevel_to_js(LDKLevel val) {
196 case LDKLevel_Off: return 0;
197 case LDKLevel_Error: return 1;
198 case LDKLevel_Warn: return 2;
199 case LDKLevel_Info: return 3;
200 case LDKLevel_Debug: return 4;
201 case LDKLevel_Trace: return 5;
205 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
207 case 0: return LDKNetwork_Bitcoin;
208 case 1: return LDKNetwork_Testnet;
209 case 2: return LDKNetwork_Regtest;
213 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
215 case LDKNetwork_Bitcoin: return 0;
216 case LDKNetwork_Testnet: return 1;
217 case LDKNetwork_Regtest: return 2;
221 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
223 case 0: return LDKSecp256k1Error_IncorrectSignature;
224 case 1: return LDKSecp256k1Error_InvalidMessage;
225 case 2: return LDKSecp256k1Error_InvalidPublicKey;
226 case 3: return LDKSecp256k1Error_InvalidSignature;
227 case 4: return LDKSecp256k1Error_InvalidSecretKey;
228 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
229 case 6: return LDKSecp256k1Error_InvalidTweak;
230 case 7: return LDKSecp256k1Error_TweakCheckFailed;
231 case 8: return LDKSecp256k1Error_NotEnoughMemory;
235 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
237 case LDKSecp256k1Error_IncorrectSignature: return 0;
238 case LDKSecp256k1Error_InvalidMessage: return 1;
239 case LDKSecp256k1Error_InvalidPublicKey: return 2;
240 case LDKSecp256k1Error_InvalidSignature: return 3;
241 case LDKSecp256k1Error_InvalidSecretKey: return 4;
242 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
243 case LDKSecp256k1Error_InvalidTweak: return 6;
244 case LDKSecp256k1Error_TweakCheckFailed: return 7;
245 case LDKSecp256k1Error_NotEnoughMemory: return 8;
249 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u8Z_new(int8_tArray elems) {
250 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
251 ret->datalen = *((uint32_t*)elems);
252 if (ret->datalen == 0) {
255 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
256 int8_t *java_elems = (int8_t*)(elems + 4);
257 for (size_t i = 0; i < ret->datalen; i++) {
258 ret->data[i] = java_elems[i];
263 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
264 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
265 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
268 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_result_ok(uint32_t arg) {
269 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
271 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_ok(uint32_t arg) {
272 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
273 CHECK(val->result_ok);
274 int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
275 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).bytes, 32);
278 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SecretKeyErrorZ_get_err(uint32_t arg) {
279 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
280 CHECK(!val->result_ok);
281 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
284 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_result_ok(uint32_t arg) {
285 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
287 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_ok(uint32_t arg) {
288 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
289 CHECK(val->result_ok);
290 int8_tArray res_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
291 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compressed_form, 33);
294 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PublicKeyErrorZ_get_err(uint32_t arg) {
295 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
296 CHECK(!val->result_ok);
297 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
300 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_result_ok(uint32_t arg) {
301 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
303 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t arg) {
304 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
305 CHECK(val->result_ok);
306 LDKTxCreationKeys res_var = (*val->contents.result);
307 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
308 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
309 long res_ref = (long)res_var.inner & ~1;
312 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t arg) {
313 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
314 CHECK(!val->result_ok);
315 LDKDecodeError err_var = (*val->contents.err);
316 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
317 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
318 long err_ref = (long)err_var.inner & ~1;
321 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_result_ok(uint32_t arg) {
322 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
324 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t arg) {
325 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
326 CHECK(val->result_ok);
327 LDKChannelPublicKeys res_var = (*val->contents.result);
328 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
329 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
330 long res_ref = (long)res_var.inner & ~1;
333 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t arg) {
334 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
335 CHECK(!val->result_ok);
336 LDKDecodeError err_var = (*val->contents.err);
337 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
338 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
339 long err_ref = (long)err_var.inner & ~1;
342 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_result_ok(uint32_t arg) {
343 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
345 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_ok(uint32_t arg) {
346 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
347 CHECK(val->result_ok);
348 LDKTxCreationKeys res_var = (*val->contents.result);
349 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
350 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
351 long res_ref = (long)res_var.inner & ~1;
354 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxCreationKeysErrorZ_get_err(uint32_t arg) {
355 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
356 CHECK(!val->result_ok);
357 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
360 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_result_ok(uint32_t arg) {
361 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
363 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t arg) {
364 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
365 CHECK(val->result_ok);
366 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
367 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
368 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
369 long res_ref = (long)res_var.inner & ~1;
372 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t arg) {
373 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
374 CHECK(!val->result_ok);
375 LDKDecodeError err_var = (*val->contents.err);
376 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
377 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
378 long err_ref = (long)err_var.inner & ~1;
381 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
382 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
384 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
385 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
386 CHECK(val->result_ok);
387 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
388 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
389 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
390 long res_ref = (long)res_var.inner & ~1;
393 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
394 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
395 CHECK(!val->result_ok);
396 LDKDecodeError err_var = (*val->contents.err);
397 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
398 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
399 long err_ref = (long)err_var.inner & ~1;
402 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
403 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
405 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
406 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
407 CHECK(val->result_ok);
408 LDKChannelTransactionParameters res_var = (*val->contents.result);
409 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
410 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
411 long res_ref = (long)res_var.inner & ~1;
414 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
415 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
416 CHECK(!val->result_ok);
417 LDKDecodeError err_var = (*val->contents.err);
418 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
419 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
420 long err_ref = (long)err_var.inner & ~1;
423 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
424 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
426 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
427 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
428 CHECK(val->result_ok);
429 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
430 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
431 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
432 long res_ref = (long)res_var.inner & ~1;
435 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
436 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
437 CHECK(!val->result_ok);
438 LDKDecodeError err_var = (*val->contents.err);
439 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
440 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
441 long err_ref = (long)err_var.inner & ~1;
444 jboolean __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
445 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
447 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
448 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
449 CHECK(val->result_ok);
450 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
451 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
452 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
453 long res_ref = (long)res_var.inner & ~1;
456 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
457 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
458 CHECK(!val->result_ok);
459 LDKDecodeError err_var = (*val->contents.err);
460 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
461 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
462 long err_ref = (long)err_var.inner & ~1;
465 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
466 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
468 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
469 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
470 CHECK(val->result_ok);
471 LDKCommitmentTransaction res_var = (*val->contents.result);
472 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
473 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
474 long res_ref = (long)res_var.inner & ~1;
477 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
478 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
479 CHECK(!val->result_ok);
480 LDKDecodeError err_var = (*val->contents.err);
481 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
482 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
483 long err_ref = (long)err_var.inner & ~1;
486 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_result_ok(uint32_t arg) {
487 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
489 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t arg) {
490 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
491 CHECK(val->result_ok);
492 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
493 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
494 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
495 long res_ref = (long)res_var.inner & ~1;
498 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t arg) {
499 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
500 CHECK(!val->result_ok);
501 return *val->contents.err;
503 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_result_ok(uint32_t arg) {
504 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
506 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_ok(uint32_t arg) {
507 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
508 CHECK(val->result_ok);
509 LDKCVec_SignatureZ res_var = (*val->contents.result);
510 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
511 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
512 for (size_t m = 0; m < res_var.datalen; m++) {
513 int8_tArray res_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
514 memcpy((uint8_t*)(res_conv_12_arr + 4), res_var.data[m].compact_form, 64);
515 res_arr_ptr[m] = res_conv_12_arr;
519 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_err(uint32_t arg) {
520 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
521 CHECK(!val->result_ok);
522 return *val->contents.err;
524 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(uint32_t arg) {
525 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
527 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t arg) {
528 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
529 CHECK(val->result_ok);
530 LDKCVec_u8Z res_var = (*val->contents.result);
531 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
532 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
535 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t arg) {
536 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
537 CHECK(!val->result_ok);
538 LDKPeerHandleError err_var = (*val->contents.err);
539 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
540 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
541 long err_ref = (long)err_var.inner & ~1;
544 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_result_ok(uint32_t arg) {
545 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
547 void __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_ok(uint32_t arg) {
548 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
549 CHECK(val->result_ok);
550 return *val->contents.result;
552 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_err(uint32_t arg) {
553 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
554 CHECK(!val->result_ok);
555 LDKPeerHandleError err_var = (*val->contents.err);
556 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
557 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
558 long err_ref = (long)err_var.inner & ~1;
561 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_result_ok(uint32_t arg) {
562 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
564 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_ok(uint32_t arg) {
565 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
566 CHECK(val->result_ok);
567 return *val->contents.result;
569 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_err(uint32_t arg) {
570 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
571 CHECK(!val->result_ok);
572 LDKPeerHandleError err_var = (*val->contents.err);
573 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
574 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
575 long err_ref = (long)err_var.inner & ~1;
578 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
579 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
581 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
582 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
583 CHECK(val->result_ok);
584 LDKInitFeatures res_var = (*val->contents.result);
585 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
586 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
587 long res_ref = (long)res_var.inner & ~1;
590 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) {
591 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
592 CHECK(!val->result_ok);
593 LDKDecodeError err_var = (*val->contents.err);
594 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
595 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
596 long err_ref = (long)err_var.inner & ~1;
599 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
600 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
602 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
603 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
604 CHECK(val->result_ok);
605 LDKNodeFeatures res_var = (*val->contents.result);
606 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
607 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
608 long res_ref = (long)res_var.inner & ~1;
611 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) {
612 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
613 CHECK(!val->result_ok);
614 LDKDecodeError err_var = (*val->contents.err);
615 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
616 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
617 long err_ref = (long)err_var.inner & ~1;
620 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
621 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
623 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
624 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
625 CHECK(val->result_ok);
626 LDKChannelFeatures res_var = (*val->contents.result);
627 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
628 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
629 long res_ref = (long)res_var.inner & ~1;
632 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t arg) {
633 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
634 CHECK(!val->result_ok);
635 LDKDecodeError err_var = (*val->contents.err);
636 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
637 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
638 long err_ref = (long)err_var.inner & ~1;
641 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_result_ok(uint32_t arg) {
642 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
644 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t arg) {
645 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
646 CHECK(val->result_ok);
647 LDKChannelConfig res_var = (*val->contents.result);
648 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
649 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
650 long res_ref = (long)res_var.inner & ~1;
653 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_err(uint32_t arg) {
654 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
655 CHECK(!val->result_ok);
656 LDKDecodeError err_var = (*val->contents.err);
657 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
658 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
659 long err_ref = (long)err_var.inner & ~1;
662 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_result_ok(uint32_t arg) {
663 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
665 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_ok(uint32_t arg) {
666 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
667 CHECK(val->result_ok);
668 return *val->contents.result;
670 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_err(uint32_t arg) {
671 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
672 CHECK(!val->result_ok);
673 LDKLightningError err_var = (*val->contents.err);
674 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
675 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
676 long err_ref = (long)err_var.inner & ~1;
679 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
680 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
681 LDKChannelAnnouncement a_conv;
682 a_conv.inner = (void*)(a & (~1));
683 a_conv.is_owned = (a & 1) || (a == 0);
684 a_conv = ChannelAnnouncement_clone(&a_conv);
686 LDKChannelUpdate b_conv;
687 b_conv.inner = (void*)(b & (~1));
688 b_conv.is_owned = (b & 1) || (b == 0);
689 b_conv = ChannelUpdate_clone(&b_conv);
691 LDKChannelUpdate c_conv;
692 c_conv.inner = (void*)(c & (~1));
693 c_conv.is_owned = (c & 1) || (c == 0);
694 c_conv = ChannelUpdate_clone(&c_conv);
698 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t ptr) {
699 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
700 LDKChannelAnnouncement a_var = tuple->a;
701 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
702 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
703 long a_ref = (long)a_var.inner & ~1;
706 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t ptr) {
707 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
708 LDKChannelUpdate b_var = tuple->b;
709 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
710 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
711 long b_ref = (long)b_var.inner & ~1;
714 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t ptr) {
715 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
716 LDKChannelUpdate c_var = tuple->c;
717 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
718 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
719 long c_ref = (long)c_var.inner & ~1;
722 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_new(uint32_tArray elems) {
723 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
724 ret->datalen = *((uint32_t*)elems);
725 if (ret->datalen == 0) {
728 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
729 uint32_t *java_elems = (uint32_t*)(elems + 4);
730 for (size_t i = 0; i < ret->datalen; i++) {
731 uint32_t arr_elem = java_elems[i];
732 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
733 FREE((void*)arr_elem);
734 ret->data[i] = arr_elem_conv;
739 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
740 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
741 for (size_t i = 0; i < ret.datalen; i++) {
742 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
746 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NodeAnnouncementZ_new(uint32_tArray elems) {
747 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
748 ret->datalen = *((uint32_t*)elems);
749 if (ret->datalen == 0) {
752 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
753 uint32_t *java_elems = (uint32_t*)(elems + 4);
754 for (size_t i = 0; i < ret->datalen; i++) {
755 uint32_t arr_elem = java_elems[i];
756 LDKNodeAnnouncement arr_elem_conv;
757 arr_elem_conv.inner = (void*)(arr_elem & (~1));
758 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
759 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
760 ret->data[i] = arr_elem_conv;
765 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
766 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
767 for (size_t i = 0; i < ret.datalen; i++) {
768 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
772 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_result_ok(uint32_t arg) {
773 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
775 void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
776 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
777 CHECK(val->result_ok);
778 return *val->contents.result;
780 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
781 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
782 CHECK(!val->result_ok);
783 LDKLightningError err_var = (*val->contents.err);
784 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
785 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
786 long err_ref = (long)err_var.inner & ~1;
789 uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(uint32_t ptr) {
790 LDKErrorAction *obj = (LDKErrorAction*)ptr;
792 case LDKErrorAction_DisconnectPeer: {
793 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
794 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
795 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
796 long msg_ref = (long)msg_var.inner & ~1;
797 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
799 case LDKErrorAction_IgnoreError: {
800 return 0 /* LDKErrorAction - IgnoreError */;
802 case LDKErrorAction_SendErrorMessage: {
803 LDKErrorMessage msg_var = obj->send_error_message.msg;
804 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
805 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
806 long msg_ref = (long)msg_var.inner & ~1;
807 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
812 uint32_t __attribute__((visibility("default"))) TS_LDKHTLCFailChannelUpdate_ref_from_ptr(uint32_t ptr) {
813 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
815 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
816 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
817 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
818 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
819 long msg_ref = (long)msg_var.inner & ~1;
820 return 0 /* LDKHTLCFailChannelUpdate - ChannelUpdateMessage */; (void) msg_ref;
822 case LDKHTLCFailChannelUpdate_ChannelClosed: {
823 return 0 /* LDKHTLCFailChannelUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
825 case LDKHTLCFailChannelUpdate_NodeFailure: {
826 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
827 memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
828 return 0 /* LDKHTLCFailChannelUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
833 uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
834 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
836 case LDKMessageSendEvent_SendAcceptChannel: {
837 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
838 memcpy((uint8_t*)(node_id_arr + 4), obj->send_accept_channel.node_id.compressed_form, 33);
839 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
840 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
841 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
842 long msg_ref = (long)msg_var.inner & ~1;
843 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
845 case LDKMessageSendEvent_SendOpenChannel: {
846 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
847 memcpy((uint8_t*)(node_id_arr + 4), obj->send_open_channel.node_id.compressed_form, 33);
848 LDKOpenChannel msg_var = obj->send_open_channel.msg;
849 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
850 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
851 long msg_ref = (long)msg_var.inner & ~1;
852 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
854 case LDKMessageSendEvent_SendFundingCreated: {
855 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
856 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_created.node_id.compressed_form, 33);
857 LDKFundingCreated msg_var = obj->send_funding_created.msg;
858 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
859 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
860 long msg_ref = (long)msg_var.inner & ~1;
861 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
863 case LDKMessageSendEvent_SendFundingSigned: {
864 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
865 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_signed.node_id.compressed_form, 33);
866 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
867 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
868 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
869 long msg_ref = (long)msg_var.inner & ~1;
870 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
872 case LDKMessageSendEvent_SendFundingLocked: {
873 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
874 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_locked.node_id.compressed_form, 33);
875 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
876 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
877 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
878 long msg_ref = (long)msg_var.inner & ~1;
879 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
881 case LDKMessageSendEvent_SendAnnouncementSignatures: {
882 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
883 memcpy((uint8_t*)(node_id_arr + 4), obj->send_announcement_signatures.node_id.compressed_form, 33);
884 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
885 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
886 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
887 long msg_ref = (long)msg_var.inner & ~1;
888 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
890 case LDKMessageSendEvent_UpdateHTLCs: {
891 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
892 memcpy((uint8_t*)(node_id_arr + 4), obj->update_htl_cs.node_id.compressed_form, 33);
893 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
894 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
895 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
896 long updates_ref = (long)updates_var.inner & ~1;
897 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
899 case LDKMessageSendEvent_SendRevokeAndACK: {
900 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
901 memcpy((uint8_t*)(node_id_arr + 4), obj->send_revoke_and_ack.node_id.compressed_form, 33);
902 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
903 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
904 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
905 long msg_ref = (long)msg_var.inner & ~1;
906 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
908 case LDKMessageSendEvent_SendClosingSigned: {
909 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
910 memcpy((uint8_t*)(node_id_arr + 4), obj->send_closing_signed.node_id.compressed_form, 33);
911 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
912 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
913 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
914 long msg_ref = (long)msg_var.inner & ~1;
915 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
917 case LDKMessageSendEvent_SendShutdown: {
918 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
919 memcpy((uint8_t*)(node_id_arr + 4), obj->send_shutdown.node_id.compressed_form, 33);
920 LDKShutdown msg_var = obj->send_shutdown.msg;
921 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
922 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
923 long msg_ref = (long)msg_var.inner & ~1;
924 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
926 case LDKMessageSendEvent_SendChannelReestablish: {
927 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
928 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_reestablish.node_id.compressed_form, 33);
929 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
930 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
931 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
932 long msg_ref = (long)msg_var.inner & ~1;
933 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
935 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
936 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
937 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
938 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
939 long msg_ref = (long)msg_var.inner & ~1;
940 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
941 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
942 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
943 long update_msg_ref = (long)update_msg_var.inner & ~1;
944 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
946 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
947 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
948 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
949 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
950 long msg_ref = (long)msg_var.inner & ~1;
951 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
953 case LDKMessageSendEvent_BroadcastChannelUpdate: {
954 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
955 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
956 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
957 long msg_ref = (long)msg_var.inner & ~1;
958 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
960 case LDKMessageSendEvent_HandleError: {
961 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
962 memcpy((uint8_t*)(node_id_arr + 4), obj->handle_error.node_id.compressed_form, 33);
963 long action_ref = ((long)&obj->handle_error.action) | 1;
964 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
966 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
967 long update_ref = ((long)&obj->payment_failure_network_update.update) | 1;
968 return 0 /* LDKMessageSendEvent - PaymentFailureNetworkUpdate */; (void) update_ref;
970 case LDKMessageSendEvent_SendChannelRangeQuery: {
971 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
972 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_range_query.node_id.compressed_form, 33);
973 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
974 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
975 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
976 long msg_ref = (long)msg_var.inner & ~1;
977 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
979 case LDKMessageSendEvent_SendShortIdsQuery: {
980 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
981 memcpy((uint8_t*)(node_id_arr + 4), obj->send_short_ids_query.node_id.compressed_form, 33);
982 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
983 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
984 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
985 long msg_ref = (long)msg_var.inner & ~1;
986 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
991 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MessageSendEventZ_new(uint32_tArray elems) {
992 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
993 ret->datalen = *((uint32_t*)elems);
994 if (ret->datalen == 0) {
997 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
998 uint32_t *java_elems = (uint32_t*)(elems + 4);
999 for (size_t i = 0; i < ret->datalen; i++) {
1000 uint32_t arr_elem = java_elems[i];
1001 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1002 FREE((void*)arr_elem);
1003 ret->data[i] = arr_elem_conv;
1008 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1009 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1010 for (size_t i = 0; i < ret.datalen; i++) {
1011 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1015 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
1016 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
1018 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
1019 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
1020 CHECK(val->result_ok);
1021 LDKDirectionalChannelInfo res_var = (*val->contents.result);
1022 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1023 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1024 long res_ref = (long)res_var.inner & ~1;
1027 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
1028 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
1029 CHECK(!val->result_ok);
1030 LDKDecodeError err_var = (*val->contents.err);
1031 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1032 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1033 long err_ref = (long)err_var.inner & ~1;
1036 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
1037 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
1039 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
1040 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
1041 CHECK(val->result_ok);
1042 LDKChannelInfo res_var = (*val->contents.result);
1043 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1044 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1045 long res_ref = (long)res_var.inner & ~1;
1048 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
1049 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
1050 CHECK(!val->result_ok);
1051 LDKDecodeError err_var = (*val->contents.err);
1052 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1053 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1054 long err_ref = (long)err_var.inner & ~1;
1057 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_result_ok(uint32_t arg) {
1058 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
1060 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t arg) {
1061 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
1062 CHECK(val->result_ok);
1063 LDKRoutingFees res_var = (*val->contents.result);
1064 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1065 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1066 long res_ref = (long)res_var.inner & ~1;
1069 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_err(uint32_t arg) {
1070 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
1071 CHECK(!val->result_ok);
1072 LDKDecodeError err_var = (*val->contents.err);
1073 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1074 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1075 long err_ref = (long)err_var.inner & ~1;
1078 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
1079 LDKNetAddress *obj = (LDKNetAddress*)ptr;
1081 case LDKNetAddress_IPv4: {
1082 int8_tArray addr_arr = init_arr(4, sizeof(uint8_t), "Native int8_tArray Bytes");
1083 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv4.addr.data, 4);
1084 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
1086 case LDKNetAddress_IPv6: {
1087 int8_tArray addr_arr = init_arr(16, sizeof(uint8_t), "Native int8_tArray Bytes");
1088 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv6.addr.data, 16);
1089 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
1091 case LDKNetAddress_OnionV2: {
1092 int8_tArray addr_arr = init_arr(10, sizeof(uint8_t), "Native int8_tArray Bytes");
1093 memcpy((uint8_t*)(addr_arr + 4), obj->onion_v2.addr.data, 10);
1094 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
1096 case LDKNetAddress_OnionV3: {
1097 int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1098 memcpy((uint8_t*)(ed25519_pubkey_arr + 4), obj->onion_v3.ed25519_pubkey.data, 32);
1099 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
1104 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NetAddressZ_new(uint32_tArray elems) {
1105 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
1106 ret->datalen = *((uint32_t*)elems);
1107 if (ret->datalen == 0) {
1110 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
1111 uint32_t *java_elems = (uint32_t*)(elems + 4);
1112 for (size_t i = 0; i < ret->datalen; i++) {
1113 uint32_t arr_elem = java_elems[i];
1114 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
1115 FREE((void*)arr_elem);
1116 ret->data[i] = arr_elem_conv;
1121 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
1122 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
1123 for (size_t i = 0; i < ret.datalen; i++) {
1124 ret.data[i] = NetAddress_clone(&orig->data[i]);
1128 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_result_ok(uint32_t arg) {
1129 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
1131 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t arg) {
1132 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
1133 CHECK(val->result_ok);
1134 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
1135 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1136 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1137 long res_ref = (long)res_var.inner & ~1;
1140 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t arg) {
1141 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
1142 CHECK(!val->result_ok);
1143 LDKDecodeError err_var = (*val->contents.err);
1144 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1145 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1146 long err_ref = (long)err_var.inner & ~1;
1149 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u64Z_new(int64_tArray elems) {
1150 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
1151 ret->datalen = *((uint32_t*)elems);
1152 if (ret->datalen == 0) {
1155 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
1156 int64_t *java_elems = (int64_t*)(elems + 4);
1157 for (size_t i = 0; i < ret->datalen; i++) {
1158 ret->data[i] = java_elems[i];
1163 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1164 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1165 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1168 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_result_ok(uint32_t arg) {
1169 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
1171 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_ok(uint32_t arg) {
1172 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
1173 CHECK(val->result_ok);
1174 LDKNodeInfo res_var = (*val->contents.result);
1175 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1176 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1177 long res_ref = (long)res_var.inner & ~1;
1180 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_err(uint32_t arg) {
1181 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
1182 CHECK(!val->result_ok);
1183 LDKDecodeError err_var = (*val->contents.err);
1184 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1185 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1186 long err_ref = (long)err_var.inner & ~1;
1189 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_result_ok(uint32_t arg) {
1190 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
1192 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t arg) {
1193 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
1194 CHECK(val->result_ok);
1195 LDKNetworkGraph res_var = (*val->contents.result);
1196 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1197 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1198 long res_ref = (long)res_var.inner & ~1;
1201 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_err(uint32_t arg) {
1202 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
1203 CHECK(!val->result_ok);
1204 LDKDecodeError err_var = (*val->contents.err);
1205 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1206 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1207 long err_ref = (long)err_var.inner & ~1;
1210 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
1211 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1213 LDKTransaction b_ref;
1214 b_ref.datalen = *((uint32_t*)b);
1215 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1216 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
1217 b_ref.data_is_owned = false;
1221 int64_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_a(uint32_t ptr) {
1222 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1225 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_b(uint32_t ptr) {
1226 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1227 LDKTransaction b_var = tuple->b;
1228 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1229 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
1232 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_usizeTransactionZZ_new(uint32_tArray elems) {
1233 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1234 ret->datalen = *((uint32_t*)elems);
1235 if (ret->datalen == 0) {
1238 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1239 uint32_t *java_elems = (uint32_t*)(elems + 4);
1240 for (size_t i = 0; i < ret->datalen; i++) {
1241 uint32_t arr_elem = java_elems[i];
1242 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1243 FREE((void*)arr_elem);
1244 ret->data[i] = arr_elem_conv;
1249 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_result_ok(uint32_t arg) {
1250 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1252 void __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t arg) {
1253 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1254 CHECK(val->result_ok);
1255 return *val->contents.result;
1257 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t arg) {
1258 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1259 CHECK(!val->result_ok);
1260 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
1263 uint32_t __attribute__((visibility("default"))) TS_LDKMonitorEvent_ref_from_ptr(uint32_t ptr) {
1264 LDKMonitorEvent *obj = (LDKMonitorEvent*)ptr;
1266 case LDKMonitorEvent_HTLCEvent: {
1267 return 0 /* LDKMonitorEvent - HTLCEvent */;
1269 case LDKMonitorEvent_CommitmentTxBroadcasted: {
1270 return 0 /* LDKMonitorEvent - CommitmentTxBroadcasted */;
1275 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MonitorEventZ_new(uint32_tArray elems) {
1276 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1277 ret->datalen = *((uint32_t*)elems);
1278 if (ret->datalen == 0) {
1281 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1282 uint32_t *java_elems = (uint32_t*)(elems + 4);
1283 for (size_t i = 0; i < ret->datalen; i++) {
1284 uint32_t arr_elem = java_elems[i];
1285 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
1286 FREE((void*)arr_elem);
1287 ret->data[i] = arr_elem_conv;
1292 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1293 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1294 for (size_t i = 0; i < ret.datalen; i++) {
1295 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1299 uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
1300 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
1302 case LDKSpendableOutputDescriptor_StaticOutput: {
1303 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1304 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1305 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1306 long outpoint_ref = (long)outpoint_var.inner & ~1;
1307 long output_ref = ((long)&obj->static_output.output) | 1;
1308 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (long)output_ref;
1310 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1311 return 0 /* LDKSpendableOutputDescriptor - DelayedPaymentOutput */;
1313 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1314 return 0 /* LDKSpendableOutputDescriptor - StaticPaymentOutput */;
1319 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_SpendableOutputDescriptorZ_new(uint32_tArray elems) {
1320 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1321 ret->datalen = *((uint32_t*)elems);
1322 if (ret->datalen == 0) {
1325 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1326 uint32_t *java_elems = (uint32_t*)(elems + 4);
1327 for (size_t i = 0; i < ret->datalen; i++) {
1328 uint32_t arr_elem = java_elems[i];
1329 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1330 FREE((void*)arr_elem);
1331 ret->data[i] = arr_elem_conv;
1336 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1337 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1338 for (size_t i = 0; i < ret.datalen; i++) {
1339 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1343 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
1344 LDKEvent *obj = (LDKEvent*)ptr;
1346 case LDKEvent_FundingGenerationReady: {
1347 int8_tArray temporary_channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1348 memcpy((uint8_t*)(temporary_channel_id_arr + 4), obj->funding_generation_ready.temporary_channel_id.data, 32);
1349 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1350 int8_tArray output_script_arr = init_arr(output_script_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1351 memcpy((uint8_t*)(output_script_arr + 4), output_script_var.data, output_script_var.datalen);
1352 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;
1354 case LDKEvent_FundingBroadcastSafe: {
1355 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
1356 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1357 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1358 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
1359 return 0 /* LDKEvent - FundingBroadcastSafe */; (void) funding_txo_ref; (void) obj->funding_broadcast_safe.user_channel_id;
1361 case LDKEvent_PaymentReceived: {
1362 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1363 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_received.payment_hash.data, 32);
1364 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1365 memcpy((uint8_t*)(payment_secret_arr + 4), obj->payment_received.payment_secret.data, 32);
1366 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) payment_secret_arr; (void) obj->payment_received.amt;
1368 case LDKEvent_PaymentSent: {
1369 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1370 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
1371 return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr;
1373 case LDKEvent_PaymentFailed: {
1374 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1375 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_failed.payment_hash.data, 32);
1376 return 0 /* LDKEvent - PaymentFailed */; (void) payment_hash_arr; (void) obj->payment_failed.rejected_by_dest;
1378 case LDKEvent_PendingHTLCsForwardable: {
1379 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
1381 case LDKEvent_SpendableOutputs: {
1382 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1383 uint32_tArray outputs_arr = init_arr(outputs_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
1384 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
1385 for (size_t b = 0; b < outputs_var.datalen; b++) {
1386 long outputs_conv_27_ref = ((long)&outputs_var.data[b]) | 1;
1387 outputs_arr_ptr[b] = outputs_conv_27_ref;
1389 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
1394 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_EventZ_new(uint32_tArray elems) {
1395 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1396 ret->datalen = *((uint32_t*)elems);
1397 if (ret->datalen == 0) {
1400 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
1401 uint32_t *java_elems = (uint32_t*)(elems + 4);
1402 for (size_t i = 0; i < ret->datalen; i++) {
1403 uint32_t arr_elem = java_elems[i];
1404 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
1405 FREE((void*)arr_elem);
1406 ret->data[i] = arr_elem_conv;
1411 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
1412 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
1413 for (size_t i = 0; i < ret.datalen; i++) {
1414 ret.data[i] = Event_clone(&orig->data[i]);
1418 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_result_ok(uint32_t arg) {
1419 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
1421 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_ok(uint32_t arg) {
1422 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
1423 CHECK(val->result_ok);
1424 LDKOutPoint res_var = (*val->contents.result);
1425 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1426 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1427 long res_ref = (long)res_var.inner & ~1;
1430 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_err(uint32_t arg) {
1431 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
1432 CHECK(!val->result_ok);
1433 LDKDecodeError err_var = (*val->contents.err);
1434 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1435 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1436 long err_ref = (long)err_var.inner & ~1;
1439 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_result_ok(uint32_t arg) {
1440 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
1442 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t arg) {
1443 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1444 CHECK(val->result_ok);
1445 LDKChannelMonitorUpdate res_var = (*val->contents.result);
1446 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1447 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1448 long res_ref = (long)res_var.inner & ~1;
1451 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t arg) {
1452 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1453 CHECK(!val->result_ok);
1454 LDKDecodeError err_var = (*val->contents.err);
1455 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1456 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1457 long err_ref = (long)err_var.inner & ~1;
1460 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_result_ok(uint32_t arg) {
1461 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
1463 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t arg) {
1464 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
1465 CHECK(val->result_ok);
1466 LDKHTLCUpdate res_var = (*val->contents.result);
1467 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1468 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1469 long res_ref = (long)res_var.inner & ~1;
1472 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t arg) {
1473 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
1474 CHECK(!val->result_ok);
1475 LDKDecodeError err_var = (*val->contents.err);
1476 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1477 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1478 long err_ref = (long)err_var.inner & ~1;
1481 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_result_ok(uint32_t arg) {
1482 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
1484 void __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_ok(uint32_t arg) {
1485 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1486 CHECK(val->result_ok);
1487 return *val->contents.result;
1489 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_err(uint32_t arg) {
1490 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1491 CHECK(!val->result_ok);
1492 LDKMonitorUpdateError err_var = (*val->contents.err);
1493 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1494 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1495 long err_ref = (long)err_var.inner & ~1;
1498 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
1499 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
1501 a_conv.inner = (void*)(a & (~1));
1502 a_conv.is_owned = (a & 1) || (a == 0);
1503 a_conv = OutPoint_clone(&a_conv);
1506 b_ref.datalen = *((uint32_t*)b);
1507 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
1508 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
1512 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_a(uint32_t ptr) {
1513 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1514 LDKOutPoint a_var = tuple->a;
1515 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1516 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1517 long a_ref = (long)a_var.inner & ~1;
1520 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_b(uint32_t ptr) {
1521 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1522 LDKCVec_u8Z b_var = tuple->b;
1523 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1524 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
1527 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
1528 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
1530 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
1535 int32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_a(uint32_t ptr) {
1536 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
1539 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_b(uint32_t ptr) {
1540 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
1541 long b_ref = ((long)&tuple->b) | 1;
1544 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32TxOutZZ_new(uint32_tArray elems) {
1545 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
1546 ret->datalen = *((uint32_t*)elems);
1547 if (ret->datalen == 0) {
1550 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
1551 uint32_t *java_elems = (uint32_t*)(elems + 4);
1552 for (size_t i = 0; i < ret->datalen; i++) {
1553 uint32_t arr_elem = java_elems[i];
1554 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
1555 FREE((void*)arr_elem);
1556 ret->data[i] = arr_elem_conv;
1561 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
1562 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
1563 for (size_t i = 0; i < ret.datalen; i++) {
1564 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
1568 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
1569 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
1570 LDKThirtyTwoBytes a_ref;
1571 CHECK(*((uint32_t*)a) == 32);
1572 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
1574 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
1575 b_constr.datalen = *((uint32_t*)b);
1576 if (b_constr.datalen > 0)
1577 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
1579 b_constr.data = NULL;
1580 uint32_t* b_vals = (uint32_t*)(b + 4);
1581 for (size_t z = 0; z < b_constr.datalen; z++) {
1582 uint32_t b_conv_25 = b_vals[z];
1583 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
1584 FREE((void*)b_conv_25);
1585 b_constr.data[z] = b_conv_25_conv;
1590 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t ptr) {
1591 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
1592 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1593 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
1596 uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t ptr) {
1597 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
1598 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
1599 uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
1600 uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4);
1601 for (size_t z = 0; z < b_var.datalen; z++) {
1602 long b_conv_25_ref = (long)(&b_var.data[z]) | 1;
1603 b_arr_ptr[z] = b_conv_25_ref;
1607 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_new(uint32_tArray elems) {
1608 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
1609 ret->datalen = *((uint32_t*)elems);
1610 if (ret->datalen == 0) {
1613 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
1614 uint32_t *java_elems = (uint32_t*)(elems + 4);
1615 for (size_t i = 0; i < ret->datalen; i++) {
1616 uint32_t arr_elem = java_elems[i];
1617 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
1618 FREE((void*)arr_elem);
1619 ret->data[i] = arr_elem_conv;
1624 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
1625 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1627 CHECK(*((uint32_t*)a) == 64);
1628 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
1630 LDKCVec_SignatureZ b_constr;
1631 b_constr.datalen = *((uint32_t*)b);
1632 if (b_constr.datalen > 0)
1633 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
1635 b_constr.data = NULL;
1636 int8_tArray* b_vals = (int8_tArray*)(b + 4);
1637 for (size_t m = 0; m < b_constr.datalen; m++) {
1638 int8_tArray b_conv_12 = b_vals[m];
1639 LDKSignature b_conv_12_ref;
1640 CHECK(*((uint32_t*)b_conv_12) == 64);
1641 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
1642 b_constr.data[m] = b_conv_12_ref;
1647 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t ptr) {
1648 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1649 int8_tArray a_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1650 memcpy((uint8_t*)(a_arr + 4), tuple->a.compact_form, 64);
1653 ptrArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t ptr) {
1654 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1655 LDKCVec_SignatureZ b_var = tuple->b;
1656 ptrArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1657 int8_tArray *b_arr_ptr = (int8_tArray*)(b_arr + 4);
1658 for (size_t m = 0; m < b_var.datalen; m++) {
1659 int8_tArray b_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1660 memcpy((uint8_t*)(b_conv_12_arr + 4), b_var.data[m].compact_form, 64);
1661 b_arr_ptr[m] = b_conv_12_arr;
1665 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_result_ok(uint32_t arg) {
1666 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
1668 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t arg) {
1669 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1670 CHECK(val->result_ok);
1671 long res_ref = (long)(&(*val->contents.result)) | 1;
1674 void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t arg) {
1675 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1676 CHECK(!val->result_ok);
1677 return *val->contents.err;
1679 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_result_ok(uint32_t arg) {
1680 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
1682 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_ok(uint32_t arg) {
1683 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1684 CHECK(val->result_ok);
1685 int8_tArray res_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1686 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compact_form, 64);
1689 void __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_err(uint32_t arg) {
1690 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1691 CHECK(!val->result_ok);
1692 return *val->contents.err;
1694 typedef struct LDKSign_JCalls {
1695 atomic_size_t refcnt;
1696 uint32_t get_per_commitment_point_meth;
1697 uint32_t release_commitment_secret_meth;
1698 uint32_t channel_keys_id_meth;
1699 uint32_t sign_counterparty_commitment_meth;
1700 uint32_t sign_holder_commitment_and_htlcs_meth;
1701 uint32_t sign_justice_transaction_meth;
1702 uint32_t sign_counterparty_htlc_transaction_meth;
1703 uint32_t sign_closing_transaction_meth;
1704 uint32_t sign_channel_announcement_meth;
1705 uint32_t ready_channel_meth;
1706 uint32_t write_meth;
1708 static void LDKSign_JCalls_free(void* this_arg) {
1709 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1710 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1711 js_free(j_calls->get_per_commitment_point_meth);
1712 js_free(j_calls->release_commitment_secret_meth);
1713 js_free(j_calls->channel_keys_id_meth);
1714 js_free(j_calls->sign_counterparty_commitment_meth);
1715 js_free(j_calls->sign_holder_commitment_and_htlcs_meth);
1716 js_free(j_calls->sign_justice_transaction_meth);
1717 js_free(j_calls->sign_counterparty_htlc_transaction_meth);
1718 js_free(j_calls->sign_closing_transaction_meth);
1719 js_free(j_calls->sign_channel_announcement_meth);
1720 js_free(j_calls->ready_channel_meth);
1721 js_free(j_calls->write_meth);
1725 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1726 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1727 int8_tArray ret = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx);
1728 LDKPublicKey ret_ref;
1729 CHECK(*((uint32_t*)ret) == 33);
1730 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
1733 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1734 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1735 int8_tArray ret = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx);
1736 LDKThirtyTwoBytes ret_ref;
1737 CHECK(*((uint32_t*)ret) == 32);
1738 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1741 LDKThirtyTwoBytes channel_keys_id_jcall(const void* this_arg) {
1742 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1743 int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth);
1744 LDKThirtyTwoBytes ret_ref;
1745 CHECK(*((uint32_t*)ret) == 32);
1746 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1749 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1750 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1751 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1752 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1753 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1754 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1755 long commitment_tx_ref = (long)commitment_tx_var.inner;
1756 if (commitment_tx_var.is_owned) {
1757 commitment_tx_ref |= 1;
1759 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1760 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1761 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
1764 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1765 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1766 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1767 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1768 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1769 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1770 long commitment_tx_ref = (long)commitment_tx_var.inner;
1771 if (commitment_tx_var.is_owned) {
1772 commitment_tx_ref |= 1;
1774 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
1775 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1776 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
1779 LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
1780 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1781 LDKTransaction justice_tx_var = justice_tx;
1782 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1783 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1784 Transaction_free(justice_tx_var);
1785 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1786 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1787 LDKHTLCOutputInCommitment htlc_var = *htlc;
1788 htlc_var = HTLCOutputInCommitment_clone(htlc);
1789 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1790 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1791 long htlc_ref = (long)htlc_var.inner;
1792 if (htlc_var.is_owned) {
1795 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_5(j_calls->sign_justice_transaction_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
1796 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1797 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1800 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
1801 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1802 LDKTransaction htlc_tx_var = htlc_tx;
1803 int8_tArray htlc_tx_arr = init_arr(htlc_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1804 memcpy((uint8_t*)(htlc_tx_arr + 4), htlc_tx_var.data, htlc_tx_var.datalen);
1805 Transaction_free(htlc_tx_var);
1806 int8_tArray per_commitment_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1807 memcpy((uint8_t*)(per_commitment_point_arr + 4), per_commitment_point.compressed_form, 33);
1808 LDKHTLCOutputInCommitment htlc_var = *htlc;
1809 htlc_var = HTLCOutputInCommitment_clone(htlc);
1810 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1811 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1812 long htlc_ref = (long)htlc_var.inner;
1813 if (htlc_var.is_owned) {
1816 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_5(j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
1817 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1818 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1821 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1822 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1823 LDKTransaction closing_tx_var = closing_tx;
1824 int8_tArray closing_tx_arr = init_arr(closing_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1825 memcpy((uint8_t*)(closing_tx_arr + 4), closing_tx_var.data, closing_tx_var.datalen);
1826 Transaction_free(closing_tx_var);
1827 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_arr);
1828 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1829 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1832 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1833 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1834 LDKUnsignedChannelAnnouncement msg_var = *msg;
1835 msg_var = UnsignedChannelAnnouncement_clone(msg);
1836 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1837 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1838 long msg_ref = (long)msg_var.inner;
1839 if (msg_var.is_owned) {
1842 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
1843 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1844 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1847 void ready_channel_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1848 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1849 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1850 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1851 CHECK((((long)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1852 CHECK((((long)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1853 long channel_parameters_ref = (long)channel_parameters_var.inner;
1854 if (channel_parameters_var.is_owned) {
1855 channel_parameters_ref |= 1;
1857 js_invoke_function_1(j_calls->ready_channel_meth, channel_parameters_ref);
1859 LDKCVec_u8Z write_jcall(const void* this_arg) {
1860 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1861 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
1862 LDKCVec_u8Z ret_ref;
1863 ret_ref.datalen = *((uint32_t*)ret);
1864 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
1865 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
1868 static void* LDKSign_JCalls_clone(const void* this_arg) {
1869 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1870 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1871 return (void*) this_arg;
1873 static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1874 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
1875 atomic_init(&calls->refcnt, 1);
1876 //TODO: Assign calls->o from o
1878 LDKChannelPublicKeys pubkeys_conv;
1879 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1880 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1881 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1884 .this_arg = (void*) calls,
1885 .get_per_commitment_point = get_per_commitment_point_jcall,
1886 .release_commitment_secret = release_commitment_secret_jcall,
1887 .channel_keys_id = channel_keys_id_jcall,
1888 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1889 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_jcall,
1890 .sign_justice_transaction = sign_justice_transaction_jcall,
1891 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1892 .sign_closing_transaction = sign_closing_transaction_jcall,
1893 .sign_channel_announcement = sign_channel_announcement_jcall,
1894 .ready_channel = ready_channel_jcall,
1895 .clone = LDKSign_JCalls_clone,
1896 .write = write_jcall,
1897 .free = LDKSign_JCalls_free,
1898 .pubkeys = pubkeys_conv,
1899 .set_pubkeys = NULL,
1903 long __attribute__((visibility("default"))) TS_LDKSign_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1904 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
1905 *res_ptr = LDKSign_init(o, pubkeys);
1906 return (long)res_ptr;
1908 int8_tArray __attribute__((visibility("default"))) TS_Sign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
1909 LDKSign* this_arg_conv = (LDKSign*)this_arg;
1910 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1911 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1915 int8_tArray __attribute__((visibility("default"))) TS_Sign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
1916 LDKSign* this_arg_conv = (LDKSign*)this_arg;
1917 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1918 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1922 int8_tArray __attribute__((visibility("default"))) TS_Sign_channel_keys_id(uint32_t this_arg) {
1923 LDKSign* this_arg_conv = (LDKSign*)this_arg;
1924 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1925 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1929 uint32_t __attribute__((visibility("default"))) TS_Sign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
1930 LDKSign* this_arg_conv = (LDKSign*)this_arg;
1931 LDKCommitmentTransaction commitment_tx_conv;
1932 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1933 commitment_tx_conv.is_owned = false;
1934 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1935 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1936 return (long)ret_conv;
1939 uint32_t __attribute__((visibility("default"))) TS_Sign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
1940 LDKSign* this_arg_conv = (LDKSign*)this_arg;
1941 LDKHolderCommitmentTransaction commitment_tx_conv;
1942 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1943 commitment_tx_conv.is_owned = false;
1944 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1945 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
1946 return (long)ret_conv;
1949 uint32_t __attribute__((visibility("default"))) TS_Sign_sign_justice_transaction(uint32_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, uint32_t htlc) {
1950 LDKSign* this_arg_conv = (LDKSign*)this_arg;
1951 LDKTransaction justice_tx_ref;
1952 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
1953 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1954 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
1955 justice_tx_ref.data_is_owned = true;
1956 unsigned char per_commitment_key_arr[32];
1957 CHECK(*((uint32_t*)per_commitment_key) == 32);
1958 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
1959 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1960 LDKHTLCOutputInCommitment htlc_conv;
1961 htlc_conv.inner = (void*)(htlc & (~1));
1962 htlc_conv.is_owned = false;
1963 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1964 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
1965 return (long)ret_conv;
1968 uint32_t __attribute__((visibility("default"))) TS_Sign_sign_counterparty_htlc_transaction(uint32_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t amount, int8_tArray per_commitment_point, uint32_t htlc) {
1969 LDKSign* this_arg_conv = (LDKSign*)this_arg;
1970 LDKTransaction htlc_tx_ref;
1971 htlc_tx_ref.datalen = *((uint32_t*)htlc_tx);
1972 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1973 memcpy(htlc_tx_ref.data, (uint8_t*)(htlc_tx + 4), htlc_tx_ref.datalen);
1974 htlc_tx_ref.data_is_owned = true;
1975 LDKPublicKey per_commitment_point_ref;
1976 CHECK(*((uint32_t*)per_commitment_point) == 33);
1977 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
1978 LDKHTLCOutputInCommitment htlc_conv;
1979 htlc_conv.inner = (void*)(htlc & (~1));
1980 htlc_conv.is_owned = false;
1981 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1982 *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);
1983 return (long)ret_conv;
1986 uint32_t __attribute__((visibility("default"))) TS_Sign_sign_closing_transaction(uint32_t this_arg, int8_tArray closing_tx) {
1987 LDKSign* this_arg_conv = (LDKSign*)this_arg;
1988 LDKTransaction closing_tx_ref;
1989 closing_tx_ref.datalen = *((uint32_t*)closing_tx);
1990 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
1991 memcpy(closing_tx_ref.data, (uint8_t*)(closing_tx + 4), closing_tx_ref.datalen);
1992 closing_tx_ref.data_is_owned = true;
1993 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1994 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
1995 return (long)ret_conv;
1998 uint32_t __attribute__((visibility("default"))) TS_Sign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
1999 LDKSign* this_arg_conv = (LDKSign*)this_arg;
2000 LDKUnsignedChannelAnnouncement msg_conv;
2001 msg_conv.inner = (void*)(msg & (~1));
2002 msg_conv.is_owned = false;
2003 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2004 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2005 return (long)ret_conv;
2008 void __attribute__((visibility("default"))) TS_Sign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
2009 LDKSign* this_arg_conv = (LDKSign*)this_arg;
2010 LDKChannelTransactionParameters channel_parameters_conv;
2011 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2012 channel_parameters_conv.is_owned = false;
2013 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2016 int8_tArray __attribute__((visibility("default"))) TS_Sign_write(uint32_t this_arg) {
2017 LDKSign* this_arg_conv = (LDKSign*)this_arg;
2018 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2019 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2020 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2021 CVec_u8Z_free(ret_var);
2025 LDKChannelPublicKeys LDKSign_set_get_pubkeys(LDKSign* this_arg) {
2026 if (this_arg->set_pubkeys != NULL)
2027 this_arg->set_pubkeys(this_arg);
2028 return this_arg->pubkeys;
2030 uint32_t __attribute__((visibility("default"))) TS_Sign_get_pubkeys(uint32_t this_arg) {
2031 LDKSign* this_arg_conv = (LDKSign*)this_arg;
2032 LDKChannelPublicKeys ret_var = LDKSign_set_get_pubkeys(this_arg_conv);
2033 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2034 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2035 long ret_ref = (long)ret_var.inner;
2036 if (ret_var.is_owned) {
2042 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
2043 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2044 LDKThirtyTwoBytes a_ref;
2045 CHECK(*((uint32_t*)a) == 32);
2046 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2048 LDKChannelMonitor b_conv;
2049 b_conv.inner = (void*)(b & (~1));
2050 b_conv.is_owned = (b & 1) || (b == 0);
2051 b_conv = ChannelMonitor_clone(&b_conv);
2055 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t ptr) {
2056 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2057 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2058 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2061 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t ptr) {
2062 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2063 LDKChannelMonitor b_var = tuple->b;
2064 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2065 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2066 long b_ref = (long)b_var.inner & ~1;
2069 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(uint32_t arg) {
2070 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
2072 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t arg) {
2073 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
2074 CHECK(val->result_ok);
2075 long res_ref = (long)(&(*val->contents.result)) | 1;
2078 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t arg) {
2079 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
2080 CHECK(!val->result_ok);
2081 LDKDecodeError err_var = (*val->contents.err);
2082 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2083 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2084 long err_ref = (long)err_var.inner & ~1;
2087 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_result_ok(uint32_t arg) {
2088 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
2090 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_ok(uint32_t arg) {
2091 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2092 CHECK(val->result_ok);
2093 long res_ref = ((long)&(*val->contents.result)) | 1;
2094 return (long)res_ref;
2096 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_err(uint32_t arg) {
2097 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2098 CHECK(!val->result_ok);
2099 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
2102 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
2103 LDKAPIError *obj = (LDKAPIError*)ptr;
2105 case LDKAPIError_APIMisuseError: {
2106 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
2107 int8_tArray err_arr = init_arr(err_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2108 memcpy((uint8_t*)(err_arr + 4), err_var.data, err_var.datalen);
2109 return 0 /* LDKAPIError - APIMisuseError */; (void) err_arr;
2111 case LDKAPIError_FeeRateTooHigh: {
2112 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
2113 int8_tArray err_arr = init_arr(err_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2114 memcpy((uint8_t*)(err_arr + 4), err_var.data, err_var.datalen);
2115 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_arr; (void) obj->fee_rate_too_high.feerate;
2117 case LDKAPIError_RouteError: {
2118 LDKStr err_str = obj->route_error.err;
2119 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2120 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
2122 case LDKAPIError_ChannelUnavailable: {
2123 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
2124 int8_tArray err_arr = init_arr(err_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2125 memcpy((uint8_t*)(err_arr + 4), err_var.data, err_var.datalen);
2126 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_arr;
2128 case LDKAPIError_MonitorUpdateFailed: {
2129 return 0 /* LDKAPIError - MonitorUpdateFailed */;
2134 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_result_ok(uint32_t arg) {
2135 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2137 void __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_ok(uint32_t arg) {
2138 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2139 CHECK(val->result_ok);
2140 return *val->contents.result;
2142 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_err(uint32_t arg) {
2143 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2144 CHECK(!val->result_ok);
2145 long err_ref = ((long)&(*val->contents.err)) | 1;
2148 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_CResult_NoneAPIErrorZZ_new(uint32_tArray elems) {
2149 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2150 ret->datalen = *((uint32_t*)elems);
2151 if (ret->datalen == 0) {
2154 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2155 uint32_t *java_elems = (uint32_t*)(elems + 4);
2156 for (size_t i = 0; i < ret->datalen; i++) {
2157 uint32_t arr_elem = java_elems[i];
2158 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
2159 FREE((void*)arr_elem);
2160 ret->data[i] = arr_elem_conv;
2165 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2166 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2167 for (size_t i = 0; i < ret.datalen; i++) {
2168 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2172 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_APIErrorZ_new(uint32_tArray elems) {
2173 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
2174 ret->datalen = *((uint32_t*)elems);
2175 if (ret->datalen == 0) {
2178 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
2179 uint32_t *java_elems = (uint32_t*)(elems + 4);
2180 for (size_t i = 0; i < ret->datalen; i++) {
2181 uint32_t arr_elem = java_elems[i];
2182 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
2183 FREE((void*)arr_elem);
2184 ret->data[i] = arr_elem_conv;
2189 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2190 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2191 for (size_t i = 0; i < ret.datalen; i++) {
2192 ret.data[i] = APIError_clone(&orig->data[i]);
2196 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelDetailsZ_new(uint32_tArray elems) {
2197 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
2198 ret->datalen = *((uint32_t*)elems);
2199 if (ret->datalen == 0) {
2202 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
2203 uint32_t *java_elems = (uint32_t*)(elems + 4);
2204 for (size_t i = 0; i < ret->datalen; i++) {
2205 uint32_t arr_elem = java_elems[i];
2206 LDKChannelDetails arr_elem_conv;
2207 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2208 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2209 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2210 ret->data[i] = arr_elem_conv;
2215 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2216 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2217 for (size_t i = 0; i < ret.datalen; i++) {
2218 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2222 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) {
2223 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)ptr;
2225 case LDKPaymentSendFailure_ParameterError: {
2226 return 0 /* LDKPaymentSendFailure - ParameterError */;
2228 case LDKPaymentSendFailure_PathParameterError: {
2229 return 0 /* LDKPaymentSendFailure - PathParameterError */;
2231 case LDKPaymentSendFailure_AllFailedRetrySafe: {
2232 return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */;
2234 case LDKPaymentSendFailure_PartialFailure: {
2235 return 0 /* LDKPaymentSendFailure - PartialFailure */;
2240 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_result_ok(uint32_t arg) {
2241 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2243 void __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_ok(uint32_t arg) {
2244 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2245 CHECK(val->result_ok);
2246 return *val->contents.result;
2248 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_err(uint32_t arg) {
2249 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2250 CHECK(!val->result_ok);
2251 long err_ref = ((long)&(*val->contents.err)) | 1;
2254 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelMonitorZ_new(uint32_tArray elems) {
2255 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2256 ret->datalen = *((uint32_t*)elems);
2257 if (ret->datalen == 0) {
2260 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2261 uint32_t *java_elems = (uint32_t*)(elems + 4);
2262 for (size_t i = 0; i < ret->datalen; i++) {
2263 uint32_t arr_elem = java_elems[i];
2264 LDKChannelMonitor arr_elem_conv;
2265 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2266 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2267 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
2268 ret->data[i] = arr_elem_conv;
2273 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2274 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2275 for (size_t i = 0; i < ret.datalen; i++) {
2276 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2280 typedef struct LDKWatch_JCalls {
2281 atomic_size_t refcnt;
2282 uint32_t watch_channel_meth;
2283 uint32_t update_channel_meth;
2284 uint32_t release_pending_monitor_events_meth;
2286 static void LDKWatch_JCalls_free(void* this_arg) {
2287 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2288 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2289 js_free(j_calls->watch_channel_meth);
2290 js_free(j_calls->update_channel_meth);
2291 js_free(j_calls->release_pending_monitor_events_meth);
2295 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2296 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2297 LDKOutPoint funding_txo_var = funding_txo;
2298 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2299 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2300 long funding_txo_ref = (long)funding_txo_var.inner;
2301 if (funding_txo_var.is_owned) {
2302 funding_txo_ref |= 1;
2304 LDKChannelMonitor monitor_var = monitor;
2305 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2306 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2307 long monitor_ref = (long)monitor_var.inner;
2308 if (monitor_var.is_owned) {
2311 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2312 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2313 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
2316 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2317 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2318 LDKOutPoint funding_txo_var = funding_txo;
2319 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2320 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2321 long funding_txo_ref = (long)funding_txo_var.inner;
2322 if (funding_txo_var.is_owned) {
2323 funding_txo_ref |= 1;
2325 LDKChannelMonitorUpdate update_var = update;
2326 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2327 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2328 long update_ref = (long)update_var.inner;
2329 if (update_var.is_owned) {
2332 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
2333 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2334 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
2337 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2338 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2339 uint32_tArray ret = js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
2340 LDKCVec_MonitorEventZ ret_constr;
2341 ret_constr.datalen = *((uint32_t*)ret);
2342 if (ret_constr.datalen > 0)
2343 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2345 ret_constr.data = NULL;
2346 uint32_t* ret_vals = (uint32_t*)(ret + 4);
2347 for (size_t o = 0; o < ret_constr.datalen; o++) {
2348 uint32_t ret_conv_14 = ret_vals[o];
2349 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
2350 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)ret_conv_14);
2351 ret_constr.data[o] = ret_conv_14_conv;
2355 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2356 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2357 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2358 return (void*) this_arg;
2360 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
2361 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2362 atomic_init(&calls->refcnt, 1);
2363 //TODO: Assign calls->o from o
2366 .this_arg = (void*) calls,
2367 .watch_channel = watch_channel_jcall,
2368 .update_channel = update_channel_jcall,
2369 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2370 .free = LDKWatch_JCalls_free,
2374 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
2375 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2376 *res_ptr = LDKWatch_init(o);
2377 return (long)res_ptr;
2379 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
2380 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2381 LDKOutPoint funding_txo_conv;
2382 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2383 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2384 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2385 LDKChannelMonitor monitor_conv;
2386 monitor_conv.inner = (void*)(monitor & (~1));
2387 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2388 monitor_conv = ChannelMonitor_clone(&monitor_conv);
2389 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2390 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2391 return (long)ret_conv;
2394 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
2395 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2396 LDKOutPoint funding_txo_conv;
2397 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2398 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2399 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2400 LDKChannelMonitorUpdate update_conv;
2401 update_conv.inner = (void*)(update & (~1));
2402 update_conv.is_owned = (update & 1) || (update == 0);
2403 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2404 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2405 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2406 return (long)ret_conv;
2409 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
2410 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2411 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2412 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2413 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
2414 for (size_t o = 0; o < ret_var.datalen; o++) {
2415 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2416 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
2417 long ret_conv_14_ref = (long)ret_conv_14_copy;
2418 ret_arr_ptr[o] = ret_conv_14_ref;
2424 typedef struct LDKBroadcasterInterface_JCalls {
2425 atomic_size_t refcnt;
2426 uint32_t broadcast_transaction_meth;
2427 } LDKBroadcasterInterface_JCalls;
2428 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2429 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2430 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2431 js_free(j_calls->broadcast_transaction_meth);
2435 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2436 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2437 LDKTransaction tx_var = tx;
2438 int8_tArray tx_arr = init_arr(tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2439 memcpy((uint8_t*)(tx_arr + 4), tx_var.data, tx_var.datalen);
2440 Transaction_free(tx_var);
2441 js_invoke_function_1(j_calls->broadcast_transaction_meth, tx_arr);
2443 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2444 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2445 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2446 return (void*) this_arg;
2448 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
2449 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2450 atomic_init(&calls->refcnt, 1);
2451 //TODO: Assign calls->o from o
2453 LDKBroadcasterInterface ret = {
2454 .this_arg = (void*) calls,
2455 .broadcast_transaction = broadcast_transaction_jcall,
2456 .free = LDKBroadcasterInterface_JCalls_free,
2460 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
2461 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2462 *res_ptr = LDKBroadcasterInterface_init(o);
2463 return (long)res_ptr;
2465 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
2466 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2467 LDKTransaction tx_ref;
2468 tx_ref.datalen = *((uint32_t*)tx);
2469 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2470 memcpy(tx_ref.data, (uint8_t*)(tx + 4), tx_ref.datalen);
2471 tx_ref.data_is_owned = true;
2472 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2475 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_result_ok(uint32_t arg) {
2476 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
2478 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_ok(uint32_t arg) {
2479 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2480 CHECK(val->result_ok);
2481 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
2482 *ret = Sign_clone(&(*val->contents.result));
2485 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_err(uint32_t arg) {
2486 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2487 CHECK(!val->result_ok);
2488 LDKDecodeError err_var = (*val->contents.err);
2489 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2490 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2491 long err_ref = (long)err_var.inner & ~1;
2494 typedef struct LDKKeysInterface_JCalls {
2495 atomic_size_t refcnt;
2496 uint32_t get_node_secret_meth;
2497 uint32_t get_destination_script_meth;
2498 uint32_t get_shutdown_pubkey_meth;
2499 uint32_t get_channel_signer_meth;
2500 uint32_t get_secure_random_bytes_meth;
2501 uint32_t read_chan_signer_meth;
2502 } LDKKeysInterface_JCalls;
2503 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2504 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2505 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2506 js_free(j_calls->get_node_secret_meth);
2507 js_free(j_calls->get_destination_script_meth);
2508 js_free(j_calls->get_shutdown_pubkey_meth);
2509 js_free(j_calls->get_channel_signer_meth);
2510 js_free(j_calls->get_secure_random_bytes_meth);
2511 js_free(j_calls->read_chan_signer_meth);
2515 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2516 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2517 int8_tArray ret = js_invoke_function_0(j_calls->get_node_secret_meth);
2518 LDKSecretKey ret_ref;
2519 CHECK(*((uint32_t*)ret) == 32);
2520 memcpy(ret_ref.bytes, (uint8_t*)(ret + 4), 32);
2523 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2524 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2525 int8_tArray ret = js_invoke_function_0(j_calls->get_destination_script_meth);
2526 LDKCVec_u8Z ret_ref;
2527 ret_ref.datalen = *((uint32_t*)ret);
2528 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2529 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
2532 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2533 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2534 int8_tArray ret = js_invoke_function_0(j_calls->get_shutdown_pubkey_meth);
2535 LDKPublicKey ret_ref;
2536 CHECK(*((uint32_t*)ret) == 33);
2537 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
2540 LDKSign get_channel_signer_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2541 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2542 LDKSign* ret = (LDKSign*)js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
2543 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
2544 ret_conv = Sign_clone(ret);
2547 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2548 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2549 int8_tArray ret = js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
2550 LDKThirtyTwoBytes ret_ref;
2551 CHECK(*((uint32_t*)ret) == 32);
2552 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
2555 LDKCResult_SignDecodeErrorZ read_chan_signer_jcall(const void* this_arg, LDKu8slice reader) {
2556 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2557 LDKu8slice reader_var = reader;
2558 int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2559 memcpy((uint8_t*)(reader_arr + 4), reader_var.data, reader_var.datalen);
2560 LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
2561 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
2562 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)ret);
2565 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2566 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2567 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2568 return (void*) this_arg;
2570 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
2571 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2572 atomic_init(&calls->refcnt, 1);
2573 //TODO: Assign calls->o from o
2575 LDKKeysInterface ret = {
2576 .this_arg = (void*) calls,
2577 .get_node_secret = get_node_secret_jcall,
2578 .get_destination_script = get_destination_script_jcall,
2579 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2580 .get_channel_signer = get_channel_signer_jcall,
2581 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2582 .read_chan_signer = read_chan_signer_jcall,
2583 .free = LDKKeysInterface_JCalls_free,
2587 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
2588 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2589 *res_ptr = LDKKeysInterface_init(o);
2590 return (long)res_ptr;
2592 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
2593 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2594 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2595 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
2599 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
2600 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2601 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2602 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2603 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2604 CVec_u8Z_free(ret_var);
2608 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_pubkey(uint32_t this_arg) {
2609 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2610 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
2611 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form, 33);
2615 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
2616 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2617 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
2618 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2622 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
2623 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2624 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2625 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
2629 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
2630 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2631 LDKu8slice reader_ref;
2632 reader_ref.datalen = *((uint32_t*)reader);
2633 reader_ref.data = (int8_t*)(reader + 4);
2634 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
2635 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
2636 return (long)ret_conv;
2639 typedef struct LDKFeeEstimator_JCalls {
2640 atomic_size_t refcnt;
2641 uint32_t get_est_sat_per_1000_weight_meth;
2642 } LDKFeeEstimator_JCalls;
2643 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2644 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2645 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2646 js_free(j_calls->get_est_sat_per_1000_weight_meth);
2650 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2651 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2652 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
2653 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2655 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2656 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2657 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2658 return (void*) this_arg;
2660 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
2661 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2662 atomic_init(&calls->refcnt, 1);
2663 //TODO: Assign calls->o from o
2665 LDKFeeEstimator ret = {
2666 .this_arg = (void*) calls,
2667 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2668 .free = LDKFeeEstimator_JCalls_free,
2672 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
2673 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2674 *res_ptr = LDKFeeEstimator_init(o);
2675 return (long)res_ptr;
2677 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
2678 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2679 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
2680 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2684 typedef struct LDKLogger_JCalls {
2685 atomic_size_t refcnt;
2688 static void LDKLogger_JCalls_free(void* this_arg) {
2689 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2690 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2691 js_free(j_calls->log_meth);
2695 void log_jcall(const void* this_arg, const char* record) {
2696 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2697 const char* record_str = record;
2698 jstring record_conv = str_ref_to_ts(record_str, strlen(record_str));
2699 js_invoke_function_1(j_calls->log_meth, record_conv);
2701 static void* LDKLogger_JCalls_clone(const void* this_arg) {
2702 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2703 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2704 return (void*) this_arg;
2706 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
2707 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2708 atomic_init(&calls->refcnt, 1);
2709 //TODO: Assign calls->o from o
2712 .this_arg = (void*) calls,
2714 .free = LDKLogger_JCalls_free,
2718 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
2719 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2720 *res_ptr = LDKLogger_init(o);
2721 return (long)res_ptr;
2723 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
2724 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
2725 LDKThirtyTwoBytes a_ref;
2726 CHECK(*((uint32_t*)a) == 32);
2727 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2729 LDKChannelManager b_conv;
2730 b_conv.inner = (void*)(b & (~1));
2731 b_conv.is_owned = (b & 1) || (b == 0);
2732 // Warning: we need a move here but no clone is available for LDKChannelManager
2736 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_a(uint32_t ptr) {
2737 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2738 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2739 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2742 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_b(uint32_t ptr) {
2743 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2744 LDKChannelManager b_var = tuple->b;
2745 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2746 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2747 long b_ref = (long)b_var.inner & ~1;
2750 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_result_ok(uint32_t arg) {
2751 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
2753 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t arg) {
2754 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2755 CHECK(val->result_ok);
2756 long res_ref = (long)(&(*val->contents.result)) | 1;
2759 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t arg) {
2760 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2761 CHECK(!val->result_ok);
2762 LDKDecodeError err_var = (*val->contents.err);
2763 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2764 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2765 long err_ref = (long)err_var.inner & ~1;
2768 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
2769 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2771 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
2772 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2773 CHECK(val->result_ok);
2774 long res_ref = ((long)&(*val->contents.result)) | 1;
2777 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
2778 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2779 CHECK(!val->result_ok);
2780 LDKDecodeError err_var = (*val->contents.err);
2781 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2782 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2783 long err_ref = (long)err_var.inner & ~1;
2786 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2787 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2788 for (size_t i = 0; i < ret.datalen; i++) {
2789 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2793 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_result_ok(uint32_t arg) {
2794 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
2796 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t arg) {
2797 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2798 CHECK(val->result_ok);
2799 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2800 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
2801 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
2802 for (size_t m = 0; m < res_var.datalen; m++) {
2803 LDKCVec_u8Z res_conv_12_var = res_var.data[m];
2804 int8_tArray res_conv_12_arr = init_arr(res_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2805 memcpy((uint8_t*)(res_conv_12_arr + 4), res_conv_12_var.data, res_conv_12_var.datalen);
2806 res_arr_ptr[m] = res_conv_12_arr;
2810 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t arg) {
2811 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2812 CHECK(!val->result_ok);
2813 return *val->contents.err;
2815 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_result_ok(uint32_t arg) {
2816 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
2818 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t arg) {
2819 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2820 CHECK(val->result_ok);
2821 LDKInMemorySigner res_var = (*val->contents.result);
2822 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2823 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2824 long res_ref = (long)res_var.inner & ~1;
2827 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_err(uint32_t arg) {
2828 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2829 CHECK(!val->result_ok);
2830 LDKDecodeError err_var = (*val->contents.err);
2831 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2832 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2833 long err_ref = (long)err_var.inner & ~1;
2836 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_TxOutZ_new(uint32_tArray elems) {
2837 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
2838 ret->datalen = *((uint32_t*)elems);
2839 if (ret->datalen == 0) {
2842 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
2843 uint32_t *java_elems = (uint32_t*)(elems + 4);
2844 for (size_t i = 0; i < ret->datalen; i++) {
2845 uint32_t arr_elem = java_elems[i];
2846 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
2847 FREE((void*)arr_elem);
2848 ret->data[i] = arr_elem_conv;
2853 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2854 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2855 for (size_t i = 0; i < ret.datalen; i++) {
2856 ret.data[i] = TxOut_clone(&orig->data[i]);
2860 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_result_ok(uint32_t arg) {
2861 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
2863 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_ok(uint32_t arg) {
2864 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2865 CHECK(val->result_ok);
2866 LDKTransaction res_var = (*val->contents.result);
2867 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2868 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
2871 void __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_err(uint32_t arg) {
2872 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2873 CHECK(!val->result_ok);
2874 return *val->contents.err;
2876 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHopZ_new(uint32_tArray elems) {
2877 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
2878 ret->datalen = *((uint32_t*)elems);
2879 if (ret->datalen == 0) {
2882 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
2883 uint32_t *java_elems = (uint32_t*)(elems + 4);
2884 for (size_t i = 0; i < ret->datalen; i++) {
2885 uint32_t arr_elem = java_elems[i];
2886 LDKRouteHop arr_elem_conv;
2887 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2888 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2889 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
2890 ret->data[i] = arr_elem_conv;
2895 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
2896 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
2897 for (size_t i = 0; i < ret.datalen; i++) {
2898 ret.data[i] = RouteHop_clone(&orig->data[i]);
2902 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
2903 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
2904 for (size_t i = 0; i < ret.datalen; i++) {
2905 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
2909 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_result_ok(uint32_t arg) {
2910 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
2912 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_ok(uint32_t arg) {
2913 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
2914 CHECK(val->result_ok);
2915 LDKRoute res_var = (*val->contents.result);
2916 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2917 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2918 long res_ref = (long)res_var.inner & ~1;
2921 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_err(uint32_t arg) {
2922 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
2923 CHECK(!val->result_ok);
2924 LDKDecodeError err_var = (*val->contents.err);
2925 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2926 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2927 long err_ref = (long)err_var.inner & ~1;
2930 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHintZ_new(uint32_tArray elems) {
2931 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
2932 ret->datalen = *((uint32_t*)elems);
2933 if (ret->datalen == 0) {
2936 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
2937 uint32_t *java_elems = (uint32_t*)(elems + 4);
2938 for (size_t i = 0; i < ret->datalen; i++) {
2939 uint32_t arr_elem = java_elems[i];
2940 LDKRouteHint arr_elem_conv;
2941 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2942 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2943 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
2944 ret->data[i] = arr_elem_conv;
2949 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2950 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2951 for (size_t i = 0; i < ret.datalen; i++) {
2952 ret.data[i] = RouteHint_clone(&orig->data[i]);
2956 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_result_ok(uint32_t arg) {
2957 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
2959 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_ok(uint32_t arg) {
2960 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
2961 CHECK(val->result_ok);
2962 LDKRoute res_var = (*val->contents.result);
2963 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2964 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2965 long res_ref = (long)res_var.inner & ~1;
2968 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_err(uint32_t arg) {
2969 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
2970 CHECK(!val->result_ok);
2971 LDKLightningError err_var = (*val->contents.err);
2972 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2973 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2974 long err_ref = (long)err_var.inner & ~1;
2977 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_result_ok(uint32_t arg) {
2978 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
2980 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_ok(uint32_t arg) {
2981 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
2982 CHECK(val->result_ok);
2983 long res_ref = ((long)&(*val->contents.result)) | 1;
2986 int8_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_err(uint32_t arg) {
2987 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
2988 CHECK(!val->result_ok);
2989 return *val->contents.err;
2991 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_result_ok(uint32_t arg) {
2992 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
2994 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_ok(uint32_t arg) {
2995 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
2996 CHECK(val->result_ok);
2997 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
2998 *res_conv = (*val->contents.result);
2999 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
3000 return (long)res_conv;
3002 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_err(uint32_t arg) {
3003 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
3004 CHECK(!val->result_ok);
3005 LDKDecodeError err_var = (*val->contents.err);
3006 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3007 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3008 long err_ref = (long)err_var.inner & ~1;
3011 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateAddHTLCZ_new(uint32_tArray elems) {
3012 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
3013 ret->datalen = *((uint32_t*)elems);
3014 if (ret->datalen == 0) {
3017 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
3018 uint32_t *java_elems = (uint32_t*)(elems + 4);
3019 for (size_t i = 0; i < ret->datalen; i++) {
3020 uint32_t arr_elem = java_elems[i];
3021 LDKUpdateAddHTLC arr_elem_conv;
3022 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3023 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3024 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3025 ret->data[i] = arr_elem_conv;
3030 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
3031 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
3032 for (size_t i = 0; i < ret.datalen; i++) {
3033 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
3037 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFulfillHTLCZ_new(uint32_tArray elems) {
3038 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
3039 ret->datalen = *((uint32_t*)elems);
3040 if (ret->datalen == 0) {
3043 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
3044 uint32_t *java_elems = (uint32_t*)(elems + 4);
3045 for (size_t i = 0; i < ret->datalen; i++) {
3046 uint32_t arr_elem = java_elems[i];
3047 LDKUpdateFulfillHTLC arr_elem_conv;
3048 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3049 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3050 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3051 ret->data[i] = arr_elem_conv;
3056 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
3057 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
3058 for (size_t i = 0; i < ret.datalen; i++) {
3059 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
3063 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailHTLCZ_new(uint32_tArray elems) {
3064 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
3065 ret->datalen = *((uint32_t*)elems);
3066 if (ret->datalen == 0) {
3069 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
3070 uint32_t *java_elems = (uint32_t*)(elems + 4);
3071 for (size_t i = 0; i < ret->datalen; i++) {
3072 uint32_t arr_elem = java_elems[i];
3073 LDKUpdateFailHTLC arr_elem_conv;
3074 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3075 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3076 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3077 ret->data[i] = arr_elem_conv;
3082 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
3083 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
3084 for (size_t i = 0; i < ret.datalen; i++) {
3085 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
3089 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailMalformedHTLCZ_new(uint32_tArray elems) {
3090 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
3091 ret->datalen = *((uint32_t*)elems);
3092 if (ret->datalen == 0) {
3095 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
3096 uint32_t *java_elems = (uint32_t*)(elems + 4);
3097 for (size_t i = 0; i < ret->datalen; i++) {
3098 uint32_t arr_elem = java_elems[i];
3099 LDKUpdateFailMalformedHTLC arr_elem_conv;
3100 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3101 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3102 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3103 ret->data[i] = arr_elem_conv;
3108 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
3109 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
3110 for (size_t i = 0; i < ret.datalen; i++) {
3111 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
3115 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_result_ok(uint32_t arg) {
3116 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
3118 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t arg) {
3119 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
3120 CHECK(val->result_ok);
3121 LDKAcceptChannel res_var = (*val->contents.result);
3122 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3123 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3124 long res_ref = (long)res_var.inner & ~1;
3127 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_err(uint32_t arg) {
3128 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
3129 CHECK(!val->result_ok);
3130 LDKDecodeError err_var = (*val->contents.err);
3131 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3132 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3133 long err_ref = (long)err_var.inner & ~1;
3136 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_result_ok(uint32_t arg) {
3137 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
3139 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t arg) {
3140 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
3141 CHECK(val->result_ok);
3142 LDKAnnouncementSignatures res_var = (*val->contents.result);
3143 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3144 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3145 long res_ref = (long)res_var.inner & ~1;
3148 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t arg) {
3149 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
3150 CHECK(!val->result_ok);
3151 LDKDecodeError err_var = (*val->contents.err);
3152 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3153 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3154 long err_ref = (long)err_var.inner & ~1;
3157 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_result_ok(uint32_t arg) {
3158 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
3160 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t arg) {
3161 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
3162 CHECK(val->result_ok);
3163 LDKChannelReestablish res_var = (*val->contents.result);
3164 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3165 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3166 long res_ref = (long)res_var.inner & ~1;
3169 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t arg) {
3170 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
3171 CHECK(!val->result_ok);
3172 LDKDecodeError err_var = (*val->contents.err);
3173 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3174 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3175 long err_ref = (long)err_var.inner & ~1;
3178 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_result_ok(uint32_t arg) {
3179 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
3181 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t arg) {
3182 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
3183 CHECK(val->result_ok);
3184 LDKClosingSigned res_var = (*val->contents.result);
3185 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3186 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3187 long res_ref = (long)res_var.inner & ~1;
3190 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_err(uint32_t arg) {
3191 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
3192 CHECK(!val->result_ok);
3193 LDKDecodeError err_var = (*val->contents.err);
3194 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3195 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3196 long err_ref = (long)err_var.inner & ~1;
3199 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(uint32_t arg) {
3200 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
3202 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t arg) {
3203 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
3204 CHECK(val->result_ok);
3205 LDKCommitmentSigned res_var = (*val->contents.result);
3206 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3207 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3208 long res_ref = (long)res_var.inner & ~1;
3211 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t arg) {
3212 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
3213 CHECK(!val->result_ok);
3214 LDKDecodeError err_var = (*val->contents.err);
3215 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3216 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3217 long err_ref = (long)err_var.inner & ~1;
3220 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_result_ok(uint32_t arg) {
3221 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
3223 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t arg) {
3224 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
3225 CHECK(val->result_ok);
3226 LDKFundingCreated res_var = (*val->contents.result);
3227 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3228 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3229 long res_ref = (long)res_var.inner & ~1;
3232 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_err(uint32_t arg) {
3233 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
3234 CHECK(!val->result_ok);
3235 LDKDecodeError err_var = (*val->contents.err);
3236 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3237 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3238 long err_ref = (long)err_var.inner & ~1;
3241 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_result_ok(uint32_t arg) {
3242 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
3244 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_ok(uint32_t arg) {
3245 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
3246 CHECK(val->result_ok);
3247 LDKFundingSigned res_var = (*val->contents.result);
3248 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3249 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3250 long res_ref = (long)res_var.inner & ~1;
3253 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_err(uint32_t arg) {
3254 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
3255 CHECK(!val->result_ok);
3256 LDKDecodeError err_var = (*val->contents.err);
3257 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3258 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3259 long err_ref = (long)err_var.inner & ~1;
3262 jboolean __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_result_ok(uint32_t arg) {
3263 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
3265 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_ok(uint32_t arg) {
3266 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
3267 CHECK(val->result_ok);
3268 LDKFundingLocked res_var = (*val->contents.result);
3269 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3270 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3271 long res_ref = (long)res_var.inner & ~1;
3274 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_err(uint32_t arg) {
3275 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
3276 CHECK(!val->result_ok);
3277 LDKDecodeError err_var = (*val->contents.err);
3278 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3279 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3280 long err_ref = (long)err_var.inner & ~1;
3283 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_result_ok(uint32_t arg) {
3284 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
3286 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_ok(uint32_t arg) {
3287 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
3288 CHECK(val->result_ok);
3289 LDKInit res_var = (*val->contents.result);
3290 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3291 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3292 long res_ref = (long)res_var.inner & ~1;
3295 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_err(uint32_t arg) {
3296 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
3297 CHECK(!val->result_ok);
3298 LDKDecodeError err_var = (*val->contents.err);
3299 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3300 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3301 long err_ref = (long)err_var.inner & ~1;
3304 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_result_ok(uint32_t arg) {
3305 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
3307 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_ok(uint32_t arg) {
3308 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
3309 CHECK(val->result_ok);
3310 LDKOpenChannel res_var = (*val->contents.result);
3311 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3312 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3313 long res_ref = (long)res_var.inner & ~1;
3316 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_err(uint32_t arg) {
3317 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
3318 CHECK(!val->result_ok);
3319 LDKDecodeError err_var = (*val->contents.err);
3320 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3321 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3322 long err_ref = (long)err_var.inner & ~1;
3325 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_result_ok(uint32_t arg) {
3326 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
3328 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t arg) {
3329 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
3330 CHECK(val->result_ok);
3331 LDKRevokeAndACK res_var = (*val->contents.result);
3332 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3333 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3334 long res_ref = (long)res_var.inner & ~1;
3337 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t arg) {
3338 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
3339 CHECK(!val->result_ok);
3340 LDKDecodeError err_var = (*val->contents.err);
3341 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3342 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3343 long err_ref = (long)err_var.inner & ~1;
3346 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_result_ok(uint32_t arg) {
3347 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
3349 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_ok(uint32_t arg) {
3350 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
3351 CHECK(val->result_ok);
3352 LDKShutdown res_var = (*val->contents.result);
3353 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3354 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3355 long res_ref = (long)res_var.inner & ~1;
3358 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_err(uint32_t arg) {
3359 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
3360 CHECK(!val->result_ok);
3361 LDKDecodeError err_var = (*val->contents.err);
3362 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3363 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3364 long err_ref = (long)err_var.inner & ~1;
3367 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_result_ok(uint32_t arg) {
3368 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
3370 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t arg) {
3371 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
3372 CHECK(val->result_ok);
3373 LDKUpdateFailHTLC res_var = (*val->contents.result);
3374 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3375 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3376 long res_ref = (long)res_var.inner & ~1;
3379 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t arg) {
3380 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
3381 CHECK(!val->result_ok);
3382 LDKDecodeError err_var = (*val->contents.err);
3383 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3384 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3385 long err_ref = (long)err_var.inner & ~1;
3388 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_result_ok(uint32_t arg) {
3389 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
3391 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t arg) {
3392 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
3393 CHECK(val->result_ok);
3394 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
3395 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3396 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3397 long res_ref = (long)res_var.inner & ~1;
3400 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t arg) {
3401 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
3402 CHECK(!val->result_ok);
3403 LDKDecodeError err_var = (*val->contents.err);
3404 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3405 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3406 long err_ref = (long)err_var.inner & ~1;
3409 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_result_ok(uint32_t arg) {
3410 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
3412 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t arg) {
3413 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
3414 CHECK(val->result_ok);
3415 LDKUpdateFee res_var = (*val->contents.result);
3416 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3417 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3418 long res_ref = (long)res_var.inner & ~1;
3421 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_err(uint32_t arg) {
3422 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
3423 CHECK(!val->result_ok);
3424 LDKDecodeError err_var = (*val->contents.err);
3425 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3426 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3427 long err_ref = (long)err_var.inner & ~1;
3430 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_result_ok(uint32_t arg) {
3431 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
3433 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t arg) {
3434 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
3435 CHECK(val->result_ok);
3436 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
3437 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3438 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3439 long res_ref = (long)res_var.inner & ~1;
3442 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t arg) {
3443 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
3444 CHECK(!val->result_ok);
3445 LDKDecodeError err_var = (*val->contents.err);
3446 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3447 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3448 long err_ref = (long)err_var.inner & ~1;
3451 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_result_ok(uint32_t arg) {
3452 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
3454 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t arg) {
3455 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
3456 CHECK(val->result_ok);
3457 LDKUpdateAddHTLC res_var = (*val->contents.result);
3458 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3459 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3460 long res_ref = (long)res_var.inner & ~1;
3463 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t arg) {
3464 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
3465 CHECK(!val->result_ok);
3466 LDKDecodeError err_var = (*val->contents.err);
3467 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3468 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3469 long err_ref = (long)err_var.inner & ~1;
3472 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_result_ok(uint32_t arg) {
3473 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
3475 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_ok(uint32_t arg) {
3476 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
3477 CHECK(val->result_ok);
3478 LDKPing res_var = (*val->contents.result);
3479 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3480 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3481 long res_ref = (long)res_var.inner & ~1;
3484 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_err(uint32_t arg) {
3485 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
3486 CHECK(!val->result_ok);
3487 LDKDecodeError err_var = (*val->contents.err);
3488 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3489 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3490 long err_ref = (long)err_var.inner & ~1;
3493 jboolean __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_result_ok(uint32_t arg) {
3494 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
3496 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_ok(uint32_t arg) {
3497 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
3498 CHECK(val->result_ok);
3499 LDKPong res_var = (*val->contents.result);
3500 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3501 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3502 long res_ref = (long)res_var.inner & ~1;
3505 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_err(uint32_t arg) {
3506 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
3507 CHECK(!val->result_ok);
3508 LDKDecodeError err_var = (*val->contents.err);
3509 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3510 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3511 long err_ref = (long)err_var.inner & ~1;
3514 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3515 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
3517 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3518 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3519 CHECK(val->result_ok);
3520 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
3521 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3522 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3523 long res_ref = (long)res_var.inner & ~1;
3526 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3527 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3528 CHECK(!val->result_ok);
3529 LDKDecodeError err_var = (*val->contents.err);
3530 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3531 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3532 long err_ref = (long)err_var.inner & ~1;
3535 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3536 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
3538 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3539 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3540 CHECK(val->result_ok);
3541 LDKChannelAnnouncement res_var = (*val->contents.result);
3542 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3543 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3544 long res_ref = (long)res_var.inner & ~1;
3547 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3548 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3549 CHECK(!val->result_ok);
3550 LDKDecodeError err_var = (*val->contents.err);
3551 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3552 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3553 long err_ref = (long)err_var.inner & ~1;
3556 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3557 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
3559 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3560 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
3561 CHECK(val->result_ok);
3562 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
3563 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3564 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3565 long res_ref = (long)res_var.inner & ~1;
3568 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
3569 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
3570 CHECK(!val->result_ok);
3571 LDKDecodeError err_var = (*val->contents.err);
3572 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3573 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3574 long err_ref = (long)err_var.inner & ~1;
3577 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3578 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
3580 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3581 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
3582 CHECK(val->result_ok);
3583 LDKChannelUpdate res_var = (*val->contents.result);
3584 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3585 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3586 long res_ref = (long)res_var.inner & ~1;
3589 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
3590 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
3591 CHECK(!val->result_ok);
3592 LDKDecodeError err_var = (*val->contents.err);
3593 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3594 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3595 long err_ref = (long)err_var.inner & ~1;
3598 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_result_ok(uint32_t arg) {
3599 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
3601 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t arg) {
3602 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
3603 CHECK(val->result_ok);
3604 LDKErrorMessage res_var = (*val->contents.result);
3605 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3606 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3607 long res_ref = (long)res_var.inner & ~1;
3610 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_err(uint32_t arg) {
3611 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
3612 CHECK(!val->result_ok);
3613 LDKDecodeError err_var = (*val->contents.err);
3614 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3615 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3616 long err_ref = (long)err_var.inner & ~1;
3619 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3620 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
3622 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3623 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
3624 CHECK(val->result_ok);
3625 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
3626 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3627 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3628 long res_ref = (long)res_var.inner & ~1;
3631 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3632 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
3633 CHECK(!val->result_ok);
3634 LDKDecodeError err_var = (*val->contents.err);
3635 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3636 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3637 long err_ref = (long)err_var.inner & ~1;
3640 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3641 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
3643 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3644 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
3645 CHECK(val->result_ok);
3646 LDKNodeAnnouncement res_var = (*val->contents.result);
3647 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3648 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3649 long res_ref = (long)res_var.inner & ~1;
3652 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3653 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
3654 CHECK(!val->result_ok);
3655 LDKDecodeError err_var = (*val->contents.err);
3656 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3657 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3658 long err_ref = (long)err_var.inner & ~1;
3661 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_result_ok(uint32_t arg) {
3662 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
3664 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t arg) {
3665 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
3666 CHECK(val->result_ok);
3667 LDKQueryShortChannelIds res_var = (*val->contents.result);
3668 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3669 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3670 long res_ref = (long)res_var.inner & ~1;
3673 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t arg) {
3674 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
3675 CHECK(!val->result_ok);
3676 LDKDecodeError err_var = (*val->contents.err);
3677 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3678 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3679 long err_ref = (long)err_var.inner & ~1;
3682 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_result_ok(uint32_t arg) {
3683 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
3685 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t arg) {
3686 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
3687 CHECK(val->result_ok);
3688 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
3689 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3690 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3691 long res_ref = (long)res_var.inner & ~1;
3694 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t arg) {
3695 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
3696 CHECK(!val->result_ok);
3697 LDKDecodeError err_var = (*val->contents.err);
3698 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3699 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3700 long err_ref = (long)err_var.inner & ~1;
3703 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
3704 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
3706 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
3707 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
3708 CHECK(val->result_ok);
3709 LDKQueryChannelRange res_var = (*val->contents.result);
3710 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3711 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3712 long res_ref = (long)res_var.inner & ~1;
3715 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
3716 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
3717 CHECK(!val->result_ok);
3718 LDKDecodeError err_var = (*val->contents.err);
3719 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3720 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3721 long err_ref = (long)err_var.inner & ~1;
3724 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
3725 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
3727 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
3728 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
3729 CHECK(val->result_ok);
3730 LDKReplyChannelRange res_var = (*val->contents.result);
3731 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3732 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3733 long res_ref = (long)res_var.inner & ~1;
3736 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
3737 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
3738 CHECK(!val->result_ok);
3739 LDKDecodeError err_var = (*val->contents.err);
3740 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3741 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3742 long err_ref = (long)err_var.inner & ~1;
3745 jboolean __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_result_ok(uint32_t arg) {
3746 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
3748 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t arg) {
3749 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
3750 CHECK(val->result_ok);
3751 LDKGossipTimestampFilter res_var = (*val->contents.result);
3752 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3753 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3754 long res_ref = (long)res_var.inner & ~1;
3757 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t arg) {
3758 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
3759 CHECK(!val->result_ok);
3760 LDKDecodeError err_var = (*val->contents.err);
3761 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3762 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3763 long err_ref = (long)err_var.inner & ~1;
3766 typedef struct LDKMessageSendEventsProvider_JCalls {
3767 atomic_size_t refcnt;
3768 uint32_t get_and_clear_pending_msg_events_meth;
3769 } LDKMessageSendEventsProvider_JCalls;
3770 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
3771 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3772 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3773 js_free(j_calls->get_and_clear_pending_msg_events_meth);
3777 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
3778 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3779 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
3780 LDKCVec_MessageSendEventZ ret_constr;
3781 ret_constr.datalen = *((uint32_t*)ret);
3782 if (ret_constr.datalen > 0)
3783 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
3785 ret_constr.data = NULL;
3786 uint32_t* ret_vals = (uint32_t*)(ret + 4);
3787 for (size_t s = 0; s < ret_constr.datalen; s++) {
3788 uint32_t ret_conv_18 = ret_vals[s];
3789 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
3790 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)ret_conv_18);
3791 ret_constr.data[s] = ret_conv_18_conv;
3795 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
3796 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3797 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3798 return (void*) this_arg;
3800 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
3801 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
3802 atomic_init(&calls->refcnt, 1);
3803 //TODO: Assign calls->o from o
3805 LDKMessageSendEventsProvider ret = {
3806 .this_arg = (void*) calls,
3807 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
3808 .free = LDKMessageSendEventsProvider_JCalls_free,
3812 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
3813 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
3814 *res_ptr = LDKMessageSendEventsProvider_init(o);
3815 return (long)res_ptr;
3817 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
3818 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
3819 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
3820 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3821 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3822 for (size_t s = 0; s < ret_var.datalen; s++) {
3823 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
3824 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
3825 long ret_conv_18_ref = (long)ret_conv_18_copy;
3826 ret_arr_ptr[s] = ret_conv_18_ref;
3832 typedef struct LDKEventsProvider_JCalls {
3833 atomic_size_t refcnt;
3834 uint32_t get_and_clear_pending_events_meth;
3835 } LDKEventsProvider_JCalls;
3836 static void LDKEventsProvider_JCalls_free(void* this_arg) {
3837 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3838 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3839 js_free(j_calls->get_and_clear_pending_events_meth);
3843 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
3844 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3845 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_events_meth);
3846 LDKCVec_EventZ ret_constr;
3847 ret_constr.datalen = *((uint32_t*)ret);
3848 if (ret_constr.datalen > 0)
3849 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
3851 ret_constr.data = NULL;
3852 uint32_t* ret_vals = (uint32_t*)(ret + 4);
3853 for (size_t h = 0; h < ret_constr.datalen; h++) {
3854 uint32_t ret_conv_7 = ret_vals[h];
3855 LDKEvent ret_conv_7_conv = *(LDKEvent*)(((uint64_t)ret_conv_7) & ~1);
3856 ret_conv_7_conv = Event_clone((LDKEvent*)ret_conv_7);
3857 ret_constr.data[h] = ret_conv_7_conv;
3861 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
3862 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3863 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3864 return (void*) this_arg;
3866 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
3867 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
3868 atomic_init(&calls->refcnt, 1);
3869 //TODO: Assign calls->o from o
3871 LDKEventsProvider ret = {
3872 .this_arg = (void*) calls,
3873 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
3874 .free = LDKEventsProvider_JCalls_free,
3878 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
3879 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
3880 *res_ptr = LDKEventsProvider_init(o);
3881 return (long)res_ptr;
3883 uint32_tArray __attribute__((visibility("default"))) TS_EventsProvider_get_and_clear_pending_events(uint32_t this_arg) {
3884 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
3885 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
3886 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3887 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3888 for (size_t h = 0; h < ret_var.datalen; h++) {
3889 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
3890 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
3891 long ret_conv_7_ref = (long)ret_conv_7_copy;
3892 ret_arr_ptr[h] = ret_conv_7_ref;
3898 typedef struct LDKAccess_JCalls {
3899 atomic_size_t refcnt;
3900 uint32_t get_utxo_meth;
3902 static void LDKAccess_JCalls_free(void* this_arg) {
3903 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3904 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3905 js_free(j_calls->get_utxo_meth);
3909 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3910 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3911 int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
3912 memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
3913 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
3914 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
3915 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)ret);
3918 static void* LDKAccess_JCalls_clone(const void* this_arg) {
3919 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3920 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3921 return (void*) this_arg;
3923 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
3924 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3925 atomic_init(&calls->refcnt, 1);
3926 //TODO: Assign calls->o from o
3929 .this_arg = (void*) calls,
3930 .get_utxo = get_utxo_jcall,
3931 .free = LDKAccess_JCalls_free,
3935 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
3936 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3937 *res_ptr = LDKAccess_init(o);
3938 return (long)res_ptr;
3940 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
3941 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
3942 unsigned char genesis_hash_arr[32];
3943 CHECK(*((uint32_t*)genesis_hash) == 32);
3944 memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
3945 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3946 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3947 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3948 return (long)ret_conv;
3951 typedef struct LDKListen_JCalls {
3952 atomic_size_t refcnt;
3953 uint32_t block_connected_meth;
3954 uint32_t block_disconnected_meth;
3956 static void LDKListen_JCalls_free(void* this_arg) {
3957 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
3958 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3959 js_free(j_calls->block_connected_meth);
3960 js_free(j_calls->block_disconnected_meth);
3964 void block_connected_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
3965 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
3966 LDKu8slice block_var = block;
3967 int8_tArray block_arr = init_arr(block_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3968 memcpy((uint8_t*)(block_arr + 4), block_var.data, block_var.datalen);
3969 js_invoke_function_2(j_calls->block_connected_meth, block_arr, height);
3971 void block_disconnected_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
3972 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
3973 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
3974 memcpy((uint8_t*)(header_arr + 4), *header, 80);
3975 js_invoke_function_2(j_calls->block_disconnected_meth, header_arr, height);
3977 static void* LDKListen_JCalls_clone(const void* this_arg) {
3978 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
3979 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3980 return (void*) this_arg;
3982 static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) {
3983 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
3984 atomic_init(&calls->refcnt, 1);
3985 //TODO: Assign calls->o from o
3988 .this_arg = (void*) calls,
3989 .block_connected = block_connected_jcall,
3990 .block_disconnected = block_disconnected_jcall,
3991 .free = LDKListen_JCalls_free,
3995 long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) {
3996 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
3997 *res_ptr = LDKListen_init(o);
3998 return (long)res_ptr;
4000 void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
4001 LDKListen* this_arg_conv = (LDKListen*)this_arg;
4002 LDKu8slice block_ref;
4003 block_ref.datalen = *((uint32_t*)block);
4004 block_ref.data = (int8_t*)(block + 4);
4005 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
4008 void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
4009 LDKListen* this_arg_conv = (LDKListen*)this_arg;
4010 unsigned char header_arr[80];
4011 CHECK(*((uint32_t*)header) == 80);
4012 memcpy(header_arr, (uint8_t*)(header + 4), 80);
4013 unsigned char (*header_ref)[80] = &header_arr;
4014 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
4017 typedef struct LDKFilter_JCalls {
4018 atomic_size_t refcnt;
4019 uint32_t register_tx_meth;
4020 uint32_t register_output_meth;
4022 static void LDKFilter_JCalls_free(void* this_arg) {
4023 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4024 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4025 js_free(j_calls->register_tx_meth);
4026 js_free(j_calls->register_output_meth);
4030 void register_tx_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
4031 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4032 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4033 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
4034 LDKu8slice script_pubkey_var = script_pubkey;
4035 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4036 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
4037 js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
4039 void register_output_jcall(const void* this_arg, const LDKOutPoint * outpoint, LDKu8slice script_pubkey) {
4040 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4041 LDKOutPoint outpoint_var = *outpoint;
4042 outpoint_var = OutPoint_clone(outpoint);
4043 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4044 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4045 long outpoint_ref = (long)outpoint_var.inner;
4046 if (outpoint_var.is_owned) {
4049 LDKu8slice script_pubkey_var = script_pubkey;
4050 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4051 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
4052 js_invoke_function_2(j_calls->register_output_meth, outpoint_ref, script_pubkey_arr);
4054 static void* LDKFilter_JCalls_clone(const void* this_arg) {
4055 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4056 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4057 return (void*) this_arg;
4059 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
4060 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
4061 atomic_init(&calls->refcnt, 1);
4062 //TODO: Assign calls->o from o
4065 .this_arg = (void*) calls,
4066 .register_tx = register_tx_jcall,
4067 .register_output = register_output_jcall,
4068 .free = LDKFilter_JCalls_free,
4072 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
4073 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
4074 *res_ptr = LDKFilter_init(o);
4075 return (long)res_ptr;
4077 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
4078 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
4079 unsigned char txid_arr[32];
4080 CHECK(*((uint32_t*)txid) == 32);
4081 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
4082 unsigned char (*txid_ref)[32] = &txid_arr;
4083 LDKu8slice script_pubkey_ref;
4084 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
4085 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
4086 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
4089 void __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t outpoint, int8_tArray script_pubkey) {
4090 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
4091 LDKOutPoint outpoint_conv;
4092 outpoint_conv.inner = (void*)(outpoint & (~1));
4093 outpoint_conv.is_owned = false;
4094 LDKu8slice script_pubkey_ref;
4095 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
4096 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
4097 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
4100 typedef struct LDKPersist_JCalls {
4101 atomic_size_t refcnt;
4102 uint32_t persist_new_channel_meth;
4103 uint32_t update_persisted_channel_meth;
4104 } LDKPersist_JCalls;
4105 static void LDKPersist_JCalls_free(void* this_arg) {
4106 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4107 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4108 js_free(j_calls->persist_new_channel_meth);
4109 js_free(j_calls->update_persisted_channel_meth);
4113 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
4114 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4115 LDKOutPoint id_var = id;
4116 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4117 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4118 long id_ref = (long)id_var.inner;
4119 if (id_var.is_owned) {
4122 LDKChannelMonitor data_var = *data;
4123 data_var = ChannelMonitor_clone(data);
4124 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4125 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4126 long data_ref = (long)data_var.inner;
4127 if (data_var.is_owned) {
4130 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
4131 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
4132 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
4135 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
4136 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4137 LDKOutPoint id_var = id;
4138 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4139 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4140 long id_ref = (long)id_var.inner;
4141 if (id_var.is_owned) {
4144 LDKChannelMonitorUpdate update_var = *update;
4145 update_var = ChannelMonitorUpdate_clone(update);
4146 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4147 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4148 long update_ref = (long)update_var.inner;
4149 if (update_var.is_owned) {
4152 LDKChannelMonitor data_var = *data;
4153 data_var = ChannelMonitor_clone(data);
4154 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4155 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4156 long data_ref = (long)data_var.inner;
4157 if (data_var.is_owned) {
4160 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_3(j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
4161 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
4162 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
4165 static void* LDKPersist_JCalls_clone(const void* this_arg) {
4166 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4167 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4168 return (void*) this_arg;
4170 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
4171 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
4172 atomic_init(&calls->refcnt, 1);
4173 //TODO: Assign calls->o from o
4176 .this_arg = (void*) calls,
4177 .persist_new_channel = persist_new_channel_jcall,
4178 .update_persisted_channel = update_persisted_channel_jcall,
4179 .free = LDKPersist_JCalls_free,
4183 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
4184 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
4185 *res_ptr = LDKPersist_init(o);
4186 return (long)res_ptr;
4188 uint32_t __attribute__((visibility("default"))) TS_Persist_persist_new_channel(uint32_t this_arg, uint32_t id, uint32_t data) {
4189 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
4190 LDKOutPoint id_conv;
4191 id_conv.inner = (void*)(id & (~1));
4192 id_conv.is_owned = (id & 1) || (id == 0);
4193 id_conv = OutPoint_clone(&id_conv);
4194 LDKChannelMonitor data_conv;
4195 data_conv.inner = (void*)(data & (~1));
4196 data_conv.is_owned = false;
4197 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4198 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
4199 return (long)ret_conv;
4202 uint32_t __attribute__((visibility("default"))) TS_Persist_update_persisted_channel(uint32_t this_arg, uint32_t id, uint32_t update, uint32_t data) {
4203 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
4204 LDKOutPoint id_conv;
4205 id_conv.inner = (void*)(id & (~1));
4206 id_conv.is_owned = (id & 1) || (id == 0);
4207 id_conv = OutPoint_clone(&id_conv);
4208 LDKChannelMonitorUpdate update_conv;
4209 update_conv.inner = (void*)(update & (~1));
4210 update_conv.is_owned = false;
4211 LDKChannelMonitor data_conv;
4212 data_conv.inner = (void*)(data & (~1));
4213 data_conv.is_owned = false;
4214 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4215 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
4216 return (long)ret_conv;
4219 typedef struct LDKChannelMessageHandler_JCalls {
4220 atomic_size_t refcnt;
4221 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4222 uint32_t handle_open_channel_meth;
4223 uint32_t handle_accept_channel_meth;
4224 uint32_t handle_funding_created_meth;
4225 uint32_t handle_funding_signed_meth;
4226 uint32_t handle_funding_locked_meth;
4227 uint32_t handle_shutdown_meth;
4228 uint32_t handle_closing_signed_meth;
4229 uint32_t handle_update_add_htlc_meth;
4230 uint32_t handle_update_fulfill_htlc_meth;
4231 uint32_t handle_update_fail_htlc_meth;
4232 uint32_t handle_update_fail_malformed_htlc_meth;
4233 uint32_t handle_commitment_signed_meth;
4234 uint32_t handle_revoke_and_ack_meth;
4235 uint32_t handle_update_fee_meth;
4236 uint32_t handle_announcement_signatures_meth;
4237 uint32_t peer_disconnected_meth;
4238 uint32_t peer_connected_meth;
4239 uint32_t handle_channel_reestablish_meth;
4240 uint32_t handle_error_meth;
4241 } LDKChannelMessageHandler_JCalls;
4242 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
4243 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4244 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4245 js_free(j_calls->handle_open_channel_meth);
4246 js_free(j_calls->handle_accept_channel_meth);
4247 js_free(j_calls->handle_funding_created_meth);
4248 js_free(j_calls->handle_funding_signed_meth);
4249 js_free(j_calls->handle_funding_locked_meth);
4250 js_free(j_calls->handle_shutdown_meth);
4251 js_free(j_calls->handle_closing_signed_meth);
4252 js_free(j_calls->handle_update_add_htlc_meth);
4253 js_free(j_calls->handle_update_fulfill_htlc_meth);
4254 js_free(j_calls->handle_update_fail_htlc_meth);
4255 js_free(j_calls->handle_update_fail_malformed_htlc_meth);
4256 js_free(j_calls->handle_commitment_signed_meth);
4257 js_free(j_calls->handle_revoke_and_ack_meth);
4258 js_free(j_calls->handle_update_fee_meth);
4259 js_free(j_calls->handle_announcement_signatures_meth);
4260 js_free(j_calls->peer_disconnected_meth);
4261 js_free(j_calls->peer_connected_meth);
4262 js_free(j_calls->handle_channel_reestablish_meth);
4263 js_free(j_calls->handle_error_meth);
4267 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
4268 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4269 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4270 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4271 LDKInitFeatures their_features_var = their_features;
4272 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4273 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4274 long their_features_ref = (long)their_features_var.inner;
4275 if (their_features_var.is_owned) {
4276 their_features_ref |= 1;
4278 LDKOpenChannel msg_var = *msg;
4279 msg_var = OpenChannel_clone(msg);
4280 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4281 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4282 long msg_ref = (long)msg_var.inner;
4283 if (msg_var.is_owned) {
4286 js_invoke_function_3(j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4288 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
4289 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4290 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4291 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4292 LDKInitFeatures their_features_var = their_features;
4293 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4294 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4295 long their_features_ref = (long)their_features_var.inner;
4296 if (their_features_var.is_owned) {
4297 their_features_ref |= 1;
4299 LDKAcceptChannel msg_var = *msg;
4300 msg_var = AcceptChannel_clone(msg);
4301 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4302 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4303 long msg_ref = (long)msg_var.inner;
4304 if (msg_var.is_owned) {
4307 js_invoke_function_3(j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4309 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
4310 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4311 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4312 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4313 LDKFundingCreated msg_var = *msg;
4314 msg_var = FundingCreated_clone(msg);
4315 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4316 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4317 long msg_ref = (long)msg_var.inner;
4318 if (msg_var.is_owned) {
4321 js_invoke_function_2(j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
4323 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
4324 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4325 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4326 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4327 LDKFundingSigned msg_var = *msg;
4328 msg_var = FundingSigned_clone(msg);
4329 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4330 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4331 long msg_ref = (long)msg_var.inner;
4332 if (msg_var.is_owned) {
4335 js_invoke_function_2(j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
4337 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
4338 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4339 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4340 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4341 LDKFundingLocked msg_var = *msg;
4342 msg_var = FundingLocked_clone(msg);
4343 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4344 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4345 long msg_ref = (long)msg_var.inner;
4346 if (msg_var.is_owned) {
4349 js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
4351 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
4352 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4353 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4354 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4355 LDKInitFeatures their_features_var = *their_features;
4356 their_features_var = InitFeatures_clone(their_features);
4357 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4358 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4359 long their_features_ref = (long)their_features_var.inner;
4360 if (their_features_var.is_owned) {
4361 their_features_ref |= 1;
4363 LDKShutdown msg_var = *msg;
4364 msg_var = Shutdown_clone(msg);
4365 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4366 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4367 long msg_ref = (long)msg_var.inner;
4368 if (msg_var.is_owned) {
4371 js_invoke_function_3(j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
4373 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
4374 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4375 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4376 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4377 LDKClosingSigned msg_var = *msg;
4378 msg_var = ClosingSigned_clone(msg);
4379 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4380 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4381 long msg_ref = (long)msg_var.inner;
4382 if (msg_var.is_owned) {
4385 js_invoke_function_2(j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
4387 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
4388 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4389 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4390 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4391 LDKUpdateAddHTLC msg_var = *msg;
4392 msg_var = UpdateAddHTLC_clone(msg);
4393 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4394 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4395 long msg_ref = (long)msg_var.inner;
4396 if (msg_var.is_owned) {
4399 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
4401 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
4402 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4403 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4404 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4405 LDKUpdateFulfillHTLC msg_var = *msg;
4406 msg_var = UpdateFulfillHTLC_clone(msg);
4407 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4408 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4409 long msg_ref = (long)msg_var.inner;
4410 if (msg_var.is_owned) {
4413 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
4415 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
4416 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4417 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4418 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4419 LDKUpdateFailHTLC msg_var = *msg;
4420 msg_var = UpdateFailHTLC_clone(msg);
4421 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4422 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4423 long msg_ref = (long)msg_var.inner;
4424 if (msg_var.is_owned) {
4427 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
4429 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
4430 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4431 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4432 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4433 LDKUpdateFailMalformedHTLC msg_var = *msg;
4434 msg_var = UpdateFailMalformedHTLC_clone(msg);
4435 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4436 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4437 long msg_ref = (long)msg_var.inner;
4438 if (msg_var.is_owned) {
4441 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
4443 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
4444 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4445 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4446 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4447 LDKCommitmentSigned msg_var = *msg;
4448 msg_var = CommitmentSigned_clone(msg);
4449 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4450 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4451 long msg_ref = (long)msg_var.inner;
4452 if (msg_var.is_owned) {
4455 js_invoke_function_2(j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
4457 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
4458 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4459 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4460 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4461 LDKRevokeAndACK msg_var = *msg;
4462 msg_var = RevokeAndACK_clone(msg);
4463 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4464 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4465 long msg_ref = (long)msg_var.inner;
4466 if (msg_var.is_owned) {
4469 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
4471 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
4472 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4473 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4474 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4475 LDKUpdateFee msg_var = *msg;
4476 msg_var = UpdateFee_clone(msg);
4477 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4478 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4479 long msg_ref = (long)msg_var.inner;
4480 if (msg_var.is_owned) {
4483 js_invoke_function_2(j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
4485 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
4486 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4487 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4488 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4489 LDKAnnouncementSignatures msg_var = *msg;
4490 msg_var = AnnouncementSignatures_clone(msg);
4491 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4492 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4493 long msg_ref = (long)msg_var.inner;
4494 if (msg_var.is_owned) {
4497 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
4499 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
4500 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4501 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4502 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4503 js_invoke_function_2(j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
4505 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
4506 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4507 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4508 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4509 LDKInit msg_var = *msg;
4510 msg_var = Init_clone(msg);
4511 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4512 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4513 long msg_ref = (long)msg_var.inner;
4514 if (msg_var.is_owned) {
4517 js_invoke_function_2(j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
4519 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
4520 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4521 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4522 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4523 LDKChannelReestablish msg_var = *msg;
4524 msg_var = ChannelReestablish_clone(msg);
4525 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4526 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4527 long msg_ref = (long)msg_var.inner;
4528 if (msg_var.is_owned) {
4531 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
4533 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
4534 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4535 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4536 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4537 LDKErrorMessage msg_var = *msg;
4538 msg_var = ErrorMessage_clone(msg);
4539 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4540 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4541 long msg_ref = (long)msg_var.inner;
4542 if (msg_var.is_owned) {
4545 js_invoke_function_2(j_calls->handle_error_meth, their_node_id_arr, msg_ref);
4547 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
4548 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4549 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4550 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
4551 return (void*) this_arg;
4553 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
4554 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
4555 atomic_init(&calls->refcnt, 1);
4556 //TODO: Assign calls->o from o
4558 LDKChannelMessageHandler ret = {
4559 .this_arg = (void*) calls,
4560 .handle_open_channel = handle_open_channel_jcall,
4561 .handle_accept_channel = handle_accept_channel_jcall,
4562 .handle_funding_created = handle_funding_created_jcall,
4563 .handle_funding_signed = handle_funding_signed_jcall,
4564 .handle_funding_locked = handle_funding_locked_jcall,
4565 .handle_shutdown = handle_shutdown_jcall,
4566 .handle_closing_signed = handle_closing_signed_jcall,
4567 .handle_update_add_htlc = handle_update_add_htlc_jcall,
4568 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
4569 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
4570 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
4571 .handle_commitment_signed = handle_commitment_signed_jcall,
4572 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
4573 .handle_update_fee = handle_update_fee_jcall,
4574 .handle_announcement_signatures = handle_announcement_signatures_jcall,
4575 .peer_disconnected = peer_disconnected_jcall,
4576 .peer_connected = peer_connected_jcall,
4577 .handle_channel_reestablish = handle_channel_reestablish_jcall,
4578 .handle_error = handle_error_jcall,
4579 .free = LDKChannelMessageHandler_JCalls_free,
4580 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
4582 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
4585 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
4586 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
4587 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
4588 return (long)res_ptr;
4590 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_open_channel(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
4591 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4592 LDKPublicKey their_node_id_ref;
4593 CHECK(*((uint32_t*)their_node_id) == 33);
4594 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4595 LDKInitFeatures their_features_conv;
4596 their_features_conv.inner = (void*)(their_features & (~1));
4597 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4598 their_features_conv = InitFeatures_clone(&their_features_conv);
4599 LDKOpenChannel msg_conv;
4600 msg_conv.inner = (void*)(msg & (~1));
4601 msg_conv.is_owned = false;
4602 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4605 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_accept_channel(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
4606 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4607 LDKPublicKey their_node_id_ref;
4608 CHECK(*((uint32_t*)their_node_id) == 33);
4609 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4610 LDKInitFeatures their_features_conv;
4611 their_features_conv.inner = (void*)(their_features & (~1));
4612 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4613 their_features_conv = InitFeatures_clone(&their_features_conv);
4614 LDKAcceptChannel msg_conv;
4615 msg_conv.inner = (void*)(msg & (~1));
4616 msg_conv.is_owned = false;
4617 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4620 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4621 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4622 LDKPublicKey their_node_id_ref;
4623 CHECK(*((uint32_t*)their_node_id) == 33);
4624 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4625 LDKFundingCreated msg_conv;
4626 msg_conv.inner = (void*)(msg & (~1));
4627 msg_conv.is_owned = false;
4628 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4631 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4632 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4633 LDKPublicKey their_node_id_ref;
4634 CHECK(*((uint32_t*)their_node_id) == 33);
4635 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4636 LDKFundingSigned msg_conv;
4637 msg_conv.inner = (void*)(msg & (~1));
4638 msg_conv.is_owned = false;
4639 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4642 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4643 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4644 LDKPublicKey their_node_id_ref;
4645 CHECK(*((uint32_t*)their_node_id) == 33);
4646 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4647 LDKFundingLocked msg_conv;
4648 msg_conv.inner = (void*)(msg & (~1));
4649 msg_conv.is_owned = false;
4650 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4653 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
4654 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4655 LDKPublicKey their_node_id_ref;
4656 CHECK(*((uint32_t*)their_node_id) == 33);
4657 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4658 LDKInitFeatures their_features_conv;
4659 their_features_conv.inner = (void*)(their_features & (~1));
4660 their_features_conv.is_owned = false;
4661 LDKShutdown msg_conv;
4662 msg_conv.inner = (void*)(msg & (~1));
4663 msg_conv.is_owned = false;
4664 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
4667 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4668 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4669 LDKPublicKey their_node_id_ref;
4670 CHECK(*((uint32_t*)their_node_id) == 33);
4671 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4672 LDKClosingSigned msg_conv;
4673 msg_conv.inner = (void*)(msg & (~1));
4674 msg_conv.is_owned = false;
4675 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4678 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4679 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4680 LDKPublicKey their_node_id_ref;
4681 CHECK(*((uint32_t*)their_node_id) == 33);
4682 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4683 LDKUpdateAddHTLC msg_conv;
4684 msg_conv.inner = (void*)(msg & (~1));
4685 msg_conv.is_owned = false;
4686 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4689 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4690 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4691 LDKPublicKey their_node_id_ref;
4692 CHECK(*((uint32_t*)their_node_id) == 33);
4693 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4694 LDKUpdateFulfillHTLC msg_conv;
4695 msg_conv.inner = (void*)(msg & (~1));
4696 msg_conv.is_owned = false;
4697 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4700 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4701 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4702 LDKPublicKey their_node_id_ref;
4703 CHECK(*((uint32_t*)their_node_id) == 33);
4704 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4705 LDKUpdateFailHTLC msg_conv;
4706 msg_conv.inner = (void*)(msg & (~1));
4707 msg_conv.is_owned = false;
4708 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4711 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4712 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4713 LDKPublicKey their_node_id_ref;
4714 CHECK(*((uint32_t*)their_node_id) == 33);
4715 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4716 LDKUpdateFailMalformedHTLC msg_conv;
4717 msg_conv.inner = (void*)(msg & (~1));
4718 msg_conv.is_owned = false;
4719 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4722 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4723 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4724 LDKPublicKey their_node_id_ref;
4725 CHECK(*((uint32_t*)their_node_id) == 33);
4726 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4727 LDKCommitmentSigned msg_conv;
4728 msg_conv.inner = (void*)(msg & (~1));
4729 msg_conv.is_owned = false;
4730 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4733 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4734 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4735 LDKPublicKey their_node_id_ref;
4736 CHECK(*((uint32_t*)their_node_id) == 33);
4737 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4738 LDKRevokeAndACK msg_conv;
4739 msg_conv.inner = (void*)(msg & (~1));
4740 msg_conv.is_owned = false;
4741 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4744 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4745 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4746 LDKPublicKey their_node_id_ref;
4747 CHECK(*((uint32_t*)their_node_id) == 33);
4748 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4749 LDKUpdateFee msg_conv;
4750 msg_conv.inner = (void*)(msg & (~1));
4751 msg_conv.is_owned = false;
4752 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4755 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4756 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4757 LDKPublicKey their_node_id_ref;
4758 CHECK(*((uint32_t*)their_node_id) == 33);
4759 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4760 LDKAnnouncementSignatures msg_conv;
4761 msg_conv.inner = (void*)(msg & (~1));
4762 msg_conv.is_owned = false;
4763 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4766 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
4767 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4768 LDKPublicKey their_node_id_ref;
4769 CHECK(*((uint32_t*)their_node_id) == 33);
4770 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4771 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
4774 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4775 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4776 LDKPublicKey their_node_id_ref;
4777 CHECK(*((uint32_t*)their_node_id) == 33);
4778 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4780 msg_conv.inner = (void*)(msg & (~1));
4781 msg_conv.is_owned = false;
4782 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4785 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4786 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4787 LDKPublicKey their_node_id_ref;
4788 CHECK(*((uint32_t*)their_node_id) == 33);
4789 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4790 LDKChannelReestablish msg_conv;
4791 msg_conv.inner = (void*)(msg & (~1));
4792 msg_conv.is_owned = false;
4793 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4796 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4797 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4798 LDKPublicKey their_node_id_ref;
4799 CHECK(*((uint32_t*)their_node_id) == 33);
4800 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4801 LDKErrorMessage msg_conv;
4802 msg_conv.inner = (void*)(msg & (~1));
4803 msg_conv.is_owned = false;
4804 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4807 typedef struct LDKRoutingMessageHandler_JCalls {
4808 atomic_size_t refcnt;
4809 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4810 uint32_t handle_node_announcement_meth;
4811 uint32_t handle_channel_announcement_meth;
4812 uint32_t handle_channel_update_meth;
4813 uint32_t handle_htlc_fail_channel_update_meth;
4814 uint32_t get_next_channel_announcements_meth;
4815 uint32_t get_next_node_announcements_meth;
4816 uint32_t sync_routing_table_meth;
4817 uint32_t handle_reply_channel_range_meth;
4818 uint32_t handle_reply_short_channel_ids_end_meth;
4819 uint32_t handle_query_channel_range_meth;
4820 uint32_t handle_query_short_channel_ids_meth;
4821 } LDKRoutingMessageHandler_JCalls;
4822 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
4823 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4824 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4825 js_free(j_calls->handle_node_announcement_meth);
4826 js_free(j_calls->handle_channel_announcement_meth);
4827 js_free(j_calls->handle_channel_update_meth);
4828 js_free(j_calls->handle_htlc_fail_channel_update_meth);
4829 js_free(j_calls->get_next_channel_announcements_meth);
4830 js_free(j_calls->get_next_node_announcements_meth);
4831 js_free(j_calls->sync_routing_table_meth);
4832 js_free(j_calls->handle_reply_channel_range_meth);
4833 js_free(j_calls->handle_reply_short_channel_ids_end_meth);
4834 js_free(j_calls->handle_query_channel_range_meth);
4835 js_free(j_calls->handle_query_short_channel_ids_meth);
4839 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
4840 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4841 LDKNodeAnnouncement msg_var = *msg;
4842 msg_var = NodeAnnouncement_clone(msg);
4843 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4844 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4845 long msg_ref = (long)msg_var.inner;
4846 if (msg_var.is_owned) {
4849 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
4850 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
4851 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
4854 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
4855 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4856 LDKChannelAnnouncement msg_var = *msg;
4857 msg_var = ChannelAnnouncement_clone(msg);
4858 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4859 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4860 long msg_ref = (long)msg_var.inner;
4861 if (msg_var.is_owned) {
4864 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
4865 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
4866 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
4869 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
4870 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4871 LDKChannelUpdate msg_var = *msg;
4872 msg_var = ChannelUpdate_clone(msg);
4873 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4874 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4875 long msg_ref = (long)msg_var.inner;
4876 if (msg_var.is_owned) {
4879 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
4880 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
4881 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
4884 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
4885 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4886 long ret_update = (long)update;
4887 js_invoke_function_1(j_calls->handle_htlc_fail_channel_update_meth, ret_update);
4889 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
4890 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4891 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
4892 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
4893 ret_constr.datalen = *((uint32_t*)ret);
4894 if (ret_constr.datalen > 0)
4895 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4897 ret_constr.data = NULL;
4898 uint32_t* ret_vals = (uint32_t*)(ret + 4);
4899 for (size_t l = 0; l < ret_constr.datalen; l++) {
4900 uint32_t ret_conv_63 = ret_vals[l];
4901 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
4902 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ret_conv_63);
4903 ret_constr.data[l] = ret_conv_63_conv;
4907 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
4908 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4909 int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4910 memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33);
4911 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
4912 LDKCVec_NodeAnnouncementZ ret_constr;
4913 ret_constr.datalen = *((uint32_t*)ret);
4914 if (ret_constr.datalen > 0)
4915 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
4917 ret_constr.data = NULL;
4918 uint32_t* ret_vals = (uint32_t*)(ret + 4);
4919 for (size_t s = 0; s < ret_constr.datalen; s++) {
4920 uint32_t ret_conv_18 = ret_vals[s];
4921 LDKNodeAnnouncement ret_conv_18_conv;
4922 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
4923 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
4924 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
4925 ret_constr.data[s] = ret_conv_18_conv;
4929 void sync_routing_table_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
4930 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4931 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4932 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4933 LDKInit init_var = *init;
4934 init_var = Init_clone(init);
4935 CHECK((((long)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4936 CHECK((((long)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4937 long init_ref = (long)init_var.inner;
4938 if (init_var.is_owned) {
4941 js_invoke_function_2(j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
4943 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
4944 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4945 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4946 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4947 LDKReplyChannelRange msg_var = msg;
4948 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4949 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4950 long msg_ref = (long)msg_var.inner;
4951 if (msg_var.is_owned) {
4954 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
4955 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
4956 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
4959 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
4960 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4961 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4962 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4963 LDKReplyShortChannelIdsEnd msg_var = msg;
4964 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4965 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4966 long msg_ref = (long)msg_var.inner;
4967 if (msg_var.is_owned) {
4970 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
4971 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
4972 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
4975 LDKCResult_NoneLightningErrorZ handle_query_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
4976 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4977 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4978 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4979 LDKQueryChannelRange msg_var = msg;
4980 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4981 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4982 long msg_ref = (long)msg_var.inner;
4983 if (msg_var.is_owned) {
4986 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
4987 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
4988 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
4991 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
4992 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4993 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4994 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4995 LDKQueryShortChannelIds msg_var = msg;
4996 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4997 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4998 long msg_ref = (long)msg_var.inner;
4999 if (msg_var.is_owned) {
5002 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
5003 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5004 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5007 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
5008 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5009 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5010 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
5011 return (void*) this_arg;
5013 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
5014 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
5015 atomic_init(&calls->refcnt, 1);
5016 //TODO: Assign calls->o from o
5018 LDKRoutingMessageHandler ret = {
5019 .this_arg = (void*) calls,
5020 .handle_node_announcement = handle_node_announcement_jcall,
5021 .handle_channel_announcement = handle_channel_announcement_jcall,
5022 .handle_channel_update = handle_channel_update_jcall,
5023 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
5024 .get_next_channel_announcements = get_next_channel_announcements_jcall,
5025 .get_next_node_announcements = get_next_node_announcements_jcall,
5026 .sync_routing_table = sync_routing_table_jcall,
5027 .handle_reply_channel_range = handle_reply_channel_range_jcall,
5028 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_jcall,
5029 .handle_query_channel_range = handle_query_channel_range_jcall,
5030 .handle_query_short_channel_ids = handle_query_short_channel_ids_jcall,
5031 .free = LDKRoutingMessageHandler_JCalls_free,
5032 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
5034 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
5037 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
5038 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
5039 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
5040 return (long)res_ptr;
5042 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
5043 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5044 LDKNodeAnnouncement msg_conv;
5045 msg_conv.inner = (void*)(msg & (~1));
5046 msg_conv.is_owned = false;
5047 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5048 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
5049 return (long)ret_conv;
5052 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
5053 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5054 LDKChannelAnnouncement msg_conv;
5055 msg_conv.inner = (void*)(msg & (~1));
5056 msg_conv.is_owned = false;
5057 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5058 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
5059 return (long)ret_conv;
5062 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
5063 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5064 LDKChannelUpdate msg_conv;
5065 msg_conv.inner = (void*)(msg & (~1));
5066 msg_conv.is_owned = false;
5067 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5068 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
5069 return (long)ret_conv;
5072 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_htlc_fail_channel_update(uint32_t this_arg, uint32_t update) {
5073 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5074 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
5075 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
5078 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
5079 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5080 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
5081 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5082 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5083 for (size_t l = 0; l < ret_var.datalen; l++) {
5084 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5085 *ret_conv_63_ref = ret_var.data[l];
5086 ret_arr_ptr[l] = (long)ret_conv_63_ref;
5092 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
5093 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5094 LDKPublicKey starting_point_ref;
5095 CHECK(*((uint32_t*)starting_point) == 33);
5096 memcpy(starting_point_ref.compressed_form, (uint8_t*)(starting_point + 4), 33);
5097 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
5098 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5099 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5100 for (size_t s = 0; s < ret_var.datalen; s++) {
5101 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
5102 CHECK((((long)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5103 CHECK((((long)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5104 long ret_conv_18_ref = (long)ret_conv_18_var.inner;
5105 if (ret_conv_18_var.is_owned) {
5106 ret_conv_18_ref |= 1;
5108 ret_arr_ptr[s] = ret_conv_18_ref;
5114 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
5115 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5116 LDKPublicKey their_node_id_ref;
5117 CHECK(*((uint32_t*)their_node_id) == 33);
5118 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5120 init_conv.inner = (void*)(init & (~1));
5121 init_conv.is_owned = false;
5122 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
5125 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5126 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5127 LDKPublicKey their_node_id_ref;
5128 CHECK(*((uint32_t*)their_node_id) == 33);
5129 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5130 LDKReplyChannelRange msg_conv;
5131 msg_conv.inner = (void*)(msg & (~1));
5132 msg_conv.is_owned = (msg & 1) || (msg == 0);
5133 msg_conv = ReplyChannelRange_clone(&msg_conv);
5134 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5135 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5136 return (long)ret_conv;
5139 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_short_channel_ids_end(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5140 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5141 LDKPublicKey their_node_id_ref;
5142 CHECK(*((uint32_t*)their_node_id) == 33);
5143 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5144 LDKReplyShortChannelIdsEnd msg_conv;
5145 msg_conv.inner = (void*)(msg & (~1));
5146 msg_conv.is_owned = (msg & 1) || (msg == 0);
5147 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
5148 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5149 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5150 return (long)ret_conv;
5153 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5154 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5155 LDKPublicKey their_node_id_ref;
5156 CHECK(*((uint32_t*)their_node_id) == 33);
5157 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5158 LDKQueryChannelRange msg_conv;
5159 msg_conv.inner = (void*)(msg & (~1));
5160 msg_conv.is_owned = (msg & 1) || (msg == 0);
5161 msg_conv = QueryChannelRange_clone(&msg_conv);
5162 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5163 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5164 return (long)ret_conv;
5167 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5168 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5169 LDKPublicKey their_node_id_ref;
5170 CHECK(*((uint32_t*)their_node_id) == 33);
5171 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5172 LDKQueryShortChannelIds msg_conv;
5173 msg_conv.inner = (void*)(msg & (~1));
5174 msg_conv.is_owned = (msg & 1) || (msg == 0);
5175 msg_conv = QueryShortChannelIds_clone(&msg_conv);
5176 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5177 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5178 return (long)ret_conv;
5181 typedef struct LDKSocketDescriptor_JCalls {
5182 atomic_size_t refcnt;
5183 uint32_t send_data_meth;
5184 uint32_t disconnect_socket_meth;
5187 } LDKSocketDescriptor_JCalls;
5188 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
5189 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5190 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5191 js_free(j_calls->send_data_meth);
5192 js_free(j_calls->disconnect_socket_meth);
5193 js_free(j_calls->eq_meth);
5194 js_free(j_calls->hash_meth);
5198 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
5199 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5200 LDKu8slice data_var = data;
5201 int8_tArray data_arr = init_arr(data_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5202 memcpy((uint8_t*)(data_arr + 4), data_var.data, data_var.datalen);
5203 return js_invoke_function_2(j_calls->send_data_meth, data_arr, resume_read);
5205 void disconnect_socket_jcall(void* this_arg) {
5206 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5207 js_invoke_function_0(j_calls->disconnect_socket_meth);
5209 bool eq_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
5210 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5211 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5212 *other_arg_clone = SocketDescriptor_clone(other_arg);
5213 return js_invoke_function_1(j_calls->eq_meth, (long)other_arg_clone);
5215 uint64_t hash_jcall(const void* this_arg) {
5216 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5217 return js_invoke_function_0(j_calls->hash_meth);
5219 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
5220 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5221 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5222 return (void*) this_arg;
5224 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
5225 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
5226 atomic_init(&calls->refcnt, 1);
5227 //TODO: Assign calls->o from o
5229 LDKSocketDescriptor ret = {
5230 .this_arg = (void*) calls,
5231 .send_data = send_data_jcall,
5232 .disconnect_socket = disconnect_socket_jcall,
5235 .clone = LDKSocketDescriptor_JCalls_clone,
5236 .free = LDKSocketDescriptor_JCalls_free,
5240 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
5241 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5242 *res_ptr = LDKSocketDescriptor_init(o);
5243 return (long)res_ptr;
5245 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
5246 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5247 LDKu8slice data_ref;
5248 data_ref.datalen = *((uint32_t*)data);
5249 data_ref.data = (int8_t*)(data + 4);
5250 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
5254 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
5255 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5256 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
5259 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
5260 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5261 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
5265 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
5266 LDKTransaction _res_ref;
5267 _res_ref.datalen = *((uint32_t*)_res);
5268 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
5269 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
5270 _res_ref.data_is_owned = true;
5271 Transaction_free(_res_ref);
5274 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
5275 if ((_res & 1) != 0) return;
5276 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
5278 TxOut_free(_res_conv);
5281 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
5282 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
5283 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5284 *ret_ref = TxOut_clone(orig_conv);
5285 return (long)ret_ref;
5288 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
5290 CHECK(*((uint32_t*)o) == 32);
5291 memcpy(o_ref.bytes, (uint8_t*)(o + 4), 32);
5292 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
5293 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
5294 return (long)ret_conv;
5297 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
5298 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5299 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
5300 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
5301 return (long)ret_conv;
5304 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
5305 if ((_res & 1) != 0) return;
5306 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
5308 CResult_SecretKeyErrorZ_free(_res_conv);
5311 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
5313 CHECK(*((uint32_t*)o) == 33);
5314 memcpy(o_ref.compressed_form, (uint8_t*)(o + 4), 33);
5315 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
5316 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
5317 return (long)ret_conv;
5320 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
5321 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5322 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
5323 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
5324 return (long)ret_conv;
5327 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
5328 if ((_res & 1) != 0) return;
5329 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
5331 CResult_PublicKeyErrorZ_free(_res_conv);
5334 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
5335 LDKTxCreationKeys o_conv;
5336 o_conv.inner = (void*)(o & (~1));
5337 o_conv.is_owned = (o & 1) || (o == 0);
5338 o_conv = TxCreationKeys_clone(&o_conv);
5339 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
5340 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
5341 return (long)ret_conv;
5344 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
5345 LDKDecodeError e_conv;
5346 e_conv.inner = (void*)(e & (~1));
5347 e_conv.is_owned = (e & 1) || (e == 0);
5348 e_conv = DecodeError_clone(&e_conv);
5349 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
5350 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
5351 return (long)ret_conv;
5354 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
5355 if ((_res & 1) != 0) return;
5356 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
5358 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
5361 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
5362 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
5363 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
5364 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
5365 return (long)ret_conv;
5368 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
5369 LDKChannelPublicKeys o_conv;
5370 o_conv.inner = (void*)(o & (~1));
5371 o_conv.is_owned = (o & 1) || (o == 0);
5372 o_conv = ChannelPublicKeys_clone(&o_conv);
5373 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
5374 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
5375 return (long)ret_conv;
5378 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
5379 LDKDecodeError e_conv;
5380 e_conv.inner = (void*)(e & (~1));
5381 e_conv.is_owned = (e & 1) || (e == 0);
5382 e_conv = DecodeError_clone(&e_conv);
5383 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
5384 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
5385 return (long)ret_conv;
5388 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
5389 if ((_res & 1) != 0) return;
5390 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
5392 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
5395 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
5396 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
5397 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
5398 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
5399 return (long)ret_conv;
5402 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
5403 LDKTxCreationKeys o_conv;
5404 o_conv.inner = (void*)(o & (~1));
5405 o_conv.is_owned = (o & 1) || (o == 0);
5406 o_conv = TxCreationKeys_clone(&o_conv);
5407 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
5408 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
5409 return (long)ret_conv;
5412 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
5413 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5414 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
5415 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
5416 return (long)ret_conv;
5419 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
5420 if ((_res & 1) != 0) return;
5421 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
5423 CResult_TxCreationKeysErrorZ_free(_res_conv);
5426 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
5427 LDKHTLCOutputInCommitment o_conv;
5428 o_conv.inner = (void*)(o & (~1));
5429 o_conv.is_owned = (o & 1) || (o == 0);
5430 o_conv = HTLCOutputInCommitment_clone(&o_conv);
5431 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
5432 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
5433 return (long)ret_conv;
5436 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
5437 LDKDecodeError e_conv;
5438 e_conv.inner = (void*)(e & (~1));
5439 e_conv.is_owned = (e & 1) || (e == 0);
5440 e_conv = DecodeError_clone(&e_conv);
5441 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
5442 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
5443 return (long)ret_conv;
5446 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
5447 if ((_res & 1) != 0) return;
5448 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
5450 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
5453 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
5454 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
5455 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
5456 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
5457 return (long)ret_conv;
5460 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
5461 LDKCounterpartyChannelTransactionParameters o_conv;
5462 o_conv.inner = (void*)(o & (~1));
5463 o_conv.is_owned = (o & 1) || (o == 0);
5464 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
5465 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
5466 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
5467 return (long)ret_conv;
5470 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
5471 LDKDecodeError e_conv;
5472 e_conv.inner = (void*)(e & (~1));
5473 e_conv.is_owned = (e & 1) || (e == 0);
5474 e_conv = DecodeError_clone(&e_conv);
5475 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
5476 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
5477 return (long)ret_conv;
5480 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
5481 if ((_res & 1) != 0) return;
5482 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
5484 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
5487 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
5488 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
5489 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
5490 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
5491 return (long)ret_conv;
5494 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
5495 LDKChannelTransactionParameters o_conv;
5496 o_conv.inner = (void*)(o & (~1));
5497 o_conv.is_owned = (o & 1) || (o == 0);
5498 o_conv = ChannelTransactionParameters_clone(&o_conv);
5499 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
5500 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
5501 return (long)ret_conv;
5504 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
5505 LDKDecodeError e_conv;
5506 e_conv.inner = (void*)(e & (~1));
5507 e_conv.is_owned = (e & 1) || (e == 0);
5508 e_conv = DecodeError_clone(&e_conv);
5509 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
5510 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
5511 return (long)ret_conv;
5514 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
5515 if ((_res & 1) != 0) return;
5516 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
5518 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
5521 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
5522 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
5523 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
5524 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
5525 return (long)ret_conv;
5528 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
5529 LDKCVec_SignatureZ _res_constr;
5530 _res_constr.datalen = *((uint32_t*)_res);
5531 if (_res_constr.datalen > 0)
5532 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5534 _res_constr.data = NULL;
5535 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
5536 for (size_t m = 0; m < _res_constr.datalen; m++) {
5537 int8_tArray _res_conv_12 = _res_vals[m];
5538 LDKSignature _res_conv_12_ref;
5539 CHECK(*((uint32_t*)_res_conv_12) == 64);
5540 memcpy(_res_conv_12_ref.compact_form, (uint8_t*)(_res_conv_12 + 4), 64);
5541 _res_constr.data[m] = _res_conv_12_ref;
5543 CVec_SignatureZ_free(_res_constr);
5546 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
5547 LDKHolderCommitmentTransaction o_conv;
5548 o_conv.inner = (void*)(o & (~1));
5549 o_conv.is_owned = (o & 1) || (o == 0);
5550 o_conv = HolderCommitmentTransaction_clone(&o_conv);
5551 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
5552 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
5553 return (long)ret_conv;
5556 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
5557 LDKDecodeError e_conv;
5558 e_conv.inner = (void*)(e & (~1));
5559 e_conv.is_owned = (e & 1) || (e == 0);
5560 e_conv = DecodeError_clone(&e_conv);
5561 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
5562 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
5563 return (long)ret_conv;
5566 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
5567 if ((_res & 1) != 0) return;
5568 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
5570 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
5573 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
5574 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
5575 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
5576 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
5577 return (long)ret_conv;
5580 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
5581 LDKBuiltCommitmentTransaction o_conv;
5582 o_conv.inner = (void*)(o & (~1));
5583 o_conv.is_owned = (o & 1) || (o == 0);
5584 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
5585 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
5586 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
5587 return (long)ret_conv;
5590 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
5591 LDKDecodeError e_conv;
5592 e_conv.inner = (void*)(e & (~1));
5593 e_conv.is_owned = (e & 1) || (e == 0);
5594 e_conv = DecodeError_clone(&e_conv);
5595 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
5596 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
5597 return (long)ret_conv;
5600 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
5601 if ((_res & 1) != 0) return;
5602 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
5604 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
5607 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
5608 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
5609 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
5610 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
5611 return (long)ret_conv;
5614 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
5615 LDKCommitmentTransaction o_conv;
5616 o_conv.inner = (void*)(o & (~1));
5617 o_conv.is_owned = (o & 1) || (o == 0);
5618 o_conv = CommitmentTransaction_clone(&o_conv);
5619 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
5620 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
5621 return (long)ret_conv;
5624 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
5625 LDKDecodeError e_conv;
5626 e_conv.inner = (void*)(e & (~1));
5627 e_conv.is_owned = (e & 1) || (e == 0);
5628 e_conv = DecodeError_clone(&e_conv);
5629 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
5630 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
5631 return (long)ret_conv;
5634 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
5635 if ((_res & 1) != 0) return;
5636 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
5638 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
5641 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
5642 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
5643 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
5644 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
5645 return (long)ret_conv;
5648 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
5649 LDKTrustedCommitmentTransaction o_conv;
5650 o_conv.inner = (void*)(o & (~1));
5651 o_conv.is_owned = (o & 1) || (o == 0);
5652 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
5653 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
5654 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
5655 return (long)ret_conv;
5658 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
5659 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
5660 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
5661 return (long)ret_conv;
5664 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
5665 if ((_res & 1) != 0) return;
5666 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
5668 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
5671 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
5672 LDKCVec_SignatureZ o_constr;
5673 o_constr.datalen = *((uint32_t*)o);
5674 if (o_constr.datalen > 0)
5675 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5677 o_constr.data = NULL;
5678 int8_tArray* o_vals = (int8_tArray*)(o + 4);
5679 for (size_t m = 0; m < o_constr.datalen; m++) {
5680 int8_tArray o_conv_12 = o_vals[m];
5681 LDKSignature o_conv_12_ref;
5682 CHECK(*((uint32_t*)o_conv_12) == 64);
5683 memcpy(o_conv_12_ref.compact_form, (uint8_t*)(o_conv_12 + 4), 64);
5684 o_constr.data[m] = o_conv_12_ref;
5686 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5687 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
5688 return (long)ret_conv;
5691 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
5692 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5693 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
5694 return (long)ret_conv;
5697 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
5698 if ((_res & 1) != 0) return;
5699 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
5701 CResult_CVec_SignatureZNoneZ_free(_res_conv);
5704 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
5705 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
5706 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5707 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
5708 return (long)ret_conv;
5711 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
5712 LDKCVec_PublicKeyZ _res_constr;
5713 _res_constr.datalen = *((uint32_t*)_res);
5714 if (_res_constr.datalen > 0)
5715 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
5717 _res_constr.data = NULL;
5718 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
5719 for (size_t m = 0; m < _res_constr.datalen; m++) {
5720 int8_tArray _res_conv_12 = _res_vals[m];
5721 LDKPublicKey _res_conv_12_ref;
5722 CHECK(*((uint32_t*)_res_conv_12) == 33);
5723 memcpy(_res_conv_12_ref.compressed_form, (uint8_t*)(_res_conv_12 + 4), 33);
5724 _res_constr.data[m] = _res_conv_12_ref;
5726 CVec_PublicKeyZ_free(_res_constr);
5729 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
5730 LDKCVec_u8Z _res_ref;
5731 _res_ref.datalen = *((uint32_t*)_res);
5732 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
5733 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
5734 CVec_u8Z_free(_res_ref);
5737 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
5739 o_ref.datalen = *((uint32_t*)o);
5740 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
5741 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
5742 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
5743 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
5744 return (long)ret_conv;
5747 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
5748 LDKPeerHandleError e_conv;
5749 e_conv.inner = (void*)(e & (~1));
5750 e_conv.is_owned = (e & 1) || (e == 0);
5751 e_conv = PeerHandleError_clone(&e_conv);
5752 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
5753 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
5754 return (long)ret_conv;
5757 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
5758 if ((_res & 1) != 0) return;
5759 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
5761 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
5764 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
5765 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
5766 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
5767 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
5768 return (long)ret_conv;
5771 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
5772 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5773 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
5774 return (long)ret_conv;
5777 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
5778 LDKPeerHandleError e_conv;
5779 e_conv.inner = (void*)(e & (~1));
5780 e_conv.is_owned = (e & 1) || (e == 0);
5781 e_conv = PeerHandleError_clone(&e_conv);
5782 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5783 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
5784 return (long)ret_conv;
5787 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
5788 if ((_res & 1) != 0) return;
5789 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
5791 CResult_NonePeerHandleErrorZ_free(_res_conv);
5794 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
5795 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
5796 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5797 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
5798 return (long)ret_conv;
5801 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
5802 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
5803 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
5804 return (long)ret_conv;
5807 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
5808 LDKPeerHandleError e_conv;
5809 e_conv.inner = (void*)(e & (~1));
5810 e_conv.is_owned = (e & 1) || (e == 0);
5811 e_conv = PeerHandleError_clone(&e_conv);
5812 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
5813 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
5814 return (long)ret_conv;
5817 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
5818 if ((_res & 1) != 0) return;
5819 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
5821 CResult_boolPeerHandleErrorZ_free(_res_conv);
5824 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
5825 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
5826 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
5827 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
5828 return (long)ret_conv;
5831 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
5832 LDKInitFeatures o_conv;
5833 o_conv.inner = (void*)(o & (~1));
5834 o_conv.is_owned = (o & 1) || (o == 0);
5835 o_conv = InitFeatures_clone(&o_conv);
5836 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
5837 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
5838 return (long)ret_conv;
5841 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
5842 LDKDecodeError e_conv;
5843 e_conv.inner = (void*)(e & (~1));
5844 e_conv.is_owned = (e & 1) || (e == 0);
5845 e_conv = DecodeError_clone(&e_conv);
5846 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
5847 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
5848 return (long)ret_conv;
5851 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
5852 if ((_res & 1) != 0) return;
5853 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
5855 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
5858 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
5859 LDKNodeFeatures o_conv;
5860 o_conv.inner = (void*)(o & (~1));
5861 o_conv.is_owned = (o & 1) || (o == 0);
5862 o_conv = NodeFeatures_clone(&o_conv);
5863 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
5864 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
5865 return (long)ret_conv;
5868 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
5869 LDKDecodeError e_conv;
5870 e_conv.inner = (void*)(e & (~1));
5871 e_conv.is_owned = (e & 1) || (e == 0);
5872 e_conv = DecodeError_clone(&e_conv);
5873 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
5874 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
5875 return (long)ret_conv;
5878 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
5879 if ((_res & 1) != 0) return;
5880 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
5882 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
5885 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
5886 LDKChannelFeatures o_conv;
5887 o_conv.inner = (void*)(o & (~1));
5888 o_conv.is_owned = (o & 1) || (o == 0);
5889 o_conv = ChannelFeatures_clone(&o_conv);
5890 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
5891 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
5892 return (long)ret_conv;
5895 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
5896 LDKDecodeError e_conv;
5897 e_conv.inner = (void*)(e & (~1));
5898 e_conv.is_owned = (e & 1) || (e == 0);
5899 e_conv = DecodeError_clone(&e_conv);
5900 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
5901 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
5902 return (long)ret_conv;
5905 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
5906 if ((_res & 1) != 0) return;
5907 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
5909 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
5912 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
5913 LDKChannelConfig o_conv;
5914 o_conv.inner = (void*)(o & (~1));
5915 o_conv.is_owned = (o & 1) || (o == 0);
5916 o_conv = ChannelConfig_clone(&o_conv);
5917 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
5918 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
5919 return (long)ret_conv;
5922 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
5923 LDKDecodeError e_conv;
5924 e_conv.inner = (void*)(e & (~1));
5925 e_conv.is_owned = (e & 1) || (e == 0);
5926 e_conv = DecodeError_clone(&e_conv);
5927 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
5928 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
5929 return (long)ret_conv;
5932 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
5933 if ((_res & 1) != 0) return;
5934 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
5936 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
5939 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
5940 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
5941 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
5942 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
5943 return (long)ret_conv;
5946 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
5947 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5948 *ret_conv = CResult_boolLightningErrorZ_ok(o);
5949 return (long)ret_conv;
5952 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
5953 LDKLightningError e_conv;
5954 e_conv.inner = (void*)(e & (~1));
5955 e_conv.is_owned = (e & 1) || (e == 0);
5956 e_conv = LightningError_clone(&e_conv);
5957 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5958 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
5959 return (long)ret_conv;
5962 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
5963 if ((_res & 1) != 0) return;
5964 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
5966 CResult_boolLightningErrorZ_free(_res_conv);
5969 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
5970 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
5971 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5972 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
5973 return (long)ret_conv;
5976 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
5977 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
5978 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5979 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
5980 return (long)ret_ref;
5983 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
5984 LDKChannelAnnouncement a_conv;
5985 a_conv.inner = (void*)(a & (~1));
5986 a_conv.is_owned = (a & 1) || (a == 0);
5987 a_conv = ChannelAnnouncement_clone(&a_conv);
5988 LDKChannelUpdate b_conv;
5989 b_conv.inner = (void*)(b & (~1));
5990 b_conv.is_owned = (b & 1) || (b == 0);
5991 b_conv = ChannelUpdate_clone(&b_conv);
5992 LDKChannelUpdate c_conv;
5993 c_conv.inner = (void*)(c & (~1));
5994 c_conv.is_owned = (c & 1) || (c == 0);
5995 c_conv = ChannelUpdate_clone(&c_conv);
5996 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5997 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
5998 return (long)ret_ref;
6001 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
6002 if ((_res & 1) != 0) return;
6003 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
6005 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
6008 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
6009 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
6010 _res_constr.datalen = *((uint32_t*)_res);
6011 if (_res_constr.datalen > 0)
6012 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6014 _res_constr.data = NULL;
6015 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6016 for (size_t l = 0; l < _res_constr.datalen; l++) {
6017 uint32_t _res_conv_63 = _res_vals[l];
6018 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
6019 FREE((void*)_res_conv_63);
6020 _res_constr.data[l] = _res_conv_63_conv;
6022 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
6025 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
6026 LDKCVec_NodeAnnouncementZ _res_constr;
6027 _res_constr.datalen = *((uint32_t*)_res);
6028 if (_res_constr.datalen > 0)
6029 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6031 _res_constr.data = NULL;
6032 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6033 for (size_t s = 0; s < _res_constr.datalen; s++) {
6034 uint32_t _res_conv_18 = _res_vals[s];
6035 LDKNodeAnnouncement _res_conv_18_conv;
6036 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
6037 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
6038 _res_constr.data[s] = _res_conv_18_conv;
6040 CVec_NodeAnnouncementZ_free(_res_constr);
6043 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
6044 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6045 *ret_conv = CResult_NoneLightningErrorZ_ok();
6046 return (long)ret_conv;
6049 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
6050 LDKLightningError e_conv;
6051 e_conv.inner = (void*)(e & (~1));
6052 e_conv.is_owned = (e & 1) || (e == 0);
6053 e_conv = LightningError_clone(&e_conv);
6054 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6055 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
6056 return (long)ret_conv;
6059 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
6060 if ((_res & 1) != 0) return;
6061 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
6063 CResult_NoneLightningErrorZ_free(_res_conv);
6066 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
6067 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
6068 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6069 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
6070 return (long)ret_conv;
6073 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
6074 LDKCVec_MessageSendEventZ _res_constr;
6075 _res_constr.datalen = *((uint32_t*)_res);
6076 if (_res_constr.datalen > 0)
6077 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
6079 _res_constr.data = NULL;
6080 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6081 for (size_t s = 0; s < _res_constr.datalen; s++) {
6082 uint32_t _res_conv_18 = _res_vals[s];
6083 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
6084 FREE((void*)_res_conv_18);
6085 _res_constr.data[s] = _res_conv_18_conv;
6087 CVec_MessageSendEventZ_free(_res_constr);
6090 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
6091 LDKDirectionalChannelInfo o_conv;
6092 o_conv.inner = (void*)(o & (~1));
6093 o_conv.is_owned = (o & 1) || (o == 0);
6094 o_conv = DirectionalChannelInfo_clone(&o_conv);
6095 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
6096 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
6097 return (long)ret_conv;
6100 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
6101 LDKDecodeError e_conv;
6102 e_conv.inner = (void*)(e & (~1));
6103 e_conv.is_owned = (e & 1) || (e == 0);
6104 e_conv = DecodeError_clone(&e_conv);
6105 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
6106 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
6107 return (long)ret_conv;
6110 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
6111 if ((_res & 1) != 0) return;
6112 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
6114 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
6117 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
6118 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
6119 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
6120 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
6121 return (long)ret_conv;
6124 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
6125 LDKChannelInfo o_conv;
6126 o_conv.inner = (void*)(o & (~1));
6127 o_conv.is_owned = (o & 1) || (o == 0);
6128 o_conv = ChannelInfo_clone(&o_conv);
6129 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
6130 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
6131 return (long)ret_conv;
6134 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
6135 LDKDecodeError e_conv;
6136 e_conv.inner = (void*)(e & (~1));
6137 e_conv.is_owned = (e & 1) || (e == 0);
6138 e_conv = DecodeError_clone(&e_conv);
6139 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
6140 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
6141 return (long)ret_conv;
6144 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
6145 if ((_res & 1) != 0) return;
6146 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
6148 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
6151 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
6152 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
6153 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
6154 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
6155 return (long)ret_conv;
6158 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
6159 LDKRoutingFees o_conv;
6160 o_conv.inner = (void*)(o & (~1));
6161 o_conv.is_owned = (o & 1) || (o == 0);
6162 o_conv = RoutingFees_clone(&o_conv);
6163 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
6164 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
6165 return (long)ret_conv;
6168 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
6169 LDKDecodeError e_conv;
6170 e_conv.inner = (void*)(e & (~1));
6171 e_conv.is_owned = (e & 1) || (e == 0);
6172 e_conv = DecodeError_clone(&e_conv);
6173 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
6174 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
6175 return (long)ret_conv;
6178 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
6179 if ((_res & 1) != 0) return;
6180 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
6182 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
6185 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
6186 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
6187 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
6188 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
6189 return (long)ret_conv;
6192 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
6193 LDKCVec_NetAddressZ _res_constr;
6194 _res_constr.datalen = *((uint32_t*)_res);
6195 if (_res_constr.datalen > 0)
6196 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
6198 _res_constr.data = NULL;
6199 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6200 for (size_t m = 0; m < _res_constr.datalen; m++) {
6201 uint32_t _res_conv_12 = _res_vals[m];
6202 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
6203 FREE((void*)_res_conv_12);
6204 _res_constr.data[m] = _res_conv_12_conv;
6206 CVec_NetAddressZ_free(_res_constr);
6209 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
6210 LDKNodeAnnouncementInfo o_conv;
6211 o_conv.inner = (void*)(o & (~1));
6212 o_conv.is_owned = (o & 1) || (o == 0);
6213 o_conv = NodeAnnouncementInfo_clone(&o_conv);
6214 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
6215 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
6216 return (long)ret_conv;
6219 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
6220 LDKDecodeError e_conv;
6221 e_conv.inner = (void*)(e & (~1));
6222 e_conv.is_owned = (e & 1) || (e == 0);
6223 e_conv = DecodeError_clone(&e_conv);
6224 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
6225 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
6226 return (long)ret_conv;
6229 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
6230 if ((_res & 1) != 0) return;
6231 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
6233 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
6236 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
6237 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
6238 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
6239 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
6240 return (long)ret_conv;
6243 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
6244 LDKCVec_u64Z _res_constr;
6245 _res_constr.datalen = *((uint32_t*)_res);
6246 if (_res_constr.datalen > 0)
6247 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
6249 _res_constr.data = NULL;
6250 int64_t* _res_vals = (int64_t*)(_res + 4);
6251 for (size_t i = 0; i < _res_constr.datalen; i++) {
6252 int64_t _res_conv_8 = _res_vals[i];
6253 _res_constr.data[i] = _res_conv_8;
6255 CVec_u64Z_free(_res_constr);
6258 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
6260 o_conv.inner = (void*)(o & (~1));
6261 o_conv.is_owned = (o & 1) || (o == 0);
6262 o_conv = NodeInfo_clone(&o_conv);
6263 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
6264 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
6265 return (long)ret_conv;
6268 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
6269 LDKDecodeError e_conv;
6270 e_conv.inner = (void*)(e & (~1));
6271 e_conv.is_owned = (e & 1) || (e == 0);
6272 e_conv = DecodeError_clone(&e_conv);
6273 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
6274 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
6275 return (long)ret_conv;
6278 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
6279 if ((_res & 1) != 0) return;
6280 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
6282 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
6285 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
6286 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
6287 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
6288 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
6289 return (long)ret_conv;
6292 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
6293 LDKNetworkGraph o_conv;
6294 o_conv.inner = (void*)(o & (~1));
6295 o_conv.is_owned = (o & 1) || (o == 0);
6296 o_conv = NetworkGraph_clone(&o_conv);
6297 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
6298 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
6299 return (long)ret_conv;
6302 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
6303 LDKDecodeError e_conv;
6304 e_conv.inner = (void*)(e & (~1));
6305 e_conv.is_owned = (e & 1) || (e == 0);
6306 e_conv = DecodeError_clone(&e_conv);
6307 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
6308 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
6309 return (long)ret_conv;
6312 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
6313 if ((_res & 1) != 0) return;
6314 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
6316 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
6319 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
6320 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
6321 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
6322 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
6323 return (long)ret_conv;
6326 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
6327 LDKTransaction b_ref;
6328 b_ref.datalen = *((uint32_t*)b);
6329 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
6330 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
6331 b_ref.data_is_owned = true;
6332 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
6333 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
6334 return (long)ret_ref;
6337 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
6338 if ((_res & 1) != 0) return;
6339 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
6341 C2Tuple_usizeTransactionZ_free(_res_conv);
6344 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
6345 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
6346 _res_constr.datalen = *((uint32_t*)_res);
6347 if (_res_constr.datalen > 0)
6348 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6350 _res_constr.data = NULL;
6351 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6352 for (size_t e = 0; e < _res_constr.datalen; e++) {
6353 uint32_t _res_conv_30 = _res_vals[e];
6354 LDKC2Tuple_usizeTransactionZ _res_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_30) & ~1);
6355 FREE((void*)_res_conv_30);
6356 _res_constr.data[e] = _res_conv_30_conv;
6358 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
6361 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
6362 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6363 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
6364 return (long)ret_conv;
6367 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
6368 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
6369 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6370 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
6371 return (long)ret_conv;
6374 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
6375 if ((_res & 1) != 0) return;
6376 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
6378 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
6381 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
6382 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
6383 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6384 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
6385 return (long)ret_conv;
6388 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
6389 LDKCVec_MonitorEventZ _res_constr;
6390 _res_constr.datalen = *((uint32_t*)_res);
6391 if (_res_constr.datalen > 0)
6392 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
6394 _res_constr.data = NULL;
6395 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6396 for (size_t o = 0; o < _res_constr.datalen; o++) {
6397 uint32_t _res_conv_14 = _res_vals[o];
6398 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
6399 FREE((void*)_res_conv_14);
6400 _res_constr.data[o] = _res_conv_14_conv;
6402 CVec_MonitorEventZ_free(_res_constr);
6405 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
6406 LDKCVec_EventZ _res_constr;
6407 _res_constr.datalen = *((uint32_t*)_res);
6408 if (_res_constr.datalen > 0)
6409 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
6411 _res_constr.data = NULL;
6412 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6413 for (size_t h = 0; h < _res_constr.datalen; h++) {
6414 uint32_t _res_conv_7 = _res_vals[h];
6415 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
6416 FREE((void*)_res_conv_7);
6417 _res_constr.data[h] = _res_conv_7_conv;
6419 CVec_EventZ_free(_res_constr);
6422 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
6424 o_conv.inner = (void*)(o & (~1));
6425 o_conv.is_owned = (o & 1) || (o == 0);
6426 o_conv = OutPoint_clone(&o_conv);
6427 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
6428 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
6429 return (long)ret_conv;
6432 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
6433 LDKDecodeError e_conv;
6434 e_conv.inner = (void*)(e & (~1));
6435 e_conv.is_owned = (e & 1) || (e == 0);
6436 e_conv = DecodeError_clone(&e_conv);
6437 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
6438 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
6439 return (long)ret_conv;
6442 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
6443 if ((_res & 1) != 0) return;
6444 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
6446 CResult_OutPointDecodeErrorZ_free(_res_conv);
6449 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
6450 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
6451 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
6452 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
6453 return (long)ret_conv;
6456 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
6457 LDKChannelMonitorUpdate o_conv;
6458 o_conv.inner = (void*)(o & (~1));
6459 o_conv.is_owned = (o & 1) || (o == 0);
6460 o_conv = ChannelMonitorUpdate_clone(&o_conv);
6461 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
6462 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
6463 return (long)ret_conv;
6466 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
6467 LDKDecodeError e_conv;
6468 e_conv.inner = (void*)(e & (~1));
6469 e_conv.is_owned = (e & 1) || (e == 0);
6470 e_conv = DecodeError_clone(&e_conv);
6471 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
6472 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
6473 return (long)ret_conv;
6476 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
6477 if ((_res & 1) != 0) return;
6478 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
6480 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
6483 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
6484 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
6485 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
6486 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
6487 return (long)ret_conv;
6490 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
6491 LDKHTLCUpdate o_conv;
6492 o_conv.inner = (void*)(o & (~1));
6493 o_conv.is_owned = (o & 1) || (o == 0);
6494 o_conv = HTLCUpdate_clone(&o_conv);
6495 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
6496 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
6497 return (long)ret_conv;
6500 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
6501 LDKDecodeError e_conv;
6502 e_conv.inner = (void*)(e & (~1));
6503 e_conv.is_owned = (e & 1) || (e == 0);
6504 e_conv = DecodeError_clone(&e_conv);
6505 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
6506 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
6507 return (long)ret_conv;
6510 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
6511 if ((_res & 1) != 0) return;
6512 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
6514 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
6517 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
6518 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
6519 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
6520 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
6521 return (long)ret_conv;
6524 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_ok() {
6525 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6526 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
6527 return (long)ret_conv;
6530 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_err(uint32_t e) {
6531 LDKMonitorUpdateError e_conv;
6532 e_conv.inner = (void*)(e & (~1));
6533 e_conv.is_owned = (e & 1) || (e == 0);
6534 e_conv = MonitorUpdateError_clone(&e_conv);
6535 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6536 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
6537 return (long)ret_conv;
6540 void __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_free(uint32_t _res) {
6541 if ((_res & 1) != 0) return;
6542 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
6544 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
6547 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone(uint32_t orig) {
6548 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
6549 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6550 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
6551 return (long)ret_conv;
6554 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
6555 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
6556 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6557 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
6558 return (long)ret_ref;
6561 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
6563 a_conv.inner = (void*)(a & (~1));
6564 a_conv.is_owned = (a & 1) || (a == 0);
6565 a_conv = OutPoint_clone(&a_conv);
6567 b_ref.datalen = *((uint32_t*)b);
6568 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
6569 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
6570 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6571 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
6572 return (long)ret_ref;
6575 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
6576 if ((_res & 1) != 0) return;
6577 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
6579 C2Tuple_OutPointScriptZ_free(_res_conv);
6582 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
6583 LDKCVec_TransactionZ _res_constr;
6584 _res_constr.datalen = *((uint32_t*)_res);
6585 if (_res_constr.datalen > 0)
6586 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
6588 _res_constr.data = NULL;
6589 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
6590 for (size_t m = 0; m < _res_constr.datalen; m++) {
6591 int8_tArray _res_conv_12 = _res_vals[m];
6592 LDKTransaction _res_conv_12_ref;
6593 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
6594 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
6595 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
6596 _res_conv_12_ref.data_is_owned = true;
6597 _res_constr.data[m] = _res_conv_12_ref;
6599 CVec_TransactionZ_free(_res_constr);
6602 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
6603 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
6604 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6605 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
6606 return (long)ret_ref;
6609 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
6610 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
6612 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6613 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
6614 return (long)ret_ref;
6617 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
6618 if ((_res & 1) != 0) return;
6619 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
6621 C2Tuple_u32TxOutZ_free(_res_conv);
6624 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
6625 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
6626 _res_constr.datalen = *((uint32_t*)_res);
6627 if (_res_constr.datalen > 0)
6628 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
6630 _res_constr.data = NULL;
6631 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6632 for (size_t z = 0; z < _res_constr.datalen; z++) {
6633 uint32_t _res_conv_25 = _res_vals[z];
6634 LDKC2Tuple_u32TxOutZ _res_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_25) & ~1);
6635 FREE((void*)_res_conv_25);
6636 _res_constr.data[z] = _res_conv_25_conv;
6638 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
6641 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
6642 LDKThirtyTwoBytes a_ref;
6643 CHECK(*((uint32_t*)a) == 32);
6644 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
6645 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
6646 b_constr.datalen = *((uint32_t*)b);
6647 if (b_constr.datalen > 0)
6648 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
6650 b_constr.data = NULL;
6651 uint32_t* b_vals = (uint32_t*)(b + 4);
6652 for (size_t z = 0; z < b_constr.datalen; z++) {
6653 uint32_t b_conv_25 = b_vals[z];
6654 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
6655 FREE((void*)b_conv_25);
6656 b_constr.data[z] = b_conv_25_conv;
6658 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
6659 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
6660 return (long)ret_ref;
6663 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
6664 if ((_res & 1) != 0) return;
6665 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
6667 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
6670 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
6671 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
6672 _res_constr.datalen = *((uint32_t*)_res);
6673 if (_res_constr.datalen > 0)
6674 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
6676 _res_constr.data = NULL;
6677 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6678 for (size_t x = 0; x < _res_constr.datalen; x++) {
6679 uint32_t _res_conv_49 = _res_vals[x];
6680 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_49) & ~1);
6681 FREE((void*)_res_conv_49);
6682 _res_constr.data[x] = _res_conv_49_conv;
6684 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
6687 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
6688 LDKThirtyTwoBytes a_ref;
6689 CHECK(*((uint32_t*)a) == 32);
6690 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
6691 LDKChannelMonitor b_conv;
6692 b_conv.inner = (void*)(b & (~1));
6693 b_conv.is_owned = (b & 1) || (b == 0);
6694 b_conv = ChannelMonitor_clone(&b_conv);
6695 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6696 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
6697 return (long)ret_ref;
6700 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
6701 if ((_res & 1) != 0) return;
6702 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
6704 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
6707 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
6708 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
6710 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
6711 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
6712 return (long)ret_conv;
6715 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
6716 LDKDecodeError e_conv;
6717 e_conv.inner = (void*)(e & (~1));
6718 e_conv.is_owned = (e & 1) || (e == 0);
6719 e_conv = DecodeError_clone(&e_conv);
6720 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
6721 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
6722 return (long)ret_conv;
6725 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
6726 if ((_res & 1) != 0) return;
6727 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
6729 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
6732 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
6733 LDKCVec_SpendableOutputDescriptorZ _res_constr;
6734 _res_constr.datalen = *((uint32_t*)_res);
6735 if (_res_constr.datalen > 0)
6736 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
6738 _res_constr.data = NULL;
6739 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6740 for (size_t b = 0; b < _res_constr.datalen; b++) {
6741 uint32_t _res_conv_27 = _res_vals[b];
6742 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
6743 FREE((void*)_res_conv_27);
6744 _res_constr.data[b] = _res_conv_27_conv;
6746 CVec_SpendableOutputDescriptorZ_free(_res_constr);
6749 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
6750 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
6752 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6753 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
6754 return (long)ret_conv;
6757 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
6758 LDKAccessError e_conv = LDKAccessError_from_js(e);
6759 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6760 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
6761 return (long)ret_conv;
6764 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
6765 if ((_res & 1) != 0) return;
6766 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
6768 CResult_TxOutAccessErrorZ_free(_res_conv);
6771 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
6772 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
6773 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6774 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
6775 return (long)ret_conv;
6778 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
6779 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6780 *ret_conv = CResult_NoneAPIErrorZ_ok();
6781 return (long)ret_conv;
6784 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
6785 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
6787 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6788 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
6789 return (long)ret_conv;
6792 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
6793 if ((_res & 1) != 0) return;
6794 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
6796 CResult_NoneAPIErrorZ_free(_res_conv);
6799 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
6800 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
6801 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6802 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
6803 return (long)ret_conv;
6806 void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
6807 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
6808 _res_constr.datalen = *((uint32_t*)_res);
6809 if (_res_constr.datalen > 0)
6810 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
6812 _res_constr.data = NULL;
6813 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6814 for (size_t w = 0; w < _res_constr.datalen; w++) {
6815 uint32_t _res_conv_22 = _res_vals[w];
6816 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
6817 FREE((void*)_res_conv_22);
6818 _res_constr.data[w] = _res_conv_22_conv;
6820 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
6823 void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
6824 LDKCVec_APIErrorZ _res_constr;
6825 _res_constr.datalen = *((uint32_t*)_res);
6826 if (_res_constr.datalen > 0)
6827 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
6829 _res_constr.data = NULL;
6830 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6831 for (size_t k = 0; k < _res_constr.datalen; k++) {
6832 uint32_t _res_conv_10 = _res_vals[k];
6833 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
6834 FREE((void*)_res_conv_10);
6835 _res_constr.data[k] = _res_conv_10_conv;
6837 CVec_APIErrorZ_free(_res_constr);
6840 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
6841 LDKCVec_ChannelDetailsZ _res_constr;
6842 _res_constr.datalen = *((uint32_t*)_res);
6843 if (_res_constr.datalen > 0)
6844 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6846 _res_constr.data = NULL;
6847 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6848 for (size_t q = 0; q < _res_constr.datalen; q++) {
6849 uint32_t _res_conv_16 = _res_vals[q];
6850 LDKChannelDetails _res_conv_16_conv;
6851 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
6852 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
6853 _res_constr.data[q] = _res_conv_16_conv;
6855 CVec_ChannelDetailsZ_free(_res_constr);
6858 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
6859 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6860 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
6861 return (long)ret_conv;
6864 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
6865 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
6867 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6868 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
6869 return (long)ret_conv;
6872 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
6873 if ((_res & 1) != 0) return;
6874 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
6876 CResult_NonePaymentSendFailureZ_free(_res_conv);
6879 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
6880 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
6881 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6882 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
6883 return (long)ret_conv;
6886 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
6887 LDKCVec_ChannelMonitorZ _res_constr;
6888 _res_constr.datalen = *((uint32_t*)_res);
6889 if (_res_constr.datalen > 0)
6890 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
6892 _res_constr.data = NULL;
6893 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6894 for (size_t q = 0; q < _res_constr.datalen; q++) {
6895 uint32_t _res_conv_16 = _res_vals[q];
6896 LDKChannelMonitor _res_conv_16_conv;
6897 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
6898 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
6899 _res_constr.data[q] = _res_conv_16_conv;
6901 CVec_ChannelMonitorZ_free(_res_constr);
6904 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
6905 LDKThirtyTwoBytes a_ref;
6906 CHECK(*((uint32_t*)a) == 32);
6907 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
6908 LDKChannelManager b_conv;
6909 b_conv.inner = (void*)(b & (~1));
6910 b_conv.is_owned = (b & 1) || (b == 0);
6911 // Warning: we need a move here but no clone is available for LDKChannelManager
6912 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
6913 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
6914 return (long)ret_ref;
6917 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
6918 if ((_res & 1) != 0) return;
6919 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
6921 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
6924 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
6925 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
6927 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
6928 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
6929 return (long)ret_conv;
6932 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
6933 LDKDecodeError e_conv;
6934 e_conv.inner = (void*)(e & (~1));
6935 e_conv.is_owned = (e & 1) || (e == 0);
6936 e_conv = DecodeError_clone(&e_conv);
6937 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
6938 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
6939 return (long)ret_conv;
6942 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
6943 if ((_res & 1) != 0) return;
6944 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
6946 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
6949 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
6950 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
6952 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
6953 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
6954 return (long)ret_conv;
6957 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
6958 LDKDecodeError e_conv;
6959 e_conv.inner = (void*)(e & (~1));
6960 e_conv.is_owned = (e & 1) || (e == 0);
6961 e_conv = DecodeError_clone(&e_conv);
6962 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
6963 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
6964 return (long)ret_conv;
6967 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
6968 if ((_res & 1) != 0) return;
6969 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
6971 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
6974 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
6975 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
6976 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
6977 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
6978 return (long)ret_conv;
6981 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
6982 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
6983 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
6984 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
6985 return (long)ret_ref;
6988 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
6990 CHECK(*((uint32_t*)a) == 64);
6991 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
6992 LDKCVec_SignatureZ b_constr;
6993 b_constr.datalen = *((uint32_t*)b);
6994 if (b_constr.datalen > 0)
6995 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6997 b_constr.data = NULL;
6998 int8_tArray* b_vals = (int8_tArray*)(b + 4);
6999 for (size_t m = 0; m < b_constr.datalen; m++) {
7000 int8_tArray b_conv_12 = b_vals[m];
7001 LDKSignature b_conv_12_ref;
7002 CHECK(*((uint32_t*)b_conv_12) == 64);
7003 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
7004 b_constr.data[m] = b_conv_12_ref;
7006 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
7007 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
7008 return (long)ret_ref;
7011 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
7012 if ((_res & 1) != 0) return;
7013 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
7015 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
7018 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
7019 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
7021 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
7022 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
7023 return (long)ret_conv;
7026 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
7027 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
7028 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
7029 return (long)ret_conv;
7032 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
7033 if ((_res & 1) != 0) return;
7034 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
7036 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
7039 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
7040 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
7041 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
7042 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
7043 return (long)ret_conv;
7046 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
7048 CHECK(*((uint32_t*)o) == 64);
7049 memcpy(o_ref.compact_form, (uint8_t*)(o + 4), 64);
7050 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7051 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
7052 return (long)ret_conv;
7055 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
7056 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7057 *ret_conv = CResult_SignatureNoneZ_err();
7058 return (long)ret_conv;
7061 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
7062 if ((_res & 1) != 0) return;
7063 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
7065 CResult_SignatureNoneZ_free(_res_conv);
7068 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
7069 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
7070 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7071 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
7072 return (long)ret_conv;
7075 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
7076 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
7077 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7078 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
7079 return (long)ret_conv;
7082 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
7083 LDKDecodeError e_conv;
7084 e_conv.inner = (void*)(e & (~1));
7085 e_conv.is_owned = (e & 1) || (e == 0);
7086 e_conv = DecodeError_clone(&e_conv);
7087 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7088 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
7089 return (long)ret_conv;
7092 void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
7093 if ((_res & 1) != 0) return;
7094 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
7096 CResult_SignDecodeErrorZ_free(_res_conv);
7099 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
7100 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
7101 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7102 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
7103 return (long)ret_conv;
7106 void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
7107 LDKCVec_CVec_u8ZZ _res_constr;
7108 _res_constr.datalen = *((uint32_t*)_res);
7109 if (_res_constr.datalen > 0)
7110 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
7112 _res_constr.data = NULL;
7113 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
7114 for (size_t m = 0; m < _res_constr.datalen; m++) {
7115 int8_tArray _res_conv_12 = _res_vals[m];
7116 LDKCVec_u8Z _res_conv_12_ref;
7117 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
7118 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
7119 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
7120 _res_constr.data[m] = _res_conv_12_ref;
7122 CVec_CVec_u8ZZ_free(_res_constr);
7125 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
7126 LDKCVec_CVec_u8ZZ o_constr;
7127 o_constr.datalen = *((uint32_t*)o);
7128 if (o_constr.datalen > 0)
7129 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
7131 o_constr.data = NULL;
7132 int8_tArray* o_vals = (int8_tArray*)(o + 4);
7133 for (size_t m = 0; m < o_constr.datalen; m++) {
7134 int8_tArray o_conv_12 = o_vals[m];
7135 LDKCVec_u8Z o_conv_12_ref;
7136 o_conv_12_ref.datalen = *((uint32_t*)o_conv_12);
7137 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
7138 memcpy(o_conv_12_ref.data, (uint8_t*)(o_conv_12 + 4), o_conv_12_ref.datalen);
7139 o_constr.data[m] = o_conv_12_ref;
7141 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
7142 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
7143 return (long)ret_conv;
7146 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
7147 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
7148 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
7149 return (long)ret_conv;
7152 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
7153 if ((_res & 1) != 0) return;
7154 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
7156 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
7159 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
7160 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
7161 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
7162 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
7163 return (long)ret_conv;
7166 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
7167 LDKInMemorySigner o_conv;
7168 o_conv.inner = (void*)(o & (~1));
7169 o_conv.is_owned = (o & 1) || (o == 0);
7170 o_conv = InMemorySigner_clone(&o_conv);
7171 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
7172 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
7173 return (long)ret_conv;
7176 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
7177 LDKDecodeError e_conv;
7178 e_conv.inner = (void*)(e & (~1));
7179 e_conv.is_owned = (e & 1) || (e == 0);
7180 e_conv = DecodeError_clone(&e_conv);
7181 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
7182 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
7183 return (long)ret_conv;
7186 void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
7187 if ((_res & 1) != 0) return;
7188 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
7190 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
7193 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
7194 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
7195 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
7196 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
7197 return (long)ret_conv;
7200 void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
7201 LDKCVec_TxOutZ _res_constr;
7202 _res_constr.datalen = *((uint32_t*)_res);
7203 if (_res_constr.datalen > 0)
7204 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
7206 _res_constr.data = NULL;
7207 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7208 for (size_t h = 0; h < _res_constr.datalen; h++) {
7209 uint32_t _res_conv_7 = _res_vals[h];
7210 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
7211 FREE((void*)_res_conv_7);
7212 _res_constr.data[h] = _res_conv_7_conv;
7214 CVec_TxOutZ_free(_res_constr);
7217 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
7218 LDKTransaction o_ref;
7219 o_ref.datalen = *((uint32_t*)o);
7220 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
7221 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
7222 o_ref.data_is_owned = true;
7223 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
7224 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
7225 return (long)ret_conv;
7228 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() {
7229 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
7230 *ret_conv = CResult_TransactionNoneZ_err();
7231 return (long)ret_conv;
7234 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
7235 if ((_res & 1) != 0) return;
7236 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
7238 CResult_TransactionNoneZ_free(_res_conv);
7241 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
7242 LDKCVec_RouteHopZ _res_constr;
7243 _res_constr.datalen = *((uint32_t*)_res);
7244 if (_res_constr.datalen > 0)
7245 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7247 _res_constr.data = NULL;
7248 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7249 for (size_t k = 0; k < _res_constr.datalen; k++) {
7250 uint32_t _res_conv_10 = _res_vals[k];
7251 LDKRouteHop _res_conv_10_conv;
7252 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
7253 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
7254 _res_constr.data[k] = _res_conv_10_conv;
7256 CVec_RouteHopZ_free(_res_constr);
7259 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
7260 LDKCVec_CVec_RouteHopZZ _res_constr;
7261 _res_constr.datalen = *((uint32_t*)_res);
7262 if (_res_constr.datalen > 0)
7263 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
7265 _res_constr.data = NULL;
7266 uint32_tArray* _res_vals = (uint32_tArray*)(_res + 4);
7267 for (size_t m = 0; m < _res_constr.datalen; m++) {
7268 uint32_tArray _res_conv_12 = _res_vals[m];
7269 LDKCVec_RouteHopZ _res_conv_12_constr;
7270 _res_conv_12_constr.datalen = *((uint32_t*)_res_conv_12);
7271 if (_res_conv_12_constr.datalen > 0)
7272 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7274 _res_conv_12_constr.data = NULL;
7275 uint32_t* _res_conv_12_vals = (uint32_t*)(_res_conv_12 + 4);
7276 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
7277 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
7278 LDKRouteHop _res_conv_12_conv_10_conv;
7279 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
7280 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
7281 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
7283 _res_constr.data[m] = _res_conv_12_constr;
7285 CVec_CVec_RouteHopZZ_free(_res_constr);
7288 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
7290 o_conv.inner = (void*)(o & (~1));
7291 o_conv.is_owned = (o & 1) || (o == 0);
7292 o_conv = Route_clone(&o_conv);
7293 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7294 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
7295 return (long)ret_conv;
7298 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
7299 LDKDecodeError e_conv;
7300 e_conv.inner = (void*)(e & (~1));
7301 e_conv.is_owned = (e & 1) || (e == 0);
7302 e_conv = DecodeError_clone(&e_conv);
7303 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7304 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
7305 return (long)ret_conv;
7308 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
7309 if ((_res & 1) != 0) return;
7310 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
7312 CResult_RouteDecodeErrorZ_free(_res_conv);
7315 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
7316 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
7317 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7318 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
7319 return (long)ret_conv;
7322 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
7323 LDKCVec_RouteHintZ _res_constr;
7324 _res_constr.datalen = *((uint32_t*)_res);
7325 if (_res_constr.datalen > 0)
7326 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
7328 _res_constr.data = NULL;
7329 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7330 for (size_t l = 0; l < _res_constr.datalen; l++) {
7331 uint32_t _res_conv_11 = _res_vals[l];
7332 LDKRouteHint _res_conv_11_conv;
7333 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
7334 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
7335 _res_constr.data[l] = _res_conv_11_conv;
7337 CVec_RouteHintZ_free(_res_constr);
7340 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
7342 o_conv.inner = (void*)(o & (~1));
7343 o_conv.is_owned = (o & 1) || (o == 0);
7344 o_conv = Route_clone(&o_conv);
7345 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7346 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
7347 return (long)ret_conv;
7350 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
7351 LDKLightningError e_conv;
7352 e_conv.inner = (void*)(e & (~1));
7353 e_conv.is_owned = (e & 1) || (e == 0);
7354 e_conv = LightningError_clone(&e_conv);
7355 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7356 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
7357 return (long)ret_conv;
7360 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
7361 if ((_res & 1) != 0) return;
7362 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
7364 CResult_RouteLightningErrorZ_free(_res_conv);
7367 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
7368 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
7369 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7370 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
7371 return (long)ret_conv;
7374 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_ok(uint32_t o) {
7375 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
7377 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
7378 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
7379 return (long)ret_conv;
7382 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_err(int8_t e) {
7383 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
7384 *ret_conv = CResult_NetAddressu8Z_err(e);
7385 return (long)ret_conv;
7388 void __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_free(uint32_t _res) {
7389 if ((_res & 1) != 0) return;
7390 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
7392 CResult_NetAddressu8Z_free(_res_conv);
7395 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_clone(uint32_t orig) {
7396 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
7397 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
7398 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
7399 return (long)ret_conv;
7402 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(uint32_t o) {
7403 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
7405 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
7406 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
7407 return (long)ret_conv;
7410 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_err(uint32_t e) {
7411 LDKDecodeError e_conv;
7412 e_conv.inner = (void*)(e & (~1));
7413 e_conv.is_owned = (e & 1) || (e == 0);
7414 e_conv = DecodeError_clone(&e_conv);
7415 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
7416 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
7417 return (long)ret_conv;
7420 void __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_free(uint32_t _res) {
7421 if ((_res & 1) != 0) return;
7422 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
7424 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
7427 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(uint32_t orig) {
7428 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
7429 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
7430 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
7431 return (long)ret_conv;
7434 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
7435 LDKCVec_UpdateAddHTLCZ _res_constr;
7436 _res_constr.datalen = *((uint32_t*)_res);
7437 if (_res_constr.datalen > 0)
7438 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
7440 _res_constr.data = NULL;
7441 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7442 for (size_t p = 0; p < _res_constr.datalen; p++) {
7443 uint32_t _res_conv_15 = _res_vals[p];
7444 LDKUpdateAddHTLC _res_conv_15_conv;
7445 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
7446 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
7447 _res_constr.data[p] = _res_conv_15_conv;
7449 CVec_UpdateAddHTLCZ_free(_res_constr);
7452 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
7453 LDKCVec_UpdateFulfillHTLCZ _res_constr;
7454 _res_constr.datalen = *((uint32_t*)_res);
7455 if (_res_constr.datalen > 0)
7456 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
7458 _res_constr.data = NULL;
7459 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7460 for (size_t t = 0; t < _res_constr.datalen; t++) {
7461 uint32_t _res_conv_19 = _res_vals[t];
7462 LDKUpdateFulfillHTLC _res_conv_19_conv;
7463 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
7464 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
7465 _res_constr.data[t] = _res_conv_19_conv;
7467 CVec_UpdateFulfillHTLCZ_free(_res_constr);
7470 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
7471 LDKCVec_UpdateFailHTLCZ _res_constr;
7472 _res_constr.datalen = *((uint32_t*)_res);
7473 if (_res_constr.datalen > 0)
7474 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
7476 _res_constr.data = NULL;
7477 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7478 for (size_t q = 0; q < _res_constr.datalen; q++) {
7479 uint32_t _res_conv_16 = _res_vals[q];
7480 LDKUpdateFailHTLC _res_conv_16_conv;
7481 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
7482 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
7483 _res_constr.data[q] = _res_conv_16_conv;
7485 CVec_UpdateFailHTLCZ_free(_res_constr);
7488 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
7489 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
7490 _res_constr.datalen = *((uint32_t*)_res);
7491 if (_res_constr.datalen > 0)
7492 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
7494 _res_constr.data = NULL;
7495 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7496 for (size_t z = 0; z < _res_constr.datalen; z++) {
7497 uint32_t _res_conv_25 = _res_vals[z];
7498 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
7499 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
7500 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
7501 _res_constr.data[z] = _res_conv_25_conv;
7503 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
7506 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
7507 LDKAcceptChannel o_conv;
7508 o_conv.inner = (void*)(o & (~1));
7509 o_conv.is_owned = (o & 1) || (o == 0);
7510 o_conv = AcceptChannel_clone(&o_conv);
7511 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
7512 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
7513 return (long)ret_conv;
7516 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
7517 LDKDecodeError e_conv;
7518 e_conv.inner = (void*)(e & (~1));
7519 e_conv.is_owned = (e & 1) || (e == 0);
7520 e_conv = DecodeError_clone(&e_conv);
7521 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
7522 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
7523 return (long)ret_conv;
7526 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
7527 if ((_res & 1) != 0) return;
7528 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
7530 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
7533 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
7534 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
7535 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
7536 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
7537 return (long)ret_conv;
7540 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
7541 LDKAnnouncementSignatures o_conv;
7542 o_conv.inner = (void*)(o & (~1));
7543 o_conv.is_owned = (o & 1) || (o == 0);
7544 o_conv = AnnouncementSignatures_clone(&o_conv);
7545 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
7546 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
7547 return (long)ret_conv;
7550 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
7551 LDKDecodeError e_conv;
7552 e_conv.inner = (void*)(e & (~1));
7553 e_conv.is_owned = (e & 1) || (e == 0);
7554 e_conv = DecodeError_clone(&e_conv);
7555 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
7556 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
7557 return (long)ret_conv;
7560 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
7561 if ((_res & 1) != 0) return;
7562 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7564 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
7567 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
7568 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
7569 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
7570 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
7571 return (long)ret_conv;
7574 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
7575 LDKChannelReestablish o_conv;
7576 o_conv.inner = (void*)(o & (~1));
7577 o_conv.is_owned = (o & 1) || (o == 0);
7578 o_conv = ChannelReestablish_clone(&o_conv);
7579 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
7580 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
7581 return (long)ret_conv;
7584 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
7585 LDKDecodeError e_conv;
7586 e_conv.inner = (void*)(e & (~1));
7587 e_conv.is_owned = (e & 1) || (e == 0);
7588 e_conv = DecodeError_clone(&e_conv);
7589 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
7590 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
7591 return (long)ret_conv;
7594 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
7595 if ((_res & 1) != 0) return;
7596 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
7598 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
7601 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
7602 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
7603 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
7604 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
7605 return (long)ret_conv;
7608 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
7609 LDKClosingSigned o_conv;
7610 o_conv.inner = (void*)(o & (~1));
7611 o_conv.is_owned = (o & 1) || (o == 0);
7612 o_conv = ClosingSigned_clone(&o_conv);
7613 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
7614 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
7615 return (long)ret_conv;
7618 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
7619 LDKDecodeError e_conv;
7620 e_conv.inner = (void*)(e & (~1));
7621 e_conv.is_owned = (e & 1) || (e == 0);
7622 e_conv = DecodeError_clone(&e_conv);
7623 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
7624 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
7625 return (long)ret_conv;
7628 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
7629 if ((_res & 1) != 0) return;
7630 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7632 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
7635 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
7636 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
7637 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
7638 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
7639 return (long)ret_conv;
7642 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
7643 LDKCommitmentSigned o_conv;
7644 o_conv.inner = (void*)(o & (~1));
7645 o_conv.is_owned = (o & 1) || (o == 0);
7646 o_conv = CommitmentSigned_clone(&o_conv);
7647 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
7648 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
7649 return (long)ret_conv;
7652 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
7653 LDKDecodeError e_conv;
7654 e_conv.inner = (void*)(e & (~1));
7655 e_conv.is_owned = (e & 1) || (e == 0);
7656 e_conv = DecodeError_clone(&e_conv);
7657 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
7658 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
7659 return (long)ret_conv;
7662 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
7663 if ((_res & 1) != 0) return;
7664 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7666 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
7669 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
7670 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
7671 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
7672 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
7673 return (long)ret_conv;
7676 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
7677 LDKFundingCreated o_conv;
7678 o_conv.inner = (void*)(o & (~1));
7679 o_conv.is_owned = (o & 1) || (o == 0);
7680 o_conv = FundingCreated_clone(&o_conv);
7681 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
7682 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
7683 return (long)ret_conv;
7686 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
7687 LDKDecodeError e_conv;
7688 e_conv.inner = (void*)(e & (~1));
7689 e_conv.is_owned = (e & 1) || (e == 0);
7690 e_conv = DecodeError_clone(&e_conv);
7691 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
7692 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
7693 return (long)ret_conv;
7696 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
7697 if ((_res & 1) != 0) return;
7698 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7700 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
7703 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
7704 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
7705 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
7706 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
7707 return (long)ret_conv;
7710 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
7711 LDKFundingSigned o_conv;
7712 o_conv.inner = (void*)(o & (~1));
7713 o_conv.is_owned = (o & 1) || (o == 0);
7714 o_conv = FundingSigned_clone(&o_conv);
7715 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
7716 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
7717 return (long)ret_conv;
7720 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
7721 LDKDecodeError e_conv;
7722 e_conv.inner = (void*)(e & (~1));
7723 e_conv.is_owned = (e & 1) || (e == 0);
7724 e_conv = DecodeError_clone(&e_conv);
7725 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
7726 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
7727 return (long)ret_conv;
7730 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
7731 if ((_res & 1) != 0) return;
7732 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7734 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
7737 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
7738 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
7739 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
7740 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
7741 return (long)ret_conv;
7744 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
7745 LDKFundingLocked o_conv;
7746 o_conv.inner = (void*)(o & (~1));
7747 o_conv.is_owned = (o & 1) || (o == 0);
7748 o_conv = FundingLocked_clone(&o_conv);
7749 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
7750 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
7751 return (long)ret_conv;
7754 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
7755 LDKDecodeError e_conv;
7756 e_conv.inner = (void*)(e & (~1));
7757 e_conv.is_owned = (e & 1) || (e == 0);
7758 e_conv = DecodeError_clone(&e_conv);
7759 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
7760 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
7761 return (long)ret_conv;
7764 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
7765 if ((_res & 1) != 0) return;
7766 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7768 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
7771 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
7772 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
7773 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
7774 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
7775 return (long)ret_conv;
7778 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
7780 o_conv.inner = (void*)(o & (~1));
7781 o_conv.is_owned = (o & 1) || (o == 0);
7782 o_conv = Init_clone(&o_conv);
7783 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
7784 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
7785 return (long)ret_conv;
7788 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
7789 LDKDecodeError e_conv;
7790 e_conv.inner = (void*)(e & (~1));
7791 e_conv.is_owned = (e & 1) || (e == 0);
7792 e_conv = DecodeError_clone(&e_conv);
7793 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
7794 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
7795 return (long)ret_conv;
7798 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
7799 if ((_res & 1) != 0) return;
7800 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
7802 CResult_InitDecodeErrorZ_free(_res_conv);
7805 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
7806 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
7807 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
7808 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
7809 return (long)ret_conv;
7812 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
7813 LDKOpenChannel o_conv;
7814 o_conv.inner = (void*)(o & (~1));
7815 o_conv.is_owned = (o & 1) || (o == 0);
7816 o_conv = OpenChannel_clone(&o_conv);
7817 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
7818 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
7819 return (long)ret_conv;
7822 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
7823 LDKDecodeError e_conv;
7824 e_conv.inner = (void*)(e & (~1));
7825 e_conv.is_owned = (e & 1) || (e == 0);
7826 e_conv = DecodeError_clone(&e_conv);
7827 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
7828 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
7829 return (long)ret_conv;
7832 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
7833 if ((_res & 1) != 0) return;
7834 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
7836 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
7839 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
7840 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
7841 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
7842 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
7843 return (long)ret_conv;
7846 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
7847 LDKRevokeAndACK o_conv;
7848 o_conv.inner = (void*)(o & (~1));
7849 o_conv.is_owned = (o & 1) || (o == 0);
7850 o_conv = RevokeAndACK_clone(&o_conv);
7851 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
7852 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
7853 return (long)ret_conv;
7856 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
7857 LDKDecodeError e_conv;
7858 e_conv.inner = (void*)(e & (~1));
7859 e_conv.is_owned = (e & 1) || (e == 0);
7860 e_conv = DecodeError_clone(&e_conv);
7861 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
7862 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
7863 return (long)ret_conv;
7866 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
7867 if ((_res & 1) != 0) return;
7868 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
7870 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
7873 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
7874 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
7875 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
7876 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
7877 return (long)ret_conv;
7880 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
7882 o_conv.inner = (void*)(o & (~1));
7883 o_conv.is_owned = (o & 1) || (o == 0);
7884 o_conv = Shutdown_clone(&o_conv);
7885 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
7886 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
7887 return (long)ret_conv;
7890 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
7891 LDKDecodeError e_conv;
7892 e_conv.inner = (void*)(e & (~1));
7893 e_conv.is_owned = (e & 1) || (e == 0);
7894 e_conv = DecodeError_clone(&e_conv);
7895 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
7896 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
7897 return (long)ret_conv;
7900 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
7901 if ((_res & 1) != 0) return;
7902 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
7904 CResult_ShutdownDecodeErrorZ_free(_res_conv);
7907 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
7908 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
7909 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
7910 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
7911 return (long)ret_conv;
7914 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
7915 LDKUpdateFailHTLC o_conv;
7916 o_conv.inner = (void*)(o & (~1));
7917 o_conv.is_owned = (o & 1) || (o == 0);
7918 o_conv = UpdateFailHTLC_clone(&o_conv);
7919 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
7920 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
7921 return (long)ret_conv;
7924 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
7925 LDKDecodeError e_conv;
7926 e_conv.inner = (void*)(e & (~1));
7927 e_conv.is_owned = (e & 1) || (e == 0);
7928 e_conv = DecodeError_clone(&e_conv);
7929 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
7930 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
7931 return (long)ret_conv;
7934 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
7935 if ((_res & 1) != 0) return;
7936 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
7938 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
7941 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
7942 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
7943 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
7944 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
7945 return (long)ret_conv;
7948 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
7949 LDKUpdateFailMalformedHTLC o_conv;
7950 o_conv.inner = (void*)(o & (~1));
7951 o_conv.is_owned = (o & 1) || (o == 0);
7952 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
7953 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
7954 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
7955 return (long)ret_conv;
7958 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
7959 LDKDecodeError e_conv;
7960 e_conv.inner = (void*)(e & (~1));
7961 e_conv.is_owned = (e & 1) || (e == 0);
7962 e_conv = DecodeError_clone(&e_conv);
7963 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
7964 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
7965 return (long)ret_conv;
7968 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
7969 if ((_res & 1) != 0) return;
7970 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
7972 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
7975 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
7976 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
7977 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
7978 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
7979 return (long)ret_conv;
7982 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
7983 LDKUpdateFee o_conv;
7984 o_conv.inner = (void*)(o & (~1));
7985 o_conv.is_owned = (o & 1) || (o == 0);
7986 o_conv = UpdateFee_clone(&o_conv);
7987 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
7988 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
7989 return (long)ret_conv;
7992 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
7993 LDKDecodeError e_conv;
7994 e_conv.inner = (void*)(e & (~1));
7995 e_conv.is_owned = (e & 1) || (e == 0);
7996 e_conv = DecodeError_clone(&e_conv);
7997 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
7998 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
7999 return (long)ret_conv;
8002 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
8003 if ((_res & 1) != 0) return;
8004 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
8006 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
8009 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
8010 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
8011 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
8012 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
8013 return (long)ret_conv;
8016 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
8017 LDKUpdateFulfillHTLC o_conv;
8018 o_conv.inner = (void*)(o & (~1));
8019 o_conv.is_owned = (o & 1) || (o == 0);
8020 o_conv = UpdateFulfillHTLC_clone(&o_conv);
8021 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
8022 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
8023 return (long)ret_conv;
8026 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
8027 LDKDecodeError e_conv;
8028 e_conv.inner = (void*)(e & (~1));
8029 e_conv.is_owned = (e & 1) || (e == 0);
8030 e_conv = DecodeError_clone(&e_conv);
8031 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
8032 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
8033 return (long)ret_conv;
8036 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
8037 if ((_res & 1) != 0) return;
8038 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8040 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
8043 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
8044 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
8045 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
8046 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
8047 return (long)ret_conv;
8050 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
8051 LDKUpdateAddHTLC o_conv;
8052 o_conv.inner = (void*)(o & (~1));
8053 o_conv.is_owned = (o & 1) || (o == 0);
8054 o_conv = UpdateAddHTLC_clone(&o_conv);
8055 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
8056 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
8057 return (long)ret_conv;
8060 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
8061 LDKDecodeError e_conv;
8062 e_conv.inner = (void*)(e & (~1));
8063 e_conv.is_owned = (e & 1) || (e == 0);
8064 e_conv = DecodeError_clone(&e_conv);
8065 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
8066 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
8067 return (long)ret_conv;
8070 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
8071 if ((_res & 1) != 0) return;
8072 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8074 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
8077 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
8078 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
8079 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
8080 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
8081 return (long)ret_conv;
8084 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
8086 o_conv.inner = (void*)(o & (~1));
8087 o_conv.is_owned = (o & 1) || (o == 0);
8088 o_conv = Ping_clone(&o_conv);
8089 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
8090 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
8091 return (long)ret_conv;
8094 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
8095 LDKDecodeError e_conv;
8096 e_conv.inner = (void*)(e & (~1));
8097 e_conv.is_owned = (e & 1) || (e == 0);
8098 e_conv = DecodeError_clone(&e_conv);
8099 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
8100 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
8101 return (long)ret_conv;
8104 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
8105 if ((_res & 1) != 0) return;
8106 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
8108 CResult_PingDecodeErrorZ_free(_res_conv);
8111 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
8112 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
8113 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
8114 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
8115 return (long)ret_conv;
8118 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
8120 o_conv.inner = (void*)(o & (~1));
8121 o_conv.is_owned = (o & 1) || (o == 0);
8122 o_conv = Pong_clone(&o_conv);
8123 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
8124 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
8125 return (long)ret_conv;
8128 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
8129 LDKDecodeError e_conv;
8130 e_conv.inner = (void*)(e & (~1));
8131 e_conv.is_owned = (e & 1) || (e == 0);
8132 e_conv = DecodeError_clone(&e_conv);
8133 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
8134 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
8135 return (long)ret_conv;
8138 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
8139 if ((_res & 1) != 0) return;
8140 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
8142 CResult_PongDecodeErrorZ_free(_res_conv);
8145 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
8146 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
8147 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
8148 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
8149 return (long)ret_conv;
8152 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
8153 LDKUnsignedChannelAnnouncement o_conv;
8154 o_conv.inner = (void*)(o & (~1));
8155 o_conv.is_owned = (o & 1) || (o == 0);
8156 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
8157 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
8158 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
8159 return (long)ret_conv;
8162 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
8163 LDKDecodeError e_conv;
8164 e_conv.inner = (void*)(e & (~1));
8165 e_conv.is_owned = (e & 1) || (e == 0);
8166 e_conv = DecodeError_clone(&e_conv);
8167 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
8168 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
8169 return (long)ret_conv;
8172 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
8173 if ((_res & 1) != 0) return;
8174 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8176 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
8179 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8180 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
8181 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
8182 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
8183 return (long)ret_conv;
8186 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
8187 LDKChannelAnnouncement o_conv;
8188 o_conv.inner = (void*)(o & (~1));
8189 o_conv.is_owned = (o & 1) || (o == 0);
8190 o_conv = ChannelAnnouncement_clone(&o_conv);
8191 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
8192 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
8193 return (long)ret_conv;
8196 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
8197 LDKDecodeError e_conv;
8198 e_conv.inner = (void*)(e & (~1));
8199 e_conv.is_owned = (e & 1) || (e == 0);
8200 e_conv = DecodeError_clone(&e_conv);
8201 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
8202 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
8203 return (long)ret_conv;
8206 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
8207 if ((_res & 1) != 0) return;
8208 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8210 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
8213 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8214 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
8215 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
8216 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
8217 return (long)ret_conv;
8220 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
8221 LDKUnsignedChannelUpdate o_conv;
8222 o_conv.inner = (void*)(o & (~1));
8223 o_conv.is_owned = (o & 1) || (o == 0);
8224 o_conv = UnsignedChannelUpdate_clone(&o_conv);
8225 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
8226 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
8227 return (long)ret_conv;
8230 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
8231 LDKDecodeError e_conv;
8232 e_conv.inner = (void*)(e & (~1));
8233 e_conv.is_owned = (e & 1) || (e == 0);
8234 e_conv = DecodeError_clone(&e_conv);
8235 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
8236 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
8237 return (long)ret_conv;
8240 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
8241 if ((_res & 1) != 0) return;
8242 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
8244 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
8247 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
8248 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
8249 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
8250 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
8251 return (long)ret_conv;
8254 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
8255 LDKChannelUpdate o_conv;
8256 o_conv.inner = (void*)(o & (~1));
8257 o_conv.is_owned = (o & 1) || (o == 0);
8258 o_conv = ChannelUpdate_clone(&o_conv);
8259 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
8260 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
8261 return (long)ret_conv;
8264 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
8265 LDKDecodeError e_conv;
8266 e_conv.inner = (void*)(e & (~1));
8267 e_conv.is_owned = (e & 1) || (e == 0);
8268 e_conv = DecodeError_clone(&e_conv);
8269 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
8270 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
8271 return (long)ret_conv;
8274 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
8275 if ((_res & 1) != 0) return;
8276 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
8278 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
8281 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
8282 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
8283 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
8284 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
8285 return (long)ret_conv;
8288 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
8289 LDKErrorMessage o_conv;
8290 o_conv.inner = (void*)(o & (~1));
8291 o_conv.is_owned = (o & 1) || (o == 0);
8292 o_conv = ErrorMessage_clone(&o_conv);
8293 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
8294 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
8295 return (long)ret_conv;
8298 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
8299 LDKDecodeError e_conv;
8300 e_conv.inner = (void*)(e & (~1));
8301 e_conv.is_owned = (e & 1) || (e == 0);
8302 e_conv = DecodeError_clone(&e_conv);
8303 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
8304 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
8305 return (long)ret_conv;
8308 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
8309 if ((_res & 1) != 0) return;
8310 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
8312 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
8315 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
8316 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
8317 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
8318 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
8319 return (long)ret_conv;
8322 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
8323 LDKUnsignedNodeAnnouncement o_conv;
8324 o_conv.inner = (void*)(o & (~1));
8325 o_conv.is_owned = (o & 1) || (o == 0);
8326 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
8327 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
8328 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
8329 return (long)ret_conv;
8332 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
8333 LDKDecodeError e_conv;
8334 e_conv.inner = (void*)(e & (~1));
8335 e_conv.is_owned = (e & 1) || (e == 0);
8336 e_conv = DecodeError_clone(&e_conv);
8337 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
8338 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
8339 return (long)ret_conv;
8342 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
8343 if ((_res & 1) != 0) return;
8344 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8346 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
8349 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8350 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
8351 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
8352 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
8353 return (long)ret_conv;
8356 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
8357 LDKNodeAnnouncement o_conv;
8358 o_conv.inner = (void*)(o & (~1));
8359 o_conv.is_owned = (o & 1) || (o == 0);
8360 o_conv = NodeAnnouncement_clone(&o_conv);
8361 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
8362 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
8363 return (long)ret_conv;
8366 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
8367 LDKDecodeError e_conv;
8368 e_conv.inner = (void*)(e & (~1));
8369 e_conv.is_owned = (e & 1) || (e == 0);
8370 e_conv = DecodeError_clone(&e_conv);
8371 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
8372 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
8373 return (long)ret_conv;
8376 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
8377 if ((_res & 1) != 0) return;
8378 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8380 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
8383 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8384 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
8385 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
8386 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
8387 return (long)ret_conv;
8390 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
8391 LDKQueryShortChannelIds o_conv;
8392 o_conv.inner = (void*)(o & (~1));
8393 o_conv.is_owned = (o & 1) || (o == 0);
8394 o_conv = QueryShortChannelIds_clone(&o_conv);
8395 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
8396 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
8397 return (long)ret_conv;
8400 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
8401 LDKDecodeError e_conv;
8402 e_conv.inner = (void*)(e & (~1));
8403 e_conv.is_owned = (e & 1) || (e == 0);
8404 e_conv = DecodeError_clone(&e_conv);
8405 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
8406 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
8407 return (long)ret_conv;
8410 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
8411 if ((_res & 1) != 0) return;
8412 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
8414 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
8417 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
8418 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
8419 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
8420 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
8421 return (long)ret_conv;
8424 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
8425 LDKReplyShortChannelIdsEnd o_conv;
8426 o_conv.inner = (void*)(o & (~1));
8427 o_conv.is_owned = (o & 1) || (o == 0);
8428 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
8429 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
8430 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
8431 return (long)ret_conv;
8434 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
8435 LDKDecodeError e_conv;
8436 e_conv.inner = (void*)(e & (~1));
8437 e_conv.is_owned = (e & 1) || (e == 0);
8438 e_conv = DecodeError_clone(&e_conv);
8439 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
8440 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
8441 return (long)ret_conv;
8444 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
8445 if ((_res & 1) != 0) return;
8446 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
8448 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
8451 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
8452 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
8453 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
8454 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
8455 return (long)ret_conv;
8458 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
8459 LDKQueryChannelRange o_conv;
8460 o_conv.inner = (void*)(o & (~1));
8461 o_conv.is_owned = (o & 1) || (o == 0);
8462 o_conv = QueryChannelRange_clone(&o_conv);
8463 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
8464 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
8465 return (long)ret_conv;
8468 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
8469 LDKDecodeError e_conv;
8470 e_conv.inner = (void*)(e & (~1));
8471 e_conv.is_owned = (e & 1) || (e == 0);
8472 e_conv = DecodeError_clone(&e_conv);
8473 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
8474 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
8475 return (long)ret_conv;
8478 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
8479 if ((_res & 1) != 0) return;
8480 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
8482 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
8485 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
8486 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
8487 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
8488 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
8489 return (long)ret_conv;
8492 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
8493 LDKReplyChannelRange o_conv;
8494 o_conv.inner = (void*)(o & (~1));
8495 o_conv.is_owned = (o & 1) || (o == 0);
8496 o_conv = ReplyChannelRange_clone(&o_conv);
8497 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
8498 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
8499 return (long)ret_conv;
8502 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
8503 LDKDecodeError e_conv;
8504 e_conv.inner = (void*)(e & (~1));
8505 e_conv.is_owned = (e & 1) || (e == 0);
8506 e_conv = DecodeError_clone(&e_conv);
8507 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
8508 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
8509 return (long)ret_conv;
8512 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
8513 if ((_res & 1) != 0) return;
8514 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
8516 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
8519 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
8520 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
8521 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
8522 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
8523 return (long)ret_conv;
8526 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
8527 LDKGossipTimestampFilter o_conv;
8528 o_conv.inner = (void*)(o & (~1));
8529 o_conv.is_owned = (o & 1) || (o == 0);
8530 o_conv = GossipTimestampFilter_clone(&o_conv);
8531 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
8532 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
8533 return (long)ret_conv;
8536 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
8537 LDKDecodeError e_conv;
8538 e_conv.inner = (void*)(e & (~1));
8539 e_conv.is_owned = (e & 1) || (e == 0);
8540 e_conv = DecodeError_clone(&e_conv);
8541 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
8542 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
8543 return (long)ret_conv;
8546 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
8547 if ((_res & 1) != 0) return;
8548 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
8550 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
8553 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
8554 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
8555 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
8556 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
8557 return (long)ret_conv;
8560 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
8561 if ((this_ptr & 1) != 0) return;
8562 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
8563 FREE((void*)this_ptr);
8564 Event_free(this_ptr_conv);
8567 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
8568 LDKEvent* orig_conv = (LDKEvent*)orig;
8569 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
8570 *ret_copy = Event_clone(orig_conv);
8571 long ret_ref = (long)ret_copy;
8575 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
8576 LDKEvent* obj_conv = (LDKEvent*)obj;
8577 LDKCVec_u8Z ret_var = Event_write(obj_conv);
8578 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
8579 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
8580 CVec_u8Z_free(ret_var);
8584 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
8585 if ((this_ptr & 1) != 0) return;
8586 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
8587 FREE((void*)this_ptr);
8588 MessageSendEvent_free(this_ptr_conv);
8591 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
8592 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
8593 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
8594 *ret_copy = MessageSendEvent_clone(orig_conv);
8595 long ret_ref = (long)ret_copy;
8599 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
8600 if ((this_ptr & 1) != 0) return;
8601 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
8602 FREE((void*)this_ptr);
8603 MessageSendEventsProvider_free(this_ptr_conv);
8606 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
8607 if ((this_ptr & 1) != 0) return;
8608 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
8609 FREE((void*)this_ptr);
8610 EventsProvider_free(this_ptr_conv);
8613 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
8614 if ((this_ptr & 1) != 0) return;
8615 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
8616 FREE((void*)this_ptr);
8617 APIError_free(this_ptr_conv);
8620 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
8621 LDKAPIError* orig_conv = (LDKAPIError*)orig;
8622 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
8623 *ret_copy = APIError_clone(orig_conv);
8624 long ret_ref = (long)ret_copy;
8628 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
8629 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
8630 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
8634 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
8635 uint32_t ret_conv = LDKLevel_to_js(Level_max());
8639 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
8640 if ((this_ptr & 1) != 0) return;
8641 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
8642 FREE((void*)this_ptr);
8643 Logger_free(this_ptr_conv);
8646 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_ptr) {
8647 LDKChannelHandshakeConfig this_ptr_conv;
8648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8649 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8650 ChannelHandshakeConfig_free(this_ptr_conv);
8653 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
8654 LDKChannelHandshakeConfig this_ptr_conv;
8655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8656 this_ptr_conv.is_owned = false;
8657 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
8661 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
8662 LDKChannelHandshakeConfig this_ptr_conv;
8663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8664 this_ptr_conv.is_owned = false;
8665 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
8668 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
8669 LDKChannelHandshakeConfig this_ptr_conv;
8670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8671 this_ptr_conv.is_owned = false;
8672 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
8676 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
8677 LDKChannelHandshakeConfig this_ptr_conv;
8678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8679 this_ptr_conv.is_owned = false;
8680 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
8683 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
8684 LDKChannelHandshakeConfig this_ptr_conv;
8685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8686 this_ptr_conv.is_owned = false;
8687 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
8691 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
8692 LDKChannelHandshakeConfig this_ptr_conv;
8693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8694 this_ptr_conv.is_owned = false;
8695 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
8698 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_new(int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg) {
8699 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
8700 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8701 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8702 long ret_ref = (long)ret_var.inner;
8703 if (ret_var.is_owned) {
8709 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
8710 LDKChannelHandshakeConfig orig_conv;
8711 orig_conv.inner = (void*)(orig & (~1));
8712 orig_conv.is_owned = false;
8713 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
8714 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8715 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8716 long ret_ref = (long)ret_var.inner;
8717 if (ret_var.is_owned) {
8723 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
8724 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
8725 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8726 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8727 long ret_ref = (long)ret_var.inner;
8728 if (ret_var.is_owned) {
8734 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_ptr) {
8735 LDKChannelHandshakeLimits this_ptr_conv;
8736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8737 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8738 ChannelHandshakeLimits_free(this_ptr_conv);
8741 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
8742 LDKChannelHandshakeLimits this_ptr_conv;
8743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8744 this_ptr_conv.is_owned = false;
8745 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
8749 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
8750 LDKChannelHandshakeLimits this_ptr_conv;
8751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8752 this_ptr_conv.is_owned = false;
8753 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
8756 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
8757 LDKChannelHandshakeLimits this_ptr_conv;
8758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8759 this_ptr_conv.is_owned = false;
8760 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
8764 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
8765 LDKChannelHandshakeLimits this_ptr_conv;
8766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8767 this_ptr_conv.is_owned = false;
8768 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
8771 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
8772 LDKChannelHandshakeLimits this_ptr_conv;
8773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8774 this_ptr_conv.is_owned = false;
8775 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
8779 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
8780 LDKChannelHandshakeLimits this_ptr_conv;
8781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8782 this_ptr_conv.is_owned = false;
8783 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8786 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
8787 LDKChannelHandshakeLimits this_ptr_conv;
8788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8789 this_ptr_conv.is_owned = false;
8790 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
8794 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
8795 LDKChannelHandshakeLimits this_ptr_conv;
8796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8797 this_ptr_conv.is_owned = false;
8798 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
8801 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
8802 LDKChannelHandshakeLimits this_ptr_conv;
8803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8804 this_ptr_conv.is_owned = false;
8805 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
8809 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
8810 LDKChannelHandshakeLimits this_ptr_conv;
8811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8812 this_ptr_conv.is_owned = false;
8813 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
8816 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_dust_limit_satoshis(uint32_t this_ptr) {
8817 LDKChannelHandshakeLimits this_ptr_conv;
8818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8819 this_ptr_conv.is_owned = false;
8820 int64_t ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
8824 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
8825 LDKChannelHandshakeLimits this_ptr_conv;
8826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8827 this_ptr_conv.is_owned = false;
8828 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
8831 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_dust_limit_satoshis(uint32_t this_ptr) {
8832 LDKChannelHandshakeLimits this_ptr_conv;
8833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8834 this_ptr_conv.is_owned = false;
8835 int64_t ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
8839 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
8840 LDKChannelHandshakeLimits this_ptr_conv;
8841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8842 this_ptr_conv.is_owned = false;
8843 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
8846 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
8847 LDKChannelHandshakeLimits this_ptr_conv;
8848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8849 this_ptr_conv.is_owned = false;
8850 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
8854 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
8855 LDKChannelHandshakeLimits this_ptr_conv;
8856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8857 this_ptr_conv.is_owned = false;
8858 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
8861 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
8862 LDKChannelHandshakeLimits this_ptr_conv;
8863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8864 this_ptr_conv.is_owned = false;
8865 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
8869 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
8870 LDKChannelHandshakeLimits this_ptr_conv;
8871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8872 this_ptr_conv.is_owned = false;
8873 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
8876 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
8877 LDKChannelHandshakeLimits this_ptr_conv;
8878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8879 this_ptr_conv.is_owned = false;
8880 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
8884 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
8885 LDKChannelHandshakeLimits this_ptr_conv;
8886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8887 this_ptr_conv.is_owned = false;
8888 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
8891 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_new(int64_t min_funding_satoshis_arg, int64_t max_htlc_minimum_msat_arg, int64_t min_max_htlc_value_in_flight_msat_arg, int64_t max_channel_reserve_satoshis_arg, int16_t min_max_accepted_htlcs_arg, int64_t min_dust_limit_satoshis_arg, int64_t max_dust_limit_satoshis_arg, int32_t max_minimum_depth_arg, jboolean force_announced_channel_preference_arg, int16_t their_to_self_delay_arg) {
8892 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);
8893 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8894 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8895 long ret_ref = (long)ret_var.inner;
8896 if (ret_var.is_owned) {
8902 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
8903 LDKChannelHandshakeLimits orig_conv;
8904 orig_conv.inner = (void*)(orig & (~1));
8905 orig_conv.is_owned = false;
8906 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
8907 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8908 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8909 long ret_ref = (long)ret_var.inner;
8910 if (ret_var.is_owned) {
8916 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
8917 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
8918 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8919 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8920 long ret_ref = (long)ret_var.inner;
8921 if (ret_var.is_owned) {
8927 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_ptr) {
8928 LDKChannelConfig this_ptr_conv;
8929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8930 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8931 ChannelConfig_free(this_ptr_conv);
8934 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_fee_proportional_millionths(uint32_t this_ptr) {
8935 LDKChannelConfig this_ptr_conv;
8936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8937 this_ptr_conv.is_owned = false;
8938 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
8942 void __attribute__((visibility("default"))) TS_ChannelConfig_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
8943 LDKChannelConfig this_ptr_conv;
8944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8945 this_ptr_conv.is_owned = false;
8946 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
8949 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
8950 LDKChannelConfig this_ptr_conv;
8951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8952 this_ptr_conv.is_owned = false;
8953 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
8957 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
8958 LDKChannelConfig this_ptr_conv;
8959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8960 this_ptr_conv.is_owned = false;
8961 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
8964 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
8965 LDKChannelConfig this_ptr_conv;
8966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8967 this_ptr_conv.is_owned = false;
8968 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
8972 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
8973 LDKChannelConfig this_ptr_conv;
8974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8975 this_ptr_conv.is_owned = false;
8976 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
8979 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_new(int32_t fee_proportional_millionths_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
8980 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
8981 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8982 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8983 long ret_ref = (long)ret_var.inner;
8984 if (ret_var.is_owned) {
8990 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
8991 LDKChannelConfig orig_conv;
8992 orig_conv.inner = (void*)(orig & (~1));
8993 orig_conv.is_owned = false;
8994 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
8995 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8996 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8997 long ret_ref = (long)ret_var.inner;
8998 if (ret_var.is_owned) {
9004 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
9005 LDKChannelConfig ret_var = ChannelConfig_default();
9006 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9007 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9008 long ret_ref = (long)ret_var.inner;
9009 if (ret_var.is_owned) {
9015 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
9016 LDKChannelConfig obj_conv;
9017 obj_conv.inner = (void*)(obj & (~1));
9018 obj_conv.is_owned = false;
9019 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
9020 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9021 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9022 CVec_u8Z_free(ret_var);
9026 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
9028 ser_ref.datalen = *((uint32_t*)ser);
9029 ser_ref.data = (int8_t*)(ser + 4);
9030 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9031 *ret_conv = ChannelConfig_read(ser_ref);
9032 return (long)ret_conv;
9035 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_ptr) {
9036 LDKUserConfig 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 UserConfig_free(this_ptr_conv);
9042 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
9043 LDKUserConfig this_ptr_conv;
9044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9045 this_ptr_conv.is_owned = false;
9046 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_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 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
9057 LDKUserConfig this_ptr_conv;
9058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9059 this_ptr_conv.is_owned = false;
9060 LDKChannelHandshakeConfig val_conv;
9061 val_conv.inner = (void*)(val & (~1));
9062 val_conv.is_owned = (val & 1) || (val == 0);
9063 val_conv = ChannelHandshakeConfig_clone(&val_conv);
9064 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
9067 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
9068 LDKUserConfig this_ptr_conv;
9069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9070 this_ptr_conv.is_owned = false;
9071 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
9072 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9073 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9074 long ret_ref = (long)ret_var.inner;
9075 if (ret_var.is_owned) {
9081 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
9082 LDKUserConfig this_ptr_conv;
9083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9084 this_ptr_conv.is_owned = false;
9085 LDKChannelHandshakeLimits val_conv;
9086 val_conv.inner = (void*)(val & (~1));
9087 val_conv.is_owned = (val & 1) || (val == 0);
9088 val_conv = ChannelHandshakeLimits_clone(&val_conv);
9089 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
9092 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
9093 LDKUserConfig this_ptr_conv;
9094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9095 this_ptr_conv.is_owned = false;
9096 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
9097 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9098 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9099 long ret_ref = (long)ret_var.inner;
9100 if (ret_var.is_owned) {
9106 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
9107 LDKUserConfig this_ptr_conv;
9108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9109 this_ptr_conv.is_owned = false;
9110 LDKChannelConfig val_conv;
9111 val_conv.inner = (void*)(val & (~1));
9112 val_conv.is_owned = (val & 1) || (val == 0);
9113 val_conv = ChannelConfig_clone(&val_conv);
9114 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
9117 uint32_t __attribute__((visibility("default"))) TS_UserConfig_new(uint32_t own_channel_config_arg, uint32_t peer_channel_config_limits_arg, uint32_t channel_options_arg) {
9118 LDKChannelHandshakeConfig own_channel_config_arg_conv;
9119 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
9120 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
9121 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
9122 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
9123 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
9124 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
9125 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
9126 LDKChannelConfig channel_options_arg_conv;
9127 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
9128 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
9129 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
9130 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
9131 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9132 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9133 long ret_ref = (long)ret_var.inner;
9134 if (ret_var.is_owned) {
9140 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
9141 LDKUserConfig orig_conv;
9142 orig_conv.inner = (void*)(orig & (~1));
9143 orig_conv.is_owned = false;
9144 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
9145 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9146 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9147 long ret_ref = (long)ret_var.inner;
9148 if (ret_var.is_owned) {
9154 uint32_t __attribute__((visibility("default"))) TS_UserConfig_default() {
9155 LDKUserConfig ret_var = UserConfig_default();
9156 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9157 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9158 long ret_ref = (long)ret_var.inner;
9159 if (ret_var.is_owned) {
9165 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
9166 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
9167 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
9171 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
9172 if ((this_ptr & 1) != 0) return;
9173 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
9174 FREE((void*)this_ptr);
9175 Access_free(this_ptr_conv);
9178 void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) {
9179 if ((this_ptr & 1) != 0) return;
9180 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
9181 FREE((void*)this_ptr);
9182 Listen_free(this_ptr_conv);
9185 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
9186 if ((this_ptr & 1) != 0) return;
9187 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
9188 FREE((void*)this_ptr);
9189 Watch_free(this_ptr_conv);
9192 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
9193 if ((this_ptr & 1) != 0) return;
9194 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
9195 FREE((void*)this_ptr);
9196 Filter_free(this_ptr_conv);
9199 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
9200 if ((this_ptr & 1) != 0) return;
9201 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
9202 FREE((void*)this_ptr);
9203 BroadcasterInterface_free(this_ptr_conv);
9206 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
9207 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
9208 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
9212 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
9213 if ((this_ptr & 1) != 0) return;
9214 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
9215 FREE((void*)this_ptr);
9216 FeeEstimator_free(this_ptr_conv);
9219 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_ptr) {
9220 LDKChainMonitor this_ptr_conv;
9221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9222 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9223 ChainMonitor_free(this_ptr_conv);
9226 void __attribute__((visibility("default"))) TS_ChainMonitor_block_connected(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
9227 LDKChainMonitor this_arg_conv;
9228 this_arg_conv.inner = (void*)(this_arg & (~1));
9229 this_arg_conv.is_owned = false;
9230 unsigned char header_arr[80];
9231 CHECK(*((uint32_t*)header) == 80);
9232 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9233 unsigned char (*header_ref)[80] = &header_arr;
9234 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9235 txdata_constr.datalen = *((uint32_t*)txdata);
9236 if (txdata_constr.datalen > 0)
9237 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9239 txdata_constr.data = NULL;
9240 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
9241 for (size_t e = 0; e < txdata_constr.datalen; e++) {
9242 uint32_t txdata_conv_30 = txdata_vals[e];
9243 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
9244 FREE((void*)txdata_conv_30);
9245 txdata_constr.data[e] = txdata_conv_30_conv;
9247 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
9250 void __attribute__((visibility("default"))) TS_ChainMonitor_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t disconnected_height) {
9251 LDKChainMonitor this_arg_conv;
9252 this_arg_conv.inner = (void*)(this_arg & (~1));
9253 this_arg_conv.is_owned = false;
9254 unsigned char header_arr[80];
9255 CHECK(*((uint32_t*)header) == 80);
9256 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9257 unsigned char (*header_ref)[80] = &header_arr;
9258 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
9261 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
9262 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
9263 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
9264 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
9265 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
9266 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
9267 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
9268 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9269 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9270 long ret_ref = (long)ret_var.inner;
9271 if (ret_var.is_owned) {
9277 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
9278 LDKChainMonitor this_arg_conv;
9279 this_arg_conv.inner = (void*)(this_arg & (~1));
9280 this_arg_conv.is_owned = false;
9281 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
9282 *ret = ChainMonitor_as_Watch(&this_arg_conv);
9286 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
9287 LDKChainMonitor this_arg_conv;
9288 this_arg_conv.inner = (void*)(this_arg & (~1));
9289 this_arg_conv.is_owned = false;
9290 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
9291 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
9295 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_ptr) {
9296 LDKChannelMonitorUpdate this_ptr_conv;
9297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9298 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9299 ChannelMonitorUpdate_free(this_ptr_conv);
9302 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
9303 LDKChannelMonitorUpdate this_ptr_conv;
9304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9305 this_ptr_conv.is_owned = false;
9306 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
9310 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
9311 LDKChannelMonitorUpdate this_ptr_conv;
9312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9313 this_ptr_conv.is_owned = false;
9314 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
9317 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
9318 LDKChannelMonitorUpdate orig_conv;
9319 orig_conv.inner = (void*)(orig & (~1));
9320 orig_conv.is_owned = false;
9321 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
9322 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9323 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9324 long ret_ref = (long)ret_var.inner;
9325 if (ret_var.is_owned) {
9331 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
9332 LDKChannelMonitorUpdate obj_conv;
9333 obj_conv.inner = (void*)(obj & (~1));
9334 obj_conv.is_owned = false;
9335 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
9336 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9337 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9338 CVec_u8Z_free(ret_var);
9342 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
9344 ser_ref.datalen = *((uint32_t*)ser);
9345 ser_ref.data = (int8_t*)(ser + 4);
9346 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9347 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
9348 return (long)ret_conv;
9351 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
9352 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
9353 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
9357 void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_ptr) {
9358 LDKMonitorUpdateError this_ptr_conv;
9359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9360 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9361 MonitorUpdateError_free(this_ptr_conv);
9364 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uint32_t orig) {
9365 LDKMonitorUpdateError orig_conv;
9366 orig_conv.inner = (void*)(orig & (~1));
9367 orig_conv.is_owned = false;
9368 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
9369 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9370 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9371 long ret_ref = (long)ret_var.inner;
9372 if (ret_var.is_owned) {
9378 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
9379 if ((this_ptr & 1) != 0) return;
9380 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
9381 FREE((void*)this_ptr);
9382 MonitorEvent_free(this_ptr_conv);
9385 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
9386 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
9387 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
9388 *ret_copy = MonitorEvent_clone(orig_conv);
9389 long ret_ref = (long)ret_copy;
9393 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_ptr) {
9394 LDKHTLCUpdate this_ptr_conv;
9395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9396 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9397 HTLCUpdate_free(this_ptr_conv);
9400 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
9401 LDKHTLCUpdate orig_conv;
9402 orig_conv.inner = (void*)(orig & (~1));
9403 orig_conv.is_owned = false;
9404 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
9405 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9406 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9407 long ret_ref = (long)ret_var.inner;
9408 if (ret_var.is_owned) {
9414 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
9415 LDKHTLCUpdate obj_conv;
9416 obj_conv.inner = (void*)(obj & (~1));
9417 obj_conv.is_owned = false;
9418 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
9419 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9420 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9421 CVec_u8Z_free(ret_var);
9425 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
9427 ser_ref.datalen = *((uint32_t*)ser);
9428 ser_ref.data = (int8_t*)(ser + 4);
9429 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9430 *ret_conv = HTLCUpdate_read(ser_ref);
9431 return (long)ret_conv;
9434 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_ptr) {
9435 LDKChannelMonitor this_ptr_conv;
9436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9437 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9438 ChannelMonitor_free(this_ptr_conv);
9441 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
9442 LDKChannelMonitor orig_conv;
9443 orig_conv.inner = (void*)(orig & (~1));
9444 orig_conv.is_owned = false;
9445 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
9446 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9447 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9448 long ret_ref = (long)ret_var.inner;
9449 if (ret_var.is_owned) {
9455 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
9456 LDKChannelMonitor obj_conv;
9457 obj_conv.inner = (void*)(obj & (~1));
9458 obj_conv.is_owned = false;
9459 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
9460 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9461 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9462 CVec_u8Z_free(ret_var);
9466 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_update_monitor(uint32_t this_arg, uint32_t updates, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
9467 LDKChannelMonitor this_arg_conv;
9468 this_arg_conv.inner = (void*)(this_arg & (~1));
9469 this_arg_conv.is_owned = false;
9470 LDKChannelMonitorUpdate updates_conv;
9471 updates_conv.inner = (void*)(updates & (~1));
9472 updates_conv.is_owned = false;
9473 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
9474 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator;
9475 LDKLogger* logger_conv = (LDKLogger*)logger;
9476 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
9477 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
9478 return (long)ret_conv;
9481 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
9482 LDKChannelMonitor this_arg_conv;
9483 this_arg_conv.inner = (void*)(this_arg & (~1));
9484 this_arg_conv.is_owned = false;
9485 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
9489 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
9490 LDKChannelMonitor this_arg_conv;
9491 this_arg_conv.inner = (void*)(this_arg & (~1));
9492 this_arg_conv.is_owned = false;
9493 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
9494 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
9495 return (long)ret_ref;
9498 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
9499 LDKChannelMonitor this_arg_conv;
9500 this_arg_conv.inner = (void*)(this_arg & (~1));
9501 this_arg_conv.is_owned = false;
9502 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
9503 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
9504 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
9505 for (size_t o = 0; o < ret_var.datalen; o++) {
9506 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
9507 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
9508 long ret_conv_14_ref = (long)ret_conv_14_copy;
9509 ret_arr_ptr[o] = ret_conv_14_ref;
9515 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
9516 LDKChannelMonitor this_arg_conv;
9517 this_arg_conv.inner = (void*)(this_arg & (~1));
9518 this_arg_conv.is_owned = false;
9519 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
9520 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
9521 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
9522 for (size_t h = 0; h < ret_var.datalen; h++) {
9523 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
9524 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
9525 long ret_conv_7_ref = (long)ret_conv_7_copy;
9526 ret_arr_ptr[h] = ret_conv_7_ref;
9532 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
9533 LDKChannelMonitor this_arg_conv;
9534 this_arg_conv.inner = (void*)(this_arg & (~1));
9535 this_arg_conv.is_owned = false;
9536 LDKLogger* logger_conv = (LDKLogger*)logger;
9537 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
9538 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
9539 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
9540 for (size_t m = 0; m < ret_var.datalen; m++) {
9541 LDKTransaction ret_conv_12_var = ret_var.data[m];
9542 int8_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9543 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_conv_12_var.data, ret_conv_12_var.datalen);
9544 Transaction_free(ret_conv_12_var);
9545 ret_arr_ptr[m] = ret_conv_12_arr;
9551 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_block_connected(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
9552 LDKChannelMonitor this_arg_conv;
9553 this_arg_conv.inner = (void*)(this_arg & (~1));
9554 this_arg_conv.is_owned = false;
9555 unsigned char header_arr[80];
9556 CHECK(*((uint32_t*)header) == 80);
9557 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9558 unsigned char (*header_ref)[80] = &header_arr;
9559 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9560 txdata_constr.datalen = *((uint32_t*)txdata);
9561 if (txdata_constr.datalen > 0)
9562 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9564 txdata_constr.data = NULL;
9565 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
9566 for (size_t e = 0; e < txdata_constr.datalen; e++) {
9567 uint32_t txdata_conv_30 = txdata_vals[e];
9568 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
9569 FREE((void*)txdata_conv_30);
9570 txdata_constr.data[e] = txdata_conv_30_conv;
9572 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
9573 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
9574 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
9575 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);
9576 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
9577 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
9578 for (size_t x = 0; x < ret_var.datalen; x++) {
9579 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
9580 *ret_conv_49_ref = ret_var.data[x];
9581 ret_arr_ptr[x] = (long)ret_conv_49_ref;
9587 void __attribute__((visibility("default"))) TS_ChannelMonitor_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
9588 LDKChannelMonitor this_arg_conv;
9589 this_arg_conv.inner = (void*)(this_arg & (~1));
9590 this_arg_conv.is_owned = false;
9591 unsigned char header_arr[80];
9592 CHECK(*((uint32_t*)header) == 80);
9593 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9594 unsigned char (*header_ref)[80] = &header_arr;
9595 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
9596 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
9597 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
9598 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
9601 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
9602 if ((this_ptr & 1) != 0) return;
9603 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
9604 FREE((void*)this_ptr);
9605 Persist_free(this_ptr_conv);
9608 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
9610 ser_ref.datalen = *((uint32_t*)ser);
9611 ser_ref.data = (int8_t*)(ser + 4);
9612 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
9613 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
9614 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
9615 return (long)ret_conv;
9618 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_ptr) {
9619 LDKOutPoint this_ptr_conv;
9620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9621 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9622 OutPoint_free(this_ptr_conv);
9625 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
9626 LDKOutPoint this_ptr_conv;
9627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9628 this_ptr_conv.is_owned = false;
9629 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9630 memcpy((uint8_t*)(ret_arr + 4), *OutPoint_get_txid(&this_ptr_conv), 32);
9634 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
9635 LDKOutPoint this_ptr_conv;
9636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9637 this_ptr_conv.is_owned = false;
9638 LDKThirtyTwoBytes val_ref;
9639 CHECK(*((uint32_t*)val) == 32);
9640 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
9641 OutPoint_set_txid(&this_ptr_conv, val_ref);
9644 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
9645 LDKOutPoint this_ptr_conv;
9646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9647 this_ptr_conv.is_owned = false;
9648 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
9652 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
9653 LDKOutPoint this_ptr_conv;
9654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9655 this_ptr_conv.is_owned = false;
9656 OutPoint_set_index(&this_ptr_conv, val);
9659 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
9660 LDKThirtyTwoBytes txid_arg_ref;
9661 CHECK(*((uint32_t*)txid_arg) == 32);
9662 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
9663 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
9664 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9665 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9666 long ret_ref = (long)ret_var.inner;
9667 if (ret_var.is_owned) {
9673 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
9674 LDKOutPoint orig_conv;
9675 orig_conv.inner = (void*)(orig & (~1));
9676 orig_conv.is_owned = false;
9677 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
9678 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9679 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9680 long ret_ref = (long)ret_var.inner;
9681 if (ret_var.is_owned) {
9687 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
9688 LDKOutPoint this_arg_conv;
9689 this_arg_conv.inner = (void*)(this_arg & (~1));
9690 this_arg_conv.is_owned = false;
9691 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9692 memcpy((uint8_t*)(ret_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32);
9696 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
9697 LDKOutPoint obj_conv;
9698 obj_conv.inner = (void*)(obj & (~1));
9699 obj_conv.is_owned = false;
9700 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
9701 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9702 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9703 CVec_u8Z_free(ret_var);
9707 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
9709 ser_ref.datalen = *((uint32_t*)ser);
9710 ser_ref.data = (int8_t*)(ser + 4);
9711 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
9712 *ret_conv = OutPoint_read(ser_ref);
9713 return (long)ret_conv;
9716 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_ptr) {
9717 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9719 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9720 DelayedPaymentOutputDescriptor_free(this_ptr_conv);
9723 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
9724 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9726 this_ptr_conv.is_owned = false;
9727 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
9728 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9729 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9730 long ret_ref = (long)ret_var.inner;
9731 if (ret_var.is_owned) {
9737 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
9738 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9740 this_ptr_conv.is_owned = false;
9741 LDKOutPoint val_conv;
9742 val_conv.inner = (void*)(val & (~1));
9743 val_conv.is_owned = (val & 1) || (val == 0);
9744 val_conv = OutPoint_clone(&val_conv);
9745 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
9748 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
9749 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9751 this_ptr_conv.is_owned = false;
9752 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
9753 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
9757 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
9758 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9760 this_ptr_conv.is_owned = false;
9761 LDKPublicKey val_ref;
9762 CHECK(*((uint32_t*)val) == 33);
9763 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
9764 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
9767 int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
9768 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9770 this_ptr_conv.is_owned = false;
9771 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
9775 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
9776 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9778 this_ptr_conv.is_owned = false;
9779 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
9782 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
9783 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9785 this_ptr_conv.is_owned = false;
9786 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
9788 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
9791 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
9792 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9794 this_ptr_conv.is_owned = false;
9795 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
9796 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
9800 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
9801 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9803 this_ptr_conv.is_owned = false;
9804 LDKPublicKey val_ref;
9805 CHECK(*((uint32_t*)val) == 33);
9806 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
9807 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
9810 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
9811 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9813 this_ptr_conv.is_owned = false;
9814 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9815 memcpy((uint8_t*)(ret_arr + 4), *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
9819 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
9820 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9822 this_ptr_conv.is_owned = false;
9823 LDKThirtyTwoBytes val_ref;
9824 CHECK(*((uint32_t*)val) == 32);
9825 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
9826 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
9829 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
9830 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9832 this_ptr_conv.is_owned = false;
9833 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
9837 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
9838 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
9839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9840 this_ptr_conv.is_owned = false;
9841 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
9844 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_new(uint32_t outpoint_arg, int8_tArray per_commitment_point_arg, int16_t to_self_delay_arg, uint32_t output_arg, int8_tArray revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
9845 LDKOutPoint outpoint_arg_conv;
9846 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
9847 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
9848 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
9849 LDKPublicKey per_commitment_point_arg_ref;
9850 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
9851 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
9852 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
9853 FREE((void*)output_arg);
9854 LDKPublicKey revocation_pubkey_arg_ref;
9855 CHECK(*((uint32_t*)revocation_pubkey_arg) == 33);
9856 memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33);
9857 LDKThirtyTwoBytes channel_keys_id_arg_ref;
9858 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
9859 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
9860 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_new(outpoint_arg_conv, per_commitment_point_arg_ref, to_self_delay_arg, output_arg_conv, revocation_pubkey_arg_ref, channel_keys_id_arg_ref, channel_value_satoshis_arg);
9861 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9862 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9863 long ret_ref = (long)ret_var.inner;
9864 if (ret_var.is_owned) {
9870 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
9871 LDKDelayedPaymentOutputDescriptor orig_conv;
9872 orig_conv.inner = (void*)(orig & (~1));
9873 orig_conv.is_owned = false;
9874 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
9875 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9876 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9877 long ret_ref = (long)ret_var.inner;
9878 if (ret_var.is_owned) {
9884 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_ptr) {
9885 LDKStaticPaymentOutputDescriptor this_ptr_conv;
9886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9887 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9888 StaticPaymentOutputDescriptor_free(this_ptr_conv);
9891 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
9892 LDKStaticPaymentOutputDescriptor this_ptr_conv;
9893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9894 this_ptr_conv.is_owned = false;
9895 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
9896 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9897 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9898 long ret_ref = (long)ret_var.inner;
9899 if (ret_var.is_owned) {
9905 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
9906 LDKStaticPaymentOutputDescriptor this_ptr_conv;
9907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9908 this_ptr_conv.is_owned = false;
9909 LDKOutPoint val_conv;
9910 val_conv.inner = (void*)(val & (~1));
9911 val_conv.is_owned = (val & 1) || (val == 0);
9912 val_conv = OutPoint_clone(&val_conv);
9913 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
9916 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
9917 LDKStaticPaymentOutputDescriptor this_ptr_conv;
9918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9919 this_ptr_conv.is_owned = false;
9920 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
9922 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
9925 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
9926 LDKStaticPaymentOutputDescriptor this_ptr_conv;
9927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9928 this_ptr_conv.is_owned = false;
9929 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9930 memcpy((uint8_t*)(ret_arr + 4), *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
9934 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
9935 LDKStaticPaymentOutputDescriptor this_ptr_conv;
9936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9937 this_ptr_conv.is_owned = false;
9938 LDKThirtyTwoBytes val_ref;
9939 CHECK(*((uint32_t*)val) == 32);
9940 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
9941 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
9944 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
9945 LDKStaticPaymentOutputDescriptor this_ptr_conv;
9946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9947 this_ptr_conv.is_owned = false;
9948 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
9952 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
9953 LDKStaticPaymentOutputDescriptor this_ptr_conv;
9954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9955 this_ptr_conv.is_owned = false;
9956 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
9959 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_new(uint32_t outpoint_arg, uint32_t output_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
9960 LDKOutPoint outpoint_arg_conv;
9961 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
9962 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
9963 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
9964 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
9965 FREE((void*)output_arg);
9966 LDKThirtyTwoBytes channel_keys_id_arg_ref;
9967 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
9968 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
9969 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
9970 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9971 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9972 long ret_ref = (long)ret_var.inner;
9973 if (ret_var.is_owned) {
9979 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
9980 LDKStaticPaymentOutputDescriptor orig_conv;
9981 orig_conv.inner = (void*)(orig & (~1));
9982 orig_conv.is_owned = false;
9983 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
9984 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9985 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9986 long ret_ref = (long)ret_var.inner;
9987 if (ret_var.is_owned) {
9993 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
9994 if ((this_ptr & 1) != 0) return;
9995 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
9996 FREE((void*)this_ptr);
9997 SpendableOutputDescriptor_free(this_ptr_conv);
10000 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
10001 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
10002 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
10003 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
10004 long ret_ref = (long)ret_copy;
10008 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
10009 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
10010 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
10011 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10012 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10013 CVec_u8Z_free(ret_var);
10017 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
10018 LDKu8slice ser_ref;
10019 ser_ref.datalen = *((uint32_t*)ser);
10020 ser_ref.data = (int8_t*)(ser + 4);
10021 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10022 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
10023 return (long)ret_conv;
10026 uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
10027 LDKSign* orig_conv = (LDKSign*)orig;
10028 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
10029 *ret = Sign_clone(orig_conv);
10033 void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
10034 if ((this_ptr & 1) != 0) return;
10035 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
10036 FREE((void*)this_ptr);
10037 Sign_free(this_ptr_conv);
10040 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
10041 if ((this_ptr & 1) != 0) return;
10042 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
10043 FREE((void*)this_ptr);
10044 KeysInterface_free(this_ptr_conv);
10047 void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_ptr) {
10048 LDKInMemorySigner this_ptr_conv;
10049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10050 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10051 InMemorySigner_free(this_ptr_conv);
10054 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
10055 LDKInMemorySigner this_ptr_conv;
10056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10057 this_ptr_conv.is_owned = false;
10058 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10059 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
10063 void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
10064 LDKInMemorySigner this_ptr_conv;
10065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10066 this_ptr_conv.is_owned = false;
10067 LDKSecretKey val_ref;
10068 CHECK(*((uint32_t*)val) == 32);
10069 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10070 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
10073 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
10074 LDKInMemorySigner this_ptr_conv;
10075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10076 this_ptr_conv.is_owned = false;
10077 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10078 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
10082 void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
10083 LDKInMemorySigner this_ptr_conv;
10084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10085 this_ptr_conv.is_owned = false;
10086 LDKSecretKey val_ref;
10087 CHECK(*((uint32_t*)val) == 32);
10088 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10089 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
10092 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
10093 LDKInMemorySigner this_ptr_conv;
10094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10095 this_ptr_conv.is_owned = false;
10096 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10097 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
10101 void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
10102 LDKInMemorySigner this_ptr_conv;
10103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10104 this_ptr_conv.is_owned = false;
10105 LDKSecretKey val_ref;
10106 CHECK(*((uint32_t*)val) == 32);
10107 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10108 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
10111 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
10112 LDKInMemorySigner this_ptr_conv;
10113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10114 this_ptr_conv.is_owned = false;
10115 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10116 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
10120 void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
10121 LDKInMemorySigner this_ptr_conv;
10122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10123 this_ptr_conv.is_owned = false;
10124 LDKSecretKey val_ref;
10125 CHECK(*((uint32_t*)val) == 32);
10126 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10127 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
10130 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
10131 LDKInMemorySigner this_ptr_conv;
10132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10133 this_ptr_conv.is_owned = false;
10134 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10135 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
10139 void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
10140 LDKInMemorySigner this_ptr_conv;
10141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10142 this_ptr_conv.is_owned = false;
10143 LDKSecretKey val_ref;
10144 CHECK(*((uint32_t*)val) == 32);
10145 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10146 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
10149 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
10150 LDKInMemorySigner this_ptr_conv;
10151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10152 this_ptr_conv.is_owned = false;
10153 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10154 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
10158 void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
10159 LDKInMemorySigner this_ptr_conv;
10160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10161 this_ptr_conv.is_owned = false;
10162 LDKThirtyTwoBytes val_ref;
10163 CHECK(*((uint32_t*)val) == 32);
10164 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10165 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
10168 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) {
10169 LDKInMemorySigner orig_conv;
10170 orig_conv.inner = (void*)(orig & (~1));
10171 orig_conv.is_owned = false;
10172 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
10173 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10174 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10175 long ret_ref = (long)ret_var.inner;
10176 if (ret_var.is_owned) {
10182 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_new(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, int8_tArray channel_keys_id) {
10183 LDKSecretKey funding_key_ref;
10184 CHECK(*((uint32_t*)funding_key) == 32);
10185 memcpy(funding_key_ref.bytes, (uint8_t*)(funding_key + 4), 32);
10186 LDKSecretKey revocation_base_key_ref;
10187 CHECK(*((uint32_t*)revocation_base_key) == 32);
10188 memcpy(revocation_base_key_ref.bytes, (uint8_t*)(revocation_base_key + 4), 32);
10189 LDKSecretKey payment_key_ref;
10190 CHECK(*((uint32_t*)payment_key) == 32);
10191 memcpy(payment_key_ref.bytes, (uint8_t*)(payment_key + 4), 32);
10192 LDKSecretKey delayed_payment_base_key_ref;
10193 CHECK(*((uint32_t*)delayed_payment_base_key) == 32);
10194 memcpy(delayed_payment_base_key_ref.bytes, (uint8_t*)(delayed_payment_base_key + 4), 32);
10195 LDKSecretKey htlc_base_key_ref;
10196 CHECK(*((uint32_t*)htlc_base_key) == 32);
10197 memcpy(htlc_base_key_ref.bytes, (uint8_t*)(htlc_base_key + 4), 32);
10198 LDKThirtyTwoBytes commitment_seed_ref;
10199 CHECK(*((uint32_t*)commitment_seed) == 32);
10200 memcpy(commitment_seed_ref.data, (uint8_t*)(commitment_seed + 4), 32);
10201 LDKThirtyTwoBytes channel_keys_id_ref;
10202 CHECK(*((uint32_t*)channel_keys_id) == 32);
10203 memcpy(channel_keys_id_ref.data, (uint8_t*)(channel_keys_id + 4), 32);
10204 LDKInMemorySigner ret_var = InMemorySigner_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, channel_keys_id_ref);
10205 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10206 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10207 long ret_ref = (long)ret_var.inner;
10208 if (ret_var.is_owned) {
10214 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
10215 LDKInMemorySigner this_arg_conv;
10216 this_arg_conv.inner = (void*)(this_arg & (~1));
10217 this_arg_conv.is_owned = false;
10218 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
10219 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10220 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10221 long ret_ref = (long)ret_var.inner;
10222 if (ret_var.is_owned) {
10228 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
10229 LDKInMemorySigner this_arg_conv;
10230 this_arg_conv.inner = (void*)(this_arg & (~1));
10231 this_arg_conv.is_owned = false;
10232 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
10236 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
10237 LDKInMemorySigner this_arg_conv;
10238 this_arg_conv.inner = (void*)(this_arg & (~1));
10239 this_arg_conv.is_owned = false;
10240 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
10244 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
10245 LDKInMemorySigner this_arg_conv;
10246 this_arg_conv.inner = (void*)(this_arg & (~1));
10247 this_arg_conv.is_owned = false;
10248 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
10252 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
10253 LDKInMemorySigner this_arg_conv;
10254 this_arg_conv.inner = (void*)(this_arg & (~1));
10255 this_arg_conv.is_owned = false;
10256 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
10257 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10258 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10259 long ret_ref = (long)ret_var.inner;
10260 if (ret_var.is_owned) {
10266 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
10267 LDKInMemorySigner this_arg_conv;
10268 this_arg_conv.inner = (void*)(this_arg & (~1));
10269 this_arg_conv.is_owned = false;
10270 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
10271 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10272 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10273 long ret_ref = (long)ret_var.inner;
10274 if (ret_var.is_owned) {
10280 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_sign_counterparty_payment_input(uint32_t this_arg, int8_tArray spend_tx, int64_t input_idx, uint32_t descriptor) {
10281 LDKInMemorySigner this_arg_conv;
10282 this_arg_conv.inner = (void*)(this_arg & (~1));
10283 this_arg_conv.is_owned = false;
10284 LDKTransaction spend_tx_ref;
10285 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
10286 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
10287 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
10288 spend_tx_ref.data_is_owned = true;
10289 LDKStaticPaymentOutputDescriptor descriptor_conv;
10290 descriptor_conv.inner = (void*)(descriptor & (~1));
10291 descriptor_conv.is_owned = false;
10292 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10293 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
10294 return (long)ret_conv;
10297 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_sign_dynamic_p2wsh_input(uint32_t this_arg, int8_tArray spend_tx, int64_t input_idx, uint32_t descriptor) {
10298 LDKInMemorySigner this_arg_conv;
10299 this_arg_conv.inner = (void*)(this_arg & (~1));
10300 this_arg_conv.is_owned = false;
10301 LDKTransaction spend_tx_ref;
10302 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
10303 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
10304 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
10305 spend_tx_ref.data_is_owned = true;
10306 LDKDelayedPaymentOutputDescriptor descriptor_conv;
10307 descriptor_conv.inner = (void*)(descriptor & (~1));
10308 descriptor_conv.is_owned = false;
10309 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10310 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
10311 return (long)ret_conv;
10314 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
10315 LDKInMemorySigner this_arg_conv;
10316 this_arg_conv.inner = (void*)(this_arg & (~1));
10317 this_arg_conv.is_owned = false;
10318 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
10319 *ret = InMemorySigner_as_Sign(&this_arg_conv);
10323 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
10324 LDKInMemorySigner obj_conv;
10325 obj_conv.inner = (void*)(obj & (~1));
10326 obj_conv.is_owned = false;
10327 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
10328 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10329 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10330 CVec_u8Z_free(ret_var);
10334 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) {
10335 LDKu8slice ser_ref;
10336 ser_ref.datalen = *((uint32_t*)ser);
10337 ser_ref.data = (int8_t*)(ser + 4);
10338 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10339 *ret_conv = InMemorySigner_read(ser_ref);
10340 return (long)ret_conv;
10343 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_ptr) {
10344 LDKKeysManager this_ptr_conv;
10345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10346 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10347 KeysManager_free(this_ptr_conv);
10350 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
10351 unsigned char seed_arr[32];
10352 CHECK(*((uint32_t*)seed) == 32);
10353 memcpy(seed_arr, (uint8_t*)(seed + 4), 32);
10354 unsigned char (*seed_ref)[32] = &seed_arr;
10355 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
10356 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10357 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10358 long ret_ref = (long)ret_var.inner;
10359 if (ret_var.is_owned) {
10365 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
10366 LDKKeysManager this_arg_conv;
10367 this_arg_conv.inner = (void*)(this_arg & (~1));
10368 this_arg_conv.is_owned = false;
10369 unsigned char params_arr[32];
10370 CHECK(*((uint32_t*)params) == 32);
10371 memcpy(params_arr, (uint8_t*)(params + 4), 32);
10372 unsigned char (*params_ref)[32] = ¶ms_arr;
10373 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
10374 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10375 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10376 long ret_ref = (long)ret_var.inner;
10377 if (ret_var.is_owned) {
10383 uint32_t __attribute__((visibility("default"))) TS_KeysManager_spend_spendable_outputs(uint32_t this_arg, uint32_tArray descriptors, uint32_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight) {
10384 LDKKeysManager this_arg_conv;
10385 this_arg_conv.inner = (void*)(this_arg & (~1));
10386 this_arg_conv.is_owned = false;
10387 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
10388 descriptors_constr.datalen = *((uint32_t*)descriptors);
10389 if (descriptors_constr.datalen > 0)
10390 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
10392 descriptors_constr.data = NULL;
10393 uint32_t* descriptors_vals = (uint32_t*)(descriptors + 4);
10394 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
10395 uint32_t descriptors_conv_27 = descriptors_vals[b];
10396 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
10397 FREE((void*)descriptors_conv_27);
10398 descriptors_constr.data[b] = descriptors_conv_27_conv;
10400 LDKCVec_TxOutZ outputs_constr;
10401 outputs_constr.datalen = *((uint32_t*)outputs);
10402 if (outputs_constr.datalen > 0)
10403 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
10405 outputs_constr.data = NULL;
10406 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
10407 for (size_t h = 0; h < outputs_constr.datalen; h++) {
10408 uint32_t outputs_conv_7 = outputs_vals[h];
10409 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
10410 FREE((void*)outputs_conv_7);
10411 outputs_constr.data[h] = outputs_conv_7_conv;
10413 LDKCVec_u8Z change_destination_script_ref;
10414 change_destination_script_ref.datalen = *((uint32_t*)change_destination_script);
10415 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
10416 memcpy(change_destination_script_ref.data, (uint8_t*)(change_destination_script + 4), change_destination_script_ref.datalen);
10417 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10418 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
10419 return (long)ret_conv;
10422 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
10423 LDKKeysManager this_arg_conv;
10424 this_arg_conv.inner = (void*)(this_arg & (~1));
10425 this_arg_conv.is_owned = false;
10426 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
10427 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
10431 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_ptr) {
10432 LDKChannelManager this_ptr_conv;
10433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10434 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10435 ChannelManager_free(this_ptr_conv);
10438 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_ptr) {
10439 LDKChannelDetails this_ptr_conv;
10440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10441 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10442 ChannelDetails_free(this_ptr_conv);
10445 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
10446 LDKChannelDetails this_ptr_conv;
10447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10448 this_ptr_conv.is_owned = false;
10449 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10450 memcpy((uint8_t*)(ret_arr + 4), *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
10454 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
10455 LDKChannelDetails this_ptr_conv;
10456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10457 this_ptr_conv.is_owned = false;
10458 LDKThirtyTwoBytes val_ref;
10459 CHECK(*((uint32_t*)val) == 32);
10460 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10461 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
10464 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_remote_network_id(uint32_t this_ptr) {
10465 LDKChannelDetails this_ptr_conv;
10466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10467 this_ptr_conv.is_owned = false;
10468 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
10469 memcpy((uint8_t*)(ret_arr + 4), ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form, 33);
10473 void __attribute__((visibility("default"))) TS_ChannelDetails_set_remote_network_id(uint32_t this_ptr, int8_tArray val) {
10474 LDKChannelDetails this_ptr_conv;
10475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10476 this_ptr_conv.is_owned = false;
10477 LDKPublicKey val_ref;
10478 CHECK(*((uint32_t*)val) == 33);
10479 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
10480 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
10483 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty_features(uint32_t this_ptr) {
10484 LDKChannelDetails this_ptr_conv;
10485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10486 this_ptr_conv.is_owned = false;
10487 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
10488 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10489 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10490 long ret_ref = (long)ret_var.inner;
10491 if (ret_var.is_owned) {
10497 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty_features(uint32_t this_ptr, uint32_t val) {
10498 LDKChannelDetails this_ptr_conv;
10499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10500 this_ptr_conv.is_owned = false;
10501 LDKInitFeatures val_conv;
10502 val_conv.inner = (void*)(val & (~1));
10503 val_conv.is_owned = (val & 1) || (val == 0);
10504 val_conv = InitFeatures_clone(&val_conv);
10505 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
10508 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
10509 LDKChannelDetails this_ptr_conv;
10510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10511 this_ptr_conv.is_owned = false;
10512 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
10516 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
10517 LDKChannelDetails this_ptr_conv;
10518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10519 this_ptr_conv.is_owned = false;
10520 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
10523 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_id(uint32_t this_ptr) {
10524 LDKChannelDetails this_ptr_conv;
10525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10526 this_ptr_conv.is_owned = false;
10527 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
10531 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_id(uint32_t this_ptr, int64_t val) {
10532 LDKChannelDetails this_ptr_conv;
10533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10534 this_ptr_conv.is_owned = false;
10535 ChannelDetails_set_user_id(&this_ptr_conv, val);
10538 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
10539 LDKChannelDetails this_ptr_conv;
10540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10541 this_ptr_conv.is_owned = false;
10542 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
10546 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
10547 LDKChannelDetails this_ptr_conv;
10548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10549 this_ptr_conv.is_owned = false;
10550 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
10553 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
10554 LDKChannelDetails this_ptr_conv;
10555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10556 this_ptr_conv.is_owned = false;
10557 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
10561 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
10562 LDKChannelDetails this_ptr_conv;
10563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10564 this_ptr_conv.is_owned = false;
10565 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
10568 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_live(uint32_t this_ptr) {
10569 LDKChannelDetails this_ptr_conv;
10570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10571 this_ptr_conv.is_owned = false;
10572 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
10576 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_live(uint32_t this_ptr, jboolean val) {
10577 LDKChannelDetails this_ptr_conv;
10578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10579 this_ptr_conv.is_owned = false;
10580 ChannelDetails_set_is_live(&this_ptr_conv, val);
10583 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
10584 LDKChannelDetails orig_conv;
10585 orig_conv.inner = (void*)(orig & (~1));
10586 orig_conv.is_owned = false;
10587 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
10588 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10589 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10590 long ret_ref = (long)ret_var.inner;
10591 if (ret_var.is_owned) {
10597 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
10598 if ((this_ptr & 1) != 0) return;
10599 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
10600 FREE((void*)this_ptr);
10601 PaymentSendFailure_free(this_ptr_conv);
10604 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
10605 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
10606 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
10607 *ret_copy = PaymentSendFailure_clone(orig_conv);
10608 long ret_ref = (long)ret_copy;
10612 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_new(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) {
10613 LDKNetwork network_conv = LDKNetwork_from_js(network);
10614 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
10615 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
10616 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
10617 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10618 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
10619 LDKUserConfig config_conv;
10620 config_conv.inner = (void*)(config & (~1));
10621 config_conv.is_owned = (config & 1) || (config == 0);
10622 config_conv = UserConfig_clone(&config_conv);
10623 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);
10624 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10625 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10626 long ret_ref = (long)ret_var.inner;
10627 if (ret_var.is_owned) {
10633 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_channel(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) {
10634 LDKChannelManager this_arg_conv;
10635 this_arg_conv.inner = (void*)(this_arg & (~1));
10636 this_arg_conv.is_owned = false;
10637 LDKPublicKey their_network_key_ref;
10638 CHECK(*((uint32_t*)their_network_key) == 33);
10639 memcpy(their_network_key_ref.compressed_form, (uint8_t*)(their_network_key + 4), 33);
10640 LDKUserConfig override_config_conv;
10641 override_config_conv.inner = (void*)(override_config & (~1));
10642 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
10643 override_config_conv = UserConfig_clone(&override_config_conv);
10644 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10645 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
10646 return (long)ret_conv;
10649 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
10650 LDKChannelManager this_arg_conv;
10651 this_arg_conv.inner = (void*)(this_arg & (~1));
10652 this_arg_conv.is_owned = false;
10653 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
10654 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
10655 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
10656 for (size_t q = 0; q < ret_var.datalen; q++) {
10657 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
10658 CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10659 CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10660 long ret_conv_16_ref = (long)ret_conv_16_var.inner;
10661 if (ret_conv_16_var.is_owned) {
10662 ret_conv_16_ref |= 1;
10664 ret_arr_ptr[q] = ret_conv_16_ref;
10666 FREE(ret_var.data);
10670 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
10671 LDKChannelManager this_arg_conv;
10672 this_arg_conv.inner = (void*)(this_arg & (~1));
10673 this_arg_conv.is_owned = false;
10674 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
10675 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
10676 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
10677 for (size_t q = 0; q < ret_var.datalen; q++) {
10678 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
10679 CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10680 CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10681 long ret_conv_16_ref = (long)ret_conv_16_var.inner;
10682 if (ret_conv_16_var.is_owned) {
10683 ret_conv_16_ref |= 1;
10685 ret_arr_ptr[q] = ret_conv_16_ref;
10687 FREE(ret_var.data);
10691 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
10692 LDKChannelManager this_arg_conv;
10693 this_arg_conv.inner = (void*)(this_arg & (~1));
10694 this_arg_conv.is_owned = false;
10695 unsigned char channel_id_arr[32];
10696 CHECK(*((uint32_t*)channel_id) == 32);
10697 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
10698 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
10699 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10700 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
10701 return (long)ret_conv;
10704 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
10705 LDKChannelManager this_arg_conv;
10706 this_arg_conv.inner = (void*)(this_arg & (~1));
10707 this_arg_conv.is_owned = false;
10708 unsigned char channel_id_arr[32];
10709 CHECK(*((uint32_t*)channel_id) == 32);
10710 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
10711 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
10712 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10713 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
10714 return (long)ret_conv;
10717 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
10718 LDKChannelManager this_arg_conv;
10719 this_arg_conv.inner = (void*)(this_arg & (~1));
10720 this_arg_conv.is_owned = false;
10721 ChannelManager_force_close_all_channels(&this_arg_conv);
10724 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
10725 LDKChannelManager this_arg_conv;
10726 this_arg_conv.inner = (void*)(this_arg & (~1));
10727 this_arg_conv.is_owned = false;
10728 LDKRoute route_conv;
10729 route_conv.inner = (void*)(route & (~1));
10730 route_conv.is_owned = false;
10731 LDKThirtyTwoBytes payment_hash_ref;
10732 CHECK(*((uint32_t*)payment_hash) == 32);
10733 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
10734 LDKThirtyTwoBytes payment_secret_ref;
10735 CHECK(*((uint32_t*)payment_secret) == 32);
10736 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
10737 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10738 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
10739 return (long)ret_conv;
10742 void __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, uint32_t funding_txo) {
10743 LDKChannelManager this_arg_conv;
10744 this_arg_conv.inner = (void*)(this_arg & (~1));
10745 this_arg_conv.is_owned = false;
10746 unsigned char temporary_channel_id_arr[32];
10747 CHECK(*((uint32_t*)temporary_channel_id) == 32);
10748 memcpy(temporary_channel_id_arr, (uint8_t*)(temporary_channel_id + 4), 32);
10749 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
10750 LDKOutPoint funding_txo_conv;
10751 funding_txo_conv.inner = (void*)(funding_txo & (~1));
10752 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
10753 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
10754 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
10757 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
10758 LDKChannelManager this_arg_conv;
10759 this_arg_conv.inner = (void*)(this_arg & (~1));
10760 this_arg_conv.is_owned = false;
10761 LDKThreeBytes rgb_ref;
10762 CHECK(*((uint32_t*)rgb) == 3);
10763 memcpy(rgb_ref.data, (uint8_t*)(rgb + 4), 3);
10764 LDKThirtyTwoBytes alias_ref;
10765 CHECK(*((uint32_t*)alias) == 32);
10766 memcpy(alias_ref.data, (uint8_t*)(alias + 4), 32);
10767 LDKCVec_NetAddressZ addresses_constr;
10768 addresses_constr.datalen = *((uint32_t*)addresses);
10769 if (addresses_constr.datalen > 0)
10770 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
10772 addresses_constr.data = NULL;
10773 uint32_t* addresses_vals = (uint32_t*)(addresses + 4);
10774 for (size_t m = 0; m < addresses_constr.datalen; m++) {
10775 uint32_t addresses_conv_12 = addresses_vals[m];
10776 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
10777 FREE((void*)addresses_conv_12);
10778 addresses_constr.data[m] = addresses_conv_12_conv;
10780 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
10783 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
10784 LDKChannelManager this_arg_conv;
10785 this_arg_conv.inner = (void*)(this_arg & (~1));
10786 this_arg_conv.is_owned = false;
10787 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
10790 void __attribute__((visibility("default"))) TS_ChannelManager_timer_chan_freshness_every_min(uint32_t this_arg) {
10791 LDKChannelManager this_arg_conv;
10792 this_arg_conv.inner = (void*)(this_arg & (~1));
10793 this_arg_conv.is_owned = false;
10794 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
10797 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
10798 LDKChannelManager this_arg_conv;
10799 this_arg_conv.inner = (void*)(this_arg & (~1));
10800 this_arg_conv.is_owned = false;
10801 unsigned char payment_hash_arr[32];
10802 CHECK(*((uint32_t*)payment_hash) == 32);
10803 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
10804 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
10805 LDKThirtyTwoBytes payment_secret_ref;
10806 CHECK(*((uint32_t*)payment_secret) == 32);
10807 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
10808 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
10812 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t expected_amount) {
10813 LDKChannelManager this_arg_conv;
10814 this_arg_conv.inner = (void*)(this_arg & (~1));
10815 this_arg_conv.is_owned = false;
10816 LDKThirtyTwoBytes payment_preimage_ref;
10817 CHECK(*((uint32_t*)payment_preimage) == 32);
10818 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
10819 LDKThirtyTwoBytes payment_secret_ref;
10820 CHECK(*((uint32_t*)payment_secret) == 32);
10821 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
10822 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
10826 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
10827 LDKChannelManager this_arg_conv;
10828 this_arg_conv.inner = (void*)(this_arg & (~1));
10829 this_arg_conv.is_owned = false;
10830 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
10831 memcpy((uint8_t*)(ret_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
10835 void __attribute__((visibility("default"))) TS_ChannelManager_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, int64_t highest_applied_update_id) {
10836 LDKChannelManager this_arg_conv;
10837 this_arg_conv.inner = (void*)(this_arg & (~1));
10838 this_arg_conv.is_owned = false;
10839 LDKOutPoint funding_txo_conv;
10840 funding_txo_conv.inner = (void*)(funding_txo & (~1));
10841 funding_txo_conv.is_owned = false;
10842 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
10845 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
10846 LDKChannelManager this_arg_conv;
10847 this_arg_conv.inner = (void*)(this_arg & (~1));
10848 this_arg_conv.is_owned = false;
10849 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
10850 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
10854 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
10855 LDKChannelManager this_arg_conv;
10856 this_arg_conv.inner = (void*)(this_arg & (~1));
10857 this_arg_conv.is_owned = false;
10858 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
10859 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
10863 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
10864 LDKChannelManager this_arg_conv;
10865 this_arg_conv.inner = (void*)(this_arg & (~1));
10866 this_arg_conv.is_owned = false;
10867 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
10868 *ret = ChannelManager_as_Listen(&this_arg_conv);
10872 void __attribute__((visibility("default"))) TS_ChannelManager_block_connected(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
10873 LDKChannelManager this_arg_conv;
10874 this_arg_conv.inner = (void*)(this_arg & (~1));
10875 this_arg_conv.is_owned = false;
10876 unsigned char header_arr[80];
10877 CHECK(*((uint32_t*)header) == 80);
10878 memcpy(header_arr, (uint8_t*)(header + 4), 80);
10879 unsigned char (*header_ref)[80] = &header_arr;
10880 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10881 txdata_constr.datalen = *((uint32_t*)txdata);
10882 if (txdata_constr.datalen > 0)
10883 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10885 txdata_constr.data = NULL;
10886 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
10887 for (size_t e = 0; e < txdata_constr.datalen; e++) {
10888 uint32_t txdata_conv_30 = txdata_vals[e];
10889 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
10890 FREE((void*)txdata_conv_30);
10891 txdata_constr.data[e] = txdata_conv_30_conv;
10893 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
10896 void __attribute__((visibility("default"))) TS_ChannelManager_block_disconnected(uint32_t this_arg, int8_tArray header) {
10897 LDKChannelManager this_arg_conv;
10898 this_arg_conv.inner = (void*)(this_arg & (~1));
10899 this_arg_conv.is_owned = false;
10900 unsigned char header_arr[80];
10901 CHECK(*((uint32_t*)header) == 80);
10902 memcpy(header_arr, (uint8_t*)(header + 4), 80);
10903 unsigned char (*header_ref)[80] = &header_arr;
10904 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
10907 void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
10908 LDKChannelManager this_arg_conv;
10909 this_arg_conv.inner = (void*)(this_arg & (~1));
10910 this_arg_conv.is_owned = false;
10911 ChannelManager_await_persistable_update(&this_arg_conv);
10914 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
10915 LDKChannelManager this_arg_conv;
10916 this_arg_conv.inner = (void*)(this_arg & (~1));
10917 this_arg_conv.is_owned = false;
10918 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
10919 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
10923 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
10924 LDKChannelManager obj_conv;
10925 obj_conv.inner = (void*)(obj & (~1));
10926 obj_conv.is_owned = false;
10927 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
10928 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10929 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10930 CVec_u8Z_free(ret_var);
10934 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_ptr) {
10935 LDKChannelManagerReadArgs this_ptr_conv;
10936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10937 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10938 ChannelManagerReadArgs_free(this_ptr_conv);
10941 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
10942 LDKChannelManagerReadArgs this_ptr_conv;
10943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10944 this_ptr_conv.is_owned = false;
10945 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
10949 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
10950 LDKChannelManagerReadArgs this_ptr_conv;
10951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10952 this_ptr_conv.is_owned = false;
10953 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
10954 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
10957 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
10958 LDKChannelManagerReadArgs this_ptr_conv;
10959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10960 this_ptr_conv.is_owned = false;
10961 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
10965 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
10966 LDKChannelManagerReadArgs this_ptr_conv;
10967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10968 this_ptr_conv.is_owned = false;
10969 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
10970 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
10973 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
10974 LDKChannelManagerReadArgs this_ptr_conv;
10975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10976 this_ptr_conv.is_owned = false;
10977 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
10981 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
10982 LDKChannelManagerReadArgs this_ptr_conv;
10983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10984 this_ptr_conv.is_owned = false;
10985 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
10986 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
10989 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
10990 LDKChannelManagerReadArgs this_ptr_conv;
10991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10992 this_ptr_conv.is_owned = false;
10993 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
10997 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
10998 LDKChannelManagerReadArgs this_ptr_conv;
10999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11000 this_ptr_conv.is_owned = false;
11001 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
11002 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
11005 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
11006 LDKChannelManagerReadArgs this_ptr_conv;
11007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11008 this_ptr_conv.is_owned = false;
11009 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
11013 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
11014 LDKChannelManagerReadArgs this_ptr_conv;
11015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11016 this_ptr_conv.is_owned = false;
11017 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
11018 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
11021 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
11022 LDKChannelManagerReadArgs this_ptr_conv;
11023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11024 this_ptr_conv.is_owned = false;
11025 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
11026 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11027 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11028 long ret_ref = (long)ret_var.inner;
11029 if (ret_var.is_owned) {
11035 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
11036 LDKChannelManagerReadArgs this_ptr_conv;
11037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11038 this_ptr_conv.is_owned = false;
11039 LDKUserConfig val_conv;
11040 val_conv.inner = (void*)(val & (~1));
11041 val_conv.is_owned = (val & 1) || (val == 0);
11042 val_conv = UserConfig_clone(&val_conv);
11043 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
11046 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_new(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) {
11047 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
11048 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
11049 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
11050 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
11051 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
11052 LDKUserConfig default_config_conv;
11053 default_config_conv.inner = (void*)(default_config & (~1));
11054 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
11055 default_config_conv = UserConfig_clone(&default_config_conv);
11056 LDKCVec_ChannelMonitorZ channel_monitors_constr;
11057 channel_monitors_constr.datalen = *((uint32_t*)channel_monitors);
11058 if (channel_monitors_constr.datalen > 0)
11059 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
11061 channel_monitors_constr.data = NULL;
11062 uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4);
11063 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
11064 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
11065 LDKChannelMonitor channel_monitors_conv_16_conv;
11066 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
11067 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
11068 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
11070 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);
11071 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11072 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11073 long ret_ref = (long)ret_var.inner;
11074 if (ret_var.is_owned) {
11080 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
11081 LDKu8slice ser_ref;
11082 ser_ref.datalen = *((uint32_t*)ser);
11083 ser_ref.data = (int8_t*)(ser + 4);
11084 LDKChannelManagerReadArgs arg_conv;
11085 arg_conv.inner = (void*)(arg & (~1));
11086 arg_conv.is_owned = (arg & 1) || (arg == 0);
11087 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
11088 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
11089 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
11090 return (long)ret_conv;
11093 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_ptr) {
11094 LDKDecodeError this_ptr_conv;
11095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11096 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11097 DecodeError_free(this_ptr_conv);
11100 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
11101 LDKDecodeError orig_conv;
11102 orig_conv.inner = (void*)(orig & (~1));
11103 orig_conv.is_owned = false;
11104 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
11105 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11106 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11107 long ret_ref = (long)ret_var.inner;
11108 if (ret_var.is_owned) {
11114 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_ptr) {
11115 LDKInit this_ptr_conv;
11116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11117 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11118 Init_free(this_ptr_conv);
11121 uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
11122 LDKInit this_ptr_conv;
11123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11124 this_ptr_conv.is_owned = false;
11125 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
11126 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11127 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11128 long ret_ref = (long)ret_var.inner;
11129 if (ret_var.is_owned) {
11135 void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
11136 LDKInit this_ptr_conv;
11137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11138 this_ptr_conv.is_owned = false;
11139 LDKInitFeatures val_conv;
11140 val_conv.inner = (void*)(val & (~1));
11141 val_conv.is_owned = (val & 1) || (val == 0);
11142 val_conv = InitFeatures_clone(&val_conv);
11143 Init_set_features(&this_ptr_conv, val_conv);
11146 uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
11147 LDKInitFeatures features_arg_conv;
11148 features_arg_conv.inner = (void*)(features_arg & (~1));
11149 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
11150 features_arg_conv = InitFeatures_clone(&features_arg_conv);
11151 LDKInit ret_var = Init_new(features_arg_conv);
11152 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11153 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11154 long ret_ref = (long)ret_var.inner;
11155 if (ret_var.is_owned) {
11161 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
11163 orig_conv.inner = (void*)(orig & (~1));
11164 orig_conv.is_owned = false;
11165 LDKInit ret_var = Init_clone(&orig_conv);
11166 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11167 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11168 long ret_ref = (long)ret_var.inner;
11169 if (ret_var.is_owned) {
11175 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_ptr) {
11176 LDKErrorMessage this_ptr_conv;
11177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11178 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11179 ErrorMessage_free(this_ptr_conv);
11182 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
11183 LDKErrorMessage this_ptr_conv;
11184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11185 this_ptr_conv.is_owned = false;
11186 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11187 memcpy((uint8_t*)(ret_arr + 4), *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
11191 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
11192 LDKErrorMessage this_ptr_conv;
11193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11194 this_ptr_conv.is_owned = false;
11195 LDKThirtyTwoBytes val_ref;
11196 CHECK(*((uint32_t*)val) == 32);
11197 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11198 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
11201 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
11202 LDKErrorMessage this_ptr_conv;
11203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11204 this_ptr_conv.is_owned = false;
11205 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
11206 jstring _conv = str_ref_to_ts(_str.chars, _str.len);
11210 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, int8_tArray val) {
11211 LDKErrorMessage this_ptr_conv;
11212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11213 this_ptr_conv.is_owned = false;
11214 LDKCVec_u8Z val_ref;
11215 val_ref.datalen = *((uint32_t*)val);
11216 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
11217 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
11218 ErrorMessage_set_data(&this_ptr_conv, val_ref);
11221 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, int8_tArray data_arg) {
11222 LDKThirtyTwoBytes channel_id_arg_ref;
11223 CHECK(*((uint32_t*)channel_id_arg) == 32);
11224 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
11225 LDKCVec_u8Z data_arg_ref;
11226 data_arg_ref.datalen = *((uint32_t*)data_arg);
11227 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
11228 memcpy(data_arg_ref.data, (uint8_t*)(data_arg + 4), data_arg_ref.datalen);
11229 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
11230 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11231 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11232 long ret_ref = (long)ret_var.inner;
11233 if (ret_var.is_owned) {
11239 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
11240 LDKErrorMessage orig_conv;
11241 orig_conv.inner = (void*)(orig & (~1));
11242 orig_conv.is_owned = false;
11243 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
11244 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11245 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11246 long ret_ref = (long)ret_var.inner;
11247 if (ret_var.is_owned) {
11253 void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_ptr) {
11254 LDKPing this_ptr_conv;
11255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11256 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11257 Ping_free(this_ptr_conv);
11260 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
11261 LDKPing this_ptr_conv;
11262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11263 this_ptr_conv.is_owned = false;
11264 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
11268 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
11269 LDKPing this_ptr_conv;
11270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11271 this_ptr_conv.is_owned = false;
11272 Ping_set_ponglen(&this_ptr_conv, val);
11275 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
11276 LDKPing this_ptr_conv;
11277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11278 this_ptr_conv.is_owned = false;
11279 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
11283 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
11284 LDKPing this_ptr_conv;
11285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11286 this_ptr_conv.is_owned = false;
11287 Ping_set_byteslen(&this_ptr_conv, val);
11290 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
11291 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
11292 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11293 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11294 long ret_ref = (long)ret_var.inner;
11295 if (ret_var.is_owned) {
11301 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
11303 orig_conv.inner = (void*)(orig & (~1));
11304 orig_conv.is_owned = false;
11305 LDKPing ret_var = Ping_clone(&orig_conv);
11306 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11307 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11308 long ret_ref = (long)ret_var.inner;
11309 if (ret_var.is_owned) {
11315 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_ptr) {
11316 LDKPong this_ptr_conv;
11317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11318 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11319 Pong_free(this_ptr_conv);
11322 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
11323 LDKPong this_ptr_conv;
11324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11325 this_ptr_conv.is_owned = false;
11326 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
11330 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
11331 LDKPong this_ptr_conv;
11332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11333 this_ptr_conv.is_owned = false;
11334 Pong_set_byteslen(&this_ptr_conv, val);
11337 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
11338 LDKPong ret_var = Pong_new(byteslen_arg);
11339 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11340 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11341 long ret_ref = (long)ret_var.inner;
11342 if (ret_var.is_owned) {
11348 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
11350 orig_conv.inner = (void*)(orig & (~1));
11351 orig_conv.is_owned = false;
11352 LDKPong ret_var = Pong_clone(&orig_conv);
11353 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11354 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11355 long ret_ref = (long)ret_var.inner;
11356 if (ret_var.is_owned) {
11362 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_ptr) {
11363 LDKOpenChannel this_ptr_conv;
11364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11365 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11366 OpenChannel_free(this_ptr_conv);
11369 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
11370 LDKOpenChannel this_ptr_conv;
11371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11372 this_ptr_conv.is_owned = false;
11373 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11374 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
11378 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
11379 LDKOpenChannel this_ptr_conv;
11380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11381 this_ptr_conv.is_owned = false;
11382 LDKThirtyTwoBytes val_ref;
11383 CHECK(*((uint32_t*)val) == 32);
11384 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11385 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
11388 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
11389 LDKOpenChannel this_ptr_conv;
11390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11391 this_ptr_conv.is_owned = false;
11392 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11393 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
11397 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
11398 LDKOpenChannel this_ptr_conv;
11399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11400 this_ptr_conv.is_owned = false;
11401 LDKThirtyTwoBytes val_ref;
11402 CHECK(*((uint32_t*)val) == 32);
11403 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11404 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
11407 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
11408 LDKOpenChannel this_ptr_conv;
11409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11410 this_ptr_conv.is_owned = false;
11411 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
11415 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
11416 LDKOpenChannel this_ptr_conv;
11417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11418 this_ptr_conv.is_owned = false;
11419 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
11422 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
11423 LDKOpenChannel this_ptr_conv;
11424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11425 this_ptr_conv.is_owned = false;
11426 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
11430 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
11431 LDKOpenChannel this_ptr_conv;
11432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11433 this_ptr_conv.is_owned = false;
11434 OpenChannel_set_push_msat(&this_ptr_conv, val);
11437 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
11438 LDKOpenChannel this_ptr_conv;
11439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11440 this_ptr_conv.is_owned = false;
11441 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
11445 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
11446 LDKOpenChannel this_ptr_conv;
11447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11448 this_ptr_conv.is_owned = false;
11449 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
11452 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
11453 LDKOpenChannel this_ptr_conv;
11454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11455 this_ptr_conv.is_owned = false;
11456 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
11460 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
11461 LDKOpenChannel this_ptr_conv;
11462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11463 this_ptr_conv.is_owned = false;
11464 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
11467 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
11468 LDKOpenChannel this_ptr_conv;
11469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11470 this_ptr_conv.is_owned = false;
11471 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
11475 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
11476 LDKOpenChannel this_ptr_conv;
11477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11478 this_ptr_conv.is_owned = false;
11479 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
11482 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
11483 LDKOpenChannel this_ptr_conv;
11484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11485 this_ptr_conv.is_owned = false;
11486 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
11490 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
11491 LDKOpenChannel this_ptr_conv;
11492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11493 this_ptr_conv.is_owned = false;
11494 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
11497 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
11498 LDKOpenChannel this_ptr_conv;
11499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11500 this_ptr_conv.is_owned = false;
11501 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
11505 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
11506 LDKOpenChannel this_ptr_conv;
11507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11508 this_ptr_conv.is_owned = false;
11509 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
11512 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
11513 LDKOpenChannel this_ptr_conv;
11514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11515 this_ptr_conv.is_owned = false;
11516 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
11520 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
11521 LDKOpenChannel this_ptr_conv;
11522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11523 this_ptr_conv.is_owned = false;
11524 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
11527 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
11528 LDKOpenChannel this_ptr_conv;
11529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11530 this_ptr_conv.is_owned = false;
11531 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
11535 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
11536 LDKOpenChannel this_ptr_conv;
11537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11538 this_ptr_conv.is_owned = false;
11539 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
11542 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
11543 LDKOpenChannel this_ptr_conv;
11544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11545 this_ptr_conv.is_owned = false;
11546 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11547 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
11551 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
11552 LDKOpenChannel this_ptr_conv;
11553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11554 this_ptr_conv.is_owned = false;
11555 LDKPublicKey val_ref;
11556 CHECK(*((uint32_t*)val) == 33);
11557 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11558 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
11561 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
11562 LDKOpenChannel this_ptr_conv;
11563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11564 this_ptr_conv.is_owned = false;
11565 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11566 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
11570 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
11571 LDKOpenChannel this_ptr_conv;
11572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11573 this_ptr_conv.is_owned = false;
11574 LDKPublicKey val_ref;
11575 CHECK(*((uint32_t*)val) == 33);
11576 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11577 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
11580 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
11581 LDKOpenChannel this_ptr_conv;
11582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11583 this_ptr_conv.is_owned = false;
11584 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11585 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
11589 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
11590 LDKOpenChannel this_ptr_conv;
11591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11592 this_ptr_conv.is_owned = false;
11593 LDKPublicKey val_ref;
11594 CHECK(*((uint32_t*)val) == 33);
11595 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11596 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
11599 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
11600 LDKOpenChannel this_ptr_conv;
11601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11602 this_ptr_conv.is_owned = false;
11603 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11604 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
11608 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
11609 LDKOpenChannel this_ptr_conv;
11610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11611 this_ptr_conv.is_owned = false;
11612 LDKPublicKey val_ref;
11613 CHECK(*((uint32_t*)val) == 33);
11614 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11615 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
11618 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
11619 LDKOpenChannel this_ptr_conv;
11620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11621 this_ptr_conv.is_owned = false;
11622 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11623 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
11627 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
11628 LDKOpenChannel this_ptr_conv;
11629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11630 this_ptr_conv.is_owned = false;
11631 LDKPublicKey val_ref;
11632 CHECK(*((uint32_t*)val) == 33);
11633 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11634 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
11637 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
11638 LDKOpenChannel this_ptr_conv;
11639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11640 this_ptr_conv.is_owned = false;
11641 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11642 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
11646 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
11647 LDKOpenChannel this_ptr_conv;
11648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11649 this_ptr_conv.is_owned = false;
11650 LDKPublicKey val_ref;
11651 CHECK(*((uint32_t*)val) == 33);
11652 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11653 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
11656 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
11657 LDKOpenChannel this_ptr_conv;
11658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11659 this_ptr_conv.is_owned = false;
11660 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
11664 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
11665 LDKOpenChannel this_ptr_conv;
11666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11667 this_ptr_conv.is_owned = false;
11668 OpenChannel_set_channel_flags(&this_ptr_conv, val);
11671 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
11672 LDKOpenChannel orig_conv;
11673 orig_conv.inner = (void*)(orig & (~1));
11674 orig_conv.is_owned = false;
11675 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
11676 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11677 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11678 long ret_ref = (long)ret_var.inner;
11679 if (ret_var.is_owned) {
11685 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_ptr) {
11686 LDKAcceptChannel this_ptr_conv;
11687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11688 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11689 AcceptChannel_free(this_ptr_conv);
11692 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
11693 LDKAcceptChannel this_ptr_conv;
11694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11695 this_ptr_conv.is_owned = false;
11696 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11697 memcpy((uint8_t*)(ret_arr + 4), *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
11701 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
11702 LDKAcceptChannel this_ptr_conv;
11703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11704 this_ptr_conv.is_owned = false;
11705 LDKThirtyTwoBytes val_ref;
11706 CHECK(*((uint32_t*)val) == 32);
11707 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11708 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
11711 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
11712 LDKAcceptChannel this_ptr_conv;
11713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11714 this_ptr_conv.is_owned = false;
11715 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
11719 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
11720 LDKAcceptChannel this_ptr_conv;
11721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11722 this_ptr_conv.is_owned = false;
11723 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
11726 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
11727 LDKAcceptChannel this_ptr_conv;
11728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11729 this_ptr_conv.is_owned = false;
11730 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
11734 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
11735 LDKAcceptChannel this_ptr_conv;
11736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11737 this_ptr_conv.is_owned = false;
11738 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
11741 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
11742 LDKAcceptChannel this_ptr_conv;
11743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11744 this_ptr_conv.is_owned = false;
11745 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
11749 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
11750 LDKAcceptChannel this_ptr_conv;
11751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11752 this_ptr_conv.is_owned = false;
11753 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
11756 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
11757 LDKAcceptChannel this_ptr_conv;
11758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11759 this_ptr_conv.is_owned = false;
11760 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
11764 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
11765 LDKAcceptChannel this_ptr_conv;
11766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11767 this_ptr_conv.is_owned = false;
11768 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
11771 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
11772 LDKAcceptChannel this_ptr_conv;
11773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11774 this_ptr_conv.is_owned = false;
11775 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
11779 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
11780 LDKAcceptChannel this_ptr_conv;
11781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11782 this_ptr_conv.is_owned = false;
11783 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
11786 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
11787 LDKAcceptChannel this_ptr_conv;
11788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11789 this_ptr_conv.is_owned = false;
11790 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
11794 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
11795 LDKAcceptChannel this_ptr_conv;
11796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11797 this_ptr_conv.is_owned = false;
11798 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
11801 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
11802 LDKAcceptChannel this_ptr_conv;
11803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11804 this_ptr_conv.is_owned = false;
11805 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
11809 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
11810 LDKAcceptChannel this_ptr_conv;
11811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11812 this_ptr_conv.is_owned = false;
11813 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
11816 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
11817 LDKAcceptChannel this_ptr_conv;
11818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11819 this_ptr_conv.is_owned = false;
11820 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11821 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
11825 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
11826 LDKAcceptChannel this_ptr_conv;
11827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11828 this_ptr_conv.is_owned = false;
11829 LDKPublicKey val_ref;
11830 CHECK(*((uint32_t*)val) == 33);
11831 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11832 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
11835 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
11836 LDKAcceptChannel this_ptr_conv;
11837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11838 this_ptr_conv.is_owned = false;
11839 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11840 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
11844 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
11845 LDKAcceptChannel this_ptr_conv;
11846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11847 this_ptr_conv.is_owned = false;
11848 LDKPublicKey val_ref;
11849 CHECK(*((uint32_t*)val) == 33);
11850 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11851 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
11854 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
11855 LDKAcceptChannel this_ptr_conv;
11856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11857 this_ptr_conv.is_owned = false;
11858 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11859 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
11863 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
11864 LDKAcceptChannel this_ptr_conv;
11865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11866 this_ptr_conv.is_owned = false;
11867 LDKPublicKey val_ref;
11868 CHECK(*((uint32_t*)val) == 33);
11869 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11870 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
11873 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
11874 LDKAcceptChannel this_ptr_conv;
11875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11876 this_ptr_conv.is_owned = false;
11877 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11878 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
11882 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
11883 LDKAcceptChannel this_ptr_conv;
11884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11885 this_ptr_conv.is_owned = false;
11886 LDKPublicKey val_ref;
11887 CHECK(*((uint32_t*)val) == 33);
11888 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11889 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
11892 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
11893 LDKAcceptChannel this_ptr_conv;
11894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11895 this_ptr_conv.is_owned = false;
11896 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11897 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
11901 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
11902 LDKAcceptChannel this_ptr_conv;
11903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11904 this_ptr_conv.is_owned = false;
11905 LDKPublicKey val_ref;
11906 CHECK(*((uint32_t*)val) == 33);
11907 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11908 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
11911 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
11912 LDKAcceptChannel this_ptr_conv;
11913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11914 this_ptr_conv.is_owned = false;
11915 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11916 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
11920 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
11921 LDKAcceptChannel this_ptr_conv;
11922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11923 this_ptr_conv.is_owned = false;
11924 LDKPublicKey val_ref;
11925 CHECK(*((uint32_t*)val) == 33);
11926 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11927 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
11930 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
11931 LDKAcceptChannel orig_conv;
11932 orig_conv.inner = (void*)(orig & (~1));
11933 orig_conv.is_owned = false;
11934 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
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 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_ptr) {
11945 LDKFundingCreated this_ptr_conv;
11946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11947 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11948 FundingCreated_free(this_ptr_conv);
11951 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
11952 LDKFundingCreated this_ptr_conv;
11953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11954 this_ptr_conv.is_owned = false;
11955 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11956 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
11960 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
11961 LDKFundingCreated this_ptr_conv;
11962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11963 this_ptr_conv.is_owned = false;
11964 LDKThirtyTwoBytes val_ref;
11965 CHECK(*((uint32_t*)val) == 32);
11966 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11967 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
11970 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
11971 LDKFundingCreated this_ptr_conv;
11972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11973 this_ptr_conv.is_owned = false;
11974 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11975 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
11979 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
11980 LDKFundingCreated this_ptr_conv;
11981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11982 this_ptr_conv.is_owned = false;
11983 LDKThirtyTwoBytes val_ref;
11984 CHECK(*((uint32_t*)val) == 32);
11985 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11986 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
11989 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
11990 LDKFundingCreated this_ptr_conv;
11991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11992 this_ptr_conv.is_owned = false;
11993 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
11997 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
11998 LDKFundingCreated this_ptr_conv;
11999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12000 this_ptr_conv.is_owned = false;
12001 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
12004 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
12005 LDKFundingCreated this_ptr_conv;
12006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12007 this_ptr_conv.is_owned = false;
12008 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
12009 memcpy((uint8_t*)(ret_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
12013 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
12014 LDKFundingCreated this_ptr_conv;
12015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12016 this_ptr_conv.is_owned = false;
12017 LDKSignature val_ref;
12018 CHECK(*((uint32_t*)val) == 64);
12019 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
12020 FundingCreated_set_signature(&this_ptr_conv, val_ref);
12023 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_new(int8_tArray temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
12024 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
12025 CHECK(*((uint32_t*)temporary_channel_id_arg) == 32);
12026 memcpy(temporary_channel_id_arg_ref.data, (uint8_t*)(temporary_channel_id_arg + 4), 32);
12027 LDKThirtyTwoBytes funding_txid_arg_ref;
12028 CHECK(*((uint32_t*)funding_txid_arg) == 32);
12029 memcpy(funding_txid_arg_ref.data, (uint8_t*)(funding_txid_arg + 4), 32);
12030 LDKSignature signature_arg_ref;
12031 CHECK(*((uint32_t*)signature_arg) == 64);
12032 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
12033 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
12034 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12035 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12036 long ret_ref = (long)ret_var.inner;
12037 if (ret_var.is_owned) {
12043 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
12044 LDKFundingCreated orig_conv;
12045 orig_conv.inner = (void*)(orig & (~1));
12046 orig_conv.is_owned = false;
12047 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
12048 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12049 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12050 long ret_ref = (long)ret_var.inner;
12051 if (ret_var.is_owned) {
12057 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_ptr) {
12058 LDKFundingSigned this_ptr_conv;
12059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12060 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12061 FundingSigned_free(this_ptr_conv);
12064 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
12065 LDKFundingSigned this_ptr_conv;
12066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12067 this_ptr_conv.is_owned = false;
12068 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12069 memcpy((uint8_t*)(ret_arr + 4), *FundingSigned_get_channel_id(&this_ptr_conv), 32);
12073 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12074 LDKFundingSigned this_ptr_conv;
12075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12076 this_ptr_conv.is_owned = false;
12077 LDKThirtyTwoBytes val_ref;
12078 CHECK(*((uint32_t*)val) == 32);
12079 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12080 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
12083 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
12084 LDKFundingSigned this_ptr_conv;
12085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12086 this_ptr_conv.is_owned = false;
12087 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
12088 memcpy((uint8_t*)(ret_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
12092 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
12093 LDKFundingSigned this_ptr_conv;
12094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12095 this_ptr_conv.is_owned = false;
12096 LDKSignature val_ref;
12097 CHECK(*((uint32_t*)val) == 64);
12098 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
12099 FundingSigned_set_signature(&this_ptr_conv, val_ref);
12102 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
12103 LDKThirtyTwoBytes channel_id_arg_ref;
12104 CHECK(*((uint32_t*)channel_id_arg) == 32);
12105 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12106 LDKSignature signature_arg_ref;
12107 CHECK(*((uint32_t*)signature_arg) == 64);
12108 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
12109 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
12110 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12111 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12112 long ret_ref = (long)ret_var.inner;
12113 if (ret_var.is_owned) {
12119 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
12120 LDKFundingSigned orig_conv;
12121 orig_conv.inner = (void*)(orig & (~1));
12122 orig_conv.is_owned = false;
12123 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
12124 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12125 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12126 long ret_ref = (long)ret_var.inner;
12127 if (ret_var.is_owned) {
12133 void __attribute__((visibility("default"))) TS_FundingLocked_free(uint32_t this_ptr) {
12134 LDKFundingLocked this_ptr_conv;
12135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12136 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12137 FundingLocked_free(this_ptr_conv);
12140 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
12141 LDKFundingLocked this_ptr_conv;
12142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12143 this_ptr_conv.is_owned = false;
12144 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12145 memcpy((uint8_t*)(ret_arr + 4), *FundingLocked_get_channel_id(&this_ptr_conv), 32);
12149 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12150 LDKFundingLocked this_ptr_conv;
12151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12152 this_ptr_conv.is_owned = false;
12153 LDKThirtyTwoBytes val_ref;
12154 CHECK(*((uint32_t*)val) == 32);
12155 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12156 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
12159 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
12160 LDKFundingLocked this_ptr_conv;
12161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12162 this_ptr_conv.is_owned = false;
12163 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12164 memcpy((uint8_t*)(ret_arr + 4), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
12168 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
12169 LDKFundingLocked this_ptr_conv;
12170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12171 this_ptr_conv.is_owned = false;
12172 LDKPublicKey val_ref;
12173 CHECK(*((uint32_t*)val) == 33);
12174 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12175 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
12178 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
12179 LDKThirtyTwoBytes channel_id_arg_ref;
12180 CHECK(*((uint32_t*)channel_id_arg) == 32);
12181 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12182 LDKPublicKey next_per_commitment_point_arg_ref;
12183 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
12184 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
12185 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
12186 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12187 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12188 long ret_ref = (long)ret_var.inner;
12189 if (ret_var.is_owned) {
12195 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
12196 LDKFundingLocked orig_conv;
12197 orig_conv.inner = (void*)(orig & (~1));
12198 orig_conv.is_owned = false;
12199 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
12200 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12201 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12202 long ret_ref = (long)ret_var.inner;
12203 if (ret_var.is_owned) {
12209 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_ptr) {
12210 LDKShutdown this_ptr_conv;
12211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12212 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12213 Shutdown_free(this_ptr_conv);
12216 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
12217 LDKShutdown this_ptr_conv;
12218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12219 this_ptr_conv.is_owned = false;
12220 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12221 memcpy((uint8_t*)(ret_arr + 4), *Shutdown_get_channel_id(&this_ptr_conv), 32);
12225 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12226 LDKShutdown this_ptr_conv;
12227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12228 this_ptr_conv.is_owned = false;
12229 LDKThirtyTwoBytes val_ref;
12230 CHECK(*((uint32_t*)val) == 32);
12231 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12232 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
12235 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
12236 LDKShutdown this_ptr_conv;
12237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12238 this_ptr_conv.is_owned = false;
12239 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
12240 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12241 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12245 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
12246 LDKShutdown this_ptr_conv;
12247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12248 this_ptr_conv.is_owned = false;
12249 LDKCVec_u8Z val_ref;
12250 val_ref.datalen = *((uint32_t*)val);
12251 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
12252 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
12253 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
12256 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
12257 LDKThirtyTwoBytes channel_id_arg_ref;
12258 CHECK(*((uint32_t*)channel_id_arg) == 32);
12259 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12260 LDKCVec_u8Z scriptpubkey_arg_ref;
12261 scriptpubkey_arg_ref.datalen = *((uint32_t*)scriptpubkey_arg);
12262 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
12263 memcpy(scriptpubkey_arg_ref.data, (uint8_t*)(scriptpubkey_arg + 4), scriptpubkey_arg_ref.datalen);
12264 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
12265 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12266 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12267 long ret_ref = (long)ret_var.inner;
12268 if (ret_var.is_owned) {
12274 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
12275 LDKShutdown orig_conv;
12276 orig_conv.inner = (void*)(orig & (~1));
12277 orig_conv.is_owned = false;
12278 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
12279 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12280 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12281 long ret_ref = (long)ret_var.inner;
12282 if (ret_var.is_owned) {
12288 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_ptr) {
12289 LDKClosingSigned this_ptr_conv;
12290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12291 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12292 ClosingSigned_free(this_ptr_conv);
12295 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
12296 LDKClosingSigned this_ptr_conv;
12297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12298 this_ptr_conv.is_owned = false;
12299 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12300 memcpy((uint8_t*)(ret_arr + 4), *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
12304 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12305 LDKClosingSigned this_ptr_conv;
12306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12307 this_ptr_conv.is_owned = false;
12308 LDKThirtyTwoBytes val_ref;
12309 CHECK(*((uint32_t*)val) == 32);
12310 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12311 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
12314 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
12315 LDKClosingSigned this_ptr_conv;
12316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12317 this_ptr_conv.is_owned = false;
12318 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
12322 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
12323 LDKClosingSigned this_ptr_conv;
12324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12325 this_ptr_conv.is_owned = false;
12326 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
12329 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
12330 LDKClosingSigned this_ptr_conv;
12331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12332 this_ptr_conv.is_owned = false;
12333 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
12334 memcpy((uint8_t*)(ret_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
12338 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
12339 LDKClosingSigned this_ptr_conv;
12340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12341 this_ptr_conv.is_owned = false;
12342 LDKSignature val_ref;
12343 CHECK(*((uint32_t*)val) == 64);
12344 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
12345 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
12348 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg) {
12349 LDKThirtyTwoBytes channel_id_arg_ref;
12350 CHECK(*((uint32_t*)channel_id_arg) == 32);
12351 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12352 LDKSignature signature_arg_ref;
12353 CHECK(*((uint32_t*)signature_arg) == 64);
12354 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
12355 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
12356 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12357 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12358 long ret_ref = (long)ret_var.inner;
12359 if (ret_var.is_owned) {
12365 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
12366 LDKClosingSigned orig_conv;
12367 orig_conv.inner = (void*)(orig & (~1));
12368 orig_conv.is_owned = false;
12369 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
12370 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12371 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12372 long ret_ref = (long)ret_var.inner;
12373 if (ret_var.is_owned) {
12379 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_ptr) {
12380 LDKUpdateAddHTLC this_ptr_conv;
12381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12382 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12383 UpdateAddHTLC_free(this_ptr_conv);
12386 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
12387 LDKUpdateAddHTLC this_ptr_conv;
12388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12389 this_ptr_conv.is_owned = false;
12390 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12391 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
12395 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12396 LDKUpdateAddHTLC this_ptr_conv;
12397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12398 this_ptr_conv.is_owned = false;
12399 LDKThirtyTwoBytes val_ref;
12400 CHECK(*((uint32_t*)val) == 32);
12401 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12402 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
12405 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
12406 LDKUpdateAddHTLC this_ptr_conv;
12407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12408 this_ptr_conv.is_owned = false;
12409 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
12413 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
12414 LDKUpdateAddHTLC this_ptr_conv;
12415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12416 this_ptr_conv.is_owned = false;
12417 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
12420 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
12421 LDKUpdateAddHTLC this_ptr_conv;
12422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12423 this_ptr_conv.is_owned = false;
12424 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
12428 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
12429 LDKUpdateAddHTLC this_ptr_conv;
12430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12431 this_ptr_conv.is_owned = false;
12432 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
12435 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
12436 LDKUpdateAddHTLC this_ptr_conv;
12437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12438 this_ptr_conv.is_owned = false;
12439 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12440 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
12444 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
12445 LDKUpdateAddHTLC this_ptr_conv;
12446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12447 this_ptr_conv.is_owned = false;
12448 LDKThirtyTwoBytes val_ref;
12449 CHECK(*((uint32_t*)val) == 32);
12450 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12451 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
12454 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
12455 LDKUpdateAddHTLC this_ptr_conv;
12456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12457 this_ptr_conv.is_owned = false;
12458 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
12462 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
12463 LDKUpdateAddHTLC this_ptr_conv;
12464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12465 this_ptr_conv.is_owned = false;
12466 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
12469 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
12470 LDKUpdateAddHTLC orig_conv;
12471 orig_conv.inner = (void*)(orig & (~1));
12472 orig_conv.is_owned = false;
12473 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
12474 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12475 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12476 long ret_ref = (long)ret_var.inner;
12477 if (ret_var.is_owned) {
12483 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_ptr) {
12484 LDKUpdateFulfillHTLC this_ptr_conv;
12485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12486 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12487 UpdateFulfillHTLC_free(this_ptr_conv);
12490 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
12491 LDKUpdateFulfillHTLC this_ptr_conv;
12492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12493 this_ptr_conv.is_owned = false;
12494 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12495 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
12499 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12500 LDKUpdateFulfillHTLC this_ptr_conv;
12501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12502 this_ptr_conv.is_owned = false;
12503 LDKThirtyTwoBytes val_ref;
12504 CHECK(*((uint32_t*)val) == 32);
12505 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12506 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
12509 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
12510 LDKUpdateFulfillHTLC this_ptr_conv;
12511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12512 this_ptr_conv.is_owned = false;
12513 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
12517 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
12518 LDKUpdateFulfillHTLC this_ptr_conv;
12519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12520 this_ptr_conv.is_owned = false;
12521 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
12524 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
12525 LDKUpdateFulfillHTLC this_ptr_conv;
12526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12527 this_ptr_conv.is_owned = false;
12528 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12529 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
12533 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
12534 LDKUpdateFulfillHTLC this_ptr_conv;
12535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12536 this_ptr_conv.is_owned = false;
12537 LDKThirtyTwoBytes val_ref;
12538 CHECK(*((uint32_t*)val) == 32);
12539 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12540 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
12543 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
12544 LDKThirtyTwoBytes channel_id_arg_ref;
12545 CHECK(*((uint32_t*)channel_id_arg) == 32);
12546 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12547 LDKThirtyTwoBytes payment_preimage_arg_ref;
12548 CHECK(*((uint32_t*)payment_preimage_arg) == 32);
12549 memcpy(payment_preimage_arg_ref.data, (uint8_t*)(payment_preimage_arg + 4), 32);
12550 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
12551 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12552 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12553 long ret_ref = (long)ret_var.inner;
12554 if (ret_var.is_owned) {
12560 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
12561 LDKUpdateFulfillHTLC orig_conv;
12562 orig_conv.inner = (void*)(orig & (~1));
12563 orig_conv.is_owned = false;
12564 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
12565 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12566 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12567 long ret_ref = (long)ret_var.inner;
12568 if (ret_var.is_owned) {
12574 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_ptr) {
12575 LDKUpdateFailHTLC this_ptr_conv;
12576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12577 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12578 UpdateFailHTLC_free(this_ptr_conv);
12581 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
12582 LDKUpdateFailHTLC this_ptr_conv;
12583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12584 this_ptr_conv.is_owned = false;
12585 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12586 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
12590 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12591 LDKUpdateFailHTLC this_ptr_conv;
12592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12593 this_ptr_conv.is_owned = false;
12594 LDKThirtyTwoBytes val_ref;
12595 CHECK(*((uint32_t*)val) == 32);
12596 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12597 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
12600 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
12601 LDKUpdateFailHTLC this_ptr_conv;
12602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12603 this_ptr_conv.is_owned = false;
12604 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
12608 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
12609 LDKUpdateFailHTLC this_ptr_conv;
12610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12611 this_ptr_conv.is_owned = false;
12612 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
12615 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
12616 LDKUpdateFailHTLC orig_conv;
12617 orig_conv.inner = (void*)(orig & (~1));
12618 orig_conv.is_owned = false;
12619 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
12620 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12621 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12622 long ret_ref = (long)ret_var.inner;
12623 if (ret_var.is_owned) {
12629 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_ptr) {
12630 LDKUpdateFailMalformedHTLC this_ptr_conv;
12631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12632 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12633 UpdateFailMalformedHTLC_free(this_ptr_conv);
12636 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
12637 LDKUpdateFailMalformedHTLC this_ptr_conv;
12638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12639 this_ptr_conv.is_owned = false;
12640 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12641 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
12645 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12646 LDKUpdateFailMalformedHTLC this_ptr_conv;
12647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12648 this_ptr_conv.is_owned = false;
12649 LDKThirtyTwoBytes val_ref;
12650 CHECK(*((uint32_t*)val) == 32);
12651 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12652 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
12655 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
12656 LDKUpdateFailMalformedHTLC this_ptr_conv;
12657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12658 this_ptr_conv.is_owned = false;
12659 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
12663 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
12664 LDKUpdateFailMalformedHTLC this_ptr_conv;
12665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12666 this_ptr_conv.is_owned = false;
12667 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
12670 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
12671 LDKUpdateFailMalformedHTLC this_ptr_conv;
12672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12673 this_ptr_conv.is_owned = false;
12674 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
12678 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
12679 LDKUpdateFailMalformedHTLC this_ptr_conv;
12680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12681 this_ptr_conv.is_owned = false;
12682 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
12685 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
12686 LDKUpdateFailMalformedHTLC orig_conv;
12687 orig_conv.inner = (void*)(orig & (~1));
12688 orig_conv.is_owned = false;
12689 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
12690 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12691 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12692 long ret_ref = (long)ret_var.inner;
12693 if (ret_var.is_owned) {
12699 void __attribute__((visibility("default"))) TS_CommitmentSigned_free(uint32_t this_ptr) {
12700 LDKCommitmentSigned this_ptr_conv;
12701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12702 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12703 CommitmentSigned_free(this_ptr_conv);
12706 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
12707 LDKCommitmentSigned this_ptr_conv;
12708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12709 this_ptr_conv.is_owned = false;
12710 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12711 memcpy((uint8_t*)(ret_arr + 4), *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
12715 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12716 LDKCommitmentSigned 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(*((uint32_t*)val) == 32);
12721 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12722 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
12725 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
12726 LDKCommitmentSigned this_ptr_conv;
12727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12728 this_ptr_conv.is_owned = false;
12729 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
12730 memcpy((uint8_t*)(ret_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
12734 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
12735 LDKCommitmentSigned this_ptr_conv;
12736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12737 this_ptr_conv.is_owned = false;
12738 LDKSignature val_ref;
12739 CHECK(*((uint32_t*)val) == 64);
12740 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
12741 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
12744 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
12745 LDKCommitmentSigned this_ptr_conv;
12746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12747 this_ptr_conv.is_owned = false;
12748 LDKCVec_SignatureZ val_constr;
12749 val_constr.datalen = *((uint32_t*)val);
12750 if (val_constr.datalen > 0)
12751 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12753 val_constr.data = NULL;
12754 int8_tArray* val_vals = (int8_tArray*)(val + 4);
12755 for (size_t m = 0; m < val_constr.datalen; m++) {
12756 int8_tArray val_conv_12 = val_vals[m];
12757 LDKSignature val_conv_12_ref;
12758 CHECK(*((uint32_t*)val_conv_12) == 64);
12759 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
12760 val_constr.data[m] = val_conv_12_ref;
12762 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
12765 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
12766 LDKThirtyTwoBytes channel_id_arg_ref;
12767 CHECK(*((uint32_t*)channel_id_arg) == 32);
12768 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12769 LDKSignature signature_arg_ref;
12770 CHECK(*((uint32_t*)signature_arg) == 64);
12771 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
12772 LDKCVec_SignatureZ htlc_signatures_arg_constr;
12773 htlc_signatures_arg_constr.datalen = *((uint32_t*)htlc_signatures_arg);
12774 if (htlc_signatures_arg_constr.datalen > 0)
12775 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12777 htlc_signatures_arg_constr.data = NULL;
12778 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg + 4);
12779 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
12780 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
12781 LDKSignature htlc_signatures_arg_conv_12_ref;
12782 CHECK(*((uint32_t*)htlc_signatures_arg_conv_12) == 64);
12783 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, (uint8_t*)(htlc_signatures_arg_conv_12 + 4), 64);
12784 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
12786 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
12787 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12788 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12789 long ret_ref = (long)ret_var.inner;
12790 if (ret_var.is_owned) {
12796 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
12797 LDKCommitmentSigned orig_conv;
12798 orig_conv.inner = (void*)(orig & (~1));
12799 orig_conv.is_owned = false;
12800 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
12801 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12802 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12803 long ret_ref = (long)ret_var.inner;
12804 if (ret_var.is_owned) {
12810 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_ptr) {
12811 LDKRevokeAndACK this_ptr_conv;
12812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12813 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12814 RevokeAndACK_free(this_ptr_conv);
12817 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
12818 LDKRevokeAndACK this_ptr_conv;
12819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12820 this_ptr_conv.is_owned = false;
12821 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12822 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
12826 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12827 LDKRevokeAndACK this_ptr_conv;
12828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12829 this_ptr_conv.is_owned = false;
12830 LDKThirtyTwoBytes val_ref;
12831 CHECK(*((uint32_t*)val) == 32);
12832 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12833 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
12836 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
12837 LDKRevokeAndACK this_ptr_conv;
12838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12839 this_ptr_conv.is_owned = false;
12840 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12841 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
12845 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
12846 LDKRevokeAndACK this_ptr_conv;
12847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12848 this_ptr_conv.is_owned = false;
12849 LDKThirtyTwoBytes val_ref;
12850 CHECK(*((uint32_t*)val) == 32);
12851 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12852 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
12855 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
12856 LDKRevokeAndACK this_ptr_conv;
12857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12858 this_ptr_conv.is_owned = false;
12859 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12860 memcpy((uint8_t*)(ret_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
12864 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
12865 LDKRevokeAndACK this_ptr_conv;
12866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12867 this_ptr_conv.is_owned = false;
12868 LDKPublicKey val_ref;
12869 CHECK(*((uint32_t*)val) == 33);
12870 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12871 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
12874 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_new(int8_tArray channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
12875 LDKThirtyTwoBytes channel_id_arg_ref;
12876 CHECK(*((uint32_t*)channel_id_arg) == 32);
12877 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12878 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
12879 CHECK(*((uint32_t*)per_commitment_secret_arg) == 32);
12880 memcpy(per_commitment_secret_arg_ref.data, (uint8_t*)(per_commitment_secret_arg + 4), 32);
12881 LDKPublicKey next_per_commitment_point_arg_ref;
12882 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
12883 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
12884 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
12885 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12886 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12887 long ret_ref = (long)ret_var.inner;
12888 if (ret_var.is_owned) {
12894 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
12895 LDKRevokeAndACK orig_conv;
12896 orig_conv.inner = (void*)(orig & (~1));
12897 orig_conv.is_owned = false;
12898 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
12899 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12900 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12901 long ret_ref = (long)ret_var.inner;
12902 if (ret_var.is_owned) {
12908 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_ptr) {
12909 LDKUpdateFee this_ptr_conv;
12910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12911 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12912 UpdateFee_free(this_ptr_conv);
12915 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
12916 LDKUpdateFee this_ptr_conv;
12917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12918 this_ptr_conv.is_owned = false;
12919 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12920 memcpy((uint8_t*)(ret_arr + 4), *UpdateFee_get_channel_id(&this_ptr_conv), 32);
12924 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12925 LDKUpdateFee this_ptr_conv;
12926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12927 this_ptr_conv.is_owned = false;
12928 LDKThirtyTwoBytes val_ref;
12929 CHECK(*((uint32_t*)val) == 32);
12930 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12931 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
12934 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
12935 LDKUpdateFee this_ptr_conv;
12936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12937 this_ptr_conv.is_owned = false;
12938 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
12942 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
12943 LDKUpdateFee this_ptr_conv;
12944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12945 this_ptr_conv.is_owned = false;
12946 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
12949 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
12950 LDKThirtyTwoBytes channel_id_arg_ref;
12951 CHECK(*((uint32_t*)channel_id_arg) == 32);
12952 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12953 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
12954 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12955 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12956 long ret_ref = (long)ret_var.inner;
12957 if (ret_var.is_owned) {
12963 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
12964 LDKUpdateFee orig_conv;
12965 orig_conv.inner = (void*)(orig & (~1));
12966 orig_conv.is_owned = false;
12967 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
12968 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12969 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12970 long ret_ref = (long)ret_var.inner;
12971 if (ret_var.is_owned) {
12977 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_ptr) {
12978 LDKDataLossProtect this_ptr_conv;
12979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12980 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12981 DataLossProtect_free(this_ptr_conv);
12984 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
12985 LDKDataLossProtect this_ptr_conv;
12986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12987 this_ptr_conv.is_owned = false;
12988 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12989 memcpy((uint8_t*)(ret_arr + 4), *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
12993 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
12994 LDKDataLossProtect this_ptr_conv;
12995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12996 this_ptr_conv.is_owned = false;
12997 LDKThirtyTwoBytes val_ref;
12998 CHECK(*((uint32_t*)val) == 32);
12999 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13000 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
13003 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
13004 LDKDataLossProtect this_ptr_conv;
13005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13006 this_ptr_conv.is_owned = false;
13007 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13008 memcpy((uint8_t*)(ret_arr + 4), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
13012 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
13013 LDKDataLossProtect this_ptr_conv;
13014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13015 this_ptr_conv.is_owned = false;
13016 LDKPublicKey val_ref;
13017 CHECK(*((uint32_t*)val) == 33);
13018 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13019 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
13022 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
13023 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
13024 CHECK(*((uint32_t*)your_last_per_commitment_secret_arg) == 32);
13025 memcpy(your_last_per_commitment_secret_arg_ref.data, (uint8_t*)(your_last_per_commitment_secret_arg + 4), 32);
13026 LDKPublicKey my_current_per_commitment_point_arg_ref;
13027 CHECK(*((uint32_t*)my_current_per_commitment_point_arg) == 33);
13028 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(my_current_per_commitment_point_arg + 4), 33);
13029 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
13030 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13031 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13032 long ret_ref = (long)ret_var.inner;
13033 if (ret_var.is_owned) {
13039 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
13040 LDKDataLossProtect orig_conv;
13041 orig_conv.inner = (void*)(orig & (~1));
13042 orig_conv.is_owned = false;
13043 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_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 __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_ptr) {
13054 LDKChannelReestablish this_ptr_conv;
13055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13056 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13057 ChannelReestablish_free(this_ptr_conv);
13060 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
13061 LDKChannelReestablish this_ptr_conv;
13062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13063 this_ptr_conv.is_owned = false;
13064 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13065 memcpy((uint8_t*)(ret_arr + 4), *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
13069 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13070 LDKChannelReestablish this_ptr_conv;
13071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13072 this_ptr_conv.is_owned = false;
13073 LDKThirtyTwoBytes val_ref;
13074 CHECK(*((uint32_t*)val) == 32);
13075 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13076 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
13079 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
13080 LDKChannelReestablish this_ptr_conv;
13081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13082 this_ptr_conv.is_owned = false;
13083 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
13087 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
13088 LDKChannelReestablish this_ptr_conv;
13089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13090 this_ptr_conv.is_owned = false;
13091 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
13094 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
13095 LDKChannelReestablish this_ptr_conv;
13096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13097 this_ptr_conv.is_owned = false;
13098 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
13102 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
13103 LDKChannelReestablish this_ptr_conv;
13104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13105 this_ptr_conv.is_owned = false;
13106 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
13109 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
13110 LDKChannelReestablish orig_conv;
13111 orig_conv.inner = (void*)(orig & (~1));
13112 orig_conv.is_owned = false;
13113 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
13114 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13115 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13116 long ret_ref = (long)ret_var.inner;
13117 if (ret_var.is_owned) {
13123 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_ptr) {
13124 LDKAnnouncementSignatures this_ptr_conv;
13125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13126 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13127 AnnouncementSignatures_free(this_ptr_conv);
13130 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
13131 LDKAnnouncementSignatures this_ptr_conv;
13132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13133 this_ptr_conv.is_owned = false;
13134 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13135 memcpy((uint8_t*)(ret_arr + 4), *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
13139 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13140 LDKAnnouncementSignatures this_ptr_conv;
13141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13142 this_ptr_conv.is_owned = false;
13143 LDKThirtyTwoBytes val_ref;
13144 CHECK(*((uint32_t*)val) == 32);
13145 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13146 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
13149 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
13150 LDKAnnouncementSignatures this_ptr_conv;
13151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13152 this_ptr_conv.is_owned = false;
13153 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
13157 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
13158 LDKAnnouncementSignatures this_ptr_conv;
13159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13160 this_ptr_conv.is_owned = false;
13161 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
13164 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
13165 LDKAnnouncementSignatures this_ptr_conv;
13166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13167 this_ptr_conv.is_owned = false;
13168 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13169 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
13173 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
13174 LDKAnnouncementSignatures this_ptr_conv;
13175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13176 this_ptr_conv.is_owned = false;
13177 LDKSignature val_ref;
13178 CHECK(*((uint32_t*)val) == 64);
13179 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13180 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
13183 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
13184 LDKAnnouncementSignatures this_ptr_conv;
13185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13186 this_ptr_conv.is_owned = false;
13187 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13188 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
13192 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
13193 LDKAnnouncementSignatures this_ptr_conv;
13194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13195 this_ptr_conv.is_owned = false;
13196 LDKSignature val_ref;
13197 CHECK(*((uint32_t*)val) == 64);
13198 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13199 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
13202 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_new(int8_tArray channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
13203 LDKThirtyTwoBytes channel_id_arg_ref;
13204 CHECK(*((uint32_t*)channel_id_arg) == 32);
13205 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13206 LDKSignature node_signature_arg_ref;
13207 CHECK(*((uint32_t*)node_signature_arg) == 64);
13208 memcpy(node_signature_arg_ref.compact_form, (uint8_t*)(node_signature_arg + 4), 64);
13209 LDKSignature bitcoin_signature_arg_ref;
13210 CHECK(*((uint32_t*)bitcoin_signature_arg) == 64);
13211 memcpy(bitcoin_signature_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_arg + 4), 64);
13212 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
13213 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13214 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13215 long ret_ref = (long)ret_var.inner;
13216 if (ret_var.is_owned) {
13222 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
13223 LDKAnnouncementSignatures orig_conv;
13224 orig_conv.inner = (void*)(orig & (~1));
13225 orig_conv.is_owned = false;
13226 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
13227 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13228 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13229 long ret_ref = (long)ret_var.inner;
13230 if (ret_var.is_owned) {
13236 void __attribute__((visibility("default"))) TS_NetAddress_free(uint32_t this_ptr) {
13237 if ((this_ptr & 1) != 0) return;
13238 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
13239 FREE((void*)this_ptr);
13240 NetAddress_free(this_ptr_conv);
13243 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
13244 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
13245 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
13246 *ret_copy = NetAddress_clone(orig_conv);
13247 long ret_ref = (long)ret_copy;
13251 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
13252 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
13253 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
13254 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13255 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13256 CVec_u8Z_free(ret_var);
13260 uint32_t __attribute__((visibility("default"))) TS_Result_read(int8_tArray ser) {
13261 LDKu8slice ser_ref;
13262 ser_ref.datalen = *((uint32_t*)ser);
13263 ser_ref.data = (int8_t*)(ser + 4);
13264 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
13265 *ret_conv = Result_read(ser_ref);
13266 return (long)ret_conv;
13269 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_ptr) {
13270 LDKUnsignedNodeAnnouncement 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 UnsignedNodeAnnouncement_free(this_ptr_conv);
13276 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
13277 LDKUnsignedNodeAnnouncement this_ptr_conv;
13278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13279 this_ptr_conv.is_owned = false;
13280 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_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 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
13291 LDKUnsignedNodeAnnouncement this_ptr_conv;
13292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13293 this_ptr_conv.is_owned = false;
13294 LDKNodeFeatures val_conv;
13295 val_conv.inner = (void*)(val & (~1));
13296 val_conv.is_owned = (val & 1) || (val == 0);
13297 val_conv = NodeFeatures_clone(&val_conv);
13298 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
13301 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
13302 LDKUnsignedNodeAnnouncement this_ptr_conv;
13303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13304 this_ptr_conv.is_owned = false;
13305 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
13309 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
13310 LDKUnsignedNodeAnnouncement this_ptr_conv;
13311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13312 this_ptr_conv.is_owned = false;
13313 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
13316 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
13317 LDKUnsignedNodeAnnouncement this_ptr_conv;
13318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13319 this_ptr_conv.is_owned = false;
13320 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13321 memcpy((uint8_t*)(ret_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
13325 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
13326 LDKUnsignedNodeAnnouncement this_ptr_conv;
13327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13328 this_ptr_conv.is_owned = false;
13329 LDKPublicKey val_ref;
13330 CHECK(*((uint32_t*)val) == 33);
13331 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13332 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
13335 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
13336 LDKUnsignedNodeAnnouncement this_ptr_conv;
13337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13338 this_ptr_conv.is_owned = false;
13339 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
13340 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
13344 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
13345 LDKUnsignedNodeAnnouncement this_ptr_conv;
13346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13347 this_ptr_conv.is_owned = false;
13348 LDKThreeBytes val_ref;
13349 CHECK(*((uint32_t*)val) == 3);
13350 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
13351 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
13354 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
13355 LDKUnsignedNodeAnnouncement this_ptr_conv;
13356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13357 this_ptr_conv.is_owned = false;
13358 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13359 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
13363 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
13364 LDKUnsignedNodeAnnouncement this_ptr_conv;
13365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13366 this_ptr_conv.is_owned = false;
13367 LDKThirtyTwoBytes val_ref;
13368 CHECK(*((uint32_t*)val) == 32);
13369 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13370 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
13373 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
13374 LDKUnsignedNodeAnnouncement this_ptr_conv;
13375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13376 this_ptr_conv.is_owned = false;
13377 LDKCVec_NetAddressZ val_constr;
13378 val_constr.datalen = *((uint32_t*)val);
13379 if (val_constr.datalen > 0)
13380 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
13382 val_constr.data = NULL;
13383 uint32_t* val_vals = (uint32_t*)(val + 4);
13384 for (size_t m = 0; m < val_constr.datalen; m++) {
13385 uint32_t val_conv_12 = val_vals[m];
13386 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
13387 FREE((void*)val_conv_12);
13388 val_constr.data[m] = val_conv_12_conv;
13390 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
13393 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
13394 LDKUnsignedNodeAnnouncement orig_conv;
13395 orig_conv.inner = (void*)(orig & (~1));
13396 orig_conv.is_owned = false;
13397 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
13398 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13399 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13400 long ret_ref = (long)ret_var.inner;
13401 if (ret_var.is_owned) {
13407 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_ptr) {
13408 LDKNodeAnnouncement this_ptr_conv;
13409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13410 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13411 NodeAnnouncement_free(this_ptr_conv);
13414 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
13415 LDKNodeAnnouncement this_ptr_conv;
13416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13417 this_ptr_conv.is_owned = false;
13418 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13419 memcpy((uint8_t*)(ret_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
13423 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
13424 LDKNodeAnnouncement this_ptr_conv;
13425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13426 this_ptr_conv.is_owned = false;
13427 LDKSignature val_ref;
13428 CHECK(*((uint32_t*)val) == 64);
13429 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13430 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
13433 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
13434 LDKNodeAnnouncement this_ptr_conv;
13435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13436 this_ptr_conv.is_owned = false;
13437 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
13438 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13439 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13440 long ret_ref = (long)ret_var.inner;
13441 if (ret_var.is_owned) {
13447 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
13448 LDKNodeAnnouncement this_ptr_conv;
13449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13450 this_ptr_conv.is_owned = false;
13451 LDKUnsignedNodeAnnouncement val_conv;
13452 val_conv.inner = (void*)(val & (~1));
13453 val_conv.is_owned = (val & 1) || (val == 0);
13454 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
13455 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
13458 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
13459 LDKSignature signature_arg_ref;
13460 CHECK(*((uint32_t*)signature_arg) == 64);
13461 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
13462 LDKUnsignedNodeAnnouncement contents_arg_conv;
13463 contents_arg_conv.inner = (void*)(contents_arg & (~1));
13464 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
13465 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
13466 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
13467 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13468 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13469 long ret_ref = (long)ret_var.inner;
13470 if (ret_var.is_owned) {
13476 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
13477 LDKNodeAnnouncement orig_conv;
13478 orig_conv.inner = (void*)(orig & (~1));
13479 orig_conv.is_owned = false;
13480 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
13481 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13482 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13483 long ret_ref = (long)ret_var.inner;
13484 if (ret_var.is_owned) {
13490 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_ptr) {
13491 LDKUnsignedChannelAnnouncement this_ptr_conv;
13492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13493 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13494 UnsignedChannelAnnouncement_free(this_ptr_conv);
13497 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
13498 LDKUnsignedChannelAnnouncement this_ptr_conv;
13499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13500 this_ptr_conv.is_owned = false;
13501 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
13502 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13503 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13504 long ret_ref = (long)ret_var.inner;
13505 if (ret_var.is_owned) {
13511 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
13512 LDKUnsignedChannelAnnouncement this_ptr_conv;
13513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13514 this_ptr_conv.is_owned = false;
13515 LDKChannelFeatures val_conv;
13516 val_conv.inner = (void*)(val & (~1));
13517 val_conv.is_owned = (val & 1) || (val == 0);
13518 val_conv = ChannelFeatures_clone(&val_conv);
13519 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
13522 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
13523 LDKUnsignedChannelAnnouncement this_ptr_conv;
13524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13525 this_ptr_conv.is_owned = false;
13526 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13527 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
13531 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
13532 LDKUnsignedChannelAnnouncement this_ptr_conv;
13533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13534 this_ptr_conv.is_owned = false;
13535 LDKThirtyTwoBytes val_ref;
13536 CHECK(*((uint32_t*)val) == 32);
13537 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13538 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
13541 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
13542 LDKUnsignedChannelAnnouncement this_ptr_conv;
13543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13544 this_ptr_conv.is_owned = false;
13545 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
13549 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
13550 LDKUnsignedChannelAnnouncement this_ptr_conv;
13551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13552 this_ptr_conv.is_owned = false;
13553 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
13556 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
13557 LDKUnsignedChannelAnnouncement this_ptr_conv;
13558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13559 this_ptr_conv.is_owned = false;
13560 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13561 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
13565 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
13566 LDKUnsignedChannelAnnouncement this_ptr_conv;
13567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13568 this_ptr_conv.is_owned = false;
13569 LDKPublicKey val_ref;
13570 CHECK(*((uint32_t*)val) == 33);
13571 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13572 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
13575 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
13576 LDKUnsignedChannelAnnouncement this_ptr_conv;
13577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13578 this_ptr_conv.is_owned = false;
13579 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13580 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
13584 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
13585 LDKUnsignedChannelAnnouncement this_ptr_conv;
13586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13587 this_ptr_conv.is_owned = false;
13588 LDKPublicKey val_ref;
13589 CHECK(*((uint32_t*)val) == 33);
13590 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13591 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
13594 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
13595 LDKUnsignedChannelAnnouncement this_ptr_conv;
13596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13597 this_ptr_conv.is_owned = false;
13598 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13599 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
13603 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
13604 LDKUnsignedChannelAnnouncement this_ptr_conv;
13605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13606 this_ptr_conv.is_owned = false;
13607 LDKPublicKey val_ref;
13608 CHECK(*((uint32_t*)val) == 33);
13609 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13610 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
13613 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
13614 LDKUnsignedChannelAnnouncement this_ptr_conv;
13615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13616 this_ptr_conv.is_owned = false;
13617 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13618 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
13622 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
13623 LDKUnsignedChannelAnnouncement this_ptr_conv;
13624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13625 this_ptr_conv.is_owned = false;
13626 LDKPublicKey val_ref;
13627 CHECK(*((uint32_t*)val) == 33);
13628 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13629 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
13632 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
13633 LDKUnsignedChannelAnnouncement orig_conv;
13634 orig_conv.inner = (void*)(orig & (~1));
13635 orig_conv.is_owned = false;
13636 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
13637 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13638 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13639 long ret_ref = (long)ret_var.inner;
13640 if (ret_var.is_owned) {
13646 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_ptr) {
13647 LDKChannelAnnouncement this_ptr_conv;
13648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13649 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13650 ChannelAnnouncement_free(this_ptr_conv);
13653 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
13654 LDKChannelAnnouncement this_ptr_conv;
13655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13656 this_ptr_conv.is_owned = false;
13657 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13658 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
13662 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
13663 LDKChannelAnnouncement this_ptr_conv;
13664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13665 this_ptr_conv.is_owned = false;
13666 LDKSignature val_ref;
13667 CHECK(*((uint32_t*)val) == 64);
13668 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13669 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
13672 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
13673 LDKChannelAnnouncement this_ptr_conv;
13674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13675 this_ptr_conv.is_owned = false;
13676 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13677 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
13681 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
13682 LDKChannelAnnouncement this_ptr_conv;
13683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13684 this_ptr_conv.is_owned = false;
13685 LDKSignature val_ref;
13686 CHECK(*((uint32_t*)val) == 64);
13687 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13688 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
13691 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
13692 LDKChannelAnnouncement this_ptr_conv;
13693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13694 this_ptr_conv.is_owned = false;
13695 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13696 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
13700 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
13701 LDKChannelAnnouncement this_ptr_conv;
13702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13703 this_ptr_conv.is_owned = false;
13704 LDKSignature val_ref;
13705 CHECK(*((uint32_t*)val) == 64);
13706 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13707 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
13710 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
13711 LDKChannelAnnouncement this_ptr_conv;
13712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13713 this_ptr_conv.is_owned = false;
13714 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13715 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
13719 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
13720 LDKChannelAnnouncement this_ptr_conv;
13721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13722 this_ptr_conv.is_owned = false;
13723 LDKSignature val_ref;
13724 CHECK(*((uint32_t*)val) == 64);
13725 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13726 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
13729 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
13730 LDKChannelAnnouncement this_ptr_conv;
13731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13732 this_ptr_conv.is_owned = false;
13733 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
13734 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13735 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13736 long ret_ref = (long)ret_var.inner;
13737 if (ret_var.is_owned) {
13743 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
13744 LDKChannelAnnouncement this_ptr_conv;
13745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13746 this_ptr_conv.is_owned = false;
13747 LDKUnsignedChannelAnnouncement val_conv;
13748 val_conv.inner = (void*)(val & (~1));
13749 val_conv.is_owned = (val & 1) || (val == 0);
13750 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
13751 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
13754 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_new(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) {
13755 LDKSignature node_signature_1_arg_ref;
13756 CHECK(*((uint32_t*)node_signature_1_arg) == 64);
13757 memcpy(node_signature_1_arg_ref.compact_form, (uint8_t*)(node_signature_1_arg + 4), 64);
13758 LDKSignature node_signature_2_arg_ref;
13759 CHECK(*((uint32_t*)node_signature_2_arg) == 64);
13760 memcpy(node_signature_2_arg_ref.compact_form, (uint8_t*)(node_signature_2_arg + 4), 64);
13761 LDKSignature bitcoin_signature_1_arg_ref;
13762 CHECK(*((uint32_t*)bitcoin_signature_1_arg) == 64);
13763 memcpy(bitcoin_signature_1_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_1_arg + 4), 64);
13764 LDKSignature bitcoin_signature_2_arg_ref;
13765 CHECK(*((uint32_t*)bitcoin_signature_2_arg) == 64);
13766 memcpy(bitcoin_signature_2_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_2_arg + 4), 64);
13767 LDKUnsignedChannelAnnouncement contents_arg_conv;
13768 contents_arg_conv.inner = (void*)(contents_arg & (~1));
13769 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
13770 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
13771 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);
13772 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13773 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13774 long ret_ref = (long)ret_var.inner;
13775 if (ret_var.is_owned) {
13781 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
13782 LDKChannelAnnouncement orig_conv;
13783 orig_conv.inner = (void*)(orig & (~1));
13784 orig_conv.is_owned = false;
13785 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
13786 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13787 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13788 long ret_ref = (long)ret_var.inner;
13789 if (ret_var.is_owned) {
13795 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_ptr) {
13796 LDKUnsignedChannelUpdate this_ptr_conv;
13797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13798 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13799 UnsignedChannelUpdate_free(this_ptr_conv);
13802 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
13803 LDKUnsignedChannelUpdate this_ptr_conv;
13804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13805 this_ptr_conv.is_owned = false;
13806 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13807 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
13811 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
13812 LDKUnsignedChannelUpdate this_ptr_conv;
13813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13814 this_ptr_conv.is_owned = false;
13815 LDKThirtyTwoBytes val_ref;
13816 CHECK(*((uint32_t*)val) == 32);
13817 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13818 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
13821 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
13822 LDKUnsignedChannelUpdate this_ptr_conv;
13823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13824 this_ptr_conv.is_owned = false;
13825 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
13829 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
13830 LDKUnsignedChannelUpdate this_ptr_conv;
13831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13832 this_ptr_conv.is_owned = false;
13833 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
13836 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
13837 LDKUnsignedChannelUpdate this_ptr_conv;
13838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13839 this_ptr_conv.is_owned = false;
13840 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
13844 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
13845 LDKUnsignedChannelUpdate this_ptr_conv;
13846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13847 this_ptr_conv.is_owned = false;
13848 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
13851 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
13852 LDKUnsignedChannelUpdate this_ptr_conv;
13853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13854 this_ptr_conv.is_owned = false;
13855 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
13859 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
13860 LDKUnsignedChannelUpdate this_ptr_conv;
13861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13862 this_ptr_conv.is_owned = false;
13863 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
13866 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
13867 LDKUnsignedChannelUpdate this_ptr_conv;
13868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13869 this_ptr_conv.is_owned = false;
13870 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
13874 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
13875 LDKUnsignedChannelUpdate this_ptr_conv;
13876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13877 this_ptr_conv.is_owned = false;
13878 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
13881 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
13882 LDKUnsignedChannelUpdate this_ptr_conv;
13883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13884 this_ptr_conv.is_owned = false;
13885 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
13889 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
13890 LDKUnsignedChannelUpdate this_ptr_conv;
13891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13892 this_ptr_conv.is_owned = false;
13893 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
13896 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
13897 LDKUnsignedChannelUpdate this_ptr_conv;
13898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13899 this_ptr_conv.is_owned = false;
13900 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
13904 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
13905 LDKUnsignedChannelUpdate this_ptr_conv;
13906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13907 this_ptr_conv.is_owned = false;
13908 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
13911 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
13912 LDKUnsignedChannelUpdate this_ptr_conv;
13913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13914 this_ptr_conv.is_owned = false;
13915 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
13919 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
13920 LDKUnsignedChannelUpdate this_ptr_conv;
13921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13922 this_ptr_conv.is_owned = false;
13923 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
13926 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
13927 LDKUnsignedChannelUpdate orig_conv;
13928 orig_conv.inner = (void*)(orig & (~1));
13929 orig_conv.is_owned = false;
13930 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
13931 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13932 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13933 long ret_ref = (long)ret_var.inner;
13934 if (ret_var.is_owned) {
13940 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_ptr) {
13941 LDKChannelUpdate this_ptr_conv;
13942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13943 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13944 ChannelUpdate_free(this_ptr_conv);
13947 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
13948 LDKChannelUpdate this_ptr_conv;
13949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13950 this_ptr_conv.is_owned = false;
13951 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13952 memcpy((uint8_t*)(ret_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
13956 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
13957 LDKChannelUpdate this_ptr_conv;
13958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13959 this_ptr_conv.is_owned = false;
13960 LDKSignature val_ref;
13961 CHECK(*((uint32_t*)val) == 64);
13962 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13963 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
13966 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
13967 LDKChannelUpdate this_ptr_conv;
13968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13969 this_ptr_conv.is_owned = false;
13970 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
13971 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13972 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13973 long ret_ref = (long)ret_var.inner;
13974 if (ret_var.is_owned) {
13980 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
13981 LDKChannelUpdate this_ptr_conv;
13982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13983 this_ptr_conv.is_owned = false;
13984 LDKUnsignedChannelUpdate val_conv;
13985 val_conv.inner = (void*)(val & (~1));
13986 val_conv.is_owned = (val & 1) || (val == 0);
13987 val_conv = UnsignedChannelUpdate_clone(&val_conv);
13988 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
13991 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
13992 LDKSignature signature_arg_ref;
13993 CHECK(*((uint32_t*)signature_arg) == 64);
13994 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
13995 LDKUnsignedChannelUpdate contents_arg_conv;
13996 contents_arg_conv.inner = (void*)(contents_arg & (~1));
13997 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
13998 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
13999 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
14000 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14001 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14002 long ret_ref = (long)ret_var.inner;
14003 if (ret_var.is_owned) {
14009 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
14010 LDKChannelUpdate orig_conv;
14011 orig_conv.inner = (void*)(orig & (~1));
14012 orig_conv.is_owned = false;
14013 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
14014 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14015 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14016 long ret_ref = (long)ret_var.inner;
14017 if (ret_var.is_owned) {
14023 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_ptr) {
14024 LDKQueryChannelRange this_ptr_conv;
14025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14026 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14027 QueryChannelRange_free(this_ptr_conv);
14030 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
14031 LDKQueryChannelRange this_ptr_conv;
14032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14033 this_ptr_conv.is_owned = false;
14034 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14035 memcpy((uint8_t*)(ret_arr + 4), *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
14039 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14040 LDKQueryChannelRange this_ptr_conv;
14041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14042 this_ptr_conv.is_owned = false;
14043 LDKThirtyTwoBytes val_ref;
14044 CHECK(*((uint32_t*)val) == 32);
14045 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14046 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
14049 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
14050 LDKQueryChannelRange this_ptr_conv;
14051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14052 this_ptr_conv.is_owned = false;
14053 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
14057 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
14058 LDKQueryChannelRange this_ptr_conv;
14059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14060 this_ptr_conv.is_owned = false;
14061 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
14064 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
14065 LDKQueryChannelRange this_ptr_conv;
14066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14067 this_ptr_conv.is_owned = false;
14068 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
14072 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
14073 LDKQueryChannelRange this_ptr_conv;
14074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14075 this_ptr_conv.is_owned = false;
14076 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
14079 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
14080 LDKThirtyTwoBytes chain_hash_arg_ref;
14081 CHECK(*((uint32_t*)chain_hash_arg) == 32);
14082 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
14083 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
14084 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14085 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14086 long ret_ref = (long)ret_var.inner;
14087 if (ret_var.is_owned) {
14093 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
14094 LDKQueryChannelRange orig_conv;
14095 orig_conv.inner = (void*)(orig & (~1));
14096 orig_conv.is_owned = false;
14097 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
14098 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14099 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14100 long ret_ref = (long)ret_var.inner;
14101 if (ret_var.is_owned) {
14107 void __attribute__((visibility("default"))) TS_ReplyChannelRange_free(uint32_t this_ptr) {
14108 LDKReplyChannelRange this_ptr_conv;
14109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14110 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14111 ReplyChannelRange_free(this_ptr_conv);
14114 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
14115 LDKReplyChannelRange this_ptr_conv;
14116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14117 this_ptr_conv.is_owned = false;
14118 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14119 memcpy((uint8_t*)(ret_arr + 4), *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
14123 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14124 LDKReplyChannelRange this_ptr_conv;
14125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14126 this_ptr_conv.is_owned = false;
14127 LDKThirtyTwoBytes val_ref;
14128 CHECK(*((uint32_t*)val) == 32);
14129 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14130 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
14133 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
14134 LDKReplyChannelRange this_ptr_conv;
14135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14136 this_ptr_conv.is_owned = false;
14137 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
14141 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
14142 LDKReplyChannelRange this_ptr_conv;
14143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14144 this_ptr_conv.is_owned = false;
14145 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
14148 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
14149 LDKReplyChannelRange this_ptr_conv;
14150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14151 this_ptr_conv.is_owned = false;
14152 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
14156 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
14157 LDKReplyChannelRange this_ptr_conv;
14158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14159 this_ptr_conv.is_owned = false;
14160 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
14163 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
14164 LDKReplyChannelRange this_ptr_conv;
14165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14166 this_ptr_conv.is_owned = false;
14167 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
14171 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
14172 LDKReplyChannelRange this_ptr_conv;
14173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14174 this_ptr_conv.is_owned = false;
14175 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
14178 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
14179 LDKReplyChannelRange this_ptr_conv;
14180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14181 this_ptr_conv.is_owned = false;
14182 LDKCVec_u64Z val_constr;
14183 val_constr.datalen = *((uint32_t*)val);
14184 if (val_constr.datalen > 0)
14185 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14187 val_constr.data = NULL;
14188 int64_t* val_vals = (int64_t*)(val + 4);
14189 for (size_t i = 0; i < val_constr.datalen; i++) {
14190 int64_t val_conv_8 = val_vals[i];
14191 val_constr.data[i] = val_conv_8;
14193 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
14196 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg, jboolean sync_complete_arg, int64_tArray short_channel_ids_arg) {
14197 LDKThirtyTwoBytes chain_hash_arg_ref;
14198 CHECK(*((uint32_t*)chain_hash_arg) == 32);
14199 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
14200 LDKCVec_u64Z short_channel_ids_arg_constr;
14201 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
14202 if (short_channel_ids_arg_constr.datalen > 0)
14203 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14205 short_channel_ids_arg_constr.data = NULL;
14206 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
14207 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
14208 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
14209 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
14211 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
14212 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14213 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14214 long ret_ref = (long)ret_var.inner;
14215 if (ret_var.is_owned) {
14221 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
14222 LDKReplyChannelRange orig_conv;
14223 orig_conv.inner = (void*)(orig & (~1));
14224 orig_conv.is_owned = false;
14225 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
14226 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14227 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14228 long ret_ref = (long)ret_var.inner;
14229 if (ret_var.is_owned) {
14235 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_ptr) {
14236 LDKQueryShortChannelIds this_ptr_conv;
14237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14238 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14239 QueryShortChannelIds_free(this_ptr_conv);
14242 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
14243 LDKQueryShortChannelIds this_ptr_conv;
14244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14245 this_ptr_conv.is_owned = false;
14246 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14247 memcpy((uint8_t*)(ret_arr + 4), *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
14251 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14252 LDKQueryShortChannelIds this_ptr_conv;
14253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14254 this_ptr_conv.is_owned = false;
14255 LDKThirtyTwoBytes val_ref;
14256 CHECK(*((uint32_t*)val) == 32);
14257 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14258 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
14261 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
14262 LDKQueryShortChannelIds this_ptr_conv;
14263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14264 this_ptr_conv.is_owned = false;
14265 LDKCVec_u64Z val_constr;
14266 val_constr.datalen = *((uint32_t*)val);
14267 if (val_constr.datalen > 0)
14268 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14270 val_constr.data = NULL;
14271 int64_t* val_vals = (int64_t*)(val + 4);
14272 for (size_t i = 0; i < val_constr.datalen; i++) {
14273 int64_t val_conv_8 = val_vals[i];
14274 val_constr.data[i] = val_conv_8;
14276 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
14279 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
14280 LDKThirtyTwoBytes chain_hash_arg_ref;
14281 CHECK(*((uint32_t*)chain_hash_arg) == 32);
14282 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
14283 LDKCVec_u64Z short_channel_ids_arg_constr;
14284 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
14285 if (short_channel_ids_arg_constr.datalen > 0)
14286 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14288 short_channel_ids_arg_constr.data = NULL;
14289 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
14290 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
14291 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
14292 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
14294 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
14295 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14296 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14297 long ret_ref = (long)ret_var.inner;
14298 if (ret_var.is_owned) {
14304 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
14305 LDKQueryShortChannelIds orig_conv;
14306 orig_conv.inner = (void*)(orig & (~1));
14307 orig_conv.is_owned = false;
14308 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
14309 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14310 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14311 long ret_ref = (long)ret_var.inner;
14312 if (ret_var.is_owned) {
14318 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_ptr) {
14319 LDKReplyShortChannelIdsEnd this_ptr_conv;
14320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14321 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14322 ReplyShortChannelIdsEnd_free(this_ptr_conv);
14325 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
14326 LDKReplyShortChannelIdsEnd this_ptr_conv;
14327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14328 this_ptr_conv.is_owned = false;
14329 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14330 memcpy((uint8_t*)(ret_arr + 4), *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
14334 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14335 LDKReplyShortChannelIdsEnd this_ptr_conv;
14336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14337 this_ptr_conv.is_owned = false;
14338 LDKThirtyTwoBytes val_ref;
14339 CHECK(*((uint32_t*)val) == 32);
14340 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14341 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
14344 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
14345 LDKReplyShortChannelIdsEnd this_ptr_conv;
14346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14347 this_ptr_conv.is_owned = false;
14348 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
14352 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
14353 LDKReplyShortChannelIdsEnd this_ptr_conv;
14354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14355 this_ptr_conv.is_owned = false;
14356 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
14359 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
14360 LDKThirtyTwoBytes chain_hash_arg_ref;
14361 CHECK(*((uint32_t*)chain_hash_arg) == 32);
14362 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
14363 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
14364 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14365 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14366 long ret_ref = (long)ret_var.inner;
14367 if (ret_var.is_owned) {
14373 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
14374 LDKReplyShortChannelIdsEnd orig_conv;
14375 orig_conv.inner = (void*)(orig & (~1));
14376 orig_conv.is_owned = false;
14377 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
14378 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14379 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14380 long ret_ref = (long)ret_var.inner;
14381 if (ret_var.is_owned) {
14387 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_free(uint32_t this_ptr) {
14388 LDKGossipTimestampFilter this_ptr_conv;
14389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14390 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14391 GossipTimestampFilter_free(this_ptr_conv);
14394 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
14395 LDKGossipTimestampFilter this_ptr_conv;
14396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14397 this_ptr_conv.is_owned = false;
14398 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14399 memcpy((uint8_t*)(ret_arr + 4), *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
14403 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14404 LDKGossipTimestampFilter this_ptr_conv;
14405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14406 this_ptr_conv.is_owned = false;
14407 LDKThirtyTwoBytes val_ref;
14408 CHECK(*((uint32_t*)val) == 32);
14409 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14410 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
14413 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
14414 LDKGossipTimestampFilter this_ptr_conv;
14415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14416 this_ptr_conv.is_owned = false;
14417 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
14421 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
14422 LDKGossipTimestampFilter this_ptr_conv;
14423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14424 this_ptr_conv.is_owned = false;
14425 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
14428 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
14429 LDKGossipTimestampFilter this_ptr_conv;
14430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14431 this_ptr_conv.is_owned = false;
14432 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
14436 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
14437 LDKGossipTimestampFilter this_ptr_conv;
14438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14439 this_ptr_conv.is_owned = false;
14440 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
14443 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
14444 LDKThirtyTwoBytes chain_hash_arg_ref;
14445 CHECK(*((uint32_t*)chain_hash_arg) == 32);
14446 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
14447 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
14448 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14449 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14450 long ret_ref = (long)ret_var.inner;
14451 if (ret_var.is_owned) {
14457 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
14458 LDKGossipTimestampFilter orig_conv;
14459 orig_conv.inner = (void*)(orig & (~1));
14460 orig_conv.is_owned = false;
14461 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
14462 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14463 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14464 long ret_ref = (long)ret_var.inner;
14465 if (ret_var.is_owned) {
14471 void __attribute__((visibility("default"))) TS_ErrorAction_free(uint32_t this_ptr) {
14472 if ((this_ptr & 1) != 0) return;
14473 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
14474 FREE((void*)this_ptr);
14475 ErrorAction_free(this_ptr_conv);
14478 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
14479 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
14480 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
14481 *ret_copy = ErrorAction_clone(orig_conv);
14482 long ret_ref = (long)ret_copy;
14486 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_ptr) {
14487 LDKLightningError this_ptr_conv;
14488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14489 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14490 LightningError_free(this_ptr_conv);
14493 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
14494 LDKLightningError this_ptr_conv;
14495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14496 this_ptr_conv.is_owned = false;
14497 LDKStr _str = LightningError_get_err(&this_ptr_conv);
14498 jstring _conv = str_ref_to_ts(_str.chars, _str.len);
14502 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, int8_tArray val) {
14503 LDKLightningError this_ptr_conv;
14504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14505 this_ptr_conv.is_owned = false;
14506 LDKCVec_u8Z val_ref;
14507 val_ref.datalen = *((uint32_t*)val);
14508 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
14509 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
14510 LightningError_set_err(&this_ptr_conv, val_ref);
14513 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
14514 LDKLightningError this_ptr_conv;
14515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14516 this_ptr_conv.is_owned = false;
14517 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
14518 *ret_copy = LightningError_get_action(&this_ptr_conv);
14519 long ret_ref = (long)ret_copy;
14523 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
14524 LDKLightningError this_ptr_conv;
14525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14526 this_ptr_conv.is_owned = false;
14527 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
14529 LightningError_set_action(&this_ptr_conv, val_conv);
14532 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(int8_tArray err_arg, uint32_t action_arg) {
14533 LDKCVec_u8Z err_arg_ref;
14534 err_arg_ref.datalen = *((uint32_t*)err_arg);
14535 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
14536 memcpy(err_arg_ref.data, (uint8_t*)(err_arg + 4), err_arg_ref.datalen);
14537 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
14538 FREE((void*)action_arg);
14539 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
14540 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14541 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14542 long ret_ref = (long)ret_var.inner;
14543 if (ret_var.is_owned) {
14549 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
14550 LDKLightningError orig_conv;
14551 orig_conv.inner = (void*)(orig & (~1));
14552 orig_conv.is_owned = false;
14553 LDKLightningError ret_var = LightningError_clone(&orig_conv);
14554 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14555 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14556 long ret_ref = (long)ret_var.inner;
14557 if (ret_var.is_owned) {
14563 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_ptr) {
14564 LDKCommitmentUpdate this_ptr_conv;
14565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14566 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14567 CommitmentUpdate_free(this_ptr_conv);
14570 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
14571 LDKCommitmentUpdate this_ptr_conv;
14572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14573 this_ptr_conv.is_owned = false;
14574 LDKCVec_UpdateAddHTLCZ val_constr;
14575 val_constr.datalen = *((uint32_t*)val);
14576 if (val_constr.datalen > 0)
14577 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
14579 val_constr.data = NULL;
14580 uint32_t* val_vals = (uint32_t*)(val + 4);
14581 for (size_t p = 0; p < val_constr.datalen; p++) {
14582 uint32_t val_conv_15 = val_vals[p];
14583 LDKUpdateAddHTLC val_conv_15_conv;
14584 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
14585 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
14586 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
14587 val_constr.data[p] = val_conv_15_conv;
14589 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
14592 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
14593 LDKCommitmentUpdate this_ptr_conv;
14594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14595 this_ptr_conv.is_owned = false;
14596 LDKCVec_UpdateFulfillHTLCZ val_constr;
14597 val_constr.datalen = *((uint32_t*)val);
14598 if (val_constr.datalen > 0)
14599 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
14601 val_constr.data = NULL;
14602 uint32_t* val_vals = (uint32_t*)(val + 4);
14603 for (size_t t = 0; t < val_constr.datalen; t++) {
14604 uint32_t val_conv_19 = val_vals[t];
14605 LDKUpdateFulfillHTLC val_conv_19_conv;
14606 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
14607 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
14608 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
14609 val_constr.data[t] = val_conv_19_conv;
14611 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
14614 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
14615 LDKCommitmentUpdate this_ptr_conv;
14616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14617 this_ptr_conv.is_owned = false;
14618 LDKCVec_UpdateFailHTLCZ val_constr;
14619 val_constr.datalen = *((uint32_t*)val);
14620 if (val_constr.datalen > 0)
14621 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
14623 val_constr.data = NULL;
14624 uint32_t* val_vals = (uint32_t*)(val + 4);
14625 for (size_t q = 0; q < val_constr.datalen; q++) {
14626 uint32_t val_conv_16 = val_vals[q];
14627 LDKUpdateFailHTLC val_conv_16_conv;
14628 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
14629 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
14630 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
14631 val_constr.data[q] = val_conv_16_conv;
14633 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
14636 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
14637 LDKCommitmentUpdate this_ptr_conv;
14638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14639 this_ptr_conv.is_owned = false;
14640 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
14641 val_constr.datalen = *((uint32_t*)val);
14642 if (val_constr.datalen > 0)
14643 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
14645 val_constr.data = NULL;
14646 uint32_t* val_vals = (uint32_t*)(val + 4);
14647 for (size_t z = 0; z < val_constr.datalen; z++) {
14648 uint32_t val_conv_25 = val_vals[z];
14649 LDKUpdateFailMalformedHTLC val_conv_25_conv;
14650 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
14651 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
14652 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
14653 val_constr.data[z] = val_conv_25_conv;
14655 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
14658 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
14659 LDKCommitmentUpdate this_ptr_conv;
14660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14661 this_ptr_conv.is_owned = false;
14662 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
14663 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14664 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14665 long ret_ref = (long)ret_var.inner;
14666 if (ret_var.is_owned) {
14672 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
14673 LDKCommitmentUpdate this_ptr_conv;
14674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14675 this_ptr_conv.is_owned = false;
14676 LDKUpdateFee val_conv;
14677 val_conv.inner = (void*)(val & (~1));
14678 val_conv.is_owned = (val & 1) || (val == 0);
14679 val_conv = UpdateFee_clone(&val_conv);
14680 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
14683 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
14684 LDKCommitmentUpdate this_ptr_conv;
14685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14686 this_ptr_conv.is_owned = false;
14687 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
14688 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14689 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14690 long ret_ref = (long)ret_var.inner;
14691 if (ret_var.is_owned) {
14697 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
14698 LDKCommitmentUpdate this_ptr_conv;
14699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14700 this_ptr_conv.is_owned = false;
14701 LDKCommitmentSigned val_conv;
14702 val_conv.inner = (void*)(val & (~1));
14703 val_conv.is_owned = (val & 1) || (val == 0);
14704 val_conv = CommitmentSigned_clone(&val_conv);
14705 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
14708 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_new(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) {
14709 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
14710 update_add_htlcs_arg_constr.datalen = *((uint32_t*)update_add_htlcs_arg);
14711 if (update_add_htlcs_arg_constr.datalen > 0)
14712 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
14714 update_add_htlcs_arg_constr.data = NULL;
14715 uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg + 4);
14716 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
14717 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
14718 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
14719 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
14720 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
14721 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
14722 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
14724 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
14725 update_fulfill_htlcs_arg_constr.datalen = *((uint32_t*)update_fulfill_htlcs_arg);
14726 if (update_fulfill_htlcs_arg_constr.datalen > 0)
14727 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
14729 update_fulfill_htlcs_arg_constr.data = NULL;
14730 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg + 4);
14731 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
14732 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
14733 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
14734 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
14735 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
14736 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
14737 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
14739 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
14740 update_fail_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_htlcs_arg);
14741 if (update_fail_htlcs_arg_constr.datalen > 0)
14742 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
14744 update_fail_htlcs_arg_constr.data = NULL;
14745 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg + 4);
14746 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
14747 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
14748 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
14749 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
14750 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
14751 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
14752 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
14754 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
14755 update_fail_malformed_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_malformed_htlcs_arg);
14756 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
14757 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
14759 update_fail_malformed_htlcs_arg_constr.data = NULL;
14760 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg + 4);
14761 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
14762 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
14763 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
14764 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
14765 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = (update_fail_malformed_htlcs_arg_conv_25 & 1) || (update_fail_malformed_htlcs_arg_conv_25 == 0);
14766 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
14767 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
14769 LDKUpdateFee update_fee_arg_conv;
14770 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
14771 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
14772 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
14773 LDKCommitmentSigned commitment_signed_arg_conv;
14774 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
14775 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
14776 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
14777 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);
14778 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14779 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14780 long ret_ref = (long)ret_var.inner;
14781 if (ret_var.is_owned) {
14787 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
14788 LDKCommitmentUpdate orig_conv;
14789 orig_conv.inner = (void*)(orig & (~1));
14790 orig_conv.is_owned = false;
14791 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
14792 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14793 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14794 long ret_ref = (long)ret_var.inner;
14795 if (ret_var.is_owned) {
14801 void __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_free(uint32_t this_ptr) {
14802 if ((this_ptr & 1) != 0) return;
14803 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
14804 FREE((void*)this_ptr);
14805 HTLCFailChannelUpdate_free(this_ptr_conv);
14808 uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_clone(uint32_t orig) {
14809 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
14810 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
14811 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
14812 long ret_ref = (long)ret_copy;
14816 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
14817 if ((this_ptr & 1) != 0) return;
14818 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
14819 FREE((void*)this_ptr);
14820 ChannelMessageHandler_free(this_ptr_conv);
14823 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
14824 if ((this_ptr & 1) != 0) return;
14825 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
14826 FREE((void*)this_ptr);
14827 RoutingMessageHandler_free(this_ptr_conv);
14830 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
14831 LDKAcceptChannel obj_conv;
14832 obj_conv.inner = (void*)(obj & (~1));
14833 obj_conv.is_owned = false;
14834 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
14835 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14836 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14837 CVec_u8Z_free(ret_var);
14841 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
14842 LDKu8slice ser_ref;
14843 ser_ref.datalen = *((uint32_t*)ser);
14844 ser_ref.data = (int8_t*)(ser + 4);
14845 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
14846 *ret_conv = AcceptChannel_read(ser_ref);
14847 return (long)ret_conv;
14850 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
14851 LDKAnnouncementSignatures obj_conv;
14852 obj_conv.inner = (void*)(obj & (~1));
14853 obj_conv.is_owned = false;
14854 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
14855 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14856 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14857 CVec_u8Z_free(ret_var);
14861 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
14862 LDKu8slice ser_ref;
14863 ser_ref.datalen = *((uint32_t*)ser);
14864 ser_ref.data = (int8_t*)(ser + 4);
14865 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
14866 *ret_conv = AnnouncementSignatures_read(ser_ref);
14867 return (long)ret_conv;
14870 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
14871 LDKChannelReestablish obj_conv;
14872 obj_conv.inner = (void*)(obj & (~1));
14873 obj_conv.is_owned = false;
14874 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
14875 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14876 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14877 CVec_u8Z_free(ret_var);
14881 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
14882 LDKu8slice ser_ref;
14883 ser_ref.datalen = *((uint32_t*)ser);
14884 ser_ref.data = (int8_t*)(ser + 4);
14885 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
14886 *ret_conv = ChannelReestablish_read(ser_ref);
14887 return (long)ret_conv;
14890 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
14891 LDKClosingSigned obj_conv;
14892 obj_conv.inner = (void*)(obj & (~1));
14893 obj_conv.is_owned = false;
14894 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
14895 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14896 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14897 CVec_u8Z_free(ret_var);
14901 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
14902 LDKu8slice ser_ref;
14903 ser_ref.datalen = *((uint32_t*)ser);
14904 ser_ref.data = (int8_t*)(ser + 4);
14905 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
14906 *ret_conv = ClosingSigned_read(ser_ref);
14907 return (long)ret_conv;
14910 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
14911 LDKCommitmentSigned obj_conv;
14912 obj_conv.inner = (void*)(obj & (~1));
14913 obj_conv.is_owned = false;
14914 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
14915 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14916 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14917 CVec_u8Z_free(ret_var);
14921 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
14922 LDKu8slice ser_ref;
14923 ser_ref.datalen = *((uint32_t*)ser);
14924 ser_ref.data = (int8_t*)(ser + 4);
14925 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
14926 *ret_conv = CommitmentSigned_read(ser_ref);
14927 return (long)ret_conv;
14930 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
14931 LDKFundingCreated obj_conv;
14932 obj_conv.inner = (void*)(obj & (~1));
14933 obj_conv.is_owned = false;
14934 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
14935 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14936 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14937 CVec_u8Z_free(ret_var);
14941 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
14942 LDKu8slice ser_ref;
14943 ser_ref.datalen = *((uint32_t*)ser);
14944 ser_ref.data = (int8_t*)(ser + 4);
14945 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
14946 *ret_conv = FundingCreated_read(ser_ref);
14947 return (long)ret_conv;
14950 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
14951 LDKFundingSigned obj_conv;
14952 obj_conv.inner = (void*)(obj & (~1));
14953 obj_conv.is_owned = false;
14954 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
14955 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14956 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14957 CVec_u8Z_free(ret_var);
14961 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
14962 LDKu8slice ser_ref;
14963 ser_ref.datalen = *((uint32_t*)ser);
14964 ser_ref.data = (int8_t*)(ser + 4);
14965 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
14966 *ret_conv = FundingSigned_read(ser_ref);
14967 return (long)ret_conv;
14970 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
14971 LDKFundingLocked obj_conv;
14972 obj_conv.inner = (void*)(obj & (~1));
14973 obj_conv.is_owned = false;
14974 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
14975 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14976 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14977 CVec_u8Z_free(ret_var);
14981 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
14982 LDKu8slice ser_ref;
14983 ser_ref.datalen = *((uint32_t*)ser);
14984 ser_ref.data = (int8_t*)(ser + 4);
14985 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
14986 *ret_conv = FundingLocked_read(ser_ref);
14987 return (long)ret_conv;
14990 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
14992 obj_conv.inner = (void*)(obj & (~1));
14993 obj_conv.is_owned = false;
14994 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
14995 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
14996 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
14997 CVec_u8Z_free(ret_var);
15001 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
15002 LDKu8slice ser_ref;
15003 ser_ref.datalen = *((uint32_t*)ser);
15004 ser_ref.data = (int8_t*)(ser + 4);
15005 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
15006 *ret_conv = Init_read(ser_ref);
15007 return (long)ret_conv;
15010 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
15011 LDKOpenChannel obj_conv;
15012 obj_conv.inner = (void*)(obj & (~1));
15013 obj_conv.is_owned = false;
15014 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
15015 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15016 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15017 CVec_u8Z_free(ret_var);
15021 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
15022 LDKu8slice ser_ref;
15023 ser_ref.datalen = *((uint32_t*)ser);
15024 ser_ref.data = (int8_t*)(ser + 4);
15025 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
15026 *ret_conv = OpenChannel_read(ser_ref);
15027 return (long)ret_conv;
15030 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
15031 LDKRevokeAndACK obj_conv;
15032 obj_conv.inner = (void*)(obj & (~1));
15033 obj_conv.is_owned = false;
15034 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
15035 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15036 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15037 CVec_u8Z_free(ret_var);
15041 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
15042 LDKu8slice ser_ref;
15043 ser_ref.datalen = *((uint32_t*)ser);
15044 ser_ref.data = (int8_t*)(ser + 4);
15045 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
15046 *ret_conv = RevokeAndACK_read(ser_ref);
15047 return (long)ret_conv;
15050 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
15051 LDKShutdown obj_conv;
15052 obj_conv.inner = (void*)(obj & (~1));
15053 obj_conv.is_owned = false;
15054 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
15055 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15056 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15057 CVec_u8Z_free(ret_var);
15061 uint32_t __attribute__((visibility("default"))) TS_Shutdown_read(int8_tArray ser) {
15062 LDKu8slice ser_ref;
15063 ser_ref.datalen = *((uint32_t*)ser);
15064 ser_ref.data = (int8_t*)(ser + 4);
15065 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
15066 *ret_conv = Shutdown_read(ser_ref);
15067 return (long)ret_conv;
15070 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
15071 LDKUpdateFailHTLC obj_conv;
15072 obj_conv.inner = (void*)(obj & (~1));
15073 obj_conv.is_owned = false;
15074 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
15075 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15076 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15077 CVec_u8Z_free(ret_var);
15081 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
15082 LDKu8slice ser_ref;
15083 ser_ref.datalen = *((uint32_t*)ser);
15084 ser_ref.data = (int8_t*)(ser + 4);
15085 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
15086 *ret_conv = UpdateFailHTLC_read(ser_ref);
15087 return (long)ret_conv;
15090 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
15091 LDKUpdateFailMalformedHTLC obj_conv;
15092 obj_conv.inner = (void*)(obj & (~1));
15093 obj_conv.is_owned = false;
15094 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
15095 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15096 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15097 CVec_u8Z_free(ret_var);
15101 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
15102 LDKu8slice ser_ref;
15103 ser_ref.datalen = *((uint32_t*)ser);
15104 ser_ref.data = (int8_t*)(ser + 4);
15105 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
15106 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
15107 return (long)ret_conv;
15110 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
15111 LDKUpdateFee obj_conv;
15112 obj_conv.inner = (void*)(obj & (~1));
15113 obj_conv.is_owned = false;
15114 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
15115 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15116 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15117 CVec_u8Z_free(ret_var);
15121 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
15122 LDKu8slice ser_ref;
15123 ser_ref.datalen = *((uint32_t*)ser);
15124 ser_ref.data = (int8_t*)(ser + 4);
15125 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
15126 *ret_conv = UpdateFee_read(ser_ref);
15127 return (long)ret_conv;
15130 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
15131 LDKUpdateFulfillHTLC obj_conv;
15132 obj_conv.inner = (void*)(obj & (~1));
15133 obj_conv.is_owned = false;
15134 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
15135 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15136 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15137 CVec_u8Z_free(ret_var);
15141 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
15142 LDKu8slice ser_ref;
15143 ser_ref.datalen = *((uint32_t*)ser);
15144 ser_ref.data = (int8_t*)(ser + 4);
15145 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
15146 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
15147 return (long)ret_conv;
15150 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
15151 LDKUpdateAddHTLC obj_conv;
15152 obj_conv.inner = (void*)(obj & (~1));
15153 obj_conv.is_owned = false;
15154 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
15155 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15156 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15157 CVec_u8Z_free(ret_var);
15161 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
15162 LDKu8slice ser_ref;
15163 ser_ref.datalen = *((uint32_t*)ser);
15164 ser_ref.data = (int8_t*)(ser + 4);
15165 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
15166 *ret_conv = UpdateAddHTLC_read(ser_ref);
15167 return (long)ret_conv;
15170 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
15172 obj_conv.inner = (void*)(obj & (~1));
15173 obj_conv.is_owned = false;
15174 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
15175 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15176 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15177 CVec_u8Z_free(ret_var);
15181 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
15182 LDKu8slice ser_ref;
15183 ser_ref.datalen = *((uint32_t*)ser);
15184 ser_ref.data = (int8_t*)(ser + 4);
15185 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
15186 *ret_conv = Ping_read(ser_ref);
15187 return (long)ret_conv;
15190 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
15192 obj_conv.inner = (void*)(obj & (~1));
15193 obj_conv.is_owned = false;
15194 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
15195 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15196 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15197 CVec_u8Z_free(ret_var);
15201 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
15202 LDKu8slice ser_ref;
15203 ser_ref.datalen = *((uint32_t*)ser);
15204 ser_ref.data = (int8_t*)(ser + 4);
15205 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
15206 *ret_conv = Pong_read(ser_ref);
15207 return (long)ret_conv;
15210 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
15211 LDKUnsignedChannelAnnouncement obj_conv;
15212 obj_conv.inner = (void*)(obj & (~1));
15213 obj_conv.is_owned = false;
15214 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
15215 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15216 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15217 CVec_u8Z_free(ret_var);
15221 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
15222 LDKu8slice ser_ref;
15223 ser_ref.datalen = *((uint32_t*)ser);
15224 ser_ref.data = (int8_t*)(ser + 4);
15225 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
15226 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
15227 return (long)ret_conv;
15230 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
15231 LDKChannelAnnouncement obj_conv;
15232 obj_conv.inner = (void*)(obj & (~1));
15233 obj_conv.is_owned = false;
15234 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
15235 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15236 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15237 CVec_u8Z_free(ret_var);
15241 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
15242 LDKu8slice ser_ref;
15243 ser_ref.datalen = *((uint32_t*)ser);
15244 ser_ref.data = (int8_t*)(ser + 4);
15245 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
15246 *ret_conv = ChannelAnnouncement_read(ser_ref);
15247 return (long)ret_conv;
15250 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
15251 LDKUnsignedChannelUpdate obj_conv;
15252 obj_conv.inner = (void*)(obj & (~1));
15253 obj_conv.is_owned = false;
15254 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
15255 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15256 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15257 CVec_u8Z_free(ret_var);
15261 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
15262 LDKu8slice ser_ref;
15263 ser_ref.datalen = *((uint32_t*)ser);
15264 ser_ref.data = (int8_t*)(ser + 4);
15265 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
15266 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
15267 return (long)ret_conv;
15270 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
15271 LDKChannelUpdate obj_conv;
15272 obj_conv.inner = (void*)(obj & (~1));
15273 obj_conv.is_owned = false;
15274 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
15275 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15276 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15277 CVec_u8Z_free(ret_var);
15281 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
15282 LDKu8slice ser_ref;
15283 ser_ref.datalen = *((uint32_t*)ser);
15284 ser_ref.data = (int8_t*)(ser + 4);
15285 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
15286 *ret_conv = ChannelUpdate_read(ser_ref);
15287 return (long)ret_conv;
15290 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
15291 LDKErrorMessage obj_conv;
15292 obj_conv.inner = (void*)(obj & (~1));
15293 obj_conv.is_owned = false;
15294 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
15295 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15296 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15297 CVec_u8Z_free(ret_var);
15301 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
15302 LDKu8slice ser_ref;
15303 ser_ref.datalen = *((uint32_t*)ser);
15304 ser_ref.data = (int8_t*)(ser + 4);
15305 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15306 *ret_conv = ErrorMessage_read(ser_ref);
15307 return (long)ret_conv;
15310 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
15311 LDKUnsignedNodeAnnouncement obj_conv;
15312 obj_conv.inner = (void*)(obj & (~1));
15313 obj_conv.is_owned = false;
15314 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
15315 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15316 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15317 CVec_u8Z_free(ret_var);
15321 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
15322 LDKu8slice ser_ref;
15323 ser_ref.datalen = *((uint32_t*)ser);
15324 ser_ref.data = (int8_t*)(ser + 4);
15325 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15326 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
15327 return (long)ret_conv;
15330 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
15331 LDKNodeAnnouncement obj_conv;
15332 obj_conv.inner = (void*)(obj & (~1));
15333 obj_conv.is_owned = false;
15334 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
15335 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15336 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15337 CVec_u8Z_free(ret_var);
15341 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
15342 LDKu8slice ser_ref;
15343 ser_ref.datalen = *((uint32_t*)ser);
15344 ser_ref.data = (int8_t*)(ser + 4);
15345 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
15346 *ret_conv = NodeAnnouncement_read(ser_ref);
15347 return (long)ret_conv;
15350 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
15351 LDKu8slice ser_ref;
15352 ser_ref.datalen = *((uint32_t*)ser);
15353 ser_ref.data = (int8_t*)(ser + 4);
15354 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
15355 *ret_conv = QueryShortChannelIds_read(ser_ref);
15356 return (long)ret_conv;
15359 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
15360 LDKQueryShortChannelIds obj_conv;
15361 obj_conv.inner = (void*)(obj & (~1));
15362 obj_conv.is_owned = false;
15363 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
15364 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15365 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15366 CVec_u8Z_free(ret_var);
15370 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
15371 LDKu8slice ser_ref;
15372 ser_ref.datalen = *((uint32_t*)ser);
15373 ser_ref.data = (int8_t*)(ser + 4);
15374 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
15375 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
15376 return (long)ret_conv;
15379 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
15380 LDKReplyShortChannelIdsEnd obj_conv;
15381 obj_conv.inner = (void*)(obj & (~1));
15382 obj_conv.is_owned = false;
15383 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
15384 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15385 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15386 CVec_u8Z_free(ret_var);
15390 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
15391 LDKu8slice ser_ref;
15392 ser_ref.datalen = *((uint32_t*)ser);
15393 ser_ref.data = (int8_t*)(ser + 4);
15394 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
15395 *ret_conv = QueryChannelRange_read(ser_ref);
15396 return (long)ret_conv;
15399 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
15400 LDKQueryChannelRange obj_conv;
15401 obj_conv.inner = (void*)(obj & (~1));
15402 obj_conv.is_owned = false;
15403 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
15404 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15405 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15406 CVec_u8Z_free(ret_var);
15410 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
15411 LDKu8slice ser_ref;
15412 ser_ref.datalen = *((uint32_t*)ser);
15413 ser_ref.data = (int8_t*)(ser + 4);
15414 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
15415 *ret_conv = ReplyChannelRange_read(ser_ref);
15416 return (long)ret_conv;
15419 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
15420 LDKReplyChannelRange obj_conv;
15421 obj_conv.inner = (void*)(obj & (~1));
15422 obj_conv.is_owned = false;
15423 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
15424 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15425 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15426 CVec_u8Z_free(ret_var);
15430 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
15431 LDKu8slice ser_ref;
15432 ser_ref.datalen = *((uint32_t*)ser);
15433 ser_ref.data = (int8_t*)(ser + 4);
15434 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
15435 *ret_conv = GossipTimestampFilter_read(ser_ref);
15436 return (long)ret_conv;
15439 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
15440 LDKGossipTimestampFilter obj_conv;
15441 obj_conv.inner = (void*)(obj & (~1));
15442 obj_conv.is_owned = false;
15443 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
15444 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15445 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15446 CVec_u8Z_free(ret_var);
15450 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_ptr) {
15451 LDKMessageHandler this_ptr_conv;
15452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15453 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15454 MessageHandler_free(this_ptr_conv);
15457 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
15458 LDKMessageHandler this_ptr_conv;
15459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15460 this_ptr_conv.is_owned = false;
15461 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
15465 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
15466 LDKMessageHandler this_ptr_conv;
15467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15468 this_ptr_conv.is_owned = false;
15469 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
15470 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
15473 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
15474 LDKMessageHandler this_ptr_conv;
15475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15476 this_ptr_conv.is_owned = false;
15477 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
15481 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
15482 LDKMessageHandler this_ptr_conv;
15483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15484 this_ptr_conv.is_owned = false;
15485 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
15486 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
15489 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
15490 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
15491 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
15492 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
15493 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15494 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15495 long ret_ref = (long)ret_var.inner;
15496 if (ret_var.is_owned) {
15502 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
15503 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig;
15504 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
15505 *ret = SocketDescriptor_clone(orig_conv);
15509 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
15510 if ((this_ptr & 1) != 0) return;
15511 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
15512 FREE((void*)this_ptr);
15513 SocketDescriptor_free(this_ptr_conv);
15516 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_ptr) {
15517 LDKPeerHandleError this_ptr_conv;
15518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15519 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15520 PeerHandleError_free(this_ptr_conv);
15523 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
15524 LDKPeerHandleError this_ptr_conv;
15525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15526 this_ptr_conv.is_owned = false;
15527 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
15531 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
15532 LDKPeerHandleError this_ptr_conv;
15533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15534 this_ptr_conv.is_owned = false;
15535 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
15538 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
15539 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
15540 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15541 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15542 long ret_ref = (long)ret_var.inner;
15543 if (ret_var.is_owned) {
15549 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
15550 LDKPeerHandleError orig_conv;
15551 orig_conv.inner = (void*)(orig & (~1));
15552 orig_conv.is_owned = false;
15553 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
15554 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15555 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15556 long ret_ref = (long)ret_var.inner;
15557 if (ret_var.is_owned) {
15563 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_ptr) {
15564 LDKPeerManager this_ptr_conv;
15565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15566 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15567 PeerManager_free(this_ptr_conv);
15570 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new(uint32_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, uint32_t logger) {
15571 LDKMessageHandler message_handler_conv;
15572 message_handler_conv.inner = (void*)(message_handler & (~1));
15573 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
15574 // Warning: we need a move here but no clone is available for LDKMessageHandler
15575 LDKSecretKey our_node_secret_ref;
15576 CHECK(*((uint32_t*)our_node_secret) == 32);
15577 memcpy(our_node_secret_ref.bytes, (uint8_t*)(our_node_secret + 4), 32);
15578 unsigned char ephemeral_random_data_arr[32];
15579 CHECK(*((uint32_t*)ephemeral_random_data) == 32);
15580 memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
15581 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
15582 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15583 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
15584 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15585 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15586 long ret_ref = (long)ret_var.inner;
15587 if (ret_var.is_owned) {
15593 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
15594 LDKPeerManager this_arg_conv;
15595 this_arg_conv.inner = (void*)(this_arg & (~1));
15596 this_arg_conv.is_owned = false;
15597 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
15598 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
15599 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
15600 for (size_t m = 0; m < ret_var.datalen; m++) {
15601 int8_tArray ret_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15602 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compressed_form, 33);
15603 ret_arr_ptr[m] = ret_conv_12_arr;
15605 FREE(ret_var.data);
15609 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
15610 LDKPeerManager this_arg_conv;
15611 this_arg_conv.inner = (void*)(this_arg & (~1));
15612 this_arg_conv.is_owned = false;
15613 LDKPublicKey their_node_id_ref;
15614 CHECK(*((uint32_t*)their_node_id) == 33);
15615 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
15616 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
15617 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
15618 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
15619 return (long)ret_conv;
15622 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
15623 LDKPeerManager this_arg_conv;
15624 this_arg_conv.inner = (void*)(this_arg & (~1));
15625 this_arg_conv.is_owned = false;
15626 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
15627 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
15628 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
15629 return (long)ret_conv;
15632 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
15633 LDKPeerManager this_arg_conv;
15634 this_arg_conv.inner = (void*)(this_arg & (~1));
15635 this_arg_conv.is_owned = false;
15636 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
15637 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
15638 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
15639 return (long)ret_conv;
15642 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
15643 LDKPeerManager this_arg_conv;
15644 this_arg_conv.inner = (void*)(this_arg & (~1));
15645 this_arg_conv.is_owned = false;
15646 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
15647 LDKu8slice data_ref;
15648 data_ref.datalen = *((uint32_t*)data);
15649 data_ref.data = (int8_t*)(data + 4);
15650 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
15651 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
15652 return (long)ret_conv;
15655 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
15656 LDKPeerManager this_arg_conv;
15657 this_arg_conv.inner = (void*)(this_arg & (~1));
15658 this_arg_conv.is_owned = false;
15659 PeerManager_process_events(&this_arg_conv);
15662 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
15663 LDKPeerManager this_arg_conv;
15664 this_arg_conv.inner = (void*)(this_arg & (~1));
15665 this_arg_conv.is_owned = false;
15666 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
15667 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
15670 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
15671 LDKPeerManager this_arg_conv;
15672 this_arg_conv.inner = (void*)(this_arg & (~1));
15673 this_arg_conv.is_owned = false;
15674 LDKPublicKey node_id_ref;
15675 CHECK(*((uint32_t*)node_id) == 33);
15676 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
15677 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
15680 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occured(uint32_t this_arg) {
15681 LDKPeerManager this_arg_conv;
15682 this_arg_conv.inner = (void*)(this_arg & (~1));
15683 this_arg_conv.is_owned = false;
15684 PeerManager_timer_tick_occured(&this_arg_conv);
15687 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
15688 unsigned char commitment_seed_arr[32];
15689 CHECK(*((uint32_t*)commitment_seed) == 32);
15690 memcpy(commitment_seed_arr, (uint8_t*)(commitment_seed + 4), 32);
15691 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
15692 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
15693 memcpy((uint8_t*)(ret_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32);
15697 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
15698 LDKPublicKey per_commitment_point_ref;
15699 CHECK(*((uint32_t*)per_commitment_point) == 33);
15700 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
15701 unsigned char base_secret_arr[32];
15702 CHECK(*((uint32_t*)base_secret) == 32);
15703 memcpy(base_secret_arr, (uint8_t*)(base_secret + 4), 32);
15704 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
15705 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
15706 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
15707 return (long)ret_conv;
15710 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
15711 LDKPublicKey per_commitment_point_ref;
15712 CHECK(*((uint32_t*)per_commitment_point) == 33);
15713 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
15714 LDKPublicKey base_point_ref;
15715 CHECK(*((uint32_t*)base_point) == 33);
15716 memcpy(base_point_ref.compressed_form, (uint8_t*)(base_point + 4), 33);
15717 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15718 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
15719 return (long)ret_conv;
15722 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
15723 unsigned char per_commitment_secret_arr[32];
15724 CHECK(*((uint32_t*)per_commitment_secret) == 32);
15725 memcpy(per_commitment_secret_arr, (uint8_t*)(per_commitment_secret + 4), 32);
15726 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
15727 unsigned char countersignatory_revocation_base_secret_arr[32];
15728 CHECK(*((uint32_t*)countersignatory_revocation_base_secret) == 32);
15729 memcpy(countersignatory_revocation_base_secret_arr, (uint8_t*)(countersignatory_revocation_base_secret + 4), 32);
15730 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
15731 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
15732 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
15733 return (long)ret_conv;
15736 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
15737 LDKPublicKey per_commitment_point_ref;
15738 CHECK(*((uint32_t*)per_commitment_point) == 33);
15739 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
15740 LDKPublicKey countersignatory_revocation_base_point_ref;
15741 CHECK(*((uint32_t*)countersignatory_revocation_base_point) == 33);
15742 memcpy(countersignatory_revocation_base_point_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base_point + 4), 33);
15743 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15744 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
15745 return (long)ret_conv;
15748 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_ptr) {
15749 LDKTxCreationKeys this_ptr_conv;
15750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15751 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15752 TxCreationKeys_free(this_ptr_conv);
15755 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
15756 LDKTxCreationKeys this_ptr_conv;
15757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15758 this_ptr_conv.is_owned = false;
15759 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15760 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
15764 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
15765 LDKTxCreationKeys this_ptr_conv;
15766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15767 this_ptr_conv.is_owned = false;
15768 LDKPublicKey val_ref;
15769 CHECK(*((uint32_t*)val) == 33);
15770 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15771 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
15774 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
15775 LDKTxCreationKeys this_ptr_conv;
15776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15777 this_ptr_conv.is_owned = false;
15778 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15779 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
15783 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
15784 LDKTxCreationKeys this_ptr_conv;
15785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15786 this_ptr_conv.is_owned = false;
15787 LDKPublicKey val_ref;
15788 CHECK(*((uint32_t*)val) == 33);
15789 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15790 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
15793 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
15794 LDKTxCreationKeys this_ptr_conv;
15795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15796 this_ptr_conv.is_owned = false;
15797 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15798 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
15802 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
15803 LDKTxCreationKeys this_ptr_conv;
15804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15805 this_ptr_conv.is_owned = false;
15806 LDKPublicKey val_ref;
15807 CHECK(*((uint32_t*)val) == 33);
15808 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15809 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
15812 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
15813 LDKTxCreationKeys this_ptr_conv;
15814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15815 this_ptr_conv.is_owned = false;
15816 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15817 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
15821 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
15822 LDKTxCreationKeys this_ptr_conv;
15823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15824 this_ptr_conv.is_owned = false;
15825 LDKPublicKey val_ref;
15826 CHECK(*((uint32_t*)val) == 33);
15827 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15828 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
15831 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
15832 LDKTxCreationKeys this_ptr_conv;
15833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15834 this_ptr_conv.is_owned = false;
15835 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15836 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
15840 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
15841 LDKTxCreationKeys this_ptr_conv;
15842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15843 this_ptr_conv.is_owned = false;
15844 LDKPublicKey val_ref;
15845 CHECK(*((uint32_t*)val) == 33);
15846 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15847 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
15850 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_new(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) {
15851 LDKPublicKey per_commitment_point_arg_ref;
15852 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
15853 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
15854 LDKPublicKey revocation_key_arg_ref;
15855 CHECK(*((uint32_t*)revocation_key_arg) == 33);
15856 memcpy(revocation_key_arg_ref.compressed_form, (uint8_t*)(revocation_key_arg + 4), 33);
15857 LDKPublicKey broadcaster_htlc_key_arg_ref;
15858 CHECK(*((uint32_t*)broadcaster_htlc_key_arg) == 33);
15859 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_htlc_key_arg + 4), 33);
15860 LDKPublicKey countersignatory_htlc_key_arg_ref;
15861 CHECK(*((uint32_t*)countersignatory_htlc_key_arg) == 33);
15862 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, (uint8_t*)(countersignatory_htlc_key_arg + 4), 33);
15863 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
15864 CHECK(*((uint32_t*)broadcaster_delayed_payment_key_arg) == 33);
15865 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key_arg + 4), 33);
15866 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);
15867 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15868 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15869 long ret_ref = (long)ret_var.inner;
15870 if (ret_var.is_owned) {
15876 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
15877 LDKTxCreationKeys orig_conv;
15878 orig_conv.inner = (void*)(orig & (~1));
15879 orig_conv.is_owned = false;
15880 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
15881 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15882 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15883 long ret_ref = (long)ret_var.inner;
15884 if (ret_var.is_owned) {
15890 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
15891 LDKTxCreationKeys obj_conv;
15892 obj_conv.inner = (void*)(obj & (~1));
15893 obj_conv.is_owned = false;
15894 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
15895 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15896 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15897 CVec_u8Z_free(ret_var);
15901 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
15902 LDKu8slice ser_ref;
15903 ser_ref.datalen = *((uint32_t*)ser);
15904 ser_ref.data = (int8_t*)(ser + 4);
15905 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
15906 *ret_conv = TxCreationKeys_read(ser_ref);
15907 return (long)ret_conv;
15910 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_ptr) {
15911 LDKChannelPublicKeys this_ptr_conv;
15912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15913 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15914 ChannelPublicKeys_free(this_ptr_conv);
15917 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
15918 LDKChannelPublicKeys this_ptr_conv;
15919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15920 this_ptr_conv.is_owned = false;
15921 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15922 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
15926 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
15927 LDKChannelPublicKeys this_ptr_conv;
15928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15929 this_ptr_conv.is_owned = false;
15930 LDKPublicKey val_ref;
15931 CHECK(*((uint32_t*)val) == 33);
15932 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15933 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
15936 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
15937 LDKChannelPublicKeys this_ptr_conv;
15938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15939 this_ptr_conv.is_owned = false;
15940 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15941 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
15945 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
15946 LDKChannelPublicKeys this_ptr_conv;
15947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15948 this_ptr_conv.is_owned = false;
15949 LDKPublicKey val_ref;
15950 CHECK(*((uint32_t*)val) == 33);
15951 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15952 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
15955 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
15956 LDKChannelPublicKeys this_ptr_conv;
15957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15958 this_ptr_conv.is_owned = false;
15959 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15960 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
15964 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
15965 LDKChannelPublicKeys this_ptr_conv;
15966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15967 this_ptr_conv.is_owned = false;
15968 LDKPublicKey val_ref;
15969 CHECK(*((uint32_t*)val) == 33);
15970 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15971 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
15974 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
15975 LDKChannelPublicKeys this_ptr_conv;
15976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15977 this_ptr_conv.is_owned = false;
15978 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15979 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
15983 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
15984 LDKChannelPublicKeys this_ptr_conv;
15985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15986 this_ptr_conv.is_owned = false;
15987 LDKPublicKey val_ref;
15988 CHECK(*((uint32_t*)val) == 33);
15989 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
15990 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
15993 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
15994 LDKChannelPublicKeys this_ptr_conv;
15995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15996 this_ptr_conv.is_owned = false;
15997 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
15998 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
16002 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
16003 LDKChannelPublicKeys this_ptr_conv;
16004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16005 this_ptr_conv.is_owned = false;
16006 LDKPublicKey val_ref;
16007 CHECK(*((uint32_t*)val) == 33);
16008 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16009 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
16012 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_new(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) {
16013 LDKPublicKey funding_pubkey_arg_ref;
16014 CHECK(*((uint32_t*)funding_pubkey_arg) == 33);
16015 memcpy(funding_pubkey_arg_ref.compressed_form, (uint8_t*)(funding_pubkey_arg + 4), 33);
16016 LDKPublicKey revocation_basepoint_arg_ref;
16017 CHECK(*((uint32_t*)revocation_basepoint_arg) == 33);
16018 memcpy(revocation_basepoint_arg_ref.compressed_form, (uint8_t*)(revocation_basepoint_arg + 4), 33);
16019 LDKPublicKey payment_point_arg_ref;
16020 CHECK(*((uint32_t*)payment_point_arg) == 33);
16021 memcpy(payment_point_arg_ref.compressed_form, (uint8_t*)(payment_point_arg + 4), 33);
16022 LDKPublicKey delayed_payment_basepoint_arg_ref;
16023 CHECK(*((uint32_t*)delayed_payment_basepoint_arg) == 33);
16024 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, (uint8_t*)(delayed_payment_basepoint_arg + 4), 33);
16025 LDKPublicKey htlc_basepoint_arg_ref;
16026 CHECK(*((uint32_t*)htlc_basepoint_arg) == 33);
16027 memcpy(htlc_basepoint_arg_ref.compressed_form, (uint8_t*)(htlc_basepoint_arg + 4), 33);
16028 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);
16029 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16030 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16031 long ret_ref = (long)ret_var.inner;
16032 if (ret_var.is_owned) {
16038 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
16039 LDKChannelPublicKeys orig_conv;
16040 orig_conv.inner = (void*)(orig & (~1));
16041 orig_conv.is_owned = false;
16042 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
16043 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16044 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16045 long ret_ref = (long)ret_var.inner;
16046 if (ret_var.is_owned) {
16052 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
16053 LDKChannelPublicKeys obj_conv;
16054 obj_conv.inner = (void*)(obj & (~1));
16055 obj_conv.is_owned = false;
16056 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
16057 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16058 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16059 CVec_u8Z_free(ret_var);
16063 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
16064 LDKu8slice ser_ref;
16065 ser_ref.datalen = *((uint32_t*)ser);
16066 ser_ref.data = (int8_t*)(ser + 4);
16067 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
16068 *ret_conv = ChannelPublicKeys_read(ser_ref);
16069 return (long)ret_conv;
16072 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_derive_new(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) {
16073 LDKPublicKey per_commitment_point_ref;
16074 CHECK(*((uint32_t*)per_commitment_point) == 33);
16075 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
16076 LDKPublicKey broadcaster_delayed_payment_base_ref;
16077 CHECK(*((uint32_t*)broadcaster_delayed_payment_base) == 33);
16078 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_base + 4), 33);
16079 LDKPublicKey broadcaster_htlc_base_ref;
16080 CHECK(*((uint32_t*)broadcaster_htlc_base) == 33);
16081 memcpy(broadcaster_htlc_base_ref.compressed_form, (uint8_t*)(broadcaster_htlc_base + 4), 33);
16082 LDKPublicKey countersignatory_revocation_base_ref;
16083 CHECK(*((uint32_t*)countersignatory_revocation_base) == 33);
16084 memcpy(countersignatory_revocation_base_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base + 4), 33);
16085 LDKPublicKey countersignatory_htlc_base_ref;
16086 CHECK(*((uint32_t*)countersignatory_htlc_base) == 33);
16087 memcpy(countersignatory_htlc_base_ref.compressed_form, (uint8_t*)(countersignatory_htlc_base + 4), 33);
16088 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
16089 *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);
16090 return (long)ret_conv;
16093 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
16094 LDKPublicKey per_commitment_point_ref;
16095 CHECK(*((uint32_t*)per_commitment_point) == 33);
16096 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
16097 LDKChannelPublicKeys broadcaster_keys_conv;
16098 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
16099 broadcaster_keys_conv.is_owned = false;
16100 LDKChannelPublicKeys countersignatory_keys_conv;
16101 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
16102 countersignatory_keys_conv.is_owned = false;
16103 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
16104 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
16105 return (long)ret_conv;
16108 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
16109 LDKPublicKey revocation_key_ref;
16110 CHECK(*((uint32_t*)revocation_key) == 33);
16111 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
16112 LDKPublicKey broadcaster_delayed_payment_key_ref;
16113 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
16114 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
16115 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
16116 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16117 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16118 CVec_u8Z_free(ret_var);
16122 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_ptr) {
16123 LDKHTLCOutputInCommitment this_ptr_conv;
16124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16125 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16126 HTLCOutputInCommitment_free(this_ptr_conv);
16129 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
16130 LDKHTLCOutputInCommitment this_ptr_conv;
16131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16132 this_ptr_conv.is_owned = false;
16133 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
16137 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
16138 LDKHTLCOutputInCommitment this_ptr_conv;
16139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16140 this_ptr_conv.is_owned = false;
16141 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
16144 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
16145 LDKHTLCOutputInCommitment this_ptr_conv;
16146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16147 this_ptr_conv.is_owned = false;
16148 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
16152 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
16153 LDKHTLCOutputInCommitment this_ptr_conv;
16154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16155 this_ptr_conv.is_owned = false;
16156 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
16159 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
16160 LDKHTLCOutputInCommitment this_ptr_conv;
16161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16162 this_ptr_conv.is_owned = false;
16163 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
16167 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
16168 LDKHTLCOutputInCommitment this_ptr_conv;
16169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16170 this_ptr_conv.is_owned = false;
16171 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
16174 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
16175 LDKHTLCOutputInCommitment this_ptr_conv;
16176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16177 this_ptr_conv.is_owned = false;
16178 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16179 memcpy((uint8_t*)(ret_arr + 4), *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
16183 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
16184 LDKHTLCOutputInCommitment this_ptr_conv;
16185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16186 this_ptr_conv.is_owned = false;
16187 LDKThirtyTwoBytes val_ref;
16188 CHECK(*((uint32_t*)val) == 32);
16189 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16190 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
16193 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
16194 LDKHTLCOutputInCommitment orig_conv;
16195 orig_conv.inner = (void*)(orig & (~1));
16196 orig_conv.is_owned = false;
16197 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
16198 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16199 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16200 long ret_ref = (long)ret_var.inner;
16201 if (ret_var.is_owned) {
16207 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
16208 LDKHTLCOutputInCommitment obj_conv;
16209 obj_conv.inner = (void*)(obj & (~1));
16210 obj_conv.is_owned = false;
16211 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
16212 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16213 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16214 CVec_u8Z_free(ret_var);
16218 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
16219 LDKu8slice ser_ref;
16220 ser_ref.datalen = *((uint32_t*)ser);
16221 ser_ref.data = (int8_t*)(ser + 4);
16222 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
16223 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
16224 return (long)ret_conv;
16227 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, uint32_t keys) {
16228 LDKHTLCOutputInCommitment htlc_conv;
16229 htlc_conv.inner = (void*)(htlc & (~1));
16230 htlc_conv.is_owned = false;
16231 LDKTxCreationKeys keys_conv;
16232 keys_conv.inner = (void*)(keys & (~1));
16233 keys_conv.is_owned = false;
16234 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
16235 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16236 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16237 CVec_u8Z_free(ret_var);
16241 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
16242 LDKPublicKey broadcaster_ref;
16243 CHECK(*((uint32_t*)broadcaster) == 33);
16244 memcpy(broadcaster_ref.compressed_form, (uint8_t*)(broadcaster + 4), 33);
16245 LDKPublicKey countersignatory_ref;
16246 CHECK(*((uint32_t*)countersignatory) == 33);
16247 memcpy(countersignatory_ref.compressed_form, (uint8_t*)(countersignatory + 4), 33);
16248 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
16249 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16250 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16251 CVec_u8Z_free(ret_var);
16255 int8_tArray __attribute__((visibility("default"))) TS_build_htlc_transaction(int8_tArray prev_hash, int32_t feerate_per_kw, int16_t contest_delay, uint32_t htlc, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
16256 unsigned char prev_hash_arr[32];
16257 CHECK(*((uint32_t*)prev_hash) == 32);
16258 memcpy(prev_hash_arr, (uint8_t*)(prev_hash + 4), 32);
16259 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
16260 LDKHTLCOutputInCommitment htlc_conv;
16261 htlc_conv.inner = (void*)(htlc & (~1));
16262 htlc_conv.is_owned = false;
16263 LDKPublicKey broadcaster_delayed_payment_key_ref;
16264 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
16265 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
16266 LDKPublicKey revocation_key_ref;
16267 CHECK(*((uint32_t*)revocation_key) == 33);
16268 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
16269 LDKTransaction ret_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
16270 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16271 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16272 Transaction_free(ret_var);
16276 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_ptr) {
16277 LDKChannelTransactionParameters this_ptr_conv;
16278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16279 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16280 ChannelTransactionParameters_free(this_ptr_conv);
16283 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
16284 LDKChannelTransactionParameters this_ptr_conv;
16285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16286 this_ptr_conv.is_owned = false;
16287 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
16288 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16289 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16290 long ret_ref = (long)ret_var.inner;
16291 if (ret_var.is_owned) {
16297 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
16298 LDKChannelTransactionParameters this_ptr_conv;
16299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16300 this_ptr_conv.is_owned = false;
16301 LDKChannelPublicKeys val_conv;
16302 val_conv.inner = (void*)(val & (~1));
16303 val_conv.is_owned = (val & 1) || (val == 0);
16304 val_conv = ChannelPublicKeys_clone(&val_conv);
16305 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
16308 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
16309 LDKChannelTransactionParameters this_ptr_conv;
16310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16311 this_ptr_conv.is_owned = false;
16312 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
16316 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
16317 LDKChannelTransactionParameters this_ptr_conv;
16318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16319 this_ptr_conv.is_owned = false;
16320 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
16323 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
16324 LDKChannelTransactionParameters this_ptr_conv;
16325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16326 this_ptr_conv.is_owned = false;
16327 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
16331 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
16332 LDKChannelTransactionParameters this_ptr_conv;
16333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16334 this_ptr_conv.is_owned = false;
16335 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
16338 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
16339 LDKChannelTransactionParameters this_ptr_conv;
16340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16341 this_ptr_conv.is_owned = false;
16342 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
16343 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16344 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16345 long ret_ref = (long)ret_var.inner;
16346 if (ret_var.is_owned) {
16352 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
16353 LDKChannelTransactionParameters this_ptr_conv;
16354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16355 this_ptr_conv.is_owned = false;
16356 LDKCounterpartyChannelTransactionParameters val_conv;
16357 val_conv.inner = (void*)(val & (~1));
16358 val_conv.is_owned = (val & 1) || (val == 0);
16359 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
16360 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
16363 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
16364 LDKChannelTransactionParameters this_ptr_conv;
16365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16366 this_ptr_conv.is_owned = false;
16367 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
16368 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16369 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16370 long ret_ref = (long)ret_var.inner;
16371 if (ret_var.is_owned) {
16377 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
16378 LDKChannelTransactionParameters this_ptr_conv;
16379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16380 this_ptr_conv.is_owned = false;
16381 LDKOutPoint val_conv;
16382 val_conv.inner = (void*)(val & (~1));
16383 val_conv.is_owned = (val & 1) || (val == 0);
16384 val_conv = OutPoint_clone(&val_conv);
16385 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
16388 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_new(uint32_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, uint32_t counterparty_parameters_arg, uint32_t funding_outpoint_arg) {
16389 LDKChannelPublicKeys holder_pubkeys_arg_conv;
16390 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
16391 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
16392 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
16393 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
16394 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
16395 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
16396 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
16397 LDKOutPoint funding_outpoint_arg_conv;
16398 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
16399 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
16400 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
16401 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);
16402 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16403 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16404 long ret_ref = (long)ret_var.inner;
16405 if (ret_var.is_owned) {
16411 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
16412 LDKChannelTransactionParameters orig_conv;
16413 orig_conv.inner = (void*)(orig & (~1));
16414 orig_conv.is_owned = false;
16415 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
16416 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16417 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16418 long ret_ref = (long)ret_var.inner;
16419 if (ret_var.is_owned) {
16425 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_ptr) {
16426 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
16427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16428 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16429 CounterpartyChannelTransactionParameters_free(this_ptr_conv);
16432 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
16433 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
16434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16435 this_ptr_conv.is_owned = false;
16436 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
16437 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16438 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16439 long ret_ref = (long)ret_var.inner;
16440 if (ret_var.is_owned) {
16446 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
16447 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
16448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16449 this_ptr_conv.is_owned = false;
16450 LDKChannelPublicKeys val_conv;
16451 val_conv.inner = (void*)(val & (~1));
16452 val_conv.is_owned = (val & 1) || (val == 0);
16453 val_conv = ChannelPublicKeys_clone(&val_conv);
16454 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
16457 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
16458 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
16459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16460 this_ptr_conv.is_owned = false;
16461 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
16465 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
16466 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
16467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16468 this_ptr_conv.is_owned = false;
16469 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
16472 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
16473 LDKChannelPublicKeys pubkeys_arg_conv;
16474 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
16475 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
16476 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
16477 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
16478 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16479 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16480 long ret_ref = (long)ret_var.inner;
16481 if (ret_var.is_owned) {
16487 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
16488 LDKCounterpartyChannelTransactionParameters orig_conv;
16489 orig_conv.inner = (void*)(orig & (~1));
16490 orig_conv.is_owned = false;
16491 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
16492 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16493 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16494 long ret_ref = (long)ret_var.inner;
16495 if (ret_var.is_owned) {
16501 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
16502 LDKChannelTransactionParameters this_arg_conv;
16503 this_arg_conv.inner = (void*)(this_arg & (~1));
16504 this_arg_conv.is_owned = false;
16505 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
16509 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
16510 LDKChannelTransactionParameters this_arg_conv;
16511 this_arg_conv.inner = (void*)(this_arg & (~1));
16512 this_arg_conv.is_owned = false;
16513 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
16514 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16515 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16516 long ret_ref = (long)ret_var.inner;
16517 if (ret_var.is_owned) {
16523 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
16524 LDKChannelTransactionParameters this_arg_conv;
16525 this_arg_conv.inner = (void*)(this_arg & (~1));
16526 this_arg_conv.is_owned = false;
16527 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
16528 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16529 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16530 long ret_ref = (long)ret_var.inner;
16531 if (ret_var.is_owned) {
16537 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
16538 LDKCounterpartyChannelTransactionParameters obj_conv;
16539 obj_conv.inner = (void*)(obj & (~1));
16540 obj_conv.is_owned = false;
16541 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
16542 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16543 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16544 CVec_u8Z_free(ret_var);
16548 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
16549 LDKu8slice ser_ref;
16550 ser_ref.datalen = *((uint32_t*)ser);
16551 ser_ref.data = (int8_t*)(ser + 4);
16552 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
16553 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
16554 return (long)ret_conv;
16557 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
16558 LDKChannelTransactionParameters obj_conv;
16559 obj_conv.inner = (void*)(obj & (~1));
16560 obj_conv.is_owned = false;
16561 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
16562 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16563 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16564 CVec_u8Z_free(ret_var);
16568 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
16569 LDKu8slice ser_ref;
16570 ser_ref.datalen = *((uint32_t*)ser);
16571 ser_ref.data = (int8_t*)(ser + 4);
16572 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
16573 *ret_conv = ChannelTransactionParameters_read(ser_ref);
16574 return (long)ret_conv;
16577 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_ptr) {
16578 LDKDirectedChannelTransactionParameters this_ptr_conv;
16579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16580 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16581 DirectedChannelTransactionParameters_free(this_ptr_conv);
16584 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
16585 LDKDirectedChannelTransactionParameters this_arg_conv;
16586 this_arg_conv.inner = (void*)(this_arg & (~1));
16587 this_arg_conv.is_owned = false;
16588 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
16589 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16590 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16591 long ret_ref = (long)ret_var.inner;
16592 if (ret_var.is_owned) {
16598 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
16599 LDKDirectedChannelTransactionParameters this_arg_conv;
16600 this_arg_conv.inner = (void*)(this_arg & (~1));
16601 this_arg_conv.is_owned = false;
16602 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
16603 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16604 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16605 long ret_ref = (long)ret_var.inner;
16606 if (ret_var.is_owned) {
16612 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
16613 LDKDirectedChannelTransactionParameters this_arg_conv;
16614 this_arg_conv.inner = (void*)(this_arg & (~1));
16615 this_arg_conv.is_owned = false;
16616 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
16620 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
16621 LDKDirectedChannelTransactionParameters this_arg_conv;
16622 this_arg_conv.inner = (void*)(this_arg & (~1));
16623 this_arg_conv.is_owned = false;
16624 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
16628 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
16629 LDKDirectedChannelTransactionParameters this_arg_conv;
16630 this_arg_conv.inner = (void*)(this_arg & (~1));
16631 this_arg_conv.is_owned = false;
16632 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
16633 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16634 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16635 long ret_ref = (long)ret_var.inner;
16636 if (ret_var.is_owned) {
16642 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_ptr) {
16643 LDKHolderCommitmentTransaction this_ptr_conv;
16644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16645 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16646 HolderCommitmentTransaction_free(this_ptr_conv);
16649 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
16650 LDKHolderCommitmentTransaction this_ptr_conv;
16651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16652 this_ptr_conv.is_owned = false;
16653 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
16654 memcpy((uint8_t*)(ret_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
16658 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
16659 LDKHolderCommitmentTransaction this_ptr_conv;
16660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16661 this_ptr_conv.is_owned = false;
16662 LDKSignature val_ref;
16663 CHECK(*((uint32_t*)val) == 64);
16664 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
16665 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
16668 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
16669 LDKHolderCommitmentTransaction this_ptr_conv;
16670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16671 this_ptr_conv.is_owned = false;
16672 LDKCVec_SignatureZ val_constr;
16673 val_constr.datalen = *((uint32_t*)val);
16674 if (val_constr.datalen > 0)
16675 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
16677 val_constr.data = NULL;
16678 int8_tArray* val_vals = (int8_tArray*)(val + 4);
16679 for (size_t m = 0; m < val_constr.datalen; m++) {
16680 int8_tArray val_conv_12 = val_vals[m];
16681 LDKSignature val_conv_12_ref;
16682 CHECK(*((uint32_t*)val_conv_12) == 64);
16683 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
16684 val_constr.data[m] = val_conv_12_ref;
16686 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
16689 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
16690 LDKHolderCommitmentTransaction orig_conv;
16691 orig_conv.inner = (void*)(orig & (~1));
16692 orig_conv.is_owned = false;
16693 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
16694 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16695 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16696 long ret_ref = (long)ret_var.inner;
16697 if (ret_var.is_owned) {
16703 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
16704 LDKHolderCommitmentTransaction obj_conv;
16705 obj_conv.inner = (void*)(obj & (~1));
16706 obj_conv.is_owned = false;
16707 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
16708 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16709 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16710 CVec_u8Z_free(ret_var);
16714 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
16715 LDKu8slice ser_ref;
16716 ser_ref.datalen = *((uint32_t*)ser);
16717 ser_ref.data = (int8_t*)(ser + 4);
16718 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
16719 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
16720 return (long)ret_conv;
16723 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_new(uint32_t commitment_tx, int8_tArray counterparty_sig, ptrArray counterparty_htlc_sigs, int8_tArray holder_funding_key, int8_tArray counterparty_funding_key) {
16724 LDKCommitmentTransaction commitment_tx_conv;
16725 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
16726 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
16727 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
16728 LDKSignature counterparty_sig_ref;
16729 CHECK(*((uint32_t*)counterparty_sig) == 64);
16730 memcpy(counterparty_sig_ref.compact_form, (uint8_t*)(counterparty_sig + 4), 64);
16731 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
16732 counterparty_htlc_sigs_constr.datalen = *((uint32_t*)counterparty_htlc_sigs);
16733 if (counterparty_htlc_sigs_constr.datalen > 0)
16734 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
16736 counterparty_htlc_sigs_constr.data = NULL;
16737 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs + 4);
16738 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
16739 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
16740 LDKSignature counterparty_htlc_sigs_conv_12_ref;
16741 CHECK(*((uint32_t*)counterparty_htlc_sigs_conv_12) == 64);
16742 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, (uint8_t*)(counterparty_htlc_sigs_conv_12 + 4), 64);
16743 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
16745 LDKPublicKey holder_funding_key_ref;
16746 CHECK(*((uint32_t*)holder_funding_key) == 33);
16747 memcpy(holder_funding_key_ref.compressed_form, (uint8_t*)(holder_funding_key + 4), 33);
16748 LDKPublicKey counterparty_funding_key_ref;
16749 CHECK(*((uint32_t*)counterparty_funding_key) == 33);
16750 memcpy(counterparty_funding_key_ref.compressed_form, (uint8_t*)(counterparty_funding_key + 4), 33);
16751 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
16752 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16753 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16754 long ret_ref = (long)ret_var.inner;
16755 if (ret_var.is_owned) {
16761 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_ptr) {
16762 LDKBuiltCommitmentTransaction this_ptr_conv;
16763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16764 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16765 BuiltCommitmentTransaction_free(this_ptr_conv);
16768 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
16769 LDKBuiltCommitmentTransaction this_ptr_conv;
16770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16771 this_ptr_conv.is_owned = false;
16772 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
16773 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16774 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16775 Transaction_free(ret_var);
16779 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
16780 LDKBuiltCommitmentTransaction this_ptr_conv;
16781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16782 this_ptr_conv.is_owned = false;
16783 LDKTransaction val_ref;
16784 val_ref.datalen = *((uint32_t*)val);
16785 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
16786 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
16787 val_ref.data_is_owned = true;
16788 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
16791 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
16792 LDKBuiltCommitmentTransaction this_ptr_conv;
16793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16794 this_ptr_conv.is_owned = false;
16795 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16796 memcpy((uint8_t*)(ret_arr + 4), *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
16800 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
16801 LDKBuiltCommitmentTransaction this_ptr_conv;
16802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16803 this_ptr_conv.is_owned = false;
16804 LDKThirtyTwoBytes val_ref;
16805 CHECK(*((uint32_t*)val) == 32);
16806 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16807 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
16810 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
16811 LDKTransaction transaction_arg_ref;
16812 transaction_arg_ref.datalen = *((uint32_t*)transaction_arg);
16813 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
16814 memcpy(transaction_arg_ref.data, (uint8_t*)(transaction_arg + 4), transaction_arg_ref.datalen);
16815 transaction_arg_ref.data_is_owned = true;
16816 LDKThirtyTwoBytes txid_arg_ref;
16817 CHECK(*((uint32_t*)txid_arg) == 32);
16818 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
16819 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
16820 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16821 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16822 long ret_ref = (long)ret_var.inner;
16823 if (ret_var.is_owned) {
16829 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
16830 LDKBuiltCommitmentTransaction orig_conv;
16831 orig_conv.inner = (void*)(orig & (~1));
16832 orig_conv.is_owned = false;
16833 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
16834 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16835 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16836 long ret_ref = (long)ret_var.inner;
16837 if (ret_var.is_owned) {
16843 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
16844 LDKBuiltCommitmentTransaction obj_conv;
16845 obj_conv.inner = (void*)(obj & (~1));
16846 obj_conv.is_owned = false;
16847 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
16848 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16849 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16850 CVec_u8Z_free(ret_var);
16854 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
16855 LDKu8slice ser_ref;
16856 ser_ref.datalen = *((uint32_t*)ser);
16857 ser_ref.data = (int8_t*)(ser + 4);
16858 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
16859 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
16860 return (long)ret_conv;
16863 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
16864 LDKBuiltCommitmentTransaction this_arg_conv;
16865 this_arg_conv.inner = (void*)(this_arg & (~1));
16866 this_arg_conv.is_owned = false;
16867 LDKu8slice funding_redeemscript_ref;
16868 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
16869 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
16870 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16871 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
16875 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_sign(uint32_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
16876 LDKBuiltCommitmentTransaction this_arg_conv;
16877 this_arg_conv.inner = (void*)(this_arg & (~1));
16878 this_arg_conv.is_owned = false;
16879 unsigned char funding_key_arr[32];
16880 CHECK(*((uint32_t*)funding_key) == 32);
16881 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
16882 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
16883 LDKu8slice funding_redeemscript_ref;
16884 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
16885 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
16886 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
16887 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
16891 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_ptr) {
16892 LDKCommitmentTransaction this_ptr_conv;
16893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16894 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16895 CommitmentTransaction_free(this_ptr_conv);
16898 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
16899 LDKCommitmentTransaction orig_conv;
16900 orig_conv.inner = (void*)(orig & (~1));
16901 orig_conv.is_owned = false;
16902 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
16903 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16904 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16905 long ret_ref = (long)ret_var.inner;
16906 if (ret_var.is_owned) {
16912 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
16913 LDKCommitmentTransaction obj_conv;
16914 obj_conv.inner = (void*)(obj & (~1));
16915 obj_conv.is_owned = false;
16916 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
16917 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16918 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16919 CVec_u8Z_free(ret_var);
16923 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
16924 LDKu8slice ser_ref;
16925 ser_ref.datalen = *((uint32_t*)ser);
16926 ser_ref.data = (int8_t*)(ser + 4);
16927 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
16928 *ret_conv = CommitmentTransaction_read(ser_ref);
16929 return (long)ret_conv;
16932 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
16933 LDKCommitmentTransaction this_arg_conv;
16934 this_arg_conv.inner = (void*)(this_arg & (~1));
16935 this_arg_conv.is_owned = false;
16936 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
16940 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
16941 LDKCommitmentTransaction this_arg_conv;
16942 this_arg_conv.inner = (void*)(this_arg & (~1));
16943 this_arg_conv.is_owned = false;
16944 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
16948 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
16949 LDKCommitmentTransaction this_arg_conv;
16950 this_arg_conv.inner = (void*)(this_arg & (~1));
16951 this_arg_conv.is_owned = false;
16952 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
16956 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
16957 LDKCommitmentTransaction this_arg_conv;
16958 this_arg_conv.inner = (void*)(this_arg & (~1));
16959 this_arg_conv.is_owned = false;
16960 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
16964 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
16965 LDKCommitmentTransaction this_arg_conv;
16966 this_arg_conv.inner = (void*)(this_arg & (~1));
16967 this_arg_conv.is_owned = false;
16968 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
16969 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16970 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16971 long ret_ref = (long)ret_var.inner;
16972 if (ret_var.is_owned) {
16978 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
16979 LDKCommitmentTransaction this_arg_conv;
16980 this_arg_conv.inner = (void*)(this_arg & (~1));
16981 this_arg_conv.is_owned = false;
16982 LDKDirectedChannelTransactionParameters channel_parameters_conv;
16983 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
16984 channel_parameters_conv.is_owned = false;
16985 LDKChannelPublicKeys broadcaster_keys_conv;
16986 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
16987 broadcaster_keys_conv.is_owned = false;
16988 LDKChannelPublicKeys countersignatory_keys_conv;
16989 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
16990 countersignatory_keys_conv.is_owned = false;
16991 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
16992 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
16993 return (long)ret_conv;
16996 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_ptr) {
16997 LDKTrustedCommitmentTransaction this_ptr_conv;
16998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16999 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17000 TrustedCommitmentTransaction_free(this_ptr_conv);
17003 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
17004 LDKTrustedCommitmentTransaction this_arg_conv;
17005 this_arg_conv.inner = (void*)(this_arg & (~1));
17006 this_arg_conv.is_owned = false;
17007 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17008 memcpy((uint8_t*)(ret_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
17012 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
17013 LDKTrustedCommitmentTransaction this_arg_conv;
17014 this_arg_conv.inner = (void*)(this_arg & (~1));
17015 this_arg_conv.is_owned = false;
17016 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
17017 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17018 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17019 long ret_ref = (long)ret_var.inner;
17020 if (ret_var.is_owned) {
17026 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
17027 LDKTrustedCommitmentTransaction this_arg_conv;
17028 this_arg_conv.inner = (void*)(this_arg & (~1));
17029 this_arg_conv.is_owned = false;
17030 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
17031 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17032 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17033 long ret_ref = (long)ret_var.inner;
17034 if (ret_var.is_owned) {
17040 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
17041 LDKTrustedCommitmentTransaction this_arg_conv;
17042 this_arg_conv.inner = (void*)(this_arg & (~1));
17043 this_arg_conv.is_owned = false;
17044 unsigned char htlc_base_key_arr[32];
17045 CHECK(*((uint32_t*)htlc_base_key) == 32);
17046 memcpy(htlc_base_key_arr, (uint8_t*)(htlc_base_key + 4), 32);
17047 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
17048 LDKDirectedChannelTransactionParameters channel_parameters_conv;
17049 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
17050 channel_parameters_conv.is_owned = false;
17051 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
17052 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
17053 return (long)ret_conv;
17056 int64_t __attribute__((visibility("default"))) TS_get_commitment_transaction_number_obscure_factor(int8_tArray broadcaster_payment_basepoint, int8_tArray countersignatory_payment_basepoint, jboolean outbound_from_broadcaster) {
17057 LDKPublicKey broadcaster_payment_basepoint_ref;
17058 CHECK(*((uint32_t*)broadcaster_payment_basepoint) == 33);
17059 memcpy(broadcaster_payment_basepoint_ref.compressed_form, (uint8_t*)(broadcaster_payment_basepoint + 4), 33);
17060 LDKPublicKey countersignatory_payment_basepoint_ref;
17061 CHECK(*((uint32_t*)countersignatory_payment_basepoint) == 33);
17062 memcpy(countersignatory_payment_basepoint_ref.compressed_form, (uint8_t*)(countersignatory_payment_basepoint + 4), 33);
17063 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
17067 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
17068 LDKInitFeatures orig_conv;
17069 orig_conv.inner = (void*)(orig & (~1));
17070 orig_conv.is_owned = false;
17071 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
17072 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17073 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17074 long ret_ref = (long)ret_var.inner;
17075 if (ret_var.is_owned) {
17081 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
17082 LDKNodeFeatures orig_conv;
17083 orig_conv.inner = (void*)(orig & (~1));
17084 orig_conv.is_owned = false;
17085 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
17086 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17087 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17088 long ret_ref = (long)ret_var.inner;
17089 if (ret_var.is_owned) {
17095 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
17096 LDKChannelFeatures orig_conv;
17097 orig_conv.inner = (void*)(orig & (~1));
17098 orig_conv.is_owned = false;
17099 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
17100 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17101 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17102 long ret_ref = (long)ret_var.inner;
17103 if (ret_var.is_owned) {
17109 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_ptr) {
17110 LDKInitFeatures this_ptr_conv;
17111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17112 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17113 InitFeatures_free(this_ptr_conv);
17116 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_ptr) {
17117 LDKNodeFeatures this_ptr_conv;
17118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17119 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17120 NodeFeatures_free(this_ptr_conv);
17123 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_ptr) {
17124 LDKChannelFeatures this_ptr_conv;
17125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17126 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17127 ChannelFeatures_free(this_ptr_conv);
17130 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
17131 LDKInitFeatures ret_var = InitFeatures_empty();
17132 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17133 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17134 long ret_ref = (long)ret_var.inner;
17135 if (ret_var.is_owned) {
17141 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
17142 LDKInitFeatures ret_var = InitFeatures_known();
17143 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17144 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17145 long ret_ref = (long)ret_var.inner;
17146 if (ret_var.is_owned) {
17152 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
17153 LDKNodeFeatures ret_var = NodeFeatures_empty();
17154 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17155 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17156 long ret_ref = (long)ret_var.inner;
17157 if (ret_var.is_owned) {
17163 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
17164 LDKNodeFeatures ret_var = NodeFeatures_known();
17165 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17166 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17167 long ret_ref = (long)ret_var.inner;
17168 if (ret_var.is_owned) {
17174 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
17175 LDKChannelFeatures ret_var = ChannelFeatures_empty();
17176 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17177 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17178 long ret_ref = (long)ret_var.inner;
17179 if (ret_var.is_owned) {
17185 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
17186 LDKChannelFeatures ret_var = ChannelFeatures_known();
17187 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17188 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17189 long ret_ref = (long)ret_var.inner;
17190 if (ret_var.is_owned) {
17196 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
17197 LDKInitFeatures obj_conv;
17198 obj_conv.inner = (void*)(obj & (~1));
17199 obj_conv.is_owned = false;
17200 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
17201 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17202 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17203 CVec_u8Z_free(ret_var);
17207 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
17208 LDKNodeFeatures obj_conv;
17209 obj_conv.inner = (void*)(obj & (~1));
17210 obj_conv.is_owned = false;
17211 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
17212 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17213 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17214 CVec_u8Z_free(ret_var);
17218 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
17219 LDKChannelFeatures obj_conv;
17220 obj_conv.inner = (void*)(obj & (~1));
17221 obj_conv.is_owned = false;
17222 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
17223 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17224 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17225 CVec_u8Z_free(ret_var);
17229 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
17230 LDKu8slice ser_ref;
17231 ser_ref.datalen = *((uint32_t*)ser);
17232 ser_ref.data = (int8_t*)(ser + 4);
17233 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
17234 *ret_conv = InitFeatures_read(ser_ref);
17235 return (long)ret_conv;
17238 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
17239 LDKu8slice ser_ref;
17240 ser_ref.datalen = *((uint32_t*)ser);
17241 ser_ref.data = (int8_t*)(ser + 4);
17242 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
17243 *ret_conv = NodeFeatures_read(ser_ref);
17244 return (long)ret_conv;
17247 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
17248 LDKu8slice ser_ref;
17249 ser_ref.datalen = *((uint32_t*)ser);
17250 ser_ref.data = (int8_t*)(ser + 4);
17251 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
17252 *ret_conv = ChannelFeatures_read(ser_ref);
17253 return (long)ret_conv;
17256 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_ptr) {
17257 LDKRouteHop this_ptr_conv;
17258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17259 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17260 RouteHop_free(this_ptr_conv);
17263 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
17264 LDKRouteHop this_ptr_conv;
17265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17266 this_ptr_conv.is_owned = false;
17267 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17268 memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
17272 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
17273 LDKRouteHop this_ptr_conv;
17274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17275 this_ptr_conv.is_owned = false;
17276 LDKPublicKey val_ref;
17277 CHECK(*((uint32_t*)val) == 33);
17278 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17279 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
17282 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
17283 LDKRouteHop this_ptr_conv;
17284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17285 this_ptr_conv.is_owned = false;
17286 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
17287 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17288 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17289 long ret_ref = (long)ret_var.inner;
17290 if (ret_var.is_owned) {
17296 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
17297 LDKRouteHop this_ptr_conv;
17298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17299 this_ptr_conv.is_owned = false;
17300 LDKNodeFeatures val_conv;
17301 val_conv.inner = (void*)(val & (~1));
17302 val_conv.is_owned = (val & 1) || (val == 0);
17303 val_conv = NodeFeatures_clone(&val_conv);
17304 RouteHop_set_node_features(&this_ptr_conv, val_conv);
17307 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
17308 LDKRouteHop this_ptr_conv;
17309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17310 this_ptr_conv.is_owned = false;
17311 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
17315 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
17316 LDKRouteHop this_ptr_conv;
17317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17318 this_ptr_conv.is_owned = false;
17319 RouteHop_set_short_channel_id(&this_ptr_conv, val);
17322 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
17323 LDKRouteHop this_ptr_conv;
17324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17325 this_ptr_conv.is_owned = false;
17326 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
17327 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17328 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17329 long ret_ref = (long)ret_var.inner;
17330 if (ret_var.is_owned) {
17336 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
17337 LDKRouteHop this_ptr_conv;
17338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17339 this_ptr_conv.is_owned = false;
17340 LDKChannelFeatures val_conv;
17341 val_conv.inner = (void*)(val & (~1));
17342 val_conv.is_owned = (val & 1) || (val == 0);
17343 val_conv = ChannelFeatures_clone(&val_conv);
17344 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
17347 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
17348 LDKRouteHop this_ptr_conv;
17349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17350 this_ptr_conv.is_owned = false;
17351 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
17355 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
17356 LDKRouteHop this_ptr_conv;
17357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17358 this_ptr_conv.is_owned = false;
17359 RouteHop_set_fee_msat(&this_ptr_conv, val);
17362 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
17363 LDKRouteHop this_ptr_conv;
17364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17365 this_ptr_conv.is_owned = false;
17366 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
17370 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
17371 LDKRouteHop this_ptr_conv;
17372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17373 this_ptr_conv.is_owned = false;
17374 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
17377 uint32_t __attribute__((visibility("default"))) TS_RouteHop_new(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) {
17378 LDKPublicKey pubkey_arg_ref;
17379 CHECK(*((uint32_t*)pubkey_arg) == 33);
17380 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
17381 LDKNodeFeatures node_features_arg_conv;
17382 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
17383 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
17384 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
17385 LDKChannelFeatures channel_features_arg_conv;
17386 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
17387 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
17388 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
17389 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);
17390 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17391 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17392 long ret_ref = (long)ret_var.inner;
17393 if (ret_var.is_owned) {
17399 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
17400 LDKRouteHop orig_conv;
17401 orig_conv.inner = (void*)(orig & (~1));
17402 orig_conv.is_owned = false;
17403 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
17404 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17405 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17406 long ret_ref = (long)ret_var.inner;
17407 if (ret_var.is_owned) {
17413 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_ptr) {
17414 LDKRoute this_ptr_conv;
17415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17416 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17417 Route_free(this_ptr_conv);
17420 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
17421 LDKRoute this_ptr_conv;
17422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17423 this_ptr_conv.is_owned = false;
17424 LDKCVec_CVec_RouteHopZZ val_constr;
17425 val_constr.datalen = *((uint32_t*)val);
17426 if (val_constr.datalen > 0)
17427 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
17429 val_constr.data = NULL;
17430 uint32_tArray* val_vals = (uint32_tArray*)(val + 4);
17431 for (size_t m = 0; m < val_constr.datalen; m++) {
17432 uint32_tArray val_conv_12 = val_vals[m];
17433 LDKCVec_RouteHopZ val_conv_12_constr;
17434 val_conv_12_constr.datalen = *((uint32_t*)val_conv_12);
17435 if (val_conv_12_constr.datalen > 0)
17436 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
17438 val_conv_12_constr.data = NULL;
17439 uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4);
17440 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
17441 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
17442 LDKRouteHop val_conv_12_conv_10_conv;
17443 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
17444 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
17445 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
17446 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
17448 val_constr.data[m] = val_conv_12_constr;
17450 Route_set_paths(&this_ptr_conv, val_constr);
17453 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg) {
17454 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
17455 paths_arg_constr.datalen = *((uint32_t*)paths_arg);
17456 if (paths_arg_constr.datalen > 0)
17457 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
17459 paths_arg_constr.data = NULL;
17460 uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4);
17461 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
17462 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
17463 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
17464 paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12);
17465 if (paths_arg_conv_12_constr.datalen > 0)
17466 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
17468 paths_arg_conv_12_constr.data = NULL;
17469 uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4);
17470 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
17471 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
17472 LDKRouteHop paths_arg_conv_12_conv_10_conv;
17473 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
17474 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
17475 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
17476 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
17478 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
17480 LDKRoute ret_var = Route_new(paths_arg_constr);
17481 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17482 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17483 long ret_ref = (long)ret_var.inner;
17484 if (ret_var.is_owned) {
17490 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
17491 LDKRoute orig_conv;
17492 orig_conv.inner = (void*)(orig & (~1));
17493 orig_conv.is_owned = false;
17494 LDKRoute ret_var = Route_clone(&orig_conv);
17495 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17496 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17497 long ret_ref = (long)ret_var.inner;
17498 if (ret_var.is_owned) {
17504 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
17506 obj_conv.inner = (void*)(obj & (~1));
17507 obj_conv.is_owned = false;
17508 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
17509 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17510 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17511 CVec_u8Z_free(ret_var);
17515 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
17516 LDKu8slice ser_ref;
17517 ser_ref.datalen = *((uint32_t*)ser);
17518 ser_ref.data = (int8_t*)(ser + 4);
17519 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17520 *ret_conv = Route_read(ser_ref);
17521 return (long)ret_conv;
17524 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_ptr) {
17525 LDKRouteHint this_ptr_conv;
17526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17527 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17528 RouteHint_free(this_ptr_conv);
17531 int8_tArray __attribute__((visibility("default"))) TS_RouteHint_get_src_node_id(uint32_t this_ptr) {
17532 LDKRouteHint this_ptr_conv;
17533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17534 this_ptr_conv.is_owned = false;
17535 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
17536 memcpy((uint8_t*)(ret_arr + 4), RouteHint_get_src_node_id(&this_ptr_conv).compressed_form, 33);
17540 void __attribute__((visibility("default"))) TS_RouteHint_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
17541 LDKRouteHint this_ptr_conv;
17542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17543 this_ptr_conv.is_owned = false;
17544 LDKPublicKey val_ref;
17545 CHECK(*((uint32_t*)val) == 33);
17546 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
17547 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
17550 int64_t __attribute__((visibility("default"))) TS_RouteHint_get_short_channel_id(uint32_t this_ptr) {
17551 LDKRouteHint this_ptr_conv;
17552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17553 this_ptr_conv.is_owned = false;
17554 int64_t ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
17558 void __attribute__((visibility("default"))) TS_RouteHint_set_short_channel_id(uint32_t this_ptr, int64_t val) {
17559 LDKRouteHint this_ptr_conv;
17560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17561 this_ptr_conv.is_owned = false;
17562 RouteHint_set_short_channel_id(&this_ptr_conv, val);
17565 uint32_t __attribute__((visibility("default"))) TS_RouteHint_get_fees(uint32_t this_ptr) {
17566 LDKRouteHint this_ptr_conv;
17567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17568 this_ptr_conv.is_owned = false;
17569 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
17570 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17571 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17572 long ret_ref = (long)ret_var.inner;
17573 if (ret_var.is_owned) {
17579 void __attribute__((visibility("default"))) TS_RouteHint_set_fees(uint32_t this_ptr, uint32_t val) {
17580 LDKRouteHint this_ptr_conv;
17581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17582 this_ptr_conv.is_owned = false;
17583 LDKRoutingFees val_conv;
17584 val_conv.inner = (void*)(val & (~1));
17585 val_conv.is_owned = (val & 1) || (val == 0);
17586 val_conv = RoutingFees_clone(&val_conv);
17587 RouteHint_set_fees(&this_ptr_conv, val_conv);
17590 int16_t __attribute__((visibility("default"))) TS_RouteHint_get_cltv_expiry_delta(uint32_t this_ptr) {
17591 LDKRouteHint this_ptr_conv;
17592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17593 this_ptr_conv.is_owned = false;
17594 int16_t ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
17598 void __attribute__((visibility("default"))) TS_RouteHint_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
17599 LDKRouteHint this_ptr_conv;
17600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17601 this_ptr_conv.is_owned = false;
17602 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
17605 int64_t __attribute__((visibility("default"))) TS_RouteHint_get_htlc_minimum_msat(uint32_t this_ptr) {
17606 LDKRouteHint this_ptr_conv;
17607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17608 this_ptr_conv.is_owned = false;
17609 int64_t ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
17613 void __attribute__((visibility("default"))) TS_RouteHint_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17614 LDKRouteHint this_ptr_conv;
17615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17616 this_ptr_conv.is_owned = false;
17617 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
17620 uint32_t __attribute__((visibility("default"))) TS_RouteHint_new(int8_tArray src_node_id_arg, int64_t short_channel_id_arg, uint32_t fees_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg) {
17621 LDKPublicKey src_node_id_arg_ref;
17622 CHECK(*((uint32_t*)src_node_id_arg) == 33);
17623 memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33);
17624 LDKRoutingFees fees_arg_conv;
17625 fees_arg_conv.inner = (void*)(fees_arg & (~1));
17626 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
17627 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
17628 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);
17629 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17630 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17631 long ret_ref = (long)ret_var.inner;
17632 if (ret_var.is_owned) {
17638 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
17639 LDKRouteHint orig_conv;
17640 orig_conv.inner = (void*)(orig & (~1));
17641 orig_conv.is_owned = false;
17642 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
17643 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17644 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17645 long ret_ref = (long)ret_var.inner;
17646 if (ret_var.is_owned) {
17652 uint32_t __attribute__((visibility("default"))) TS_get_route(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) {
17653 LDKPublicKey our_node_id_ref;
17654 CHECK(*((uint32_t*)our_node_id) == 33);
17655 memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33);
17656 LDKNetworkGraph network_conv;
17657 network_conv.inner = (void*)(network & (~1));
17658 network_conv.is_owned = false;
17659 LDKPublicKey target_ref;
17660 CHECK(*((uint32_t*)target) == 33);
17661 memcpy(target_ref.compressed_form, (uint8_t*)(target + 4), 33);
17662 LDKCVec_ChannelDetailsZ first_hops_constr;
17663 first_hops_constr.datalen = *((uint32_t*)first_hops);
17664 if (first_hops_constr.datalen > 0)
17665 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
17667 first_hops_constr.data = NULL;
17668 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
17669 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
17670 uint32_t first_hops_conv_16 = first_hops_vals[q];
17671 LDKChannelDetails first_hops_conv_16_conv;
17672 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
17673 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
17674 first_hops_constr.data[q] = first_hops_conv_16_conv;
17676 LDKCVec_RouteHintZ last_hops_constr;
17677 last_hops_constr.datalen = *((uint32_t*)last_hops);
17678 if (last_hops_constr.datalen > 0)
17679 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
17681 last_hops_constr.data = NULL;
17682 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
17683 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
17684 uint32_t last_hops_conv_11 = last_hops_vals[l];
17685 LDKRouteHint last_hops_conv_11_conv;
17686 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
17687 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
17688 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
17689 last_hops_constr.data[l] = last_hops_conv_11_conv;
17691 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
17692 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17693 *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);
17694 FREE(first_hops_constr.data);
17695 return (long)ret_conv;
17698 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_ptr) {
17699 LDKNetworkGraph this_ptr_conv;
17700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17701 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17702 NetworkGraph_free(this_ptr_conv);
17705 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) {
17706 LDKNetworkGraph orig_conv;
17707 orig_conv.inner = (void*)(orig & (~1));
17708 orig_conv.is_owned = false;
17709 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
17710 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17711 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17712 long ret_ref = (long)ret_var.inner;
17713 if (ret_var.is_owned) {
17719 void __attribute__((visibility("default"))) TS_LockedNetworkGraph_free(uint32_t this_ptr) {
17720 LDKLockedNetworkGraph this_ptr_conv;
17721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17722 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17723 LockedNetworkGraph_free(this_ptr_conv);
17726 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_ptr) {
17727 LDKNetGraphMsgHandler this_ptr_conv;
17728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17729 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17730 NetGraphMsgHandler_free(this_ptr_conv);
17733 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(int8_tArray genesis_hash, uint32_t chain_access, uint32_t logger) {
17734 LDKThirtyTwoBytes genesis_hash_ref;
17735 CHECK(*((uint32_t*)genesis_hash) == 32);
17736 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
17737 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
17738 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
17739 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv, logger_conv);
17740 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17741 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17742 long ret_ref = (long)ret_var.inner;
17743 if (ret_var.is_owned) {
17749 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_from_net_graph(uint32_t chain_access, uint32_t logger, uint32_t network_graph) {
17750 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
17751 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
17752 LDKNetworkGraph network_graph_conv;
17753 network_graph_conv.inner = (void*)(network_graph & (~1));
17754 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
17755 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
17756 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
17757 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17758 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17759 long ret_ref = (long)ret_var.inner;
17760 if (ret_var.is_owned) {
17766 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_read_locked_graph(uint32_t this_arg) {
17767 LDKNetGraphMsgHandler this_arg_conv;
17768 this_arg_conv.inner = (void*)(this_arg & (~1));
17769 this_arg_conv.is_owned = false;
17770 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
17771 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17772 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17773 long ret_ref = (long)ret_var.inner;
17774 if (ret_var.is_owned) {
17780 uint32_t __attribute__((visibility("default"))) TS_LockedNetworkGraph_graph(uint32_t this_arg) {
17781 LDKLockedNetworkGraph this_arg_conv;
17782 this_arg_conv.inner = (void*)(this_arg & (~1));
17783 this_arg_conv.is_owned = false;
17784 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
17785 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17786 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17787 long ret_ref = (long)ret_var.inner;
17788 if (ret_var.is_owned) {
17794 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
17795 LDKNetGraphMsgHandler this_arg_conv;
17796 this_arg_conv.inner = (void*)(this_arg & (~1));
17797 this_arg_conv.is_owned = false;
17798 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
17799 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
17803 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
17804 LDKNetGraphMsgHandler this_arg_conv;
17805 this_arg_conv.inner = (void*)(this_arg & (~1));
17806 this_arg_conv.is_owned = false;
17807 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
17808 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
17812 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_ptr) {
17813 LDKDirectionalChannelInfo this_ptr_conv;
17814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17815 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17816 DirectionalChannelInfo_free(this_ptr_conv);
17819 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
17820 LDKDirectionalChannelInfo this_ptr_conv;
17821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17822 this_ptr_conv.is_owned = false;
17823 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
17827 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
17828 LDKDirectionalChannelInfo this_ptr_conv;
17829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17830 this_ptr_conv.is_owned = false;
17831 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
17834 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
17835 LDKDirectionalChannelInfo this_ptr_conv;
17836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17837 this_ptr_conv.is_owned = false;
17838 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
17842 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
17843 LDKDirectionalChannelInfo this_ptr_conv;
17844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17845 this_ptr_conv.is_owned = false;
17846 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
17849 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
17850 LDKDirectionalChannelInfo this_ptr_conv;
17851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17852 this_ptr_conv.is_owned = false;
17853 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
17857 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
17858 LDKDirectionalChannelInfo this_ptr_conv;
17859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17860 this_ptr_conv.is_owned = false;
17861 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
17864 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
17865 LDKDirectionalChannelInfo this_ptr_conv;
17866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17867 this_ptr_conv.is_owned = false;
17868 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
17872 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17873 LDKDirectionalChannelInfo this_ptr_conv;
17874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17875 this_ptr_conv.is_owned = false;
17876 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
17879 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
17880 LDKDirectionalChannelInfo this_ptr_conv;
17881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17882 this_ptr_conv.is_owned = false;
17883 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
17884 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17885 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17886 long ret_ref = (long)ret_var.inner;
17887 if (ret_var.is_owned) {
17893 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
17894 LDKDirectionalChannelInfo this_ptr_conv;
17895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17896 this_ptr_conv.is_owned = false;
17897 LDKRoutingFees val_conv;
17898 val_conv.inner = (void*)(val & (~1));
17899 val_conv.is_owned = (val & 1) || (val == 0);
17900 val_conv = RoutingFees_clone(&val_conv);
17901 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
17904 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
17905 LDKDirectionalChannelInfo this_ptr_conv;
17906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17907 this_ptr_conv.is_owned = false;
17908 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
17909 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17910 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17911 long ret_ref = (long)ret_var.inner;
17912 if (ret_var.is_owned) {
17918 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
17919 LDKDirectionalChannelInfo this_ptr_conv;
17920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17921 this_ptr_conv.is_owned = false;
17922 LDKChannelUpdate val_conv;
17923 val_conv.inner = (void*)(val & (~1));
17924 val_conv.is_owned = (val & 1) || (val == 0);
17925 val_conv = ChannelUpdate_clone(&val_conv);
17926 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
17929 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
17930 LDKDirectionalChannelInfo orig_conv;
17931 orig_conv.inner = (void*)(orig & (~1));
17932 orig_conv.is_owned = false;
17933 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
17934 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17935 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17936 long ret_ref = (long)ret_var.inner;
17937 if (ret_var.is_owned) {
17943 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
17944 LDKDirectionalChannelInfo obj_conv;
17945 obj_conv.inner = (void*)(obj & (~1));
17946 obj_conv.is_owned = false;
17947 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
17948 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17949 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17950 CVec_u8Z_free(ret_var);
17954 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
17955 LDKu8slice ser_ref;
17956 ser_ref.datalen = *((uint32_t*)ser);
17957 ser_ref.data = (int8_t*)(ser + 4);
17958 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
17959 *ret_conv = DirectionalChannelInfo_read(ser_ref);
17960 return (long)ret_conv;
17963 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_ptr) {
17964 LDKChannelInfo this_ptr_conv;
17965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17966 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
17967 ChannelInfo_free(this_ptr_conv);
17970 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
17971 LDKChannelInfo this_ptr_conv;
17972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17973 this_ptr_conv.is_owned = false;
17974 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
17975 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17976 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17977 long ret_ref = (long)ret_var.inner;
17978 if (ret_var.is_owned) {
17984 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
17985 LDKChannelInfo this_ptr_conv;
17986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17987 this_ptr_conv.is_owned = false;
17988 LDKChannelFeatures val_conv;
17989 val_conv.inner = (void*)(val & (~1));
17990 val_conv.is_owned = (val & 1) || (val == 0);
17991 val_conv = ChannelFeatures_clone(&val_conv);
17992 ChannelInfo_set_features(&this_ptr_conv, val_conv);
17995 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
17996 LDKChannelInfo this_ptr_conv;
17997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17998 this_ptr_conv.is_owned = false;
17999 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18000 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_one(&this_ptr_conv).compressed_form, 33);
18004 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, int8_tArray val) {
18005 LDKChannelInfo this_ptr_conv;
18006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18007 this_ptr_conv.is_owned = false;
18008 LDKPublicKey val_ref;
18009 CHECK(*((uint32_t*)val) == 33);
18010 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18011 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
18014 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
18015 LDKChannelInfo this_ptr_conv;
18016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18017 this_ptr_conv.is_owned = false;
18018 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
18019 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18020 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18021 long ret_ref = (long)ret_var.inner;
18022 if (ret_var.is_owned) {
18028 void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
18029 LDKChannelInfo this_ptr_conv;
18030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18031 this_ptr_conv.is_owned = false;
18032 LDKDirectionalChannelInfo val_conv;
18033 val_conv.inner = (void*)(val & (~1));
18034 val_conv.is_owned = (val & 1) || (val == 0);
18035 val_conv = DirectionalChannelInfo_clone(&val_conv);
18036 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
18039 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
18040 LDKChannelInfo this_ptr_conv;
18041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18042 this_ptr_conv.is_owned = false;
18043 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18044 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_two(&this_ptr_conv).compressed_form, 33);
18048 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, int8_tArray val) {
18049 LDKChannelInfo this_ptr_conv;
18050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18051 this_ptr_conv.is_owned = false;
18052 LDKPublicKey val_ref;
18053 CHECK(*((uint32_t*)val) == 33);
18054 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18055 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
18058 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
18059 LDKChannelInfo this_ptr_conv;
18060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18061 this_ptr_conv.is_owned = false;
18062 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
18063 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18064 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18065 long ret_ref = (long)ret_var.inner;
18066 if (ret_var.is_owned) {
18072 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
18073 LDKChannelInfo this_ptr_conv;
18074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18075 this_ptr_conv.is_owned = false;
18076 LDKDirectionalChannelInfo val_conv;
18077 val_conv.inner = (void*)(val & (~1));
18078 val_conv.is_owned = (val & 1) || (val == 0);
18079 val_conv = DirectionalChannelInfo_clone(&val_conv);
18080 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
18083 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
18084 LDKChannelInfo this_ptr_conv;
18085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18086 this_ptr_conv.is_owned = false;
18087 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
18088 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18089 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18090 long ret_ref = (long)ret_var.inner;
18091 if (ret_var.is_owned) {
18097 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
18098 LDKChannelInfo this_ptr_conv;
18099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18100 this_ptr_conv.is_owned = false;
18101 LDKChannelAnnouncement val_conv;
18102 val_conv.inner = (void*)(val & (~1));
18103 val_conv.is_owned = (val & 1) || (val == 0);
18104 val_conv = ChannelAnnouncement_clone(&val_conv);
18105 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
18108 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) {
18109 LDKChannelInfo orig_conv;
18110 orig_conv.inner = (void*)(orig & (~1));
18111 orig_conv.is_owned = false;
18112 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
18113 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18114 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18115 long ret_ref = (long)ret_var.inner;
18116 if (ret_var.is_owned) {
18122 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
18123 LDKChannelInfo obj_conv;
18124 obj_conv.inner = (void*)(obj & (~1));
18125 obj_conv.is_owned = false;
18126 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
18127 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18128 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18129 CVec_u8Z_free(ret_var);
18133 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
18134 LDKu8slice ser_ref;
18135 ser_ref.datalen = *((uint32_t*)ser);
18136 ser_ref.data = (int8_t*)(ser + 4);
18137 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
18138 *ret_conv = ChannelInfo_read(ser_ref);
18139 return (long)ret_conv;
18142 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_ptr) {
18143 LDKRoutingFees this_ptr_conv;
18144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18145 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18146 RoutingFees_free(this_ptr_conv);
18149 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
18150 LDKRoutingFees this_ptr_conv;
18151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18152 this_ptr_conv.is_owned = false;
18153 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
18157 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
18158 LDKRoutingFees this_ptr_conv;
18159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18160 this_ptr_conv.is_owned = false;
18161 RoutingFees_set_base_msat(&this_ptr_conv, val);
18164 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
18165 LDKRoutingFees this_ptr_conv;
18166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18167 this_ptr_conv.is_owned = false;
18168 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
18172 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
18173 LDKRoutingFees this_ptr_conv;
18174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18175 this_ptr_conv.is_owned = false;
18176 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
18179 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
18180 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
18181 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18182 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18183 long ret_ref = (long)ret_var.inner;
18184 if (ret_var.is_owned) {
18190 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
18191 LDKRoutingFees orig_conv;
18192 orig_conv.inner = (void*)(orig & (~1));
18193 orig_conv.is_owned = false;
18194 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
18195 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18196 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18197 long ret_ref = (long)ret_var.inner;
18198 if (ret_var.is_owned) {
18204 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
18205 LDKu8slice ser_ref;
18206 ser_ref.datalen = *((uint32_t*)ser);
18207 ser_ref.data = (int8_t*)(ser + 4);
18208 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
18209 *ret_conv = RoutingFees_read(ser_ref);
18210 return (long)ret_conv;
18213 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
18214 LDKRoutingFees obj_conv;
18215 obj_conv.inner = (void*)(obj & (~1));
18216 obj_conv.is_owned = false;
18217 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
18218 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18219 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18220 CVec_u8Z_free(ret_var);
18224 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_ptr) {
18225 LDKNodeAnnouncementInfo this_ptr_conv;
18226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18227 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18228 NodeAnnouncementInfo_free(this_ptr_conv);
18231 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
18232 LDKNodeAnnouncementInfo this_ptr_conv;
18233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18234 this_ptr_conv.is_owned = false;
18235 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
18236 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18237 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18238 long ret_ref = (long)ret_var.inner;
18239 if (ret_var.is_owned) {
18245 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
18246 LDKNodeAnnouncementInfo this_ptr_conv;
18247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18248 this_ptr_conv.is_owned = false;
18249 LDKNodeFeatures val_conv;
18250 val_conv.inner = (void*)(val & (~1));
18251 val_conv.is_owned = (val & 1) || (val == 0);
18252 val_conv = NodeFeatures_clone(&val_conv);
18253 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
18256 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
18257 LDKNodeAnnouncementInfo this_ptr_conv;
18258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18259 this_ptr_conv.is_owned = false;
18260 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
18264 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
18265 LDKNodeAnnouncementInfo this_ptr_conv;
18266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18267 this_ptr_conv.is_owned = false;
18268 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
18271 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
18272 LDKNodeAnnouncementInfo this_ptr_conv;
18273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18274 this_ptr_conv.is_owned = false;
18275 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
18276 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
18280 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
18281 LDKNodeAnnouncementInfo this_ptr_conv;
18282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18283 this_ptr_conv.is_owned = false;
18284 LDKThreeBytes val_ref;
18285 CHECK(*((uint32_t*)val) == 3);
18286 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
18287 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
18290 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
18291 LDKNodeAnnouncementInfo this_ptr_conv;
18292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18293 this_ptr_conv.is_owned = false;
18294 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
18295 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
18299 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
18300 LDKNodeAnnouncementInfo this_ptr_conv;
18301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18302 this_ptr_conv.is_owned = false;
18303 LDKThirtyTwoBytes val_ref;
18304 CHECK(*((uint32_t*)val) == 32);
18305 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
18306 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
18309 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
18310 LDKNodeAnnouncementInfo this_ptr_conv;
18311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18312 this_ptr_conv.is_owned = false;
18313 LDKCVec_NetAddressZ val_constr;
18314 val_constr.datalen = *((uint32_t*)val);
18315 if (val_constr.datalen > 0)
18316 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18318 val_constr.data = NULL;
18319 uint32_t* val_vals = (uint32_t*)(val + 4);
18320 for (size_t m = 0; m < val_constr.datalen; m++) {
18321 uint32_t val_conv_12 = val_vals[m];
18322 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
18323 FREE((void*)val_conv_12);
18324 val_constr.data[m] = val_conv_12_conv;
18326 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
18329 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
18330 LDKNodeAnnouncementInfo this_ptr_conv;
18331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18332 this_ptr_conv.is_owned = false;
18333 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
18334 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18335 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18336 long ret_ref = (long)ret_var.inner;
18337 if (ret_var.is_owned) {
18343 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
18344 LDKNodeAnnouncementInfo this_ptr_conv;
18345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18346 this_ptr_conv.is_owned = false;
18347 LDKNodeAnnouncement val_conv;
18348 val_conv.inner = (void*)(val & (~1));
18349 val_conv.is_owned = (val & 1) || (val == 0);
18350 val_conv = NodeAnnouncement_clone(&val_conv);
18351 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
18354 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_new(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) {
18355 LDKNodeFeatures features_arg_conv;
18356 features_arg_conv.inner = (void*)(features_arg & (~1));
18357 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
18358 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
18359 LDKThreeBytes rgb_arg_ref;
18360 CHECK(*((uint32_t*)rgb_arg) == 3);
18361 memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3);
18362 LDKThirtyTwoBytes alias_arg_ref;
18363 CHECK(*((uint32_t*)alias_arg) == 32);
18364 memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32);
18365 LDKCVec_NetAddressZ addresses_arg_constr;
18366 addresses_arg_constr.datalen = *((uint32_t*)addresses_arg);
18367 if (addresses_arg_constr.datalen > 0)
18368 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18370 addresses_arg_constr.data = NULL;
18371 uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4);
18372 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
18373 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
18374 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
18375 FREE((void*)addresses_arg_conv_12);
18376 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
18378 LDKNodeAnnouncement announcement_message_arg_conv;
18379 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
18380 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
18381 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
18382 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
18383 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18384 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18385 long ret_ref = (long)ret_var.inner;
18386 if (ret_var.is_owned) {
18392 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
18393 LDKNodeAnnouncementInfo orig_conv;
18394 orig_conv.inner = (void*)(orig & (~1));
18395 orig_conv.is_owned = false;
18396 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
18397 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18398 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18399 long ret_ref = (long)ret_var.inner;
18400 if (ret_var.is_owned) {
18406 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
18407 LDKNodeAnnouncementInfo obj_conv;
18408 obj_conv.inner = (void*)(obj & (~1));
18409 obj_conv.is_owned = false;
18410 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
18411 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18412 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18413 CVec_u8Z_free(ret_var);
18417 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
18418 LDKu8slice ser_ref;
18419 ser_ref.datalen = *((uint32_t*)ser);
18420 ser_ref.data = (int8_t*)(ser + 4);
18421 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
18422 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
18423 return (long)ret_conv;
18426 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_ptr) {
18427 LDKNodeInfo this_ptr_conv;
18428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18429 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
18430 NodeInfo_free(this_ptr_conv);
18433 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
18434 LDKNodeInfo this_ptr_conv;
18435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18436 this_ptr_conv.is_owned = false;
18437 LDKCVec_u64Z val_constr;
18438 val_constr.datalen = *((uint32_t*)val);
18439 if (val_constr.datalen > 0)
18440 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
18442 val_constr.data = NULL;
18443 int64_t* val_vals = (int64_t*)(val + 4);
18444 for (size_t i = 0; i < val_constr.datalen; i++) {
18445 int64_t val_conv_8 = val_vals[i];
18446 val_constr.data[i] = val_conv_8;
18448 NodeInfo_set_channels(&this_ptr_conv, val_constr);
18451 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
18452 LDKNodeInfo this_ptr_conv;
18453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18454 this_ptr_conv.is_owned = false;
18455 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
18456 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18457 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18458 long ret_ref = (long)ret_var.inner;
18459 if (ret_var.is_owned) {
18465 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
18466 LDKNodeInfo this_ptr_conv;
18467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18468 this_ptr_conv.is_owned = false;
18469 LDKRoutingFees val_conv;
18470 val_conv.inner = (void*)(val & (~1));
18471 val_conv.is_owned = (val & 1) || (val == 0);
18472 val_conv = RoutingFees_clone(&val_conv);
18473 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
18476 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
18477 LDKNodeInfo this_ptr_conv;
18478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18479 this_ptr_conv.is_owned = false;
18480 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
18481 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18482 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18483 long ret_ref = (long)ret_var.inner;
18484 if (ret_var.is_owned) {
18490 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
18491 LDKNodeInfo this_ptr_conv;
18492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18493 this_ptr_conv.is_owned = false;
18494 LDKNodeAnnouncementInfo val_conv;
18495 val_conv.inner = (void*)(val & (~1));
18496 val_conv.is_owned = (val & 1) || (val == 0);
18497 val_conv = NodeAnnouncementInfo_clone(&val_conv);
18498 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
18501 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
18502 LDKCVec_u64Z channels_arg_constr;
18503 channels_arg_constr.datalen = *((uint32_t*)channels_arg);
18504 if (channels_arg_constr.datalen > 0)
18505 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
18507 channels_arg_constr.data = NULL;
18508 int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4);
18509 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
18510 int64_t channels_arg_conv_8 = channels_arg_vals[i];
18511 channels_arg_constr.data[i] = channels_arg_conv_8;
18513 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
18514 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
18515 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
18516 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
18517 LDKNodeAnnouncementInfo announcement_info_arg_conv;
18518 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
18519 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
18520 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
18521 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
18522 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18523 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18524 long ret_ref = (long)ret_var.inner;
18525 if (ret_var.is_owned) {
18531 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
18532 LDKNodeInfo orig_conv;
18533 orig_conv.inner = (void*)(orig & (~1));
18534 orig_conv.is_owned = false;
18535 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
18536 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18537 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18538 long ret_ref = (long)ret_var.inner;
18539 if (ret_var.is_owned) {
18545 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
18546 LDKNodeInfo obj_conv;
18547 obj_conv.inner = (void*)(obj & (~1));
18548 obj_conv.is_owned = false;
18549 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
18550 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18551 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18552 CVec_u8Z_free(ret_var);
18556 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
18557 LDKu8slice ser_ref;
18558 ser_ref.datalen = *((uint32_t*)ser);
18559 ser_ref.data = (int8_t*)(ser + 4);
18560 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
18561 *ret_conv = NodeInfo_read(ser_ref);
18562 return (long)ret_conv;
18565 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
18566 LDKNetworkGraph obj_conv;
18567 obj_conv.inner = (void*)(obj & (~1));
18568 obj_conv.is_owned = false;
18569 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
18570 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18571 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18572 CVec_u8Z_free(ret_var);
18576 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
18577 LDKu8slice ser_ref;
18578 ser_ref.datalen = *((uint32_t*)ser);
18579 ser_ref.data = (int8_t*)(ser + 4);
18580 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
18581 *ret_conv = NetworkGraph_read(ser_ref);
18582 return (long)ret_conv;
18585 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
18586 LDKThirtyTwoBytes genesis_hash_ref;
18587 CHECK(*((uint32_t*)genesis_hash) == 32);
18588 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
18589 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
18590 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18591 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18592 long ret_ref = (long)ret_var.inner;
18593 if (ret_var.is_owned) {
18599 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
18600 LDKNetworkGraph this_arg_conv;
18601 this_arg_conv.inner = (void*)(this_arg & (~1));
18602 this_arg_conv.is_owned = false;
18603 LDKNodeAnnouncement msg_conv;
18604 msg_conv.inner = (void*)(msg & (~1));
18605 msg_conv.is_owned = false;
18606 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18607 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
18608 return (long)ret_conv;
18611 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
18612 LDKNetworkGraph this_arg_conv;
18613 this_arg_conv.inner = (void*)(this_arg & (~1));
18614 this_arg_conv.is_owned = false;
18615 LDKUnsignedNodeAnnouncement msg_conv;
18616 msg_conv.inner = (void*)(msg & (~1));
18617 msg_conv.is_owned = false;
18618 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18619 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
18620 return (long)ret_conv;
18623 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
18624 LDKNetworkGraph this_arg_conv;
18625 this_arg_conv.inner = (void*)(this_arg & (~1));
18626 this_arg_conv.is_owned = false;
18627 LDKChannelAnnouncement msg_conv;
18628 msg_conv.inner = (void*)(msg & (~1));
18629 msg_conv.is_owned = false;
18630 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
18631 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18632 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
18633 return (long)ret_conv;
18636 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
18637 LDKNetworkGraph this_arg_conv;
18638 this_arg_conv.inner = (void*)(this_arg & (~1));
18639 this_arg_conv.is_owned = false;
18640 LDKUnsignedChannelAnnouncement msg_conv;
18641 msg_conv.inner = (void*)(msg & (~1));
18642 msg_conv.is_owned = false;
18643 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
18644 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18645 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
18646 return (long)ret_conv;
18649 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
18650 LDKNetworkGraph this_arg_conv;
18651 this_arg_conv.inner = (void*)(this_arg & (~1));
18652 this_arg_conv.is_owned = false;
18653 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
18656 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
18657 LDKNetworkGraph this_arg_conv;
18658 this_arg_conv.inner = (void*)(this_arg & (~1));
18659 this_arg_conv.is_owned = false;
18660 LDKChannelUpdate msg_conv;
18661 msg_conv.inner = (void*)(msg & (~1));
18662 msg_conv.is_owned = false;
18663 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18664 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
18665 return (long)ret_conv;
18668 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
18669 LDKNetworkGraph this_arg_conv;
18670 this_arg_conv.inner = (void*)(this_arg & (~1));
18671 this_arg_conv.is_owned = false;
18672 LDKUnsignedChannelUpdate msg_conv;
18673 msg_conv.inner = (void*)(msg & (~1));
18674 msg_conv.is_owned = false;
18675 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18676 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
18677 return (long)ret_conv;