Merge pull request #120 from TheBlueMatt/main
[ldk-java] / ts / bindings.c.body
1 #include "js-wasm.h"
2 #include <stdatomic.h>
3 #include <lightning.h>
4
5 // These should be provided...somehow...
6 void *memset(void *s, int c, size_t n);
7 void *memcpy(void *dest, const void *src, size_t n);
8 int memcmp(const void *s1, const void *s2, size_t n);
9
10 extern void __attribute__((noreturn)) abort(void);
11 static inline void assert(bool expression) {
12         if (!expression) { abort(); }
13 }
14
15 uint32_t __attribute__((export_name("test_bigint_pass_deadbeef0badf00d"))) test_bigint_pass_deadbeef0badf00d(uint64_t val) {
16         return val == 0xdeadbeef0badf00dULL;
17 }
18
19
20 void *malloc(size_t size);
21 void free(void *ptr);
22
23 #define MALLOC(a, _) malloc(a)
24 #define do_MALLOC(a, _b, _c) malloc(a)
25 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
26 #define DO_ASSERT(a) (void)(a)
27 #define CHECK(a)
28 #define CHECK_ACCESS(p)
29 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
30
31 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
32 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
33 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
34 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
35
36 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
37
38 #define DECL_ARR_TYPE(ty, name) \
39         struct name##array { \
40                 uint64_t arr_len; /* uint32_t would suffice but we want to align uint64_ts as well */ \
41                 ty elems[]; \
42         }; \
43         typedef struct name##array * name##Array; \
44         static inline name##Array init_##name##Array(size_t arr_len, int lineno) { \
45                 name##Array arr = (name##Array)do_MALLOC(arr_len * sizeof(ty) + sizeof(uint64_t), #name" array init", lineno); \
46                 arr->arr_len = arr_len; \
47                 return arr; \
48         }
49
50 DECL_ARR_TYPE(int64_t, int64_t);
51 DECL_ARR_TYPE(uint64_t, uint64_t);
52 DECL_ARR_TYPE(int8_t, int8_t);
53 DECL_ARR_TYPE(uint32_t, uint32_t);
54 DECL_ARR_TYPE(void*, ptr);
55 DECL_ARR_TYPE(char, char);
56 typedef charArray jstring;
57
58 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
59         charArray arr = init_charArray(len, __LINE__);
60         memcpy(arr->elems, chars, len);
61         return arr;
62 }
63 static inline LDKStr str_ref_to_owned_c(const jstring str) {
64         char* newchars = MALLOC(str->arr_len + 1, "String chars");
65         memcpy(newchars, str->elems, str->arr_len);
66         newchars[str->arr_len] = 0;
67         LDKStr res = {
68                 .chars = newchars,
69                 .len = str->arr_len,
70                 .chars_is_owned = true
71         };
72         return res;
73 }
74
75 typedef bool jboolean;
76
77 uint32_t __attribute__((export_name("TS_malloc"))) TS_malloc(uint32_t size) {
78         return (uint32_t)MALLOC(size, "JS-Called malloc");
79 }
80 void __attribute__((export_name("TS_free"))) TS_free(uint32_t ptr) {
81         FREE((void*)ptr);
82 }
83
84 jstring __attribute__((export_name("TS_get_ldk_c_bindings_version"))) TS_get_ldk_c_bindings_version() {
85         const char *res = check_get_ldk_bindings_version();
86         if (res == NULL) return NULL;
87         return str_ref_to_ts(res, strlen(res));
88 }
89 jstring __attribute__((export_name("TS_get_ldk_version"))) get_ldk_version() {
90         const char *res = check_get_ldk_version();
91         if (res == NULL) return NULL;
92         return str_ref_to_ts(res, strlen(res));
93 }
94 #include "version.c"
95 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
96
97 static inline void* untag_ptr(uint64_t ptr) {
98         if (ptr < 4096) return (void*)ptr;
99         if (sizeof(void*) == 4) {
100                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
101                 return (void*)(uintptr_t)ptr;
102         } else {
103                 // For 64-bit systems, assume the top byte is used for tagging, then
104                 // use bit 9 ^ bit 10.
105                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
106                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
107 #ifdef LDK_DEBUG_BUILD
108                 // On debug builds we also use the 11th bit as a debug flag
109                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
110                 CHECK(tenth_bit != eleventh_bit);
111                 p ^= 1ULL << 53;
112 #endif
113                 return (void*)p;
114         }
115 }
116 static inline bool ptr_is_owned(uint64_t ptr) {
117         if(ptr < 4096) return true;
118         if (sizeof(void*) == 4) {
119                 return ptr & (1ULL << 32);
120         } else {
121                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
122                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
123 #ifdef LDK_DEBUG_BUILD
124                 // On debug builds we also use the 11th bit as a debug flag
125                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
126                 CHECK(tenth_bit != eleventh_bit);
127 #endif
128                 return (ninth_bit ^ tenth_bit) ? true : false;
129         }
130 }
131 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
132         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
133         if (sizeof(void*) == 4) {
134                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
135         } else {
136                 CHECK(sizeof(uintptr_t) == 8);
137                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
138                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
139 #ifdef LDK_DEBUG_BUILD
140                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
141                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
142                 CHECK(ninth_bit == tenth_bit);
143                 CHECK(ninth_bit == eleventh_bit);
144                 t ^= 1ULL << 53;
145 #endif
146                 CHECK(ptr_is_owned(t) == is_owned);
147                 CHECK(untag_ptr(t) == ptr);
148                 return t;
149         }
150 }
151
152 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
153         switch (ord) {
154                 case 0: return LDKAccessError_UnknownChain;
155                 case 1: return LDKAccessError_UnknownTx;
156         }
157         abort();
158 }
159 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
160         switch (val) {
161                 case LDKAccessError_UnknownChain: return 0;
162                 case LDKAccessError_UnknownTx: return 1;
163                 default: abort();
164         }
165 }
166 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
167         switch (ord) {
168                 case 0: return LDKCOption_NoneZ_Some;
169                 case 1: return LDKCOption_NoneZ_None;
170         }
171         abort();
172 }
173 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
174         switch (val) {
175                 case LDKCOption_NoneZ_Some: return 0;
176                 case LDKCOption_NoneZ_None: return 1;
177                 default: abort();
178         }
179 }
180 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_js(int32_t ord) {
181         switch (ord) {
182                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
183                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
184                 case 2: return LDKChannelMonitorUpdateStatus_PermanentFailure;
185         }
186         abort();
187 }
188 static inline int32_t LDKChannelMonitorUpdateStatus_to_js(LDKChannelMonitorUpdateStatus val) {
189         switch (val) {
190                 case LDKChannelMonitorUpdateStatus_Completed: return 0;
191                 case LDKChannelMonitorUpdateStatus_InProgress: return 1;
192                 case LDKChannelMonitorUpdateStatus_PermanentFailure: return 2;
193                 default: abort();
194         }
195 }
196 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
197         switch (ord) {
198                 case 0: return LDKConfirmationTarget_Background;
199                 case 1: return LDKConfirmationTarget_Normal;
200                 case 2: return LDKConfirmationTarget_HighPriority;
201         }
202         abort();
203 }
204 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
205         switch (val) {
206                 case LDKConfirmationTarget_Background: return 0;
207                 case LDKConfirmationTarget_Normal: return 1;
208                 case LDKConfirmationTarget_HighPriority: return 2;
209                 default: abort();
210         }
211 }
212 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
213         switch (ord) {
214                 case 0: return LDKCreationError_DescriptionTooLong;
215                 case 1: return LDKCreationError_RouteTooLong;
216                 case 2: return LDKCreationError_TimestampOutOfBounds;
217                 case 3: return LDKCreationError_InvalidAmount;
218                 case 4: return LDKCreationError_MissingRouteHints;
219         }
220         abort();
221 }
222 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
223         switch (val) {
224                 case LDKCreationError_DescriptionTooLong: return 0;
225                 case LDKCreationError_RouteTooLong: return 1;
226                 case LDKCreationError_TimestampOutOfBounds: return 2;
227                 case LDKCreationError_InvalidAmount: return 3;
228                 case LDKCreationError_MissingRouteHints: return 4;
229                 default: abort();
230         }
231 }
232 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
233         switch (ord) {
234                 case 0: return LDKCurrency_Bitcoin;
235                 case 1: return LDKCurrency_BitcoinTestnet;
236                 case 2: return LDKCurrency_Regtest;
237                 case 3: return LDKCurrency_Simnet;
238                 case 4: return LDKCurrency_Signet;
239         }
240         abort();
241 }
242 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
243         switch (val) {
244                 case LDKCurrency_Bitcoin: return 0;
245                 case LDKCurrency_BitcoinTestnet: return 1;
246                 case LDKCurrency_Regtest: return 2;
247                 case LDKCurrency_Simnet: return 3;
248                 case LDKCurrency_Signet: return 4;
249                 default: abort();
250         }
251 }
252 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
253         switch (ord) {
254                 case 0: return LDKIOError_NotFound;
255                 case 1: return LDKIOError_PermissionDenied;
256                 case 2: return LDKIOError_ConnectionRefused;
257                 case 3: return LDKIOError_ConnectionReset;
258                 case 4: return LDKIOError_ConnectionAborted;
259                 case 5: return LDKIOError_NotConnected;
260                 case 6: return LDKIOError_AddrInUse;
261                 case 7: return LDKIOError_AddrNotAvailable;
262                 case 8: return LDKIOError_BrokenPipe;
263                 case 9: return LDKIOError_AlreadyExists;
264                 case 10: return LDKIOError_WouldBlock;
265                 case 11: return LDKIOError_InvalidInput;
266                 case 12: return LDKIOError_InvalidData;
267                 case 13: return LDKIOError_TimedOut;
268                 case 14: return LDKIOError_WriteZero;
269                 case 15: return LDKIOError_Interrupted;
270                 case 16: return LDKIOError_Other;
271                 case 17: return LDKIOError_UnexpectedEof;
272         }
273         abort();
274 }
275 static inline int32_t LDKIOError_to_js(LDKIOError val) {
276         switch (val) {
277                 case LDKIOError_NotFound: return 0;
278                 case LDKIOError_PermissionDenied: return 1;
279                 case LDKIOError_ConnectionRefused: return 2;
280                 case LDKIOError_ConnectionReset: return 3;
281                 case LDKIOError_ConnectionAborted: return 4;
282                 case LDKIOError_NotConnected: return 5;
283                 case LDKIOError_AddrInUse: return 6;
284                 case LDKIOError_AddrNotAvailable: return 7;
285                 case LDKIOError_BrokenPipe: return 8;
286                 case LDKIOError_AlreadyExists: return 9;
287                 case LDKIOError_WouldBlock: return 10;
288                 case LDKIOError_InvalidInput: return 11;
289                 case LDKIOError_InvalidData: return 12;
290                 case LDKIOError_TimedOut: return 13;
291                 case LDKIOError_WriteZero: return 14;
292                 case LDKIOError_Interrupted: return 15;
293                 case LDKIOError_Other: return 16;
294                 case LDKIOError_UnexpectedEof: return 17;
295                 default: abort();
296         }
297 }
298 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
299         switch (ord) {
300                 case 0: return LDKLevel_Gossip;
301                 case 1: return LDKLevel_Trace;
302                 case 2: return LDKLevel_Debug;
303                 case 3: return LDKLevel_Info;
304                 case 4: return LDKLevel_Warn;
305                 case 5: return LDKLevel_Error;
306         }
307         abort();
308 }
309 static inline int32_t LDKLevel_to_js(LDKLevel val) {
310         switch (val) {
311                 case LDKLevel_Gossip: return 0;
312                 case LDKLevel_Trace: return 1;
313                 case LDKLevel_Debug: return 2;
314                 case LDKLevel_Info: return 3;
315                 case LDKLevel_Warn: return 4;
316                 case LDKLevel_Error: return 5;
317                 default: abort();
318         }
319 }
320 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
321         switch (ord) {
322                 case 0: return LDKNetwork_Bitcoin;
323                 case 1: return LDKNetwork_Testnet;
324                 case 2: return LDKNetwork_Regtest;
325                 case 3: return LDKNetwork_Signet;
326         }
327         abort();
328 }
329 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
330         switch (val) {
331                 case LDKNetwork_Bitcoin: return 0;
332                 case LDKNetwork_Testnet: return 1;
333                 case LDKNetwork_Regtest: return 2;
334                 case LDKNetwork_Signet: return 3;
335                 default: abort();
336         }
337 }
338 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
339         switch (ord) {
340                 case 0: return LDKRecipient_Node;
341                 case 1: return LDKRecipient_PhantomNode;
342         }
343         abort();
344 }
345 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
346         switch (val) {
347                 case LDKRecipient_Node: return 0;
348                 case LDKRecipient_PhantomNode: return 1;
349                 default: abort();
350         }
351 }
352 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
353         switch (ord) {
354                 case 0: return LDKSecp256k1Error_IncorrectSignature;
355                 case 1: return LDKSecp256k1Error_InvalidMessage;
356                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
357                 case 3: return LDKSecp256k1Error_InvalidSignature;
358                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
359                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
360                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
361                 case 7: return LDKSecp256k1Error_InvalidTweak;
362                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
363                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
364                 case 10: return LDKSecp256k1Error_InvalidParityValue;
365         }
366         abort();
367 }
368 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
369         switch (val) {
370                 case LDKSecp256k1Error_IncorrectSignature: return 0;
371                 case LDKSecp256k1Error_InvalidMessage: return 1;
372                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
373                 case LDKSecp256k1Error_InvalidSignature: return 3;
374                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
375                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
376                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
377                 case LDKSecp256k1Error_InvalidTweak: return 7;
378                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
379                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
380                 case LDKSecp256k1Error_InvalidParityValue: return 10;
381                 default: abort();
382         }
383 }
384 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
385         switch (ord) {
386                 case 0: return LDKSemanticError_NoPaymentHash;
387                 case 1: return LDKSemanticError_MultiplePaymentHashes;
388                 case 2: return LDKSemanticError_NoDescription;
389                 case 3: return LDKSemanticError_MultipleDescriptions;
390                 case 4: return LDKSemanticError_NoPaymentSecret;
391                 case 5: return LDKSemanticError_MultiplePaymentSecrets;
392                 case 6: return LDKSemanticError_InvalidFeatures;
393                 case 7: return LDKSemanticError_InvalidRecoveryId;
394                 case 8: return LDKSemanticError_InvalidSignature;
395                 case 9: return LDKSemanticError_ImpreciseAmount;
396         }
397         abort();
398 }
399 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
400         switch (val) {
401                 case LDKSemanticError_NoPaymentHash: return 0;
402                 case LDKSemanticError_MultiplePaymentHashes: return 1;
403                 case LDKSemanticError_NoDescription: return 2;
404                 case LDKSemanticError_MultipleDescriptions: return 3;
405                 case LDKSemanticError_NoPaymentSecret: return 4;
406                 case LDKSemanticError_MultiplePaymentSecrets: return 5;
407                 case LDKSemanticError_InvalidFeatures: return 6;
408                 case LDKSemanticError_InvalidRecoveryId: return 7;
409                 case LDKSemanticError_InvalidSignature: return 8;
410                 case LDKSemanticError_ImpreciseAmount: return 9;
411                 default: abort();
412         }
413 }
414 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
415         switch (ord) {
416                 case 0: return LDKSiPrefix_Milli;
417                 case 1: return LDKSiPrefix_Micro;
418                 case 2: return LDKSiPrefix_Nano;
419                 case 3: return LDKSiPrefix_Pico;
420         }
421         abort();
422 }
423 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
424         switch (val) {
425                 case LDKSiPrefix_Milli: return 0;
426                 case LDKSiPrefix_Micro: return 1;
427                 case LDKSiPrefix_Nano: return 2;
428                 case LDKSiPrefix_Pico: return 3;
429                 default: abort();
430         }
431 }
432 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
433         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
434         return ret;
435 }
436 int8_tArray  __attribute__((export_name("TS_BigEndianScalar_get_bytes"))) TS_BigEndianScalar_get_bytes(uint64_t thing) {
437         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
438         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
439         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
440         return ret_arr;
441 }
442
443 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
444 void  __attribute__((export_name("TS_BigEndianScalar_free"))) TS_BigEndianScalar_free(uint64_t thing) {
445         if (!ptr_is_owned(thing)) return;
446         void* thing_ptr = untag_ptr(thing);
447         CHECK_ACCESS(thing_ptr);
448         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
449         FREE(untag_ptr(thing));
450         BigEndianScalar_free(thing_conv);
451 }
452
453 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
454         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
455         switch(obj->tag) {
456                 case LDKBech32Error_MissingSeparator: return 0;
457                 case LDKBech32Error_InvalidChecksum: return 1;
458                 case LDKBech32Error_InvalidLength: return 2;
459                 case LDKBech32Error_InvalidChar: return 3;
460                 case LDKBech32Error_InvalidData: return 4;
461                 case LDKBech32Error_InvalidPadding: return 5;
462                 case LDKBech32Error_MixedCase: return 6;
463                 default: abort();
464         }
465 }
466 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
467         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
468         assert(obj->tag == LDKBech32Error_InvalidChar);
469                         int32_t invalid_char_conv = obj->invalid_char;
470         return invalid_char_conv;
471 }
472 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
473         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
474         assert(obj->tag == LDKBech32Error_InvalidData);
475                         int8_t invalid_data_conv = obj->invalid_data;
476         return invalid_data_conv;
477 }
478 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
479         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
480         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
481         return ret;
482 }
483 struct LDKCVec_u8Z TxOut_get_script_pubkey (struct LDKTxOut* thing) {   return CVec_u8Z_clone(&thing->script_pubkey);}int8_tArray  __attribute__((export_name("TS_TxOut_get_script_pubkey"))) TS_TxOut_get_script_pubkey(uint64_t thing) {
484         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
485         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
486         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
487         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
488         CVec_u8Z_free(ret_var);
489         return ret_arr;
490 }
491
492 uint64_t TxOut_get_value (struct LDKTxOut* thing) {     return thing->value;}int64_t  __attribute__((export_name("TS_TxOut_get_value"))) TS_TxOut_get_value(uint64_t thing) {
493         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
494         int64_t ret_conv = TxOut_get_value(thing_conv);
495         return ret_conv;
496 }
497
498 static inline struct LDKBlindedRoute CResult_BlindedRouteNoneZ_get_ok(LDKCResult_BlindedRouteNoneZ *NONNULL_PTR owner){
499         LDKBlindedRoute ret = *owner->contents.result;
500         ret.is_owned = false;
501         return ret;
502 }
503 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_get_ok"))) TS_CResult_BlindedRouteNoneZ_get_ok(uint64_t owner) {
504         LDKCResult_BlindedRouteNoneZ* owner_conv = (LDKCResult_BlindedRouteNoneZ*)untag_ptr(owner);
505         LDKBlindedRoute ret_var = CResult_BlindedRouteNoneZ_get_ok(owner_conv);
506         uint64_t ret_ref = 0;
507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
509         return ret_ref;
510 }
511
512 static inline void CResult_BlindedRouteNoneZ_get_err(LDKCResult_BlindedRouteNoneZ *NONNULL_PTR owner){
513 CHECK(!owner->result_ok);
514         return *owner->contents.err;
515 }
516 void  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_get_err"))) TS_CResult_BlindedRouteNoneZ_get_err(uint64_t owner) {
517         LDKCResult_BlindedRouteNoneZ* owner_conv = (LDKCResult_BlindedRouteNoneZ*)untag_ptr(owner);
518         CResult_BlindedRouteNoneZ_get_err(owner_conv);
519 }
520
521 uint32_t __attribute__((export_name("TS_LDKDecodeError_ty_from_ptr"))) TS_LDKDecodeError_ty_from_ptr(uint64_t ptr) {
522         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
523         switch(obj->tag) {
524                 case LDKDecodeError_UnknownVersion: return 0;
525                 case LDKDecodeError_UnknownRequiredFeature: return 1;
526                 case LDKDecodeError_InvalidValue: return 2;
527                 case LDKDecodeError_ShortRead: return 3;
528                 case LDKDecodeError_BadLengthDescriptor: return 4;
529                 case LDKDecodeError_Io: return 5;
530                 case LDKDecodeError_UnsupportedCompression: return 6;
531                 default: abort();
532         }
533 }
534 uint32_t __attribute__((export_name("TS_LDKDecodeError_Io_get_io"))) TS_LDKDecodeError_Io_get_io(uint64_t ptr) {
535         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
536         assert(obj->tag == LDKDecodeError_Io);
537                         uint32_t io_conv = LDKIOError_to_js(obj->io);
538         return io_conv;
539 }
540 static inline struct LDKBlindedRoute CResult_BlindedRouteDecodeErrorZ_get_ok(LDKCResult_BlindedRouteDecodeErrorZ *NONNULL_PTR owner){
541         LDKBlindedRoute ret = *owner->contents.result;
542         ret.is_owned = false;
543         return ret;
544 }
545 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_get_ok"))) TS_CResult_BlindedRouteDecodeErrorZ_get_ok(uint64_t owner) {
546         LDKCResult_BlindedRouteDecodeErrorZ* owner_conv = (LDKCResult_BlindedRouteDecodeErrorZ*)untag_ptr(owner);
547         LDKBlindedRoute ret_var = CResult_BlindedRouteDecodeErrorZ_get_ok(owner_conv);
548         uint64_t ret_ref = 0;
549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
551         return ret_ref;
552 }
553
554 static inline struct LDKDecodeError CResult_BlindedRouteDecodeErrorZ_get_err(LDKCResult_BlindedRouteDecodeErrorZ *NONNULL_PTR owner){
555 CHECK(!owner->result_ok);
556         return DecodeError_clone(&*owner->contents.err);
557 }
558 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_get_err"))) TS_CResult_BlindedRouteDecodeErrorZ_get_err(uint64_t owner) {
559         LDKCResult_BlindedRouteDecodeErrorZ* owner_conv = (LDKCResult_BlindedRouteDecodeErrorZ*)untag_ptr(owner);
560         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
561         *ret_copy = CResult_BlindedRouteDecodeErrorZ_get_err(owner_conv);
562         uint64_t ret_ref = tag_ptr(ret_copy, true);
563         return ret_ref;
564 }
565
566 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
567         LDKBlindedHop ret = *owner->contents.result;
568         ret.is_owned = false;
569         return ret;
570 }
571 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) {
572         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
573         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
574         uint64_t ret_ref = 0;
575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
577         return ret_ref;
578 }
579
580 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
581 CHECK(!owner->result_ok);
582         return DecodeError_clone(&*owner->contents.err);
583 }
584 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) {
585         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
586         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
587         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
588         uint64_t ret_ref = tag_ptr(ret_copy, true);
589         return ret_ref;
590 }
591
592 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
593 CHECK(owner->result_ok);
594         return *owner->contents.result;
595 }
596 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
597         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
598         CResult_NoneNoneZ_get_ok(owner_conv);
599 }
600
601 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
602 CHECK(!owner->result_ok);
603         return *owner->contents.err;
604 }
605 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
606         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
607         CResult_NoneNoneZ_get_err(owner_conv);
608 }
609
610 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
611         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
612         ret.is_owned = false;
613         return ret;
614 }
615 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
616         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
617         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
618         uint64_t ret_ref = 0;
619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
621         return ret_ref;
622 }
623
624 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
625 CHECK(!owner->result_ok);
626         return DecodeError_clone(&*owner->contents.err);
627 }
628 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
629         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
630         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
631         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
632         uint64_t ret_ref = tag_ptr(ret_copy, true);
633         return ret_ref;
634 }
635
636 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
637 CHECK(owner->result_ok);
638         return *owner->contents.result;
639 }
640 int8_tArray  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_ok"))) TS_CResult_SecretKeyErrorZ_get_ok(uint64_t owner) {
641         LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner);
642         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
643         memcpy(ret_arr->elems, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes, 32);
644         return ret_arr;
645 }
646
647 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
648 CHECK(!owner->result_ok);
649         return *owner->contents.err;
650 }
651 uint32_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_err"))) TS_CResult_SecretKeyErrorZ_get_err(uint64_t owner) {
652         LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner);
653         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_SecretKeyErrorZ_get_err(owner_conv));
654         return ret_conv;
655 }
656
657 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
658 CHECK(owner->result_ok);
659         return *owner->contents.result;
660 }
661 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint64_t owner) {
662         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
663         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
664         memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
665         return ret_arr;
666 }
667
668 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
669 CHECK(!owner->result_ok);
670         return *owner->contents.err;
671 }
672 uint32_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint64_t owner) {
673         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
674         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
675         return ret_conv;
676 }
677
678 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
679         LDKTxCreationKeys ret = *owner->contents.result;
680         ret.is_owned = false;
681         return ret;
682 }
683 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
684         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
685         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
686         uint64_t ret_ref = 0;
687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
689         return ret_ref;
690 }
691
692 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
693 CHECK(!owner->result_ok);
694         return DecodeError_clone(&*owner->contents.err);
695 }
696 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
697         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
698         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
699         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
700         uint64_t ret_ref = tag_ptr(ret_copy, true);
701         return ret_ref;
702 }
703
704 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
705         LDKChannelPublicKeys ret = *owner->contents.result;
706         ret.is_owned = false;
707         return ret;
708 }
709 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
710         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
711         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
712         uint64_t ret_ref = 0;
713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
715         return ret_ref;
716 }
717
718 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
719 CHECK(!owner->result_ok);
720         return DecodeError_clone(&*owner->contents.err);
721 }
722 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
723         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
724         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
725         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
726         uint64_t ret_ref = tag_ptr(ret_copy, true);
727         return ret_ref;
728 }
729
730 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
731         LDKTxCreationKeys ret = *owner->contents.result;
732         ret.is_owned = false;
733         return ret;
734 }
735 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_ok"))) TS_CResult_TxCreationKeysErrorZ_get_ok(uint64_t owner) {
736         LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner);
737         LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
738         uint64_t ret_ref = 0;
739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
741         return ret_ref;
742 }
743
744 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
745 CHECK(!owner->result_ok);
746         return *owner->contents.err;
747 }
748 uint32_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_err"))) TS_CResult_TxCreationKeysErrorZ_get_err(uint64_t owner) {
749         LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner);
750         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_TxCreationKeysErrorZ_get_err(owner_conv));
751         return ret_conv;
752 }
753
754 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
755         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
756         switch(obj->tag) {
757                 case LDKCOption_u32Z_Some: return 0;
758                 case LDKCOption_u32Z_None: return 1;
759                 default: abort();
760         }
761 }
762 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
763         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
764         assert(obj->tag == LDKCOption_u32Z_Some);
765                         int32_t some_conv = obj->some;
766         return some_conv;
767 }
768 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
769         LDKHTLCOutputInCommitment ret = *owner->contents.result;
770         ret.is_owned = false;
771         return ret;
772 }
773 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
774         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
775         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
776         uint64_t ret_ref = 0;
777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
779         return ret_ref;
780 }
781
782 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
783 CHECK(!owner->result_ok);
784         return DecodeError_clone(&*owner->contents.err);
785 }
786 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
787         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
788         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
789         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
790         uint64_t ret_ref = tag_ptr(ret_copy, true);
791         return ret_ref;
792 }
793
794 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
795         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
796         ret.is_owned = false;
797         return ret;
798 }
799 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
800         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
801         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
802         uint64_t ret_ref = 0;
803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
805         return ret_ref;
806 }
807
808 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
809 CHECK(!owner->result_ok);
810         return DecodeError_clone(&*owner->contents.err);
811 }
812 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
813         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
814         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
815         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
816         uint64_t ret_ref = tag_ptr(ret_copy, true);
817         return ret_ref;
818 }
819
820 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
821         LDKChannelTransactionParameters ret = *owner->contents.result;
822         ret.is_owned = false;
823         return ret;
824 }
825 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
826         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
827         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
828         uint64_t ret_ref = 0;
829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
831         return ret_ref;
832 }
833
834 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
835 CHECK(!owner->result_ok);
836         return DecodeError_clone(&*owner->contents.err);
837 }
838 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
839         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
840         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
841         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
842         uint64_t ret_ref = tag_ptr(ret_copy, true);
843         return ret_ref;
844 }
845
846 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
847         LDKHolderCommitmentTransaction ret = *owner->contents.result;
848         ret.is_owned = false;
849         return ret;
850 }
851 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
852         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
853         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
854         uint64_t ret_ref = 0;
855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
857         return ret_ref;
858 }
859
860 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
861 CHECK(!owner->result_ok);
862         return DecodeError_clone(&*owner->contents.err);
863 }
864 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
865         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
866         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
867         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
868         uint64_t ret_ref = tag_ptr(ret_copy, true);
869         return ret_ref;
870 }
871
872 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
873         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
874         ret.is_owned = false;
875         return ret;
876 }
877 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
878         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
879         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
880         uint64_t ret_ref = 0;
881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
883         return ret_ref;
884 }
885
886 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
887 CHECK(!owner->result_ok);
888         return DecodeError_clone(&*owner->contents.err);
889 }
890 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
891         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
892         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
893         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
894         uint64_t ret_ref = tag_ptr(ret_copy, true);
895         return ret_ref;
896 }
897
898 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
899         LDKTrustedClosingTransaction ret = *owner->contents.result;
900         ret.is_owned = false;
901         return ret;
902 }
903 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
904         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
905         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
906         uint64_t ret_ref = 0;
907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
909         return ret_ref;
910 }
911
912 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
913 CHECK(!owner->result_ok);
914         return *owner->contents.err;
915 }
916 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
917         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
918         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
919 }
920
921 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
922         LDKCommitmentTransaction ret = *owner->contents.result;
923         ret.is_owned = false;
924         return ret;
925 }
926 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
927         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
928         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
929         uint64_t ret_ref = 0;
930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
932         return ret_ref;
933 }
934
935 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
936 CHECK(!owner->result_ok);
937         return DecodeError_clone(&*owner->contents.err);
938 }
939 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
940         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
941         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
942         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
943         uint64_t ret_ref = tag_ptr(ret_copy, true);
944         return ret_ref;
945 }
946
947 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
948         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
949         ret.is_owned = false;
950         return ret;
951 }
952 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
953         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
954         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
955         uint64_t ret_ref = 0;
956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
958         return ret_ref;
959 }
960
961 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
962 CHECK(!owner->result_ok);
963         return *owner->contents.err;
964 }
965 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
966         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
967         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
968 }
969
970 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
971 CHECK(owner->result_ok);
972         return *owner->contents.result;
973 }
974 ptrArray  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_ok"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint64_t owner) {
975         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
976         LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
977         ptrArray ret_arr = NULL;
978         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
979         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
980         for (size_t m = 0; m < ret_var.datalen; m++) {
981                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
982                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
983                 ret_arr_ptr[m] = ret_conv_12_arr;
984         }
985         
986         return ret_arr;
987 }
988
989 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
990 CHECK(!owner->result_ok);
991         return *owner->contents.err;
992 }
993 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_err"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint64_t owner) {
994         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
995         CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
996 }
997
998 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
999         LDKShutdownScript ret = *owner->contents.result;
1000         ret.is_owned = false;
1001         return ret;
1002 }
1003 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
1004         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1005         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1006         uint64_t ret_ref = 0;
1007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1009         return ret_ref;
1010 }
1011
1012 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1013 CHECK(!owner->result_ok);
1014         return DecodeError_clone(&*owner->contents.err);
1015 }
1016 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
1017         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1018         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1019         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1020         uint64_t ret_ref = tag_ptr(ret_copy, true);
1021         return ret_ref;
1022 }
1023
1024 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1025         LDKShutdownScript ret = *owner->contents.result;
1026         ret.is_owned = false;
1027         return ret;
1028 }
1029 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
1030         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1031         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
1032         uint64_t ret_ref = 0;
1033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1035         return ret_ref;
1036 }
1037
1038 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1039         LDKInvalidShutdownScript ret = *owner->contents.err;
1040         ret.is_owned = false;
1041         return ret;
1042 }
1043 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
1044         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1045         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
1046         uint64_t ret_ref = 0;
1047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1049         return ret_ref;
1050 }
1051
1052 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1053         LDKRouteHop ret = *owner->contents.result;
1054         ret.is_owned = false;
1055         return ret;
1056 }
1057 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
1058         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1059         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
1060         uint64_t ret_ref = 0;
1061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1063         return ret_ref;
1064 }
1065
1066 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1067 CHECK(!owner->result_ok);
1068         return DecodeError_clone(&*owner->contents.err);
1069 }
1070 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
1071         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1072         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1073         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
1074         uint64_t ret_ref = tag_ptr(ret_copy, true);
1075         return ret_ref;
1076 }
1077
1078 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1079         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1080         for (size_t i = 0; i < ret.datalen; i++) {
1081                 ret.data[i] = RouteHop_clone(&orig->data[i]);
1082         }
1083         return ret;
1084 }
1085 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1086         LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1087         for (size_t i = 0; i < ret.datalen; i++) {
1088                 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1089         }
1090         return ret;
1091 }
1092 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1093         LDKRoute ret = *owner->contents.result;
1094         ret.is_owned = false;
1095         return ret;
1096 }
1097 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
1098         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1099         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1100         uint64_t ret_ref = 0;
1101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1103         return ret_ref;
1104 }
1105
1106 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1107 CHECK(!owner->result_ok);
1108         return DecodeError_clone(&*owner->contents.err);
1109 }
1110 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
1111         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1112         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1113         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1114         uint64_t ret_ref = tag_ptr(ret_copy, true);
1115         return ret_ref;
1116 }
1117
1118 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1119         LDKRouteParameters ret = *owner->contents.result;
1120         ret.is_owned = false;
1121         return ret;
1122 }
1123 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
1124         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1125         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1126         uint64_t ret_ref = 0;
1127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1129         return ret_ref;
1130 }
1131
1132 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1133 CHECK(!owner->result_ok);
1134         return DecodeError_clone(&*owner->contents.err);
1135 }
1136 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
1137         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1138         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1139         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1140         uint64_t ret_ref = tag_ptr(ret_copy, true);
1141         return ret_ref;
1142 }
1143
1144 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1145         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1146         for (size_t i = 0; i < ret.datalen; i++) {
1147                 ret.data[i] = RouteHint_clone(&orig->data[i]);
1148         }
1149         return ret;
1150 }
1151 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
1152         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1153         switch(obj->tag) {
1154                 case LDKCOption_u64Z_Some: return 0;
1155                 case LDKCOption_u64Z_None: return 1;
1156                 default: abort();
1157         }
1158 }
1159 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
1160         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1161         assert(obj->tag == LDKCOption_u64Z_Some);
1162                         int64_t some_conv = obj->some;
1163         return some_conv;
1164 }
1165 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1166         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1167         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1168         return ret;
1169 }
1170 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1171         LDKPaymentParameters ret = *owner->contents.result;
1172         ret.is_owned = false;
1173         return ret;
1174 }
1175 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
1176         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1177         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1178         uint64_t ret_ref = 0;
1179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1181         return ret_ref;
1182 }
1183
1184 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1185 CHECK(!owner->result_ok);
1186         return DecodeError_clone(&*owner->contents.err);
1187 }
1188 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
1189         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1190         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1191         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1192         uint64_t ret_ref = tag_ptr(ret_copy, true);
1193         return ret_ref;
1194 }
1195
1196 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1197         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1198         for (size_t i = 0; i < ret.datalen; i++) {
1199                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1200         }
1201         return ret;
1202 }
1203 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1204         LDKRouteHint ret = *owner->contents.result;
1205         ret.is_owned = false;
1206         return ret;
1207 }
1208 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
1209         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1210         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1211         uint64_t ret_ref = 0;
1212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1214         return ret_ref;
1215 }
1216
1217 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1218 CHECK(!owner->result_ok);
1219         return DecodeError_clone(&*owner->contents.err);
1220 }
1221 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
1222         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1223         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1224         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1225         uint64_t ret_ref = tag_ptr(ret_copy, true);
1226         return ret_ref;
1227 }
1228
1229 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1230         LDKRouteHintHop ret = *owner->contents.result;
1231         ret.is_owned = false;
1232         return ret;
1233 }
1234 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
1235         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1236         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1237         uint64_t ret_ref = 0;
1238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1240         return ret_ref;
1241 }
1242
1243 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1244 CHECK(!owner->result_ok);
1245         return DecodeError_clone(&*owner->contents.err);
1246 }
1247 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
1248         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1249         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1250         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1251         uint64_t ret_ref = tag_ptr(ret_copy, true);
1252         return ret_ref;
1253 }
1254
1255 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1256         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1257         for (size_t i = 0; i < ret.datalen; i++) {
1258                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1259         }
1260         return ret;
1261 }
1262 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1263         LDKRoute ret = *owner->contents.result;
1264         ret.is_owned = false;
1265         return ret;
1266 }
1267 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
1268         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1269         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1270         uint64_t ret_ref = 0;
1271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1273         return ret_ref;
1274 }
1275
1276 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1277         LDKLightningError ret = *owner->contents.err;
1278         ret.is_owned = false;
1279         return ret;
1280 }
1281 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
1282         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1283         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1284         uint64_t ret_ref = 0;
1285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1287         return ret_ref;
1288 }
1289
1290 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
1291         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1292         switch(obj->tag) {
1293                 case LDKPaymentPurpose_InvoicePayment: return 0;
1294                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
1295                 default: abort();
1296         }
1297 }
1298 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint64_t ptr) {
1299         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1300         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1301                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1302                         memcpy(payment_preimage_arr->elems, obj->invoice_payment.payment_preimage.data, 32);
1303         return payment_preimage_arr;
1304 }
1305 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint64_t ptr) {
1306         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1307         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1308                         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
1309                         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
1310         return payment_secret_arr;
1311 }
1312 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
1313         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1314         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
1315                         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
1316                         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
1317         return spontaneous_payment_arr;
1318 }
1319 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1320 CHECK(owner->result_ok);
1321         return PaymentPurpose_clone(&*owner->contents.result);
1322 }
1323 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
1324         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1325         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
1326         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
1327         uint64_t ret_ref = tag_ptr(ret_copy, true);
1328         return ret_ref;
1329 }
1330
1331 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1332 CHECK(!owner->result_ok);
1333         return DecodeError_clone(&*owner->contents.err);
1334 }
1335 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
1336         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1337         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1338         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
1339         uint64_t ret_ref = tag_ptr(ret_copy, true);
1340         return ret_ref;
1341 }
1342
1343 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
1344         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1345         switch(obj->tag) {
1346                 case LDKClosureReason_CounterpartyForceClosed: return 0;
1347                 case LDKClosureReason_HolderForceClosed: return 1;
1348                 case LDKClosureReason_CooperativeClosure: return 2;
1349                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
1350                 case LDKClosureReason_FundingTimedOut: return 4;
1351                 case LDKClosureReason_ProcessingError: return 5;
1352                 case LDKClosureReason_DisconnectedPeer: return 6;
1353                 case LDKClosureReason_OutdatedChannelManager: return 7;
1354                 default: abort();
1355         }
1356 }
1357 jstring __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
1358         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1359         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
1360                         LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1361                         jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1362         return peer_msg_conv;
1363 }
1364 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
1365         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1366         assert(obj->tag == LDKClosureReason_ProcessingError);
1367                         LDKStr err_str = obj->processing_error.err;
1368                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1369         return err_conv;
1370 }
1371 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
1372         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1373         switch(obj->tag) {
1374                 case LDKCOption_ClosureReasonZ_Some: return 0;
1375                 case LDKCOption_ClosureReasonZ_None: return 1;
1376                 default: abort();
1377         }
1378 }
1379 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
1380         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1381         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
1382                         uint64_t some_ref = tag_ptr(&obj->some, false);
1383         return some_ref;
1384 }
1385 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1386 CHECK(owner->result_ok);
1387         return COption_ClosureReasonZ_clone(&*owner->contents.result);
1388 }
1389 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
1390         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1391         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
1392         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
1393         uint64_t ret_ref = tag_ptr(ret_copy, true);
1394         return ret_ref;
1395 }
1396
1397 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1398 CHECK(!owner->result_ok);
1399         return DecodeError_clone(&*owner->contents.err);
1400 }
1401 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
1402         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1403         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1404         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
1405         uint64_t ret_ref = tag_ptr(ret_copy, true);
1406         return ret_ref;
1407 }
1408
1409 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
1410         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1411         switch(obj->tag) {
1412                 case LDKHTLCDestination_NextHopChannel: return 0;
1413                 case LDKHTLCDestination_UnknownNextHop: return 1;
1414                 case LDKHTLCDestination_FailedPayment: return 2;
1415                 default: abort();
1416         }
1417 }
1418 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
1419         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1420         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1421                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1422                         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
1423         return node_id_arr;
1424 }
1425 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
1426         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1427         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1428                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1429                         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
1430         return channel_id_arr;
1431 }
1432 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
1433         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1434         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
1435                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
1436         return requested_forward_scid_conv;
1437 }
1438 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
1439         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1440         assert(obj->tag == LDKHTLCDestination_FailedPayment);
1441                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1442                         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
1443         return payment_hash_arr;
1444 }
1445 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
1446         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
1447         switch(obj->tag) {
1448                 case LDKCOption_HTLCDestinationZ_Some: return 0;
1449                 case LDKCOption_HTLCDestinationZ_None: return 1;
1450                 default: abort();
1451         }
1452 }
1453 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
1454         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
1455         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
1456                         uint64_t some_ref = tag_ptr(&obj->some, false);
1457         return some_ref;
1458 }
1459 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1460 CHECK(owner->result_ok);
1461         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
1462 }
1463 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
1464         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
1465         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
1466         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
1467         uint64_t ret_ref = tag_ptr(ret_copy, true);
1468         return ret_ref;
1469 }
1470
1471 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1472 CHECK(!owner->result_ok);
1473         return DecodeError_clone(&*owner->contents.err);
1474 }
1475 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
1476         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
1477         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1478         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
1479         uint64_t ret_ref = tag_ptr(ret_copy, true);
1480         return ret_ref;
1481 }
1482
1483 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
1484         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1485         switch(obj->tag) {
1486                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
1487                 case LDKNetworkUpdate_ChannelFailure: return 1;
1488                 case LDKNetworkUpdate_NodeFailure: return 2;
1489                 default: abort();
1490         }
1491 }
1492 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
1493         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1494         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
1495                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1496                         uint64_t msg_ref = 0;
1497                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1498                         msg_ref = tag_ptr(msg_var.inner, false);
1499         return msg_ref;
1500 }
1501 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
1502         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1503         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1504                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
1505         return short_channel_id_conv;
1506 }
1507 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
1508         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1509         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1510                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
1511         return is_permanent_conv;
1512 }
1513 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
1514         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1515         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1516                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1517                         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
1518         return node_id_arr;
1519 }
1520 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
1521         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1522         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1523                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
1524         return is_permanent_conv;
1525 }
1526 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
1527         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
1528         switch(obj->tag) {
1529                 case LDKCOption_NetworkUpdateZ_Some: return 0;
1530                 case LDKCOption_NetworkUpdateZ_None: return 1;
1531                 default: abort();
1532         }
1533 }
1534 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
1535         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
1536         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
1537                         uint64_t some_ref = tag_ptr(&obj->some, false);
1538         return some_ref;
1539 }
1540 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
1541         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1542         switch(obj->tag) {
1543                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1544                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1545                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1546                 default: abort();
1547         }
1548 }
1549 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
1550         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1551         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1552                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1553                         uint64_t outpoint_ref = 0;
1554                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1555                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1556         return outpoint_ref;
1557 }
1558 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
1559         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1560         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1561                         LDKTxOut* output_ref = &obj->static_output.output;
1562         return tag_ptr(output_ref, false);
1563 }
1564 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
1565         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1566         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1567                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1568                         uint64_t delayed_payment_output_ref = 0;
1569                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1570                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1571         return delayed_payment_output_ref;
1572 }
1573 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
1574         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1575         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1576                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1577                         uint64_t static_payment_output_ref = 0;
1578                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1579                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1580         return static_payment_output_ref;
1581 }
1582 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1583         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1584         for (size_t i = 0; i < ret.datalen; i++) {
1585                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1586         }
1587         return ret;
1588 }
1589 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
1590         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1591         switch(obj->tag) {
1592                 case LDKEvent_FundingGenerationReady: return 0;
1593                 case LDKEvent_PaymentReceived: return 1;
1594                 case LDKEvent_PaymentClaimed: return 2;
1595                 case LDKEvent_PaymentSent: return 3;
1596                 case LDKEvent_PaymentFailed: return 4;
1597                 case LDKEvent_PaymentPathSuccessful: return 5;
1598                 case LDKEvent_PaymentPathFailed: return 6;
1599                 case LDKEvent_ProbeSuccessful: return 7;
1600                 case LDKEvent_ProbeFailed: return 8;
1601                 case LDKEvent_PendingHTLCsForwardable: return 9;
1602                 case LDKEvent_SpendableOutputs: return 10;
1603                 case LDKEvent_PaymentForwarded: return 11;
1604                 case LDKEvent_ChannelClosed: return 12;
1605                 case LDKEvent_DiscardFunding: return 13;
1606                 case LDKEvent_OpenChannelRequest: return 14;
1607                 case LDKEvent_HTLCHandlingFailed: return 15;
1608                 default: abort();
1609         }
1610 }
1611 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
1612         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1613         assert(obj->tag == LDKEvent_FundingGenerationReady);
1614                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1615                         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
1616         return temporary_channel_id_arr;
1617 }
1618 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
1619         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1620         assert(obj->tag == LDKEvent_FundingGenerationReady);
1621                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1622                         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
1623         return counterparty_node_id_arr;
1624 }
1625 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
1626         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1627         assert(obj->tag == LDKEvent_FundingGenerationReady);
1628                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
1629         return channel_value_satoshis_conv;
1630 }
1631 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
1632         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1633         assert(obj->tag == LDKEvent_FundingGenerationReady);
1634                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1635                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
1636                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
1637         return output_script_arr;
1638 }
1639 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
1640         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1641         assert(obj->tag == LDKEvent_FundingGenerationReady);
1642                         int64_t user_channel_id_conv = obj->funding_generation_ready.user_channel_id;
1643         return user_channel_id_conv;
1644 }
1645 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_payment_hash"))) TS_LDKEvent_PaymentReceived_get_payment_hash(uint64_t ptr) {
1646         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1647         assert(obj->tag == LDKEvent_PaymentReceived);
1648                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1649                         memcpy(payment_hash_arr->elems, obj->payment_received.payment_hash.data, 32);
1650         return payment_hash_arr;
1651 }
1652 int64_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_amount_msat"))) TS_LDKEvent_PaymentReceived_get_amount_msat(uint64_t ptr) {
1653         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1654         assert(obj->tag == LDKEvent_PaymentReceived);
1655                         int64_t amount_msat_conv = obj->payment_received.amount_msat;
1656         return amount_msat_conv;
1657 }
1658 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_purpose"))) TS_LDKEvent_PaymentReceived_get_purpose(uint64_t ptr) {
1659         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1660         assert(obj->tag == LDKEvent_PaymentReceived);
1661                         uint64_t purpose_ref = tag_ptr(&obj->payment_received.purpose, false);
1662         return purpose_ref;
1663 }
1664 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
1665         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1666         assert(obj->tag == LDKEvent_PaymentClaimed);
1667                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1668                         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
1669         return payment_hash_arr;
1670 }
1671 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
1672         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1673         assert(obj->tag == LDKEvent_PaymentClaimed);
1674                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
1675         return amount_msat_conv;
1676 }
1677 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
1678         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1679         assert(obj->tag == LDKEvent_PaymentClaimed);
1680                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
1681         return purpose_ref;
1682 }
1683 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
1684         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1685         assert(obj->tag == LDKEvent_PaymentSent);
1686                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1687                         memcpy(payment_id_arr->elems, obj->payment_sent.payment_id.data, 32);
1688         return payment_id_arr;
1689 }
1690 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
1691         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1692         assert(obj->tag == LDKEvent_PaymentSent);
1693                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1694                         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
1695         return payment_preimage_arr;
1696 }
1697 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
1698         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1699         assert(obj->tag == LDKEvent_PaymentSent);
1700                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1701                         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
1702         return payment_hash_arr;
1703 }
1704 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
1705         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1706         assert(obj->tag == LDKEvent_PaymentSent);
1707                         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
1708         return fee_paid_msat_ref;
1709 }
1710 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
1711         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1712         assert(obj->tag == LDKEvent_PaymentFailed);
1713                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1714                         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
1715         return payment_id_arr;
1716 }
1717 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
1718         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1719         assert(obj->tag == LDKEvent_PaymentFailed);
1720                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1721                         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
1722         return payment_hash_arr;
1723 }
1724 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
1725         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1726         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1727                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1728                         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
1729         return payment_id_arr;
1730 }
1731 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
1732         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1733         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1734                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1735                         memcpy(payment_hash_arr->elems, obj->payment_path_successful.payment_hash.data, 32);
1736         return payment_hash_arr;
1737 }
1738 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
1739         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1740         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1741                         LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
1742                         uint64_tArray path_arr = NULL;
1743                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1744                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1745                         for (size_t k = 0; k < path_var.datalen; k++) {
1746                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1747                                 uint64_t path_conv_10_ref = 0;
1748                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1749                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1750                                 path_arr_ptr[k] = path_conv_10_ref;
1751                         }
1752                         
1753         return path_arr;
1754 }
1755 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
1756         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1757         assert(obj->tag == LDKEvent_PaymentPathFailed);
1758                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1759                         memcpy(payment_id_arr->elems, obj->payment_path_failed.payment_id.data, 32);
1760         return payment_id_arr;
1761 }
1762 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
1763         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1764         assert(obj->tag == LDKEvent_PaymentPathFailed);
1765                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1766                         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
1767         return payment_hash_arr;
1768 }
1769 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently"))) TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(uint64_t ptr) {
1770         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1771         assert(obj->tag == LDKEvent_PaymentPathFailed);
1772                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
1773         return payment_failed_permanently_conv;
1774 }
1775 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_network_update"))) TS_LDKEvent_PaymentPathFailed_get_network_update(uint64_t ptr) {
1776         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1777         assert(obj->tag == LDKEvent_PaymentPathFailed);
1778                         uint64_t network_update_ref = tag_ptr(&obj->payment_path_failed.network_update, false);
1779         return network_update_ref;
1780 }
1781 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_all_paths_failed"))) TS_LDKEvent_PaymentPathFailed_get_all_paths_failed(uint64_t ptr) {
1782         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1783         assert(obj->tag == LDKEvent_PaymentPathFailed);
1784                         jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed;
1785         return all_paths_failed_conv;
1786 }
1787 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
1788         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1789         assert(obj->tag == LDKEvent_PaymentPathFailed);
1790                         LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
1791                         uint64_tArray path_arr = NULL;
1792                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1793                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1794                         for (size_t k = 0; k < path_var.datalen; k++) {
1795                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1796                                 uint64_t path_conv_10_ref = 0;
1797                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1798                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1799                                 path_arr_ptr[k] = path_conv_10_ref;
1800                         }
1801                         
1802         return path_arr;
1803 }
1804 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
1805         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1806         assert(obj->tag == LDKEvent_PaymentPathFailed);
1807                         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
1808         return short_channel_id_ref;
1809 }
1810 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_retry"))) TS_LDKEvent_PaymentPathFailed_get_retry(uint64_t ptr) {
1811         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1812         assert(obj->tag == LDKEvent_PaymentPathFailed);
1813                         LDKRouteParameters retry_var = obj->payment_path_failed.retry;
1814                         uint64_t retry_ref = 0;
1815                         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
1816                         retry_ref = tag_ptr(retry_var.inner, false);
1817         return retry_ref;
1818 }
1819 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
1820         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1821         assert(obj->tag == LDKEvent_ProbeSuccessful);
1822                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1823                         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
1824         return payment_id_arr;
1825 }
1826 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
1827         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1828         assert(obj->tag == LDKEvent_ProbeSuccessful);
1829                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1830                         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
1831         return payment_hash_arr;
1832 }
1833 uint64_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
1834         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1835         assert(obj->tag == LDKEvent_ProbeSuccessful);
1836                         LDKCVec_RouteHopZ path_var = obj->probe_successful.path;
1837                         uint64_tArray path_arr = NULL;
1838                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1839                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1840                         for (size_t k = 0; k < path_var.datalen; k++) {
1841                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1842                                 uint64_t path_conv_10_ref = 0;
1843                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1844                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1845                                 path_arr_ptr[k] = path_conv_10_ref;
1846                         }
1847                         
1848         return path_arr;
1849 }
1850 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
1851         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1852         assert(obj->tag == LDKEvent_ProbeFailed);
1853                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1854                         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
1855         return payment_id_arr;
1856 }
1857 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
1858         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1859         assert(obj->tag == LDKEvent_ProbeFailed);
1860                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1861                         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
1862         return payment_hash_arr;
1863 }
1864 uint64_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
1865         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1866         assert(obj->tag == LDKEvent_ProbeFailed);
1867                         LDKCVec_RouteHopZ path_var = obj->probe_failed.path;
1868                         uint64_tArray path_arr = NULL;
1869                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1870                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1871                         for (size_t k = 0; k < path_var.datalen; k++) {
1872                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1873                                 uint64_t path_conv_10_ref = 0;
1874                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1875                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1876                                 path_arr_ptr[k] = path_conv_10_ref;
1877                         }
1878                         
1879         return path_arr;
1880 }
1881 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
1882         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1883         assert(obj->tag == LDKEvent_ProbeFailed);
1884                         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
1885         return short_channel_id_ref;
1886 }
1887 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
1888         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1889         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
1890                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
1891         return time_forwardable_conv;
1892 }
1893 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
1894         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1895         assert(obj->tag == LDKEvent_SpendableOutputs);
1896                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1897                         uint64_tArray outputs_arr = NULL;
1898                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
1899                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
1900                         for (size_t b = 0; b < outputs_var.datalen; b++) {
1901                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
1902                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
1903                         }
1904                         
1905         return outputs_arr;
1906 }
1907 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
1908         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1909         assert(obj->tag == LDKEvent_PaymentForwarded);
1910                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
1911                         memcpy(prev_channel_id_arr->elems, obj->payment_forwarded.prev_channel_id.data, 32);
1912         return prev_channel_id_arr;
1913 }
1914 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
1915         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1916         assert(obj->tag == LDKEvent_PaymentForwarded);
1917                         int8_tArray next_channel_id_arr = init_int8_tArray(32, __LINE__);
1918                         memcpy(next_channel_id_arr->elems, obj->payment_forwarded.next_channel_id.data, 32);
1919         return next_channel_id_arr;
1920 }
1921 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint64_t ptr) {
1922         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1923         assert(obj->tag == LDKEvent_PaymentForwarded);
1924                         uint64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
1925         return fee_earned_msat_ref;
1926 }
1927 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
1928         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1929         assert(obj->tag == LDKEvent_PaymentForwarded);
1930                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
1931         return claim_from_onchain_tx_conv;
1932 }
1933 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
1934         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1935         assert(obj->tag == LDKEvent_ChannelClosed);
1936                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1937                         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
1938         return channel_id_arr;
1939 }
1940 int64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
1941         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1942         assert(obj->tag == LDKEvent_ChannelClosed);
1943                         int64_t user_channel_id_conv = obj->channel_closed.user_channel_id;
1944         return user_channel_id_conv;
1945 }
1946 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
1947         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1948         assert(obj->tag == LDKEvent_ChannelClosed);
1949                         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
1950         return reason_ref;
1951 }
1952 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
1953         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1954         assert(obj->tag == LDKEvent_DiscardFunding);
1955                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1956                         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
1957         return channel_id_arr;
1958 }
1959 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
1960         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1961         assert(obj->tag == LDKEvent_DiscardFunding);
1962                         LDKTransaction transaction_var = obj->discard_funding.transaction;
1963                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
1964                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
1965         return transaction_arr;
1966 }
1967 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
1968         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1969         assert(obj->tag == LDKEvent_OpenChannelRequest);
1970                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1971                         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
1972         return temporary_channel_id_arr;
1973 }
1974 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
1975         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1976         assert(obj->tag == LDKEvent_OpenChannelRequest);
1977                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1978                         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
1979         return counterparty_node_id_arr;
1980 }
1981 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
1982         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1983         assert(obj->tag == LDKEvent_OpenChannelRequest);
1984                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
1985         return funding_satoshis_conv;
1986 }
1987 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
1988         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1989         assert(obj->tag == LDKEvent_OpenChannelRequest);
1990                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
1991         return push_msat_conv;
1992 }
1993 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
1994         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1995         assert(obj->tag == LDKEvent_OpenChannelRequest);
1996                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
1997                         uint64_t channel_type_ref = 0;
1998                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
1999                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
2000         return channel_type_ref;
2001 }
2002 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
2003         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2004         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2005                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
2006                         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
2007         return prev_channel_id_arr;
2008 }
2009 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
2010         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2011         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2012                         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
2013         return failed_next_destination_ref;
2014 }
2015 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
2016         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2017         switch(obj->tag) {
2018                 case LDKCOption_EventZ_Some: return 0;
2019                 case LDKCOption_EventZ_None: return 1;
2020                 default: abort();
2021         }
2022 }
2023 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
2024         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2025         assert(obj->tag == LDKCOption_EventZ_Some);
2026                         uint64_t some_ref = tag_ptr(&obj->some, false);
2027         return some_ref;
2028 }
2029 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2030 CHECK(owner->result_ok);
2031         return COption_EventZ_clone(&*owner->contents.result);
2032 }
2033 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
2034         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2035         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2036         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
2037         uint64_t ret_ref = tag_ptr(ret_copy, true);
2038         return ret_ref;
2039 }
2040
2041 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2042 CHECK(!owner->result_ok);
2043         return DecodeError_clone(&*owner->contents.err);
2044 }
2045 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
2046         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2047         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2048         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
2049         uint64_t ret_ref = tag_ptr(ret_copy, true);
2050         return ret_ref;
2051 }
2052
2053 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
2054         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2055         switch(obj->tag) {
2056                 case LDKErrorAction_DisconnectPeer: return 0;
2057                 case LDKErrorAction_IgnoreError: return 1;
2058                 case LDKErrorAction_IgnoreAndLog: return 2;
2059                 case LDKErrorAction_IgnoreDuplicateGossip: return 3;
2060                 case LDKErrorAction_SendErrorMessage: return 4;
2061                 case LDKErrorAction_SendWarningMessage: return 5;
2062                 default: abort();
2063         }
2064 }
2065 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
2066         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2067         assert(obj->tag == LDKErrorAction_DisconnectPeer);
2068                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2069                         uint64_t msg_ref = 0;
2070                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2071                         msg_ref = tag_ptr(msg_var.inner, false);
2072         return msg_ref;
2073 }
2074 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
2075         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2076         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
2077                         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
2078         return ignore_and_log_conv;
2079 }
2080 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
2081         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2082         assert(obj->tag == LDKErrorAction_SendErrorMessage);
2083                         LDKErrorMessage msg_var = obj->send_error_message.msg;
2084                         uint64_t msg_ref = 0;
2085                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2086                         msg_ref = tag_ptr(msg_var.inner, false);
2087         return msg_ref;
2088 }
2089 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
2090         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2091         assert(obj->tag == LDKErrorAction_SendWarningMessage);
2092                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
2093                         uint64_t msg_ref = 0;
2094                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2095                         msg_ref = tag_ptr(msg_var.inner, false);
2096         return msg_ref;
2097 }
2098 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
2099         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2100         assert(obj->tag == LDKErrorAction_SendWarningMessage);
2101                         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
2102         return log_level_conv;
2103 }
2104 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
2105         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2106         switch(obj->tag) {
2107                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
2108                 case LDKMessageSendEvent_SendOpenChannel: return 1;
2109                 case LDKMessageSendEvent_SendFundingCreated: return 2;
2110                 case LDKMessageSendEvent_SendFundingSigned: return 3;
2111                 case LDKMessageSendEvent_SendChannelReady: return 4;
2112                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 5;
2113                 case LDKMessageSendEvent_UpdateHTLCs: return 6;
2114                 case LDKMessageSendEvent_SendRevokeAndACK: return 7;
2115                 case LDKMessageSendEvent_SendClosingSigned: return 8;
2116                 case LDKMessageSendEvent_SendShutdown: return 9;
2117                 case LDKMessageSendEvent_SendChannelReestablish: return 10;
2118                 case LDKMessageSendEvent_SendChannelAnnouncement: return 11;
2119                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 12;
2120                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 13;
2121                 case LDKMessageSendEvent_SendChannelUpdate: return 14;
2122                 case LDKMessageSendEvent_HandleError: return 15;
2123                 case LDKMessageSendEvent_SendChannelRangeQuery: return 16;
2124                 case LDKMessageSendEvent_SendShortIdsQuery: return 17;
2125                 case LDKMessageSendEvent_SendReplyChannelRange: return 18;
2126                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 19;
2127                 default: abort();
2128         }
2129 }
2130 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
2131         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2132         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2133                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2134                         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
2135         return node_id_arr;
2136 }
2137 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
2138         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2139         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2140                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2141                         uint64_t msg_ref = 0;
2142                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2143                         msg_ref = tag_ptr(msg_var.inner, false);
2144         return msg_ref;
2145 }
2146 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
2147         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2148         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2149                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2150                         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
2151         return node_id_arr;
2152 }
2153 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
2154         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2155         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2156                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
2157                         uint64_t msg_ref = 0;
2158                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2159                         msg_ref = tag_ptr(msg_var.inner, false);
2160         return msg_ref;
2161 }
2162 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
2163         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2164         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2165                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2166                         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
2167         return node_id_arr;
2168 }
2169 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
2170         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2171         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2172                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
2173                         uint64_t msg_ref = 0;
2174                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2175                         msg_ref = tag_ptr(msg_var.inner, false);
2176         return msg_ref;
2177 }
2178 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
2179         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2180         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2181                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2182                         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
2183         return node_id_arr;
2184 }
2185 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
2186         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2187         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2188                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2189                         uint64_t msg_ref = 0;
2190                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2191                         msg_ref = tag_ptr(msg_var.inner, false);
2192         return msg_ref;
2193 }
2194 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
2195         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2196         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2197                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2198                         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
2199         return node_id_arr;
2200 }
2201 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
2202         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2203         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2204                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
2205                         uint64_t msg_ref = 0;
2206                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2207                         msg_ref = tag_ptr(msg_var.inner, false);
2208         return msg_ref;
2209 }
2210 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
2211         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2212         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2213                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2214                         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
2215         return node_id_arr;
2216 }
2217 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
2218         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2219         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2220                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2221                         uint64_t msg_ref = 0;
2222                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2223                         msg_ref = tag_ptr(msg_var.inner, false);
2224         return msg_ref;
2225 }
2226 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
2227         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2228         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2229                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2230                         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
2231         return node_id_arr;
2232 }
2233 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
2234         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2235         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2236                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2237                         uint64_t updates_ref = 0;
2238                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2239                         updates_ref = tag_ptr(updates_var.inner, false);
2240         return updates_ref;
2241 }
2242 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
2243         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2244         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2245                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2246                         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
2247         return node_id_arr;
2248 }
2249 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
2250         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2251         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2252                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2253                         uint64_t msg_ref = 0;
2254                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2255                         msg_ref = tag_ptr(msg_var.inner, false);
2256         return msg_ref;
2257 }
2258 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
2259         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2260         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2261                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2262                         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
2263         return node_id_arr;
2264 }
2265 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
2266         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2267         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2268                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2269                         uint64_t msg_ref = 0;
2270                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2271                         msg_ref = tag_ptr(msg_var.inner, false);
2272         return msg_ref;
2273 }
2274 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
2275         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2276         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2277                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2278                         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
2279         return node_id_arr;
2280 }
2281 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
2282         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2283         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2284                         LDKShutdown msg_var = obj->send_shutdown.msg;
2285                         uint64_t msg_ref = 0;
2286                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2287                         msg_ref = tag_ptr(msg_var.inner, false);
2288         return msg_ref;
2289 }
2290 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
2291         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2292         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2293                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2294                         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
2295         return node_id_arr;
2296 }
2297 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
2298         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2299         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2300                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2301                         uint64_t msg_ref = 0;
2302                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2303                         msg_ref = tag_ptr(msg_var.inner, false);
2304         return msg_ref;
2305 }
2306 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(uint64_t ptr) {
2307         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2308         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2309                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2310                         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
2311         return node_id_arr;
2312 }
2313 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(uint64_t ptr) {
2314         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2315         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2316                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
2317                         uint64_t msg_ref = 0;
2318                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2319                         msg_ref = tag_ptr(msg_var.inner, false);
2320         return msg_ref;
2321 }
2322 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(uint64_t ptr) {
2323         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2324         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2325                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
2326                         uint64_t update_msg_ref = 0;
2327                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2328                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
2329         return update_msg_ref;
2330 }
2331 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
2332         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2333         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2334                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2335                         uint64_t msg_ref = 0;
2336                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2337                         msg_ref = tag_ptr(msg_var.inner, false);
2338         return msg_ref;
2339 }
2340 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
2341         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2342         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2343                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2344                         uint64_t update_msg_ref = 0;
2345                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2346                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
2347         return update_msg_ref;
2348 }
2349 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
2350         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2351         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
2352                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2353                         uint64_t msg_ref = 0;
2354                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2355                         msg_ref = tag_ptr(msg_var.inner, false);
2356         return msg_ref;
2357 }
2358 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
2359         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2360         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2361                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2362                         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
2363         return node_id_arr;
2364 }
2365 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
2366         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2367         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2368                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2369                         uint64_t msg_ref = 0;
2370                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2371                         msg_ref = tag_ptr(msg_var.inner, false);
2372         return msg_ref;
2373 }
2374 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
2375         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2376         assert(obj->tag == LDKMessageSendEvent_HandleError);
2377                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2378                         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
2379         return node_id_arr;
2380 }
2381 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
2382         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2383         assert(obj->tag == LDKMessageSendEvent_HandleError);
2384                         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
2385         return action_ref;
2386 }
2387 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
2388         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2389         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2390                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2391                         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
2392         return node_id_arr;
2393 }
2394 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
2395         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2396         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2397                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2398                         uint64_t msg_ref = 0;
2399                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2400                         msg_ref = tag_ptr(msg_var.inner, false);
2401         return msg_ref;
2402 }
2403 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
2404         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2405         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2406                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2407                         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
2408         return node_id_arr;
2409 }
2410 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
2411         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2412         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2413                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
2414                         uint64_t msg_ref = 0;
2415                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2416                         msg_ref = tag_ptr(msg_var.inner, false);
2417         return msg_ref;
2418 }
2419 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
2420         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2421         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2422                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2423                         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
2424         return node_id_arr;
2425 }
2426 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
2427         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2428         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2429                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
2430                         uint64_t msg_ref = 0;
2431                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2432                         msg_ref = tag_ptr(msg_var.inner, false);
2433         return msg_ref;
2434 }
2435 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
2436         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2437         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2438                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2439                         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
2440         return node_id_arr;
2441 }
2442 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
2443         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2444         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2445                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
2446                         uint64_t msg_ref = 0;
2447                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2448                         msg_ref = tag_ptr(msg_var.inner, false);
2449         return msg_ref;
2450 }
2451 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2452         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2453         for (size_t i = 0; i < ret.datalen; i++) {
2454                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2455         }
2456         return ret;
2457 }
2458 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2459 CHECK(owner->result_ok);
2460         return TxOut_clone(&*owner->contents.result);
2461 }
2462 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_ok"))) TS_CResult_TxOutAccessErrorZ_get_ok(uint64_t owner) {
2463         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
2464         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
2465         *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
2466         return tag_ptr(ret_ref, true);
2467 }
2468
2469 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2470 CHECK(!owner->result_ok);
2471         return AccessError_clone(&*owner->contents.err);
2472 }
2473 uint32_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_err"))) TS_CResult_TxOutAccessErrorZ_get_err(uint64_t owner) {
2474         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
2475         uint32_t ret_conv = LDKAccessError_to_js(CResult_TxOutAccessErrorZ_get_err(owner_conv));
2476         return ret_conv;
2477 }
2478
2479 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2480         return owner->a;
2481 }
2482 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
2483         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2484         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2485         return ret_conv;
2486 }
2487
2488 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2489         return owner->b;
2490 }
2491 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
2492         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2493         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2494         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2495         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2496         return ret_arr;
2497 }
2498
2499 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2500         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2501         for (size_t i = 0; i < ret.datalen; i++) {
2502                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2503         }
2504         return ret;
2505 }
2506 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
2507         LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
2508         for (size_t i = 0; i < ret.datalen; i++) {
2509                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2510         }
2511         return ret;
2512 }
2513 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
2514         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2515         switch(obj->tag) {
2516                 case LDKMonitorEvent_HTLCEvent: return 0;
2517                 case LDKMonitorEvent_CommitmentTxConfirmed: return 1;
2518                 case LDKMonitorEvent_Completed: return 2;
2519                 case LDKMonitorEvent_UpdateFailed: return 3;
2520                 default: abort();
2521         }
2522 }
2523 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
2524         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2525         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
2526                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2527                         uint64_t htlc_event_ref = 0;
2528                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2529                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
2530         return htlc_event_ref;
2531 }
2532 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed"))) TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed(uint64_t ptr) {
2533         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2534         assert(obj->tag == LDKMonitorEvent_CommitmentTxConfirmed);
2535                         LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
2536                         uint64_t commitment_tx_confirmed_ref = 0;
2537                         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
2538                         commitment_tx_confirmed_ref = tag_ptr(commitment_tx_confirmed_var.inner, false);
2539         return commitment_tx_confirmed_ref;
2540 }
2541 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_funding_txo"))) TS_LDKMonitorEvent_Completed_get_funding_txo(uint64_t ptr) {
2542         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2543         assert(obj->tag == LDKMonitorEvent_Completed);
2544                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
2545                         uint64_t funding_txo_ref = 0;
2546                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2547                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
2548         return funding_txo_ref;
2549 }
2550 int64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_monitor_update_id"))) TS_LDKMonitorEvent_Completed_get_monitor_update_id(uint64_t ptr) {
2551         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2552         assert(obj->tag == LDKMonitorEvent_Completed);
2553                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
2554         return monitor_update_id_conv;
2555 }
2556 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateFailed_get_update_failed"))) TS_LDKMonitorEvent_UpdateFailed_get_update_failed(uint64_t ptr) {
2557         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2558         assert(obj->tag == LDKMonitorEvent_UpdateFailed);
2559                         LDKOutPoint update_failed_var = obj->update_failed;
2560                         uint64_t update_failed_ref = 0;
2561                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
2562                         update_failed_ref = tag_ptr(update_failed_var.inner, false);
2563         return update_failed_ref;
2564 }
2565 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
2566         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
2567         for (size_t i = 0; i < ret.datalen; i++) {
2568                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
2569         }
2570         return ret;
2571 }
2572 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2573         LDKOutPoint ret = owner->a;
2574         ret.is_owned = false;
2575         return ret;
2576 }
2577 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
2578         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2579         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
2580         uint64_t ret_ref = 0;
2581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2583         return ret_ref;
2584 }
2585
2586 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2587         return CVec_MonitorEventZ_clone(&owner->b);
2588 }
2589 uint64_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
2590         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2591         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
2592         uint64_tArray ret_arr = NULL;
2593         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2594         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2595         for (size_t o = 0; o < ret_var.datalen; o++) {
2596                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2597                 *ret_conv_14_copy = ret_var.data[o];
2598                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
2599                 ret_arr_ptr[o] = ret_conv_14_ref;
2600         }
2601         
2602         FREE(ret_var.data);
2603         return ret_arr;
2604 }
2605
2606 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2607         return owner->c;
2608 }
2609 int8_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
2610         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2611         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
2612         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
2613         return ret_arr;
2614 }
2615
2616 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
2617         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
2618         for (size_t i = 0; i < ret.datalen; i++) {
2619                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
2620         }
2621         return ret;
2622 }
2623 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2624         LDKFixedPenaltyScorer ret = *owner->contents.result;
2625         ret.is_owned = false;
2626         return ret;
2627 }
2628 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
2629         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2630         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2631         uint64_t ret_ref = 0;
2632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2634         return ret_ref;
2635 }
2636
2637 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2638 CHECK(!owner->result_ok);
2639         return DecodeError_clone(&*owner->contents.err);
2640 }
2641 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
2642         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2643         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2644         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2645         uint64_t ret_ref = tag_ptr(ret_copy, true);
2646         return ret_ref;
2647 }
2648
2649 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2650         return owner->a;
2651 }
2652 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
2653         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2654         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
2655         return ret_conv;
2656 }
2657
2658 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2659         return owner->b;
2660 }
2661 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
2662         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2663         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
2664         return ret_conv;
2665 }
2666
2667 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
2668         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2669         switch(obj->tag) {
2670                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
2671                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
2672                 default: abort();
2673         }
2674 }
2675 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
2676         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2677         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
2678                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2679                         *some_conv = obj->some;
2680                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
2681         return tag_ptr(some_conv, true);
2682 }
2683 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
2684         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
2685         for (size_t i = 0; i < ret.datalen; i++) {
2686                 ret.data[i] = NodeId_clone(&orig->data[i]);
2687         }
2688         return ret;
2689 }
2690 typedef struct LDKLogger_JCalls {
2691         atomic_size_t refcnt;
2692         uint32_t instance_ptr;
2693 } LDKLogger_JCalls;
2694 static void LDKLogger_JCalls_free(void* this_arg) {
2695         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2696         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2697                 FREE(j_calls);
2698         }
2699 }
2700 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
2701         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2702         LDKRecord record_var = *record;
2703         uint64_t record_ref = 0;
2704         record_var = Record_clone(&record_var);
2705         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
2706         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
2707         js_invoke_function_buuuuu(j_calls->instance_ptr, 0, record_ref, 0, 0, 0, 0, 0);
2708 }
2709 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2710         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2711         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2712 }
2713 static inline LDKLogger LDKLogger_init (JSValue o) {
2714         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2715         atomic_init(&calls->refcnt, 1);
2716         calls->instance_ptr = o;
2717
2718         LDKLogger ret = {
2719                 .this_arg = (void*) calls,
2720                 .log = log_LDKLogger_jcall,
2721                 .free = LDKLogger_JCalls_free,
2722         };
2723         return ret;
2724 }
2725 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
2726         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2727         *res_ptr = LDKLogger_init(o);
2728         return tag_ptr(res_ptr, true);
2729 }
2730 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2731         LDKProbabilisticScorer ret = *owner->contents.result;
2732         ret.is_owned = false;
2733         return ret;
2734 }
2735 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
2736         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2737         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
2738         uint64_t ret_ref = 0;
2739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2741         return ret_ref;
2742 }
2743
2744 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2745 CHECK(!owner->result_ok);
2746         return DecodeError_clone(&*owner->contents.err);
2747 }
2748 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
2749         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2750         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2751         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
2752         uint64_t ret_ref = tag_ptr(ret_copy, true);
2753         return ret_ref;
2754 }
2755
2756 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2757         LDKInitFeatures ret = *owner->contents.result;
2758         ret.is_owned = false;
2759         return ret;
2760 }
2761 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2762         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
2763         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
2764         uint64_t ret_ref = 0;
2765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2767         return ret_ref;
2768 }
2769
2770 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2771 CHECK(!owner->result_ok);
2772         return DecodeError_clone(&*owner->contents.err);
2773 }
2774 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2775         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
2776         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2777         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
2778         uint64_t ret_ref = tag_ptr(ret_copy, true);
2779         return ret_ref;
2780 }
2781
2782 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2783         LDKChannelFeatures ret = *owner->contents.result;
2784         ret.is_owned = false;
2785         return ret;
2786 }
2787 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2788         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
2789         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
2790         uint64_t ret_ref = 0;
2791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2793         return ret_ref;
2794 }
2795
2796 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2797 CHECK(!owner->result_ok);
2798         return DecodeError_clone(&*owner->contents.err);
2799 }
2800 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2801         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
2802         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2803         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
2804         uint64_t ret_ref = tag_ptr(ret_copy, true);
2805         return ret_ref;
2806 }
2807
2808 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2809         LDKNodeFeatures ret = *owner->contents.result;
2810         ret.is_owned = false;
2811         return ret;
2812 }
2813 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2814         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
2815         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
2816         uint64_t ret_ref = 0;
2817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2819         return ret_ref;
2820 }
2821
2822 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2823 CHECK(!owner->result_ok);
2824         return DecodeError_clone(&*owner->contents.err);
2825 }
2826 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2827         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
2828         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2829         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
2830         uint64_t ret_ref = tag_ptr(ret_copy, true);
2831         return ret_ref;
2832 }
2833
2834 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2835         LDKInvoiceFeatures ret = *owner->contents.result;
2836         ret.is_owned = false;
2837         return ret;
2838 }
2839 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2840         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
2841         LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
2842         uint64_t ret_ref = 0;
2843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2845         return ret_ref;
2846 }
2847
2848 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2849 CHECK(!owner->result_ok);
2850         return DecodeError_clone(&*owner->contents.err);
2851 }
2852 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2853         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
2854         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2855         *ret_copy = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
2856         uint64_t ret_ref = tag_ptr(ret_copy, true);
2857         return ret_ref;
2858 }
2859
2860 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2861         LDKChannelTypeFeatures ret = *owner->contents.result;
2862         ret.is_owned = false;
2863         return ret;
2864 }
2865 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2866         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
2867         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
2868         uint64_t ret_ref = 0;
2869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2871         return ret_ref;
2872 }
2873
2874 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2875 CHECK(!owner->result_ok);
2876         return DecodeError_clone(&*owner->contents.err);
2877 }
2878 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2879         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
2880         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2881         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
2882         uint64_t ret_ref = tag_ptr(ret_copy, true);
2883         return ret_ref;
2884 }
2885
2886 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
2887         LDKNodeId ret = *owner->contents.result;
2888         ret.is_owned = false;
2889         return ret;
2890 }
2891 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
2892         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
2893         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
2894         uint64_t ret_ref = 0;
2895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2897         return ret_ref;
2898 }
2899
2900 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
2901 CHECK(!owner->result_ok);
2902         return DecodeError_clone(&*owner->contents.err);
2903 }
2904 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
2905         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
2906         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2907         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
2908         uint64_t ret_ref = tag_ptr(ret_copy, true);
2909         return ret_ref;
2910 }
2911
2912 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
2913 CHECK(owner->result_ok);
2914         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
2915 }
2916 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
2917         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
2918         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
2919         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
2920         uint64_t ret_ref = tag_ptr(ret_copy, true);
2921         return ret_ref;
2922 }
2923
2924 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
2925 CHECK(!owner->result_ok);
2926         return DecodeError_clone(&*owner->contents.err);
2927 }
2928 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
2929         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
2930         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2931         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
2932         uint64_t ret_ref = tag_ptr(ret_copy, true);
2933         return ret_ref;
2934 }
2935
2936 typedef struct LDKAccess_JCalls {
2937         atomic_size_t refcnt;
2938         uint32_t instance_ptr;
2939 } LDKAccess_JCalls;
2940 static void LDKAccess_JCalls_free(void* this_arg) {
2941         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
2942         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2943                 FREE(j_calls);
2944         }
2945 }
2946 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
2947         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
2948         int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
2949         memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
2950         int64_t short_channel_id_conv = short_channel_id;
2951         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 1, (uint32_t)genesis_hash_arr, short_channel_id_conv, 0, 0, 0, 0);
2952         void* ret_ptr = untag_ptr(ret);
2953         CHECK_ACCESS(ret_ptr);
2954         LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
2955         FREE(untag_ptr(ret));
2956         return ret_conv;
2957 }
2958 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
2959         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
2960         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2961 }
2962 static inline LDKAccess LDKAccess_init (JSValue o) {
2963         LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
2964         atomic_init(&calls->refcnt, 1);
2965         calls->instance_ptr = o;
2966
2967         LDKAccess ret = {
2968                 .this_arg = (void*) calls,
2969                 .get_utxo = get_utxo_LDKAccess_jcall,
2970                 .free = LDKAccess_JCalls_free,
2971         };
2972         return ret;
2973 }
2974 uint64_t  __attribute__((export_name("TS_LDKAccess_new"))) TS_LDKAccess_new(JSValue o) {
2975         LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
2976         *res_ptr = LDKAccess_init(o);
2977         return tag_ptr(res_ptr, true);
2978 }
2979 uint64_t  __attribute__((export_name("TS_Access_get_utxo"))) TS_Access_get_utxo(uint64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
2980         void* this_arg_ptr = untag_ptr(this_arg);
2981         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2982         LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
2983         unsigned char genesis_hash_arr[32];
2984         CHECK(genesis_hash->arr_len == 32);
2985         memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
2986         unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
2987         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
2988         *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
2989         return tag_ptr(ret_conv, true);
2990 }
2991
2992 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_ty_from_ptr"))) TS_LDKCOption_AccessZ_ty_from_ptr(uint64_t ptr) {
2993         LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr);
2994         switch(obj->tag) {
2995                 case LDKCOption_AccessZ_Some: return 0;
2996                 case LDKCOption_AccessZ_None: return 1;
2997                 default: abort();
2998         }
2999 }
3000 uint64_t __attribute__((export_name("TS_LDKCOption_AccessZ_Some_get_some"))) TS_LDKCOption_AccessZ_Some_get_some(uint64_t ptr) {
3001         LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr);
3002         assert(obj->tag == LDKCOption_AccessZ_Some);
3003                         LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
3004                         *some_ret = obj->some;
3005                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3006                         if ((*some_ret).free == LDKAccess_JCalls_free) {
3007                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3008                                 LDKAccess_JCalls_cloned(&(*some_ret));
3009                         }
3010         return tag_ptr(some_ret, true);
3011 }
3012 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3013 CHECK(owner->result_ok);
3014         return *owner->contents.result;
3015 }
3016 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
3017         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3018         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3019         return ret_conv;
3020 }
3021
3022 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3023         LDKLightningError ret = *owner->contents.err;
3024         ret.is_owned = false;
3025         return ret;
3026 }
3027 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
3028         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3029         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3030         uint64_t ret_ref = 0;
3031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3033         return ret_ref;
3034 }
3035
3036 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3037         LDKChannelAnnouncement ret = owner->a;
3038         ret.is_owned = false;
3039         return ret;
3040 }
3041 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
3042         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3043         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3044         uint64_t ret_ref = 0;
3045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3047         return ret_ref;
3048 }
3049
3050 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3051         LDKChannelUpdate ret = owner->b;
3052         ret.is_owned = false;
3053         return ret;
3054 }
3055 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
3056         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3057         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3058         uint64_t ret_ref = 0;
3059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3061         return ret_ref;
3062 }
3063
3064 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3065         LDKChannelUpdate ret = owner->c;
3066         ret.is_owned = false;
3067         return ret;
3068 }
3069 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
3070         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3071         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3072         uint64_t ret_ref = 0;
3073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3075         return ret_ref;
3076 }
3077
3078 uint32_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(uint64_t ptr) {
3079         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3080         switch(obj->tag) {
3081                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
3082                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
3083                 default: abort();
3084         }
3085 }
3086 uint64_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(uint64_t ptr) {
3087         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3088         assert(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
3089                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3090                         *some_conv = obj->some;
3091                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
3092         return tag_ptr(some_conv, true);
3093 }
3094 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3095 CHECK(owner->result_ok);
3096         return *owner->contents.result;
3097 }
3098 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
3099         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3100         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3101 }
3102
3103 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3104         LDKLightningError ret = *owner->contents.err;
3105         ret.is_owned = false;
3106         return ret;
3107 }
3108 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
3109         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3110         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3111         uint64_t ret_ref = 0;
3112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3114         return ret_ref;
3115 }
3116
3117 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3118         LDKChannelUpdateInfo ret = *owner->contents.result;
3119         ret.is_owned = false;
3120         return ret;
3121 }
3122 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
3123         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3124         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
3125         uint64_t ret_ref = 0;
3126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3128         return ret_ref;
3129 }
3130
3131 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3132 CHECK(!owner->result_ok);
3133         return DecodeError_clone(&*owner->contents.err);
3134 }
3135 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
3136         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3137         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3138         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
3139         uint64_t ret_ref = tag_ptr(ret_copy, true);
3140         return ret_ref;
3141 }
3142
3143 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3144         LDKChannelInfo ret = *owner->contents.result;
3145         ret.is_owned = false;
3146         return ret;
3147 }
3148 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
3149         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3150         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3151         uint64_t ret_ref = 0;
3152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3154         return ret_ref;
3155 }
3156
3157 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3158 CHECK(!owner->result_ok);
3159         return DecodeError_clone(&*owner->contents.err);
3160 }
3161 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
3162         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3163         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3164         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3165         uint64_t ret_ref = tag_ptr(ret_copy, true);
3166         return ret_ref;
3167 }
3168
3169 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3170         LDKRoutingFees ret = *owner->contents.result;
3171         ret.is_owned = false;
3172         return ret;
3173 }
3174 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
3175         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3176         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3177         uint64_t ret_ref = 0;
3178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3180         return ret_ref;
3181 }
3182
3183 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3184 CHECK(!owner->result_ok);
3185         return DecodeError_clone(&*owner->contents.err);
3186 }
3187 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
3188         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3189         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3190         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3191         uint64_t ret_ref = tag_ptr(ret_copy, true);
3192         return ret_ref;
3193 }
3194
3195 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint64_t ptr) {
3196         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3197         switch(obj->tag) {
3198                 case LDKNetAddress_IPv4: return 0;
3199                 case LDKNetAddress_IPv6: return 1;
3200                 case LDKNetAddress_OnionV2: return 2;
3201                 case LDKNetAddress_OnionV3: return 3;
3202                 case LDKNetAddress_Hostname: return 4;
3203                 default: abort();
3204         }
3205 }
3206 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint64_t ptr) {
3207         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3208         assert(obj->tag == LDKNetAddress_IPv4);
3209                         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
3210                         memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3211         return addr_arr;
3212 }
3213 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint64_t ptr) {
3214         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3215         assert(obj->tag == LDKNetAddress_IPv4);
3216                         int16_t port_conv = obj->i_pv4.port;
3217         return port_conv;
3218 }
3219 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint64_t ptr) {
3220         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3221         assert(obj->tag == LDKNetAddress_IPv6);
3222                         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
3223                         memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
3224         return addr_arr;
3225 }
3226 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint64_t ptr) {
3227         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3228         assert(obj->tag == LDKNetAddress_IPv6);
3229                         int16_t port_conv = obj->i_pv6.port;
3230         return port_conv;
3231 }
3232 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint64_t ptr) {
3233         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3234         assert(obj->tag == LDKNetAddress_OnionV2);
3235                         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
3236                         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
3237         return onion_v2_arr;
3238 }
3239 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
3240         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3241         assert(obj->tag == LDKNetAddress_OnionV3);
3242                         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
3243                         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
3244         return ed25519_pubkey_arr;
3245 }
3246 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint64_t ptr) {
3247         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3248         assert(obj->tag == LDKNetAddress_OnionV3);
3249                         int16_t checksum_conv = obj->onion_v3.checksum;
3250         return checksum_conv;
3251 }
3252 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint64_t ptr) {
3253         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3254         assert(obj->tag == LDKNetAddress_OnionV3);
3255                         int8_t version_conv = obj->onion_v3.version;
3256         return version_conv;
3257 }
3258 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint64_t ptr) {
3259         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3260         assert(obj->tag == LDKNetAddress_OnionV3);
3261                         int16_t port_conv = obj->onion_v3.port;
3262         return port_conv;
3263 }
3264 uint64_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_hostname"))) TS_LDKNetAddress_Hostname_get_hostname(uint64_t ptr) {
3265         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3266         assert(obj->tag == LDKNetAddress_Hostname);
3267                         LDKHostname hostname_var = obj->hostname.hostname;
3268                         uint64_t hostname_ref = 0;
3269                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
3270                         hostname_ref = tag_ptr(hostname_var.inner, false);
3271         return hostname_ref;
3272 }
3273 int16_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_port"))) TS_LDKNetAddress_Hostname_get_port(uint64_t ptr) {
3274         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3275         assert(obj->tag == LDKNetAddress_Hostname);
3276                         int16_t port_conv = obj->hostname.port;
3277         return port_conv;
3278 }
3279 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3280         LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3281         for (size_t i = 0; i < ret.datalen; i++) {
3282                 ret.data[i] = NetAddress_clone(&orig->data[i]);
3283         }
3284         return ret;
3285 }
3286 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3287         LDKNodeAnnouncementInfo ret = *owner->contents.result;
3288         ret.is_owned = false;
3289         return ret;
3290 }
3291 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
3292         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3293         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
3294         uint64_t ret_ref = 0;
3295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3297         return ret_ref;
3298 }
3299
3300 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3301 CHECK(!owner->result_ok);
3302         return DecodeError_clone(&*owner->contents.err);
3303 }
3304 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
3305         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3306         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3307         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
3308         uint64_t ret_ref = tag_ptr(ret_copy, true);
3309         return ret_ref;
3310 }
3311
3312 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3313         LDKNodeAlias ret = *owner->contents.result;
3314         ret.is_owned = false;
3315         return ret;
3316 }
3317 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
3318         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3319         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
3320         uint64_t ret_ref = 0;
3321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3323         return ret_ref;
3324 }
3325
3326 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3327 CHECK(!owner->result_ok);
3328         return DecodeError_clone(&*owner->contents.err);
3329 }
3330 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
3331         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3332         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3333         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
3334         uint64_t ret_ref = tag_ptr(ret_copy, true);
3335         return ret_ref;
3336 }
3337
3338 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3339         LDKNodeInfo ret = *owner->contents.result;
3340         ret.is_owned = false;
3341         return ret;
3342 }
3343 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
3344         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3345         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
3346         uint64_t ret_ref = 0;
3347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3349         return ret_ref;
3350 }
3351
3352 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3353 CHECK(!owner->result_ok);
3354         return DecodeError_clone(&*owner->contents.err);
3355 }
3356 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
3357         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3358         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3359         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
3360         uint64_t ret_ref = tag_ptr(ret_copy, true);
3361         return ret_ref;
3362 }
3363
3364 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3365         LDKNetworkGraph ret = *owner->contents.result;
3366         ret.is_owned = false;
3367         return ret;
3368 }
3369 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
3370         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3371         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
3372         uint64_t ret_ref = 0;
3373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3375         return ret_ref;
3376 }
3377
3378 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3379 CHECK(!owner->result_ok);
3380         return DecodeError_clone(&*owner->contents.err);
3381 }
3382 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
3383         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3384         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3385         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
3386         uint64_t ret_ref = tag_ptr(ret_copy, true);
3387         return ret_ref;
3388 }
3389
3390 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint64_t ptr) {
3391         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
3392         switch(obj->tag) {
3393                 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
3394                 case LDKCOption_CVec_NetAddressZZ_None: return 1;
3395                 default: abort();
3396         }
3397 }
3398 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint64_t ptr) {
3399         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
3400         assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
3401                         LDKCVec_NetAddressZ some_var = obj->some;
3402                         uint64_tArray some_arr = NULL;
3403                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
3404                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
3405                         for (size_t m = 0; m < some_var.datalen; m++) {
3406                                 uint64_t some_conv_12_ref = tag_ptr(&some_var.data[m], false);
3407                                 some_arr_ptr[m] = some_conv_12_ref;
3408                         }
3409                         
3410         return some_arr;
3411 }
3412 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3413         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
3414         ret.is_owned = false;
3415         return ret;
3416 }
3417 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3418         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3419         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3420         uint64_t ret_ref = 0;
3421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3423         return ret_ref;
3424 }
3425
3426 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3427 CHECK(!owner->result_ok);
3428         return DecodeError_clone(&*owner->contents.err);
3429 }
3430 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3431         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3432         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3433         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3434         uint64_t ret_ref = tag_ptr(ret_copy, true);
3435         return ret_ref;
3436 }
3437
3438 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3439         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
3440         ret.is_owned = false;
3441         return ret;
3442 }
3443 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3444         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3445         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3446         uint64_t ret_ref = 0;
3447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3449         return ret_ref;
3450 }
3451
3452 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3453 CHECK(!owner->result_ok);
3454         return DecodeError_clone(&*owner->contents.err);
3455 }
3456 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3457         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3458         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3459         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3460         uint64_t ret_ref = tag_ptr(ret_copy, true);
3461         return ret_ref;
3462 }
3463
3464 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3465 CHECK(owner->result_ok);
3466         return SpendableOutputDescriptor_clone(&*owner->contents.result);
3467 }
3468 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3469         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3470         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
3471         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3472         uint64_t ret_ref = tag_ptr(ret_copy, true);
3473         return ret_ref;
3474 }
3475
3476 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3477 CHECK(!owner->result_ok);
3478         return DecodeError_clone(&*owner->contents.err);
3479 }
3480 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3481         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3482         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3483         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3484         uint64_t ret_ref = tag_ptr(ret_copy, true);
3485         return ret_ref;
3486 }
3487
3488 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
3489         LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
3490         for (size_t i = 0; i < ret.datalen; i++) {
3491                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3492         }
3493         return ret;
3494 }
3495 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3496         return owner->a;
3497 }
3498 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint64_t owner) {
3499         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
3500         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3501         memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
3502         return ret_arr;
3503 }
3504
3505 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3506         return owner->b;
3507 }
3508 ptrArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint64_t owner) {
3509         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
3510         LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
3511         ptrArray ret_arr = NULL;
3512         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
3513         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
3514         for (size_t m = 0; m < ret_var.datalen; m++) {
3515                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
3516                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
3517                 ret_arr_ptr[m] = ret_conv_12_arr;
3518         }
3519         
3520         return ret_arr;
3521 }
3522
3523 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3524 CHECK(owner->result_ok);
3525         return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
3526 }
3527 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint64_t owner) {
3528         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
3529         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
3530         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
3531         return tag_ptr(ret_conv, true);
3532 }
3533
3534 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3535 CHECK(!owner->result_ok);
3536         return *owner->contents.err;
3537 }
3538 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint64_t owner) {
3539         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
3540         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
3541 }
3542
3543 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3544 CHECK(owner->result_ok);
3545         return *owner->contents.result;
3546 }
3547 int8_tArray  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint64_t owner) {
3548         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
3549         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3550         memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
3551         return ret_arr;
3552 }
3553
3554 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3555 CHECK(!owner->result_ok);
3556         return *owner->contents.err;
3557 }
3558 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint64_t owner) {
3559         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
3560         CResult_SignatureNoneZ_get_err(owner_conv);
3561 }
3562
3563 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3564         return owner->a;
3565 }
3566 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_a"))) TS_C2Tuple_SignatureSignatureZ_get_a(uint64_t owner) {
3567         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
3568         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3569         memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form, 64);
3570         return ret_arr;
3571 }
3572
3573 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3574         return owner->b;
3575 }
3576 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_b"))) TS_C2Tuple_SignatureSignatureZ_get_b(uint64_t owner) {
3577         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
3578         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3579         memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form, 64);
3580         return ret_arr;
3581 }
3582
3583 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3584 CHECK(owner->result_ok);
3585         return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
3586 }
3587 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(uint64_t owner) {
3588         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
3589         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
3590         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
3591         return tag_ptr(ret_conv, true);
3592 }
3593
3594 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3595 CHECK(!owner->result_ok);
3596         return *owner->contents.err;
3597 }
3598 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(uint64_t owner) {
3599         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
3600         CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
3601 }
3602
3603 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3604 CHECK(owner->result_ok);
3605         return *owner->contents.result;
3606 }
3607 int8_tArray  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_ok"))) TS_CResult_SecretKeyNoneZ_get_ok(uint64_t owner) {
3608         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
3609         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3610         memcpy(ret_arr->elems, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes, 32);
3611         return ret_arr;
3612 }
3613
3614 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3615 CHECK(!owner->result_ok);
3616         return *owner->contents.err;
3617 }
3618 void  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_err"))) TS_CResult_SecretKeyNoneZ_get_err(uint64_t owner) {
3619         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
3620         CResult_SecretKeyNoneZ_get_err(owner_conv);
3621 }
3622
3623 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
3624 CHECK(owner->result_ok);
3625         return *owner->contents.result;
3626 }
3627 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_ok"))) TS_CResult_PublicKeyNoneZ_get_ok(uint64_t owner) {
3628         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
3629         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3630         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
3631         return ret_arr;
3632 }
3633
3634 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
3635 CHECK(!owner->result_ok);
3636         return *owner->contents.err;
3637 }
3638 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_err"))) TS_CResult_PublicKeyNoneZ_get_err(uint64_t owner) {
3639         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
3640         CResult_PublicKeyNoneZ_get_err(owner_conv);
3641 }
3642
3643 uint32_t __attribute__((export_name("TS_LDKCOption_ScalarZ_ty_from_ptr"))) TS_LDKCOption_ScalarZ_ty_from_ptr(uint64_t ptr) {
3644         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
3645         switch(obj->tag) {
3646                 case LDKCOption_ScalarZ_Some: return 0;
3647                 case LDKCOption_ScalarZ_None: return 1;
3648                 default: abort();
3649         }
3650 }
3651 uint64_t __attribute__((export_name("TS_LDKCOption_ScalarZ_Some_get_some"))) TS_LDKCOption_ScalarZ_Some_get_some(uint64_t ptr) {
3652         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
3653         assert(obj->tag == LDKCOption_ScalarZ_Some);
3654                         LDKBigEndianScalar* some_ref = &obj->some;
3655         return tag_ptr(some_ref, false);
3656 }
3657 static inline struct LDKThirtyTwoBytes CResult_SharedSecretNoneZ_get_ok(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
3658 CHECK(owner->result_ok);
3659         return ThirtyTwoBytes_clone(&*owner->contents.result);
3660 }
3661 int8_tArray  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_ok"))) TS_CResult_SharedSecretNoneZ_get_ok(uint64_t owner) {
3662         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
3663         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3664         memcpy(ret_arr->elems, CResult_SharedSecretNoneZ_get_ok(owner_conv).data, 32);
3665         return ret_arr;
3666 }
3667
3668 static inline void CResult_SharedSecretNoneZ_get_err(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
3669 CHECK(!owner->result_ok);
3670         return *owner->contents.err;
3671 }
3672 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_err"))) TS_CResult_SharedSecretNoneZ_get_err(uint64_t owner) {
3673         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
3674         CResult_SharedSecretNoneZ_get_err(owner_conv);
3675 }
3676
3677 typedef struct LDKBaseSign_JCalls {
3678         atomic_size_t refcnt;
3679         uint32_t instance_ptr;
3680 } LDKBaseSign_JCalls;
3681 static void LDKBaseSign_JCalls_free(void* this_arg) {
3682         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3683         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3684                 FREE(j_calls);
3685         }
3686 }
3687 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3688         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3689         int64_t idx_conv = idx;
3690         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 2, idx_conv, 0, 0, 0, 0, 0);
3691         LDKPublicKey ret_ref;
3692         CHECK(ret->arr_len == 33);
3693         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
3694         return ret_ref;
3695 }
3696 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3697         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3698         int64_t idx_conv = idx;
3699         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 3, idx_conv, 0, 0, 0, 0, 0);
3700         LDKThirtyTwoBytes ret_ref;
3701         CHECK(ret->arr_len == 32);
3702         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3703         return ret_ref;
3704 }
3705 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
3706         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3707         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
3708         uint64_t holder_tx_ref = 0;
3709         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
3710         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
3711         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
3712         LDKCVec_PaymentPreimageZ preimages_var = preimages;
3713         ptrArray preimages_arr = NULL;
3714         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3715         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
3716         for (size_t m = 0; m < preimages_var.datalen; m++) {
3717                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3718                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3719                 preimages_arr_ptr[m] = preimages_conv_12_arr;
3720         }
3721         
3722         FREE(preimages_var.data);
3723         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 4, holder_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
3724         void* ret_ptr = untag_ptr(ret);
3725         CHECK_ACCESS(ret_ptr);
3726         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3727         FREE(untag_ptr(ret));
3728         return ret_conv;
3729 }
3730 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
3731         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3732         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 5, 0, 0, 0, 0, 0, 0);
3733         LDKThirtyTwoBytes ret_ref;
3734         CHECK(ret->arr_len == 32);
3735         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3736         return ret_ref;
3737 }
3738 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
3739         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3740         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
3741         uint64_t commitment_tx_ref = 0;
3742         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
3743         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3744         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3745         LDKCVec_PaymentPreimageZ preimages_var = preimages;
3746         ptrArray preimages_arr = NULL;
3747         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3748         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
3749         for (size_t m = 0; m < preimages_var.datalen; m++) {
3750                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3751                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3752                 preimages_arr_ptr[m] = preimages_conv_12_arr;
3753         }
3754         
3755         FREE(preimages_var.data);
3756         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 6, commitment_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
3757         void* ret_ptr = untag_ptr(ret);
3758         CHECK_ACCESS(ret_ptr);
3759         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3760         FREE(untag_ptr(ret));
3761         return ret_conv;
3762 }
3763 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
3764         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3765         int64_t idx_conv = idx;
3766         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
3767         memcpy(secret_arr->elems, *secret, 32);
3768         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
3769         void* ret_ptr = untag_ptr(ret);
3770         CHECK_ACCESS(ret_ptr);
3771         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3772         FREE(untag_ptr(ret));
3773         return ret_conv;
3774 }
3775 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3776         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3777         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3778         uint64_t commitment_tx_ref = 0;
3779         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
3780         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3781         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3782         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 8, commitment_tx_ref, 0, 0, 0, 0, 0);
3783         void* ret_ptr = untag_ptr(ret);
3784         CHECK_ACCESS(ret_ptr);
3785         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3786         FREE(untag_ptr(ret));
3787         return ret_conv;
3788 }
3789 LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) {
3790         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3791         LDKTransaction justice_tx_var = justice_tx;
3792         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3793         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3794         Transaction_free(justice_tx_var);
3795         uint32_t input_conv = input;
3796         int64_t amount_conv = amount;
3797         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3798         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3799         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 9, (uint32_t)justice_tx_arr, input_conv, amount_conv, (uint32_t)per_commitment_key_arr, 0, 0);
3800         void* ret_ptr = untag_ptr(ret);
3801         CHECK_ACCESS(ret_ptr);
3802         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3803         FREE(untag_ptr(ret));
3804         return ret_conv;
3805 }
3806 LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
3807         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3808         LDKTransaction justice_tx_var = justice_tx;
3809         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3810         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3811         Transaction_free(justice_tx_var);
3812         uint32_t input_conv = input;
3813         int64_t amount_conv = amount;
3814         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3815         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3816         LDKHTLCOutputInCommitment htlc_var = *htlc;
3817         uint64_t htlc_ref = 0;
3818         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3819         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3820         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3821         uint64_t ret = js_invoke_function_uububu(j_calls->instance_ptr, 10, (uint32_t)justice_tx_arr, input_conv, amount_conv, (uint32_t)per_commitment_key_arr, htlc_ref, 0);
3822         void* ret_ptr = untag_ptr(ret);
3823         CHECK_ACCESS(ret_ptr);
3824         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3825         FREE(untag_ptr(ret));
3826         return ret_conv;
3827 }
3828 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
3829         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3830         LDKTransaction htlc_tx_var = htlc_tx;
3831         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
3832         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
3833         Transaction_free(htlc_tx_var);
3834         uint32_t input_conv = input;
3835         int64_t amount_conv = amount;
3836         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
3837         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
3838         LDKHTLCOutputInCommitment htlc_var = *htlc;
3839         uint64_t htlc_ref = 0;
3840         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3841         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3842         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3843         uint64_t ret = js_invoke_function_uububu(j_calls->instance_ptr, 11, (uint32_t)htlc_tx_arr, input_conv, amount_conv, (uint32_t)per_commitment_point_arr, htlc_ref, 0);
3844         void* ret_ptr = untag_ptr(ret);
3845         CHECK_ACCESS(ret_ptr);
3846         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3847         FREE(untag_ptr(ret));
3848         return ret_conv;
3849 }
3850 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3851         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3852         LDKClosingTransaction closing_tx_var = *closing_tx;
3853         uint64_t closing_tx_ref = 0;
3854         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
3855         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3856         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
3857         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 12, closing_tx_ref, 0, 0, 0, 0, 0);
3858         void* ret_ptr = untag_ptr(ret);
3859         CHECK_ACCESS(ret_ptr);
3860         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3861         FREE(untag_ptr(ret));
3862         return ret_conv;
3863 }
3864 LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKBaseSign_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
3865         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3866         LDKTransaction anchor_tx_var = anchor_tx;
3867         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
3868         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
3869         Transaction_free(anchor_tx_var);
3870         uint32_t input_conv = input;
3871         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 13, (uint32_t)anchor_tx_arr, input_conv, 0, 0, 0, 0);
3872         void* ret_ptr = untag_ptr(ret);
3873         CHECK_ACCESS(ret_ptr);
3874         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3875         FREE(untag_ptr(ret));
3876         return ret_conv;
3877 }
3878 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3879         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3880         LDKUnsignedChannelAnnouncement msg_var = *msg;
3881         uint64_t msg_ref = 0;
3882         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
3883         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3884         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
3885         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 14, msg_ref, 0, 0, 0, 0, 0);
3886         void* ret_ptr = untag_ptr(ret);
3887         CHECK_ACCESS(ret_ptr);
3888         LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
3889         FREE(untag_ptr(ret));
3890         return ret_conv;
3891 }
3892 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
3893         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3894         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
3895         uint64_t channel_parameters_ref = 0;
3896         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
3897         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
3898         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
3899         js_invoke_function_buuuuu(j_calls->instance_ptr, 15, channel_parameters_ref, 0, 0, 0, 0, 0);
3900 }
3901 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
3902         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
3903         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3904 }
3905 static inline LDKBaseSign LDKBaseSign_init (JSValue o, uint64_t pubkeys) {
3906         LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
3907         atomic_init(&calls->refcnt, 1);
3908         calls->instance_ptr = o;
3909
3910         LDKChannelPublicKeys pubkeys_conv;
3911         pubkeys_conv.inner = untag_ptr(pubkeys);
3912         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3913         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3914
3915         LDKBaseSign ret = {
3916                 .this_arg = (void*) calls,
3917                 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
3918                 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
3919                 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
3920                 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
3921                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
3922                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
3923                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
3924                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
3925                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
3926                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
3927                 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
3928                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKBaseSign_jcall,
3929                 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
3930                 .ready_channel = ready_channel_LDKBaseSign_jcall,
3931                 .free = LDKBaseSign_JCalls_free,
3932                 .pubkeys = pubkeys_conv,
3933                 .set_pubkeys = NULL,
3934         };
3935         return ret;
3936 }
3937 uint64_t  __attribute__((export_name("TS_LDKBaseSign_new"))) TS_LDKBaseSign_new(JSValue o, uint64_t pubkeys) {
3938         LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
3939         *res_ptr = LDKBaseSign_init(o, pubkeys);
3940         return tag_ptr(res_ptr, true);
3941 }
3942 int8_tArray  __attribute__((export_name("TS_BaseSign_get_per_commitment_point"))) TS_BaseSign_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
3943         void* this_arg_ptr = untag_ptr(this_arg);
3944         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3945         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3946         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3947         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
3948         return ret_arr;
3949 }
3950
3951 int8_tArray  __attribute__((export_name("TS_BaseSign_release_commitment_secret"))) TS_BaseSign_release_commitment_secret(uint64_t this_arg, int64_t idx) {
3952         void* this_arg_ptr = untag_ptr(this_arg);
3953         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3954         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3955         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3956         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
3957         return ret_arr;
3958 }
3959
3960 uint64_t  __attribute__((export_name("TS_BaseSign_validate_holder_commitment"))) TS_BaseSign_validate_holder_commitment(uint64_t this_arg, uint64_t holder_tx, ptrArray preimages) {
3961         void* this_arg_ptr = untag_ptr(this_arg);
3962         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3963         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3964         LDKHolderCommitmentTransaction holder_tx_conv;
3965         holder_tx_conv.inner = untag_ptr(holder_tx);
3966         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
3967         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
3968         holder_tx_conv.is_owned = false;
3969         LDKCVec_PaymentPreimageZ preimages_constr;
3970         preimages_constr.datalen = preimages->arr_len;
3971         if (preimages_constr.datalen > 0)
3972                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
3973         else
3974                 preimages_constr.data = NULL;
3975         int8_tArray* preimages_vals = (void*) preimages->elems;
3976         for (size_t m = 0; m < preimages_constr.datalen; m++) {
3977                 int8_tArray preimages_conv_12 = preimages_vals[m];
3978                 LDKThirtyTwoBytes preimages_conv_12_ref;
3979                 CHECK(preimages_conv_12->arr_len == 32);
3980                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
3981                 preimages_constr.data[m] = preimages_conv_12_ref;
3982         }
3983         FREE(preimages);
3984         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3985         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
3986         return tag_ptr(ret_conv, true);
3987 }
3988
3989 int8_tArray  __attribute__((export_name("TS_BaseSign_channel_keys_id"))) TS_BaseSign_channel_keys_id(uint64_t this_arg) {
3990         void* this_arg_ptr = untag_ptr(this_arg);
3991         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3992         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3993         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3994         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
3995         return ret_arr;
3996 }
3997
3998 uint64_t  __attribute__((export_name("TS_BaseSign_sign_counterparty_commitment"))) TS_BaseSign_sign_counterparty_commitment(uint64_t this_arg, uint64_t commitment_tx, ptrArray preimages) {
3999         void* this_arg_ptr = untag_ptr(this_arg);
4000         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4001         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4002         LDKCommitmentTransaction commitment_tx_conv;
4003         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4004         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4005         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4006         commitment_tx_conv.is_owned = false;
4007         LDKCVec_PaymentPreimageZ preimages_constr;
4008         preimages_constr.datalen = preimages->arr_len;
4009         if (preimages_constr.datalen > 0)
4010                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4011         else
4012                 preimages_constr.data = NULL;
4013         int8_tArray* preimages_vals = (void*) preimages->elems;
4014         for (size_t m = 0; m < preimages_constr.datalen; m++) {
4015                 int8_tArray preimages_conv_12 = preimages_vals[m];
4016                 LDKThirtyTwoBytes preimages_conv_12_ref;
4017                 CHECK(preimages_conv_12->arr_len == 32);
4018                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4019                 preimages_constr.data[m] = preimages_conv_12_ref;
4020         }
4021         FREE(preimages);
4022         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4023         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
4024         return tag_ptr(ret_conv, true);
4025 }
4026
4027 uint64_t  __attribute__((export_name("TS_BaseSign_validate_counterparty_revocation"))) TS_BaseSign_validate_counterparty_revocation(uint64_t this_arg, int64_t idx, int8_tArray secret) {
4028         void* this_arg_ptr = untag_ptr(this_arg);
4029         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4030         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4031         unsigned char secret_arr[32];
4032         CHECK(secret->arr_len == 32);
4033         memcpy(secret_arr, secret->elems, 32); FREE(secret);
4034         unsigned char (*secret_ref)[32] = &secret_arr;
4035         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4036         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
4037         return tag_ptr(ret_conv, true);
4038 }
4039
4040 uint64_t  __attribute__((export_name("TS_BaseSign_sign_holder_commitment_and_htlcs"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint64_t this_arg, uint64_t commitment_tx) {
4041         void* this_arg_ptr = untag_ptr(this_arg);
4042         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4043         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4044         LDKHolderCommitmentTransaction commitment_tx_conv;
4045         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4046         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4047         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4048         commitment_tx_conv.is_owned = false;
4049         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4050         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
4051         return tag_ptr(ret_conv, true);
4052 }
4053
4054 uint64_t  __attribute__((export_name("TS_BaseSign_sign_justice_revoked_output"))) TS_BaseSign_sign_justice_revoked_output(uint64_t this_arg, int8_tArray justice_tx, uint32_t input, int64_t amount, int8_tArray per_commitment_key) {
4055         void* this_arg_ptr = untag_ptr(this_arg);
4056         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4057         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4058         LDKTransaction justice_tx_ref;
4059         justice_tx_ref.datalen = justice_tx->arr_len;
4060         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4061         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4062         justice_tx_ref.data_is_owned = true;
4063         unsigned char per_commitment_key_arr[32];
4064         CHECK(per_commitment_key->arr_len == 32);
4065         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4066         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4067         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4068         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
4069         return tag_ptr(ret_conv, true);
4070 }
4071
4072 uint64_t  __attribute__((export_name("TS_BaseSign_sign_justice_revoked_htlc"))) TS_BaseSign_sign_justice_revoked_htlc(uint64_t this_arg, int8_tArray justice_tx, uint32_t input, int64_t amount, int8_tArray per_commitment_key, uint64_t htlc) {
4073         void* this_arg_ptr = untag_ptr(this_arg);
4074         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4075         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4076         LDKTransaction justice_tx_ref;
4077         justice_tx_ref.datalen = justice_tx->arr_len;
4078         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4079         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4080         justice_tx_ref.data_is_owned = true;
4081         unsigned char per_commitment_key_arr[32];
4082         CHECK(per_commitment_key->arr_len == 32);
4083         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4084         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4085         LDKHTLCOutputInCommitment htlc_conv;
4086         htlc_conv.inner = untag_ptr(htlc);
4087         htlc_conv.is_owned = ptr_is_owned(htlc);
4088         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4089         htlc_conv.is_owned = false;
4090         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4091         *ret_conv = (this_arg_conv->sign_justice_revoked_htlc)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
4092         return tag_ptr(ret_conv, true);
4093 }
4094
4095 uint64_t  __attribute__((export_name("TS_BaseSign_sign_counterparty_htlc_transaction"))) TS_BaseSign_sign_counterparty_htlc_transaction(uint64_t this_arg, int8_tArray htlc_tx, uint32_t input, int64_t amount, int8_tArray per_commitment_point, uint64_t htlc) {
4096         void* this_arg_ptr = untag_ptr(this_arg);
4097         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4098         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4099         LDKTransaction htlc_tx_ref;
4100         htlc_tx_ref.datalen = htlc_tx->arr_len;
4101         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
4102         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
4103         htlc_tx_ref.data_is_owned = true;
4104         LDKPublicKey per_commitment_point_ref;
4105         CHECK(per_commitment_point->arr_len == 33);
4106         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
4107         LDKHTLCOutputInCommitment htlc_conv;
4108         htlc_conv.inner = untag_ptr(htlc);
4109         htlc_conv.is_owned = ptr_is_owned(htlc);
4110         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4111         htlc_conv.is_owned = false;
4112         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4113         *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);
4114         return tag_ptr(ret_conv, true);
4115 }
4116
4117 uint64_t  __attribute__((export_name("TS_BaseSign_sign_closing_transaction"))) TS_BaseSign_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
4118         void* this_arg_ptr = untag_ptr(this_arg);
4119         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4120         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4121         LDKClosingTransaction closing_tx_conv;
4122         closing_tx_conv.inner = untag_ptr(closing_tx);
4123         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
4124         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
4125         closing_tx_conv.is_owned = false;
4126         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4127         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
4128         return tag_ptr(ret_conv, true);
4129 }
4130
4131 uint64_t  __attribute__((export_name("TS_BaseSign_sign_holder_anchor_input"))) TS_BaseSign_sign_holder_anchor_input(uint64_t this_arg, int8_tArray anchor_tx, uint32_t input) {
4132         void* this_arg_ptr = untag_ptr(this_arg);
4133         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4134         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4135         LDKTransaction anchor_tx_ref;
4136         anchor_tx_ref.datalen = anchor_tx->arr_len;
4137         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
4138         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
4139         anchor_tx_ref.data_is_owned = true;
4140         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4141         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
4142         return tag_ptr(ret_conv, true);
4143 }
4144
4145 uint64_t  __attribute__((export_name("TS_BaseSign_sign_channel_announcement"))) TS_BaseSign_sign_channel_announcement(uint64_t this_arg, uint64_t msg) {
4146         void* this_arg_ptr = untag_ptr(this_arg);
4147         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4148         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4149         LDKUnsignedChannelAnnouncement msg_conv;
4150         msg_conv.inner = untag_ptr(msg);
4151         msg_conv.is_owned = ptr_is_owned(msg);
4152         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
4153         msg_conv.is_owned = false;
4154         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
4155         *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4156         return tag_ptr(ret_conv, true);
4157 }
4158
4159 void  __attribute__((export_name("TS_BaseSign_ready_channel"))) TS_BaseSign_ready_channel(uint64_t this_arg, uint64_t channel_parameters) {
4160         void* this_arg_ptr = untag_ptr(this_arg);
4161         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4162         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4163         LDKChannelTransactionParameters channel_parameters_conv;
4164         channel_parameters_conv.inner = untag_ptr(channel_parameters);
4165         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
4166         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
4167         channel_parameters_conv.is_owned = false;
4168         (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
4169 }
4170
4171 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
4172         if (this_arg->set_pubkeys != NULL)
4173                 this_arg->set_pubkeys(this_arg);
4174         return this_arg->pubkeys;
4175 }
4176 uint64_t  __attribute__((export_name("TS_BaseSign_get_pubkeys"))) TS_BaseSign_get_pubkeys(uint64_t this_arg) {
4177         void* this_arg_ptr = untag_ptr(this_arg);
4178         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4179         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4180         LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
4181         uint64_t ret_ref = 0;
4182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4184         return ret_ref;
4185 }
4186
4187 typedef struct LDKSign_JCalls {
4188         atomic_size_t refcnt;
4189         uint32_t instance_ptr;
4190         LDKBaseSign_JCalls* BaseSign;
4191 } LDKSign_JCalls;
4192 static void LDKSign_JCalls_free(void* this_arg) {
4193         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4194         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4195                 FREE(j_calls);
4196         }
4197 }
4198 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
4199         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4200         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 16, 0, 0, 0, 0, 0, 0);
4201         LDKCVec_u8Z ret_ref;
4202         ret_ref.datalen = ret->arr_len;
4203         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4204         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
4205         return ret_ref;
4206 }
4207 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
4208         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
4209         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4210         atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
4211 }
4212 static inline LDKSign LDKSign_init (JSValue o, JSValue BaseSign, uint64_t pubkeys) {
4213         LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
4214         atomic_init(&calls->refcnt, 1);
4215         calls->instance_ptr = o;
4216
4217         LDKChannelPublicKeys pubkeys_conv;
4218         pubkeys_conv.inner = untag_ptr(pubkeys);
4219         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4220         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4221
4222         LDKSign ret = {
4223                 .this_arg = (void*) calls,
4224                 .write = write_LDKSign_jcall,
4225                 .cloned = LDKSign_JCalls_cloned,
4226                 .free = LDKSign_JCalls_free,
4227                 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
4228         };
4229         calls->BaseSign = ret.BaseSign.this_arg;
4230         return ret;
4231 }
4232 uint64_t  __attribute__((export_name("TS_LDKSign_new"))) TS_LDKSign_new(JSValue o, JSValue BaseSign, uint64_t pubkeys) {
4233         LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
4234         *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
4235         return tag_ptr(res_ptr, true);
4236 }
4237 int8_tArray  __attribute__((export_name("TS_Sign_write"))) TS_Sign_write(uint64_t this_arg) {
4238         void* this_arg_ptr = untag_ptr(this_arg);
4239         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4240         LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
4241         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4242         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4243         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4244         CVec_u8Z_free(ret_var);
4245         return ret_arr;
4246 }
4247
4248 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4249 CHECK(owner->result_ok);
4250         return Sign_clone(&*owner->contents.result);
4251 }
4252 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_ok"))) TS_CResult_SignDecodeErrorZ_get_ok(uint64_t owner) {
4253         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
4254         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
4255         *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
4256         return tag_ptr(ret_ret, true);
4257 }
4258
4259 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4260 CHECK(!owner->result_ok);
4261         return DecodeError_clone(&*owner->contents.err);
4262 }
4263 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_err"))) TS_CResult_SignDecodeErrorZ_get_err(uint64_t owner) {
4264         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
4265         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4266         *ret_copy = CResult_SignDecodeErrorZ_get_err(owner_conv);
4267         uint64_t ret_ref = tag_ptr(ret_copy, true);
4268         return ret_ref;
4269 }
4270
4271 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4272 CHECK(owner->result_ok);
4273         return *owner->contents.result;
4274 }
4275 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
4276         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4277         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
4278         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
4279         return ret_arr;
4280 }
4281
4282 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4283 CHECK(!owner->result_ok);
4284         return *owner->contents.err;
4285 }
4286 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
4287         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4288         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
4289 }
4290
4291 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
4292         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
4293         for (size_t i = 0; i < ret.datalen; i++) {
4294                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
4295         }
4296         return ret;
4297 }
4298 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4299 CHECK(owner->result_ok);
4300         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
4301 }
4302 ptrArray  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint64_t owner) {
4303         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4304         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
4305         ptrArray ret_arr = NULL;
4306         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
4307         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
4308         for (size_t m = 0; m < ret_var.datalen; m++) {
4309                 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
4310                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
4311                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
4312                 CVec_u8Z_free(ret_conv_12_var);
4313                 ret_arr_ptr[m] = ret_conv_12_arr;
4314         }
4315         
4316         FREE(ret_var.data);
4317         return ret_arr;
4318 }
4319
4320 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4321 CHECK(!owner->result_ok);
4322         return *owner->contents.err;
4323 }
4324 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint64_t owner) {
4325         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4326         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
4327 }
4328
4329 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4330         LDKInMemorySigner ret = *owner->contents.result;
4331         ret.is_owned = false;
4332         return ret;
4333 }
4334 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
4335         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4336         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4337         uint64_t ret_ref = 0;
4338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4340         return ret_ref;
4341 }
4342
4343 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4344 CHECK(!owner->result_ok);
4345         return DecodeError_clone(&*owner->contents.err);
4346 }
4347 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
4348         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4349         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4350         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4351         uint64_t ret_ref = tag_ptr(ret_copy, true);
4352         return ret_ref;
4353 }
4354
4355 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
4356         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
4357         for (size_t i = 0; i < ret.datalen; i++) {
4358                 ret.data[i] = TxOut_clone(&orig->data[i]);
4359         }
4360         return ret;
4361 }
4362 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4363 CHECK(owner->result_ok);
4364         return *owner->contents.result;
4365 }
4366 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
4367         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4368         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
4369         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4370         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4371         return ret_arr;
4372 }
4373
4374 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4375 CHECK(!owner->result_ok);
4376         return *owner->contents.err;
4377 }
4378 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
4379         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4380         CResult_TransactionNoneZ_get_err(owner_conv);
4381 }
4382
4383 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
4384         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4385         switch(obj->tag) {
4386                 case LDKCOption_u16Z_Some: return 0;
4387                 case LDKCOption_u16Z_None: return 1;
4388                 default: abort();
4389         }
4390 }
4391 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
4392         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4393         assert(obj->tag == LDKCOption_u16Z_Some);
4394                         int16_t some_conv = obj->some;
4395         return some_conv;
4396 }
4397 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
4398         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4399         switch(obj->tag) {
4400                 case LDKAPIError_APIMisuseError: return 0;
4401                 case LDKAPIError_FeeRateTooHigh: return 1;
4402                 case LDKAPIError_RouteError: return 2;
4403                 case LDKAPIError_ChannelUnavailable: return 3;
4404                 case LDKAPIError_MonitorUpdateInProgress: return 4;
4405                 case LDKAPIError_IncompatibleShutdownScript: return 5;
4406                 default: abort();
4407         }
4408 }
4409 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
4410         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4411         assert(obj->tag == LDKAPIError_APIMisuseError);
4412                         LDKStr err_str = obj->api_misuse_error.err;
4413                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4414         return err_conv;
4415 }
4416 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
4417         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4418         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4419                         LDKStr err_str = obj->fee_rate_too_high.err;
4420                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4421         return err_conv;
4422 }
4423 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
4424         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4425         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4426                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
4427         return feerate_conv;
4428 }
4429 jstring __attribute__((export_name("TS_LDKAPIError_RouteError_get_err"))) TS_LDKAPIError_RouteError_get_err(uint64_t ptr) {
4430         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4431         assert(obj->tag == LDKAPIError_RouteError);
4432                         LDKStr err_str = obj->route_error.err;
4433                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4434         return err_conv;
4435 }
4436 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
4437         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4438         assert(obj->tag == LDKAPIError_ChannelUnavailable);
4439                         LDKStr err_str = obj->channel_unavailable.err;
4440                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4441         return err_conv;
4442 }
4443 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
4444         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4445         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
4446                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
4447                         uint64_t script_ref = 0;
4448                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
4449                         script_ref = tag_ptr(script_var.inner, false);
4450         return script_ref;
4451 }
4452 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4453 CHECK(owner->result_ok);
4454         return *owner->contents.result;
4455 }
4456 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
4457         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
4458         CResult_NoneAPIErrorZ_get_ok(owner_conv);
4459 }
4460
4461 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4462 CHECK(!owner->result_ok);
4463         return APIError_clone(&*owner->contents.err);
4464 }
4465 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
4466         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
4467         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4468         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
4469         uint64_t ret_ref = tag_ptr(ret_copy, true);
4470         return ret_ref;
4471 }
4472
4473 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
4474         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
4475         for (size_t i = 0; i < ret.datalen; i++) {
4476                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
4477         }
4478         return ret;
4479 }
4480 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
4481         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
4482         for (size_t i = 0; i < ret.datalen; i++) {
4483                 ret.data[i] = APIError_clone(&orig->data[i]);
4484         }
4485         return ret;
4486 }
4487 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4488 CHECK(owner->result_ok);
4489         return ThirtyTwoBytes_clone(&*owner->contents.result);
4490 }
4491 int8_tArray  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_ok"))) TS_CResult__u832APIErrorZ_get_ok(uint64_t owner) {
4492         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
4493         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4494         memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
4495         return ret_arr;
4496 }
4497
4498 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4499 CHECK(!owner->result_ok);
4500         return APIError_clone(&*owner->contents.err);
4501 }
4502 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_CResult__u832APIErrorZ_get_err(uint64_t owner) {
4503         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
4504         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4505         *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
4506         uint64_t ret_ref = tag_ptr(ret_copy, true);
4507         return ret_ref;
4508 }
4509
4510 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
4511         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4512         switch(obj->tag) {
4513                 case LDKPaymentSendFailure_ParameterError: return 0;
4514                 case LDKPaymentSendFailure_PathParameterError: return 1;
4515                 case LDKPaymentSendFailure_AllFailedRetrySafe: return 2;
4516                 case LDKPaymentSendFailure_PartialFailure: return 3;
4517                 default: abort();
4518         }
4519 }
4520 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
4521         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4522         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
4523                         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
4524         return parameter_error_ref;
4525 }
4526 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
4527         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4528         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
4529                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4530                         uint64_tArray path_parameter_error_arr = NULL;
4531                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
4532                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
4533                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4534                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4535                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4536                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4537                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
4538                         }
4539                         
4540         return path_parameter_error_arr;
4541 }
4542 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe"))) TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe(uint64_t ptr) {
4543         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4544         assert(obj->tag == LDKPaymentSendFailure_AllFailedRetrySafe);
4545                         LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
4546                         uint64_tArray all_failed_retry_safe_arr = NULL;
4547                         all_failed_retry_safe_arr = init_uint64_tArray(all_failed_retry_safe_var.datalen, __LINE__);
4548                         uint64_t *all_failed_retry_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_retry_safe_arr) + 8);
4549                         for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
4550                                 uint64_t all_failed_retry_safe_conv_10_ref = tag_ptr(&all_failed_retry_safe_var.data[k], false);
4551                                 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
4552                         }
4553                         
4554         return all_failed_retry_safe_arr;
4555 }
4556 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
4557         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4558         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4559                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4560                         uint64_tArray results_arr = NULL;
4561                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
4562                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
4563                         for (size_t w = 0; w < results_var.datalen; w++) {
4564                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4565                                 *results_conv_22_conv = results_var.data[w];
4566                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4567                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
4568                         }
4569                         
4570         return results_arr;
4571 }
4572 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
4573         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4574         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4575                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4576                         uint64_t failed_paths_retry_ref = 0;
4577                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4578                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
4579         return failed_paths_retry_ref;
4580 }
4581 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
4582         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4583         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4584                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4585                         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
4586         return payment_id_arr;
4587 }
4588 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4589 CHECK(owner->result_ok);
4590         return ThirtyTwoBytes_clone(&*owner->contents.result);
4591 }
4592 int8_tArray  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_ok(uint64_t owner) {
4593         LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner);
4594         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4595         memcpy(ret_arr->elems, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data, 32);
4596         return ret_arr;
4597 }
4598
4599 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4600 CHECK(!owner->result_ok);
4601         return PaymentSendFailure_clone(&*owner->contents.err);
4602 }
4603 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_err(uint64_t owner) {
4604         LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner);
4605         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4606         *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
4607         uint64_t ret_ref = tag_ptr(ret_copy, true);
4608         return ret_ref;
4609 }
4610
4611 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4612 CHECK(owner->result_ok);
4613         return *owner->contents.result;
4614 }
4615 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
4616         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4617         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
4618 }
4619
4620 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4621 CHECK(!owner->result_ok);
4622         return PaymentSendFailure_clone(&*owner->contents.err);
4623 }
4624 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
4625         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4626         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4627         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
4628         uint64_t ret_ref = tag_ptr(ret_copy, true);
4629         return ret_ref;
4630 }
4631
4632 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4633         return ThirtyTwoBytes_clone(&owner->a);
4634 }
4635 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_a"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint64_t owner) {
4636         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
4637         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4638         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
4639         return ret_arr;
4640 }
4641
4642 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4643         return ThirtyTwoBytes_clone(&owner->b);
4644 }
4645 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_b"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint64_t owner) {
4646         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
4647         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4648         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
4649         return ret_arr;
4650 }
4651
4652 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4653 CHECK(owner->result_ok);
4654         return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
4655 }
4656 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint64_t owner) {
4657         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
4658         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
4659         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
4660         return tag_ptr(ret_conv, true);
4661 }
4662
4663 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4664 CHECK(!owner->result_ok);
4665         return PaymentSendFailure_clone(&*owner->contents.err);
4666 }
4667 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint64_t owner) {
4668         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
4669         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4670         *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
4671         uint64_t ret_ref = tag_ptr(ret_copy, true);
4672         return ret_ref;
4673 }
4674
4675 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
4676         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
4677         for (size_t i = 0; i < ret.datalen; i++) {
4678                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
4679         }
4680         return ret;
4681 }
4682 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4683         return ThirtyTwoBytes_clone(&owner->a);
4684 }
4685 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_a"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint64_t owner) {
4686         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
4687         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4688         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
4689         return ret_arr;
4690 }
4691
4692 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4693         return ThirtyTwoBytes_clone(&owner->b);
4694 }
4695 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_b"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint64_t owner) {
4696         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
4697         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4698         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
4699         return ret_arr;
4700 }
4701
4702 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4703 CHECK(owner->result_ok);
4704         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4705 }
4706 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint64_t owner) {
4707         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
4708         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4709         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
4710         return tag_ptr(ret_conv, true);
4711 }
4712
4713 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4714 CHECK(!owner->result_ok);
4715         return *owner->contents.err;
4716 }
4717 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint64_t owner) {
4718         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
4719         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
4720 }
4721
4722 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4723 CHECK(owner->result_ok);
4724         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4725 }
4726 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint64_t owner) {
4727         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
4728         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4729         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
4730         return tag_ptr(ret_conv, true);
4731 }
4732
4733 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4734 CHECK(!owner->result_ok);
4735         return APIError_clone(&*owner->contents.err);
4736 }
4737 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint64_t owner) {
4738         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
4739         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4740         *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
4741         uint64_t ret_ref = tag_ptr(ret_copy, true);
4742         return ret_ref;
4743 }
4744
4745 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4746 CHECK(owner->result_ok);
4747         return ThirtyTwoBytes_clone(&*owner->contents.result);
4748 }
4749 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_ok"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint64_t owner) {
4750         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
4751         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4752         memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
4753         return ret_arr;
4754 }
4755
4756 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4757 CHECK(!owner->result_ok);
4758         return *owner->contents.err;
4759 }
4760 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_err"))) TS_CResult_PaymentSecretNoneZ_get_err(uint64_t owner) {
4761         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
4762         CResult_PaymentSecretNoneZ_get_err(owner_conv);
4763 }
4764
4765 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4766 CHECK(owner->result_ok);
4767         return ThirtyTwoBytes_clone(&*owner->contents.result);
4768 }
4769 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_ok"))) TS_CResult_PaymentSecretAPIErrorZ_get_ok(uint64_t owner) {
4770         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
4771         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4772         memcpy(ret_arr->elems, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data, 32);
4773         return ret_arr;
4774 }
4775
4776 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4777 CHECK(!owner->result_ok);
4778         return APIError_clone(&*owner->contents.err);
4779 }
4780 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_err"))) TS_CResult_PaymentSecretAPIErrorZ_get_err(uint64_t owner) {
4781         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
4782         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4783         *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
4784         uint64_t ret_ref = tag_ptr(ret_copy, true);
4785         return ret_ref;
4786 }
4787
4788 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4789 CHECK(owner->result_ok);
4790         return ThirtyTwoBytes_clone(&*owner->contents.result);
4791 }
4792 int8_tArray  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint64_t owner) {
4793         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
4794         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4795         memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
4796         return ret_arr;
4797 }
4798
4799 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4800 CHECK(!owner->result_ok);
4801         return APIError_clone(&*owner->contents.err);
4802 }
4803 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_err"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint64_t owner) {
4804         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
4805         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4806         *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
4807         uint64_t ret_ref = tag_ptr(ret_copy, true);
4808         return ret_ref;
4809 }
4810
4811 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4812         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
4813         ret.is_owned = false;
4814         return ret;
4815 }
4816 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
4817         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
4818         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
4819         uint64_t ret_ref = 0;
4820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4822         return ret_ref;
4823 }
4824
4825 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4826 CHECK(!owner->result_ok);
4827         return DecodeError_clone(&*owner->contents.err);
4828 }
4829 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
4830         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
4831         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4832         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
4833         uint64_t ret_ref = tag_ptr(ret_copy, true);
4834         return ret_ref;
4835 }
4836
4837 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
4838         LDKChannelCounterparty ret = *owner->contents.result;
4839         ret.is_owned = false;
4840         return ret;
4841 }
4842 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
4843         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
4844         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
4845         uint64_t ret_ref = 0;
4846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4848         return ret_ref;
4849 }
4850
4851 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
4852 CHECK(!owner->result_ok);
4853         return DecodeError_clone(&*owner->contents.err);
4854 }
4855 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
4856         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
4857         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4858         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
4859         uint64_t ret_ref = tag_ptr(ret_copy, true);
4860         return ret_ref;
4861 }
4862
4863 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
4864         LDKChannelDetails ret = *owner->contents.result;
4865         ret.is_owned = false;
4866         return ret;
4867 }
4868 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
4869         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
4870         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
4871         uint64_t ret_ref = 0;
4872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4874         return ret_ref;
4875 }
4876
4877 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
4878 CHECK(!owner->result_ok);
4879         return DecodeError_clone(&*owner->contents.err);
4880 }
4881 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
4882         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
4883         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4884         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
4885         uint64_t ret_ref = tag_ptr(ret_copy, true);
4886         return ret_ref;
4887 }
4888
4889 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
4890         LDKPhantomRouteHints ret = *owner->contents.result;
4891         ret.is_owned = false;
4892         return ret;
4893 }
4894 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
4895         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
4896         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
4897         uint64_t ret_ref = 0;
4898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4900         return ret_ref;
4901 }
4902
4903 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
4904 CHECK(!owner->result_ok);
4905         return DecodeError_clone(&*owner->contents.err);
4906 }
4907 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
4908         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
4909         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4910         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
4911         uint64_t ret_ref = tag_ptr(ret_copy, true);
4912         return ret_ref;
4913 }
4914
4915 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
4916         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
4917         for (size_t i = 0; i < ret.datalen; i++) {
4918                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
4919         }
4920         return ret;
4921 }
4922 typedef struct LDKWatch_JCalls {
4923         atomic_size_t refcnt;
4924         uint32_t instance_ptr;
4925 } LDKWatch_JCalls;
4926 static void LDKWatch_JCalls_free(void* this_arg) {
4927         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4928         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4929                 FREE(j_calls);
4930         }
4931 }
4932 LDKChannelMonitorUpdateStatus watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
4933         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4934         LDKOutPoint funding_txo_var = funding_txo;
4935         uint64_t funding_txo_ref = 0;
4936         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4937         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
4938         LDKChannelMonitor monitor_var = monitor;
4939         uint64_t monitor_ref = 0;
4940         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
4941         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
4942         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 17, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
4943         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
4944         return ret_conv;
4945 }
4946 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
4947         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4948         LDKOutPoint funding_txo_var = funding_txo;
4949         uint64_t funding_txo_ref = 0;
4950         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4951         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
4952         LDKChannelMonitorUpdate update_var = update;
4953         uint64_t update_ref = 0;
4954         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
4955         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
4956         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 18, funding_txo_ref, update_ref, 0, 0, 0, 0);
4957         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
4958         return ret_conv;
4959 }
4960 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
4961         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4962         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 19, 0, 0, 0, 0, 0, 0);
4963         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
4964         ret_constr.datalen = ret->arr_len;
4965         if (ret_constr.datalen > 0)
4966                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
4967         else
4968                 ret_constr.data = NULL;
4969         uint64_t* ret_vals = ret->elems;
4970         for (size_t x = 0; x < ret_constr.datalen; x++) {
4971                 uint64_t ret_conv_49 = ret_vals[x];
4972                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
4973                 CHECK_ACCESS(ret_conv_49_ptr);
4974                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
4975                 FREE(untag_ptr(ret_conv_49));
4976                 ret_constr.data[x] = ret_conv_49_conv;
4977         }
4978         FREE(ret);
4979         return ret_constr;
4980 }
4981 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
4982         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
4983         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4984 }
4985 static inline LDKWatch LDKWatch_init (JSValue o) {
4986         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
4987         atomic_init(&calls->refcnt, 1);
4988         calls->instance_ptr = o;
4989
4990         LDKWatch ret = {
4991                 .this_arg = (void*) calls,
4992                 .watch_channel = watch_channel_LDKWatch_jcall,
4993                 .update_channel = update_channel_LDKWatch_jcall,
4994                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
4995                 .free = LDKWatch_JCalls_free,
4996         };
4997         return ret;
4998 }
4999 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
5000         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5001         *res_ptr = LDKWatch_init(o);
5002         return tag_ptr(res_ptr, true);
5003 }
5004 uint32_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
5005         void* this_arg_ptr = untag_ptr(this_arg);
5006         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5007         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5008         LDKOutPoint funding_txo_conv;
5009         funding_txo_conv.inner = untag_ptr(funding_txo);
5010         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5011         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5012         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5013         LDKChannelMonitor monitor_conv;
5014         monitor_conv.inner = untag_ptr(monitor);
5015         monitor_conv.is_owned = ptr_is_owned(monitor);
5016         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5017         monitor_conv = ChannelMonitor_clone(&monitor_conv);
5018         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv));
5019         return ret_conv;
5020 }
5021
5022 uint32_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
5023         void* this_arg_ptr = untag_ptr(this_arg);
5024         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5025         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5026         LDKOutPoint funding_txo_conv;
5027         funding_txo_conv.inner = untag_ptr(funding_txo);
5028         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5029         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5030         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5031         LDKChannelMonitorUpdate update_conv;
5032         update_conv.inner = untag_ptr(update);
5033         update_conv.is_owned = ptr_is_owned(update);
5034         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5035         update_conv = ChannelMonitorUpdate_clone(&update_conv);
5036         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv));
5037         return ret_conv;
5038 }
5039
5040 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
5041         void* this_arg_ptr = untag_ptr(this_arg);
5042         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5043         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5044         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5045         uint64_tArray ret_arr = NULL;
5046         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5047         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5048         for (size_t x = 0; x < ret_var.datalen; x++) {
5049                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
5050                 *ret_conv_49_conv = ret_var.data[x];
5051                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
5052         }
5053         
5054         FREE(ret_var.data);
5055         return ret_arr;
5056 }
5057
5058 typedef struct LDKBroadcasterInterface_JCalls {
5059         atomic_size_t refcnt;
5060         uint32_t instance_ptr;
5061 } LDKBroadcasterInterface_JCalls;
5062 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5063         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5064         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5065                 FREE(j_calls);
5066         }
5067 }
5068 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
5069         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5070         LDKTransaction tx_var = tx;
5071         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
5072         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
5073         Transaction_free(tx_var);
5074         js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
5075 }
5076 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5077         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5078         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5079 }
5080 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
5081         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5082         atomic_init(&calls->refcnt, 1);
5083         calls->instance_ptr = o;
5084
5085         LDKBroadcasterInterface ret = {
5086                 .this_arg = (void*) calls,
5087                 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
5088                 .free = LDKBroadcasterInterface_JCalls_free,
5089         };
5090         return ret;
5091 }
5092 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
5093         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5094         *res_ptr = LDKBroadcasterInterface_init(o);
5095         return tag_ptr(res_ptr, true);
5096 }
5097 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transaction"))) TS_BroadcasterInterface_broadcast_transaction(uint64_t this_arg, int8_tArray tx) {
5098         void* this_arg_ptr = untag_ptr(this_arg);
5099         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5100         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5101         LDKTransaction tx_ref;
5102         tx_ref.datalen = tx->arr_len;
5103         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
5104         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
5105         tx_ref.data_is_owned = true;
5106         (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
5107 }
5108
5109 typedef struct LDKKeysInterface_JCalls {
5110         atomic_size_t refcnt;
5111         uint32_t instance_ptr;
5112 } LDKKeysInterface_JCalls;
5113 static void LDKKeysInterface_JCalls_free(void* this_arg) {
5114         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5115         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5116                 FREE(j_calls);
5117         }
5118 }
5119 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
5120         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5121         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5122         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, recipient_conv, 0, 0, 0, 0, 0);
5123         void* ret_ptr = untag_ptr(ret);
5124         CHECK_ACCESS(ret_ptr);
5125         LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
5126         FREE(untag_ptr(ret));
5127         return ret_conv;
5128 }
5129 LDKCResult_PublicKeyNoneZ get_node_id_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
5130         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5131         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5132         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, recipient_conv, 0, 0, 0, 0, 0);
5133         void* ret_ptr = untag_ptr(ret);
5134         CHECK_ACCESS(ret_ptr);
5135         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
5136         FREE(untag_ptr(ret));
5137         return ret_conv;
5138 }
5139 LDKCResult_SharedSecretNoneZ ecdh_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) {
5140         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5141         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5142         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
5143         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
5144         LDKCOption_ScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
5145         *tweak_copy = tweak;
5146         uint64_t tweak_ref = tag_ptr(tweak_copy, true);
5147         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 23, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0);
5148         void* ret_ptr = untag_ptr(ret);
5149         CHECK_ACCESS(ret_ptr);
5150         LDKCResult_SharedSecretNoneZ ret_conv = *(LDKCResult_SharedSecretNoneZ*)(ret_ptr);
5151         FREE(untag_ptr(ret));
5152         return ret_conv;
5153 }
5154 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
5155         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5156         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 24, 0, 0, 0, 0, 0, 0);
5157         LDKCVec_u8Z ret_ref;
5158         ret_ref.datalen = ret->arr_len;
5159         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5160         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5161         return ret_ref;
5162 }
5163 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
5164         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5165         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 25, 0, 0, 0, 0, 0, 0);
5166         LDKShutdownScript ret_conv;
5167         ret_conv.inner = untag_ptr(ret);
5168         ret_conv.is_owned = ptr_is_owned(ret);
5169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
5170         return ret_conv;
5171 }
5172 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
5173         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5174         jboolean inbound_conv = inbound;
5175         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5176         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 26, inbound_conv, channel_value_satoshis_conv, 0, 0, 0, 0);
5177         void* ret_ptr = untag_ptr(ret);
5178         CHECK_ACCESS(ret_ptr);
5179         LDKSign ret_conv = *(LDKSign*)(ret_ptr);
5180         FREE(untag_ptr(ret));
5181         return ret_conv;
5182 }
5183 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
5184         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5185         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 27, 0, 0, 0, 0, 0, 0);
5186         LDKThirtyTwoBytes ret_ref;
5187         CHECK(ret->arr_len == 32);
5188         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5189         return ret_ref;
5190 }
5191 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
5192         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5193         LDKu8slice reader_var = reader;
5194         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
5195         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
5196         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 28, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
5197         void* ret_ptr = untag_ptr(ret);
5198         CHECK_ACCESS(ret_ptr);
5199         LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
5200         FREE(untag_ptr(ret));
5201         return ret_conv;
5202 }
5203 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
5204         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5205         LDKu8slice hrp_bytes_var = hrp_bytes;
5206         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
5207         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
5208         LDKCVec_u5Z invoice_data_var = invoice_data;
5209         ptrArray invoice_data_arr = NULL;
5210         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
5211         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
5212         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5213                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5214                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5215         }
5216         
5217         FREE(invoice_data_var.data);
5218         uint32_t receipient_conv = LDKRecipient_to_js(receipient);
5219         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 29, (uint32_t)hrp_bytes_arr, (uint32_t)invoice_data_arr, receipient_conv, 0, 0, 0);
5220         void* ret_ptr = untag_ptr(ret);
5221         CHECK_ACCESS(ret_ptr);
5222         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5223         FREE(untag_ptr(ret));
5224         return ret_conv;
5225 }
5226 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
5227         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5228         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 30, 0, 0, 0, 0, 0, 0);
5229         LDKThirtyTwoBytes ret_ref;
5230         CHECK(ret->arr_len == 32);
5231         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5232         return ret_ref;
5233 }
5234 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
5235         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
5236         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5237 }
5238 static inline LDKKeysInterface LDKKeysInterface_init (JSValue o) {
5239         LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
5240         atomic_init(&calls->refcnt, 1);
5241         calls->instance_ptr = o;
5242
5243         LDKKeysInterface ret = {
5244                 .this_arg = (void*) calls,
5245                 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
5246                 .get_node_id = get_node_id_LDKKeysInterface_jcall,
5247                 .ecdh = ecdh_LDKKeysInterface_jcall,
5248                 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
5249                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
5250                 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
5251                 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
5252                 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
5253                 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
5254                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
5255                 .free = LDKKeysInterface_JCalls_free,
5256         };
5257         return ret;
5258 }
5259 uint64_t  __attribute__((export_name("TS_LDKKeysInterface_new"))) TS_LDKKeysInterface_new(JSValue o) {
5260         LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5261         *res_ptr = LDKKeysInterface_init(o);
5262         return tag_ptr(res_ptr, true);
5263 }
5264 uint64_t  __attribute__((export_name("TS_KeysInterface_get_node_secret"))) TS_KeysInterface_get_node_secret(uint64_t this_arg, uint32_t recipient) {
5265         void* this_arg_ptr = untag_ptr(this_arg);
5266         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5267         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5268         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5269         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
5270         *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
5271         return tag_ptr(ret_conv, true);
5272 }
5273
5274 uint64_t  __attribute__((export_name("TS_KeysInterface_get_node_id"))) TS_KeysInterface_get_node_id(uint64_t this_arg, uint32_t recipient) {
5275         void* this_arg_ptr = untag_ptr(this_arg);
5276         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5277         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5278         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5279         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
5280         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
5281         return tag_ptr(ret_conv, true);
5282 }
5283
5284 uint64_t  __attribute__((export_name("TS_KeysInterface_ecdh"))) TS_KeysInterface_ecdh(uint64_t this_arg, uint32_t recipient, int8_tArray other_key, uint64_t tweak) {
5285         void* this_arg_ptr = untag_ptr(this_arg);
5286         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5287         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5288         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5289         LDKPublicKey other_key_ref;
5290         CHECK(other_key->arr_len == 33);
5291         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
5292         void* tweak_ptr = untag_ptr(tweak);
5293         CHECK_ACCESS(tweak_ptr);
5294         LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr);
5295         // WARNING: we may need a move here but no clone is available for LDKCOption_ScalarZ
5296         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
5297         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
5298         return tag_ptr(ret_conv, true);
5299 }
5300
5301 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_destination_script"))) TS_KeysInterface_get_destination_script(uint64_t this_arg) {
5302         void* this_arg_ptr = untag_ptr(this_arg);
5303         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5304         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5305         LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
5306         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5307         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5308         CVec_u8Z_free(ret_var);
5309         return ret_arr;
5310 }
5311
5312 uint64_t  __attribute__((export_name("TS_KeysInterface_get_shutdown_scriptpubkey"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint64_t this_arg) {
5313         void* this_arg_ptr = untag_ptr(this_arg);
5314         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5315         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5316         LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
5317         uint64_t ret_ref = 0;
5318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5320         return ret_ref;
5321 }
5322
5323 uint64_t  __attribute__((export_name("TS_KeysInterface_get_channel_signer"))) TS_KeysInterface_get_channel_signer(uint64_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
5324         void* this_arg_ptr = untag_ptr(this_arg);
5325         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5326         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5327         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5328         *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
5329         return tag_ptr(ret_ret, true);
5330 }
5331
5332 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_secure_random_bytes"))) TS_KeysInterface_get_secure_random_bytes(uint64_t this_arg) {
5333         void* this_arg_ptr = untag_ptr(this_arg);
5334         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5335         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5336         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5337         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5338         return ret_arr;
5339 }
5340
5341 uint64_t  __attribute__((export_name("TS_KeysInterface_read_chan_signer"))) TS_KeysInterface_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
5342         void* this_arg_ptr = untag_ptr(this_arg);
5343         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5344         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5345         LDKu8slice reader_ref;
5346         reader_ref.datalen = reader->arr_len;
5347         reader_ref.data = reader->elems;
5348         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
5349         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
5350         FREE(reader);
5351         return tag_ptr(ret_conv, true);
5352 }
5353
5354 uint64_t  __attribute__((export_name("TS_KeysInterface_sign_invoice"))) TS_KeysInterface_sign_invoice(uint64_t this_arg, int8_tArray hrp_bytes, ptrArray invoice_data, uint32_t receipient) {
5355         void* this_arg_ptr = untag_ptr(this_arg);
5356         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5357         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5358         LDKu8slice hrp_bytes_ref;
5359         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
5360         hrp_bytes_ref.data = hrp_bytes->elems;
5361         LDKCVec_u5Z invoice_data_constr;
5362         invoice_data_constr.datalen = invoice_data->arr_len;
5363         if (invoice_data_constr.datalen > 0)
5364                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
5365         else
5366                 invoice_data_constr.data = NULL;
5367         int8_t* invoice_data_vals = (void*) invoice_data->elems;
5368         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
5369                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
5370                 
5371                 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
5372         }
5373         FREE(invoice_data);
5374         LDKRecipient receipient_conv = LDKRecipient_from_js(receipient);
5375         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
5376         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
5377         FREE(hrp_bytes);
5378         return tag_ptr(ret_conv, true);
5379 }
5380
5381 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_inbound_payment_key_material"))) TS_KeysInterface_get_inbound_payment_key_material(uint64_t this_arg) {
5382         void* this_arg_ptr = untag_ptr(this_arg);
5383         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5384         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5385         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5386         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
5387         return ret_arr;
5388 }
5389
5390 typedef struct LDKFeeEstimator_JCalls {
5391         atomic_size_t refcnt;
5392         uint32_t instance_ptr;
5393 } LDKFeeEstimator_JCalls;
5394 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
5395         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5396         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5397                 FREE(j_calls);
5398         }
5399 }
5400 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
5401         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5402         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
5403         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 31, confirmation_target_conv, 0, 0, 0, 0, 0);
5404 }
5405 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
5406         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
5407         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5408 }
5409 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
5410         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
5411         atomic_init(&calls->refcnt, 1);
5412         calls->instance_ptr = o;
5413
5414         LDKFeeEstimator ret = {
5415                 .this_arg = (void*) calls,
5416                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
5417                 .free = LDKFeeEstimator_JCalls_free,
5418         };
5419         return ret;
5420 }
5421 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
5422         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
5423         *res_ptr = LDKFeeEstimator_init(o);
5424         return tag_ptr(res_ptr, true);
5425 }
5426 int32_t  __attribute__((export_name("TS_FeeEstimator_get_est_sat_per_1000_weight"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint64_t this_arg, uint32_t confirmation_target) {
5427         void* this_arg_ptr = untag_ptr(this_arg);
5428         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5429         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
5430         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
5431         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
5432         return ret_conv;
5433 }
5434
5435 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5436         return ThirtyTwoBytes_clone(&owner->a);
5437 }
5438 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint64_t owner) {
5439         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
5440         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5441         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
5442         return ret_arr;
5443 }
5444
5445 static inline struct LDKChannelManager C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5446         LDKChannelManager ret = owner->b;
5447         ret.is_owned = false;
5448         return ret;
5449 }
5450 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint64_t owner) {
5451         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
5452         LDKChannelManager ret_var = C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
5453         uint64_t ret_ref = 0;
5454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5456         return ret_ref;
5457 }
5458
5459 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5460 CHECK(owner->result_ok);
5461         return &*owner->contents.result;
5462 }
5463 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
5464         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
5465         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
5466         return ret_ret;
5467 }
5468
5469 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5470 CHECK(!owner->result_ok);
5471         return DecodeError_clone(&*owner->contents.err);
5472 }
5473 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
5474         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
5475         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5476         *ret_copy = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
5477         uint64_t ret_ref = tag_ptr(ret_copy, true);
5478         return ret_ref;
5479 }
5480
5481 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5482         LDKChannelConfig ret = *owner->contents.result;
5483         ret.is_owned = false;
5484         return ret;
5485 }
5486 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
5487         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
5488         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
5489         uint64_t ret_ref = 0;
5490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5492         return ret_ref;
5493 }
5494
5495 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5496 CHECK(!owner->result_ok);
5497         return DecodeError_clone(&*owner->contents.err);
5498 }
5499 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
5500         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
5501         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5502         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
5503         uint64_t ret_ref = tag_ptr(ret_copy, true);
5504         return ret_ref;
5505 }
5506
5507 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5508         LDKOutPoint ret = *owner->contents.result;
5509         ret.is_owned = false;
5510         return ret;
5511 }
5512 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
5513         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
5514         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
5515         uint64_t ret_ref = 0;
5516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5518         return ret_ref;
5519 }
5520
5521 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5522 CHECK(!owner->result_ok);
5523         return DecodeError_clone(&*owner->contents.err);
5524 }
5525 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
5526         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
5527         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5528         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
5529         uint64_t ret_ref = tag_ptr(ret_copy, true);
5530         return ret_ref;
5531 }
5532
5533 typedef struct LDKType_JCalls {
5534         atomic_size_t refcnt;
5535         uint32_t instance_ptr;
5536 } LDKType_JCalls;
5537 static void LDKType_JCalls_free(void* this_arg) {
5538         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5539         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5540                 FREE(j_calls);
5541         }
5542 }
5543 uint16_t type_id_LDKType_jcall(const void* this_arg) {
5544         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5545         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, 0, 0, 0, 0, 0, 0);
5546 }
5547 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
5548         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5549         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 33, 0, 0, 0, 0, 0, 0);
5550         LDKStr ret_conv = str_ref_to_owned_c(ret);
5551         return ret_conv;
5552 }
5553 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
5554         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5555         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 34, 0, 0, 0, 0, 0, 0);
5556         LDKCVec_u8Z ret_ref;
5557         ret_ref.datalen = ret->arr_len;
5558         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5559         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5560         return ret_ref;
5561 }
5562 static void LDKType_JCalls_cloned(LDKType* new_obj) {
5563         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
5564         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5565 }
5566 static inline LDKType LDKType_init (JSValue o) {
5567         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
5568         atomic_init(&calls->refcnt, 1);
5569         calls->instance_ptr = o;
5570
5571         LDKType ret = {
5572                 .this_arg = (void*) calls,
5573                 .type_id = type_id_LDKType_jcall,
5574                 .debug_str = debug_str_LDKType_jcall,
5575                 .write = write_LDKType_jcall,
5576                 .cloned = LDKType_JCalls_cloned,
5577                 .free = LDKType_JCalls_free,
5578         };
5579         return ret;
5580 }
5581 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
5582         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
5583         *res_ptr = LDKType_init(o);
5584         return tag_ptr(res_ptr, true);
5585 }
5586 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
5587         void* this_arg_ptr = untag_ptr(this_arg);
5588         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5589         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5590         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
5591         return ret_conv;
5592 }
5593
5594 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
5595         void* this_arg_ptr = untag_ptr(this_arg);
5596         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5597         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5598         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
5599         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
5600         Str_free(ret_str);
5601         return ret_conv;
5602 }
5603
5604 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
5605         void* this_arg_ptr = untag_ptr(this_arg);
5606         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5607         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5608         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5609         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5610         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5611         CVec_u8Z_free(ret_var);
5612         return ret_arr;
5613 }
5614
5615 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
5616         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
5617         switch(obj->tag) {
5618                 case LDKCOption_TypeZ_Some: return 0;
5619                 case LDKCOption_TypeZ_None: return 1;
5620                 default: abort();
5621         }
5622 }
5623 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
5624         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
5625         assert(obj->tag == LDKCOption_TypeZ_Some);
5626                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
5627                         *some_ret = Type_clone(&obj->some);
5628         return tag_ptr(some_ret, true);
5629 }
5630 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5631 CHECK(owner->result_ok);
5632         return COption_TypeZ_clone(&*owner->contents.result);
5633 }
5634 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
5635         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
5636         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
5637         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
5638         uint64_t ret_ref = tag_ptr(ret_copy, true);
5639         return ret_ref;
5640 }
5641
5642 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5643 CHECK(!owner->result_ok);
5644         return DecodeError_clone(&*owner->contents.err);
5645 }
5646 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
5647         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
5648         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5649         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
5650         uint64_t ret_ref = tag_ptr(ret_copy, true);
5651         return ret_ref;
5652 }
5653
5654 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint64_t ptr) {
5655         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5656         switch(obj->tag) {
5657                 case LDKPaymentError_Invoice: return 0;
5658                 case LDKPaymentError_Routing: return 1;
5659                 case LDKPaymentError_Sending: return 2;
5660                 default: abort();
5661         }
5662 }
5663 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint64_t ptr) {
5664         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5665         assert(obj->tag == LDKPaymentError_Invoice);
5666                         LDKStr invoice_str = obj->invoice;
5667                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
5668         return invoice_conv;
5669 }
5670 uint64_t __attribute__((export_name("TS_LDKPaymentError_Routing_get_routing"))) TS_LDKPaymentError_Routing_get_routing(uint64_t ptr) {
5671         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5672         assert(obj->tag == LDKPaymentError_Routing);
5673                         LDKLightningError routing_var = obj->routing;
5674                         uint64_t routing_ref = 0;
5675                         CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
5676                         routing_ref = tag_ptr(routing_var.inner, false);
5677         return routing_ref;
5678 }
5679 uint64_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint64_t ptr) {
5680         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5681         assert(obj->tag == LDKPaymentError_Sending);
5682                         uint64_t sending_ref = tag_ptr(&obj->sending, false);
5683         return sending_ref;
5684 }
5685 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5686 CHECK(owner->result_ok);
5687         return ThirtyTwoBytes_clone(&*owner->contents.result);
5688 }
5689 int8_tArray  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_ok"))) TS_CResult_PaymentIdPaymentErrorZ_get_ok(uint64_t owner) {
5690         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
5691         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5692         memcpy(ret_arr->elems, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data, 32);
5693         return ret_arr;
5694 }
5695
5696 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5697 CHECK(!owner->result_ok);
5698         return PaymentError_clone(&*owner->contents.err);
5699 }
5700 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_err"))) TS_CResult_PaymentIdPaymentErrorZ_get_err(uint64_t owner) {
5701         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
5702         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
5703         *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
5704         uint64_t ret_ref = tag_ptr(ret_copy, true);
5705         return ret_ref;
5706 }
5707
5708 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
5709         LDKInFlightHtlcs ret = *owner->contents.result;
5710         ret.is_owned = false;
5711         return ret;
5712 }
5713 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) {
5714         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
5715         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
5716         uint64_t ret_ref = 0;
5717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5719         return ret_ref;
5720 }
5721
5722 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
5723 CHECK(!owner->result_ok);
5724         return DecodeError_clone(&*owner->contents.err);
5725 }
5726 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) {
5727         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
5728         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5729         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
5730         uint64_t ret_ref = tag_ptr(ret_copy, true);
5731         return ret_ref;
5732 }
5733
5734 uint32_t __attribute__((export_name("TS_LDKParseError_ty_from_ptr"))) TS_LDKParseError_ty_from_ptr(uint64_t ptr) {
5735         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5736         switch(obj->tag) {
5737                 case LDKParseError_Bech32Error: return 0;
5738                 case LDKParseError_ParseAmountError: return 1;
5739                 case LDKParseError_MalformedSignature: return 2;
5740                 case LDKParseError_BadPrefix: return 3;
5741                 case LDKParseError_UnknownCurrency: return 4;
5742                 case LDKParseError_UnknownSiPrefix: return 5;
5743                 case LDKParseError_MalformedHRP: return 6;
5744                 case LDKParseError_TooShortDataPart: return 7;
5745                 case LDKParseError_UnexpectedEndOfTaggedFields: return 8;
5746                 case LDKParseError_DescriptionDecodeError: return 9;
5747                 case LDKParseError_PaddingError: return 10;
5748                 case LDKParseError_IntegerOverflowError: return 11;
5749                 case LDKParseError_InvalidSegWitProgramLength: return 12;
5750                 case LDKParseError_InvalidPubKeyHashLength: return 13;
5751                 case LDKParseError_InvalidScriptHashLength: return 14;
5752                 case LDKParseError_InvalidRecoveryId: return 15;
5753                 case LDKParseError_InvalidSliceLength: return 16;
5754                 case LDKParseError_Skip: return 17;
5755                 default: abort();
5756         }
5757 }
5758 uint64_t __attribute__((export_name("TS_LDKParseError_Bech32Error_get_bech32_error"))) TS_LDKParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
5759         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5760         assert(obj->tag == LDKParseError_Bech32Error);
5761                         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
5762         return bech32_error_ref;
5763 }
5764 int32_t __attribute__((export_name("TS_LDKParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
5765         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5766         assert(obj->tag == LDKParseError_ParseAmountError);
5767                         /*obj->parse_amount_error*/
5768         return 0;
5769 }
5770 uint32_t __attribute__((export_name("TS_LDKParseError_MalformedSignature_get_malformed_signature"))) TS_LDKParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
5771         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5772         assert(obj->tag == LDKParseError_MalformedSignature);
5773                         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
5774         return malformed_signature_conv;
5775 }
5776 int32_t __attribute__((export_name("TS_LDKParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
5777         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5778         assert(obj->tag == LDKParseError_DescriptionDecodeError);
5779                         /*obj->description_decode_error*/
5780         return 0;
5781 }
5782 jstring __attribute__((export_name("TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
5783         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5784         assert(obj->tag == LDKParseError_InvalidSliceLength);
5785                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
5786                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
5787         return invalid_slice_length_conv;
5788 }
5789 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
5790 CHECK(owner->result_ok);
5791         return SiPrefix_clone(&*owner->contents.result);
5792 }
5793 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_ok"))) TS_CResult_SiPrefixParseErrorZ_get_ok(uint64_t owner) {
5794         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
5795         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
5796         return ret_conv;
5797 }
5798
5799 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
5800 CHECK(!owner->result_ok);
5801         return ParseError_clone(&*owner->contents.err);
5802 }
5803 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_err"))) TS_CResult_SiPrefixParseErrorZ_get_err(uint64_t owner) {
5804         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
5805         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
5806         *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
5807         uint64_t ret_ref = tag_ptr(ret_copy, true);
5808         return ret_ref;
5809 }
5810
5811 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
5812         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
5813         switch(obj->tag) {
5814                 case LDKParseOrSemanticError_ParseError: return 0;
5815                 case LDKParseOrSemanticError_SemanticError: return 1;
5816                 default: abort();
5817         }
5818 }
5819 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
5820         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
5821         assert(obj->tag == LDKParseOrSemanticError_ParseError);
5822                         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
5823         return parse_error_ref;
5824 }
5825 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
5826         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
5827         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
5828                         uint32_t semantic_error_conv = LDKSemanticError_to_js(obj->semantic_error);
5829         return semantic_error_conv;
5830 }
5831 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
5832         LDKInvoice ret = *owner->contents.result;
5833         ret.is_owned = false;
5834         return ret;
5835 }
5836 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
5837         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
5838         LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
5839         uint64_t ret_ref = 0;
5840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5842         return ret_ref;
5843 }
5844
5845 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
5846 CHECK(!owner->result_ok);
5847         return ParseOrSemanticError_clone(&*owner->contents.err);
5848 }
5849 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
5850         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
5851         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
5852         *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
5853         uint64_t ret_ref = tag_ptr(ret_copy, true);
5854         return ret_ref;
5855 }
5856
5857 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
5858         LDKSignedRawInvoice ret = *owner->contents.result;
5859         ret.is_owned = false;
5860         return ret;
5861 }
5862 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_ok(uint64_t owner) {
5863         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
5864         LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
5865         uint64_t ret_ref = 0;
5866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5868         return ret_ref;
5869 }
5870
5871 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
5872 CHECK(!owner->result_ok);
5873         return ParseError_clone(&*owner->contents.err);
5874 }
5875 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_err(uint64_t owner) {
5876         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
5877         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
5878         *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
5879         uint64_t ret_ref = tag_ptr(ret_copy, true);
5880         return ret_ref;
5881 }
5882
5883 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5884         LDKRawInvoice ret = owner->a;
5885         ret.is_owned = false;
5886         return ret;
5887 }
5888 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint64_t owner) {
5889         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
5890         LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
5891         uint64_t ret_ref = 0;
5892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5894         return ret_ref;
5895 }
5896
5897 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5898         return ThirtyTwoBytes_clone(&owner->b);
5899 }
5900 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint64_t owner) {
5901         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
5902         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5903         memcpy(ret_arr->elems, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data, 32);
5904         return ret_arr;
5905 }
5906
5907 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5908         LDKInvoiceSignature ret = owner->c;
5909         ret.is_owned = false;
5910         return ret;
5911 }
5912 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint64_t owner) {
5913         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
5914         LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
5915         uint64_t ret_ref = 0;
5916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5918         return ret_ref;
5919 }
5920
5921 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
5922         LDKPayeePubKey ret = *owner->contents.result;
5923         ret.is_owned = false;
5924         return ret;
5925 }
5926 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint64_t owner) {
5927         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
5928         LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
5929         uint64_t ret_ref = 0;
5930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5932         return ret_ref;
5933 }
5934
5935 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
5936 CHECK(!owner->result_ok);
5937         return *owner->contents.err;
5938 }
5939 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint64_t owner) {
5940         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
5941         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv));
5942         return ret_conv;
5943 }
5944
5945 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
5946         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
5947         for (size_t i = 0; i < ret.datalen; i++) {
5948                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
5949         }
5950         return ret;
5951 }
5952 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
5953         LDKPositiveTimestamp ret = *owner->contents.result;
5954         ret.is_owned = false;
5955         return ret;
5956 }
5957 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
5958         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
5959         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
5960         uint64_t ret_ref = 0;
5961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5963         return ret_ref;
5964 }
5965
5966 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
5967 CHECK(!owner->result_ok);
5968         return CreationError_clone(&*owner->contents.err);
5969 }
5970 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
5971         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
5972         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
5973         return ret_conv;
5974 }
5975
5976 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
5977 CHECK(owner->result_ok);
5978         return *owner->contents.result;
5979 }
5980 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_ok"))) TS_CResult_NoneSemanticErrorZ_get_ok(uint64_t owner) {
5981         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
5982         CResult_NoneSemanticErrorZ_get_ok(owner_conv);
5983 }
5984
5985 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
5986 CHECK(!owner->result_ok);
5987         return SemanticError_clone(&*owner->contents.err);
5988 }
5989 uint32_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_err"))) TS_CResult_NoneSemanticErrorZ_get_err(uint64_t owner) {
5990         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
5991         uint32_t ret_conv = LDKSemanticError_to_js(CResult_NoneSemanticErrorZ_get_err(owner_conv));
5992         return ret_conv;
5993 }
5994
5995 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
5996         LDKInvoice ret = *owner->contents.result;
5997         ret.is_owned = false;
5998         return ret;
5999 }
6000 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_ok"))) TS_CResult_InvoiceSemanticErrorZ_get_ok(uint64_t owner) {
6001         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
6002         LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
6003         uint64_t ret_ref = 0;
6004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6006         return ret_ref;
6007 }
6008
6009 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6010 CHECK(!owner->result_ok);
6011         return SemanticError_clone(&*owner->contents.err);
6012 }
6013 uint32_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_err"))) TS_CResult_InvoiceSemanticErrorZ_get_err(uint64_t owner) {
6014         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
6015         uint32_t ret_conv = LDKSemanticError_to_js(CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
6016         return ret_conv;
6017 }
6018
6019 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6020         LDKDescription ret = *owner->contents.result;
6021         ret.is_owned = false;
6022         return ret;
6023 }
6024 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
6025         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
6026         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
6027         uint64_t ret_ref = 0;
6028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6030         return ret_ref;
6031 }
6032
6033 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6034 CHECK(!owner->result_ok);
6035         return CreationError_clone(&*owner->contents.err);
6036 }
6037 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
6038         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
6039         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
6040         return ret_conv;
6041 }
6042
6043 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6044         LDKPrivateRoute ret = *owner->contents.result;
6045         ret.is_owned = false;
6046         return ret;
6047 }
6048 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
6049         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
6050         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
6051         uint64_t ret_ref = 0;
6052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6054         return ret_ref;
6055 }
6056
6057 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6058 CHECK(!owner->result_ok);
6059         return CreationError_clone(&*owner->contents.err);
6060 }
6061 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
6062         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
6063         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
6064         return ret_conv;
6065 }
6066
6067 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6068 CHECK(owner->result_ok);
6069         return *owner->contents.result;
6070 }
6071 jstring  __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint64_t owner) {
6072         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
6073         LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
6074         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6075         return ret_conv;
6076 }
6077
6078 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6079 CHECK(!owner->result_ok);
6080         return *owner->contents.err;
6081 }
6082 uint32_t  __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint64_t owner) {
6083         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
6084         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
6085         return ret_conv;
6086 }
6087
6088 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6089         LDKChannelMonitorUpdate ret = *owner->contents.result;
6090         ret.is_owned = false;
6091         return ret;
6092 }
6093 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6094         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6095         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
6096         uint64_t ret_ref = 0;
6097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6099         return ret_ref;
6100 }
6101
6102 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6103 CHECK(!owner->result_ok);
6104         return DecodeError_clone(&*owner->contents.err);
6105 }
6106 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
6107         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6108         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6109         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
6110         uint64_t ret_ref = tag_ptr(ret_copy, true);
6111         return ret_ref;
6112 }
6113
6114 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
6115         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6116         switch(obj->tag) {
6117                 case LDKCOption_MonitorEventZ_Some: return 0;
6118                 case LDKCOption_MonitorEventZ_None: return 1;
6119                 default: abort();
6120         }
6121 }
6122 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
6123         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6124         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
6125                         uint64_t some_ref = tag_ptr(&obj->some, false);
6126         return some_ref;
6127 }
6128 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6129 CHECK(owner->result_ok);
6130         return COption_MonitorEventZ_clone(&*owner->contents.result);
6131 }
6132 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
6133         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6134         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
6135         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
6136         uint64_t ret_ref = tag_ptr(ret_copy, true);
6137         return ret_ref;
6138 }
6139
6140 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6141 CHECK(!owner->result_ok);
6142         return DecodeError_clone(&*owner->contents.err);
6143 }
6144 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
6145         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6146         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6147         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
6148         uint64_t ret_ref = tag_ptr(ret_copy, true);
6149         return ret_ref;
6150 }
6151
6152 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6153         LDKHTLCUpdate ret = *owner->contents.result;
6154         ret.is_owned = false;
6155         return ret;
6156 }
6157 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6158         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6159         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
6160         uint64_t ret_ref = 0;
6161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6163         return ret_ref;
6164 }
6165
6166 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6167 CHECK(!owner->result_ok);
6168         return DecodeError_clone(&*owner->contents.err);
6169 }
6170 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
6171         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6172         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6173         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
6174         uint64_t ret_ref = tag_ptr(ret_copy, true);
6175         return ret_ref;
6176 }
6177
6178 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6179         LDKOutPoint ret = owner->a;
6180         ret.is_owned = false;
6181         return ret;
6182 }
6183 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint64_t owner) {
6184         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6185         LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
6186         uint64_t ret_ref = 0;
6187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6189         return ret_ref;
6190 }
6191
6192 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6193         return CVec_u8Z_clone(&owner->b);
6194 }
6195 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint64_t owner) {
6196         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6197         LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
6198         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6199         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6200         CVec_u8Z_free(ret_var);
6201         return ret_arr;
6202 }
6203
6204 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6205         return owner->a;
6206 }
6207 int32_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint64_t owner) {
6208         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6209         int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
6210         return ret_conv;
6211 }
6212
6213 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6214         return CVec_u8Z_clone(&owner->b);
6215 }
6216 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint64_t owner) {
6217         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6218         LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
6219         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6220         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6221         CVec_u8Z_free(ret_var);
6222         return ret_arr;
6223 }
6224
6225 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
6226         LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
6227         for (size_t i = 0; i < ret.datalen; i++) {
6228                 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
6229         }
6230         return ret;
6231 }
6232 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6233         return ThirtyTwoBytes_clone(&owner->a);
6234 }
6235 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint64_t owner) {
6236         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6237         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6238         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
6239         return ret_arr;
6240 }
6241
6242 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6243         return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
6244 }
6245 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint64_t owner) {
6246         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6247         LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
6248         uint64_tArray ret_arr = NULL;
6249         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6250         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6251         for (size_t v = 0; v < ret_var.datalen; v++) {
6252                 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6253                 *ret_conv_21_conv = ret_var.data[v];
6254                 ret_arr_ptr[v] = tag_ptr(ret_conv_21_conv, true);
6255         }
6256         
6257         FREE(ret_var.data);
6258         return ret_arr;
6259 }
6260
6261 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
6262         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ clone bytes"), .datalen = orig->datalen };
6263         for (size_t i = 0; i < ret.datalen; i++) {
6264                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
6265         }
6266         return ret;
6267 }
6268 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
6269         LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
6270         for (size_t i = 0; i < ret.datalen; i++) {
6271                 ret.data[i] = Event_clone(&orig->data[i]);
6272         }
6273         return ret;
6274 }
6275 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6276         return owner->a;
6277 }
6278 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
6279         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6280         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
6281         return ret_conv;
6282 }
6283
6284 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6285         return TxOut_clone(&owner->b);
6286 }
6287 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
6288         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6289         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6290         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
6291         return tag_ptr(ret_ref, true);
6292 }
6293
6294 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
6295         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
6296         for (size_t i = 0; i < ret.datalen; i++) {
6297                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
6298         }
6299         return ret;
6300 }
6301 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6302         return ThirtyTwoBytes_clone(&owner->a);
6303 }
6304 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
6305         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6306         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6307         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
6308         return ret_arr;
6309 }
6310
6311 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6312         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
6313 }
6314 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
6315         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6316         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
6317         uint64_tArray ret_arr = NULL;
6318         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6319         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6320         for (size_t u = 0; u < ret_var.datalen; u++) {
6321                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6322                 *ret_conv_20_conv = ret_var.data[u];
6323                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
6324         }
6325         
6326         FREE(ret_var.data);
6327         return ret_arr;
6328 }
6329
6330 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
6331         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ clone bytes"), .datalen = orig->datalen };
6332         for (size_t i = 0; i < ret.datalen; i++) {
6333                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6334         }
6335         return ret;
6336 }
6337 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
6338         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6339         switch(obj->tag) {
6340                 case LDKBalance_ClaimableOnChannelClose: return 0;
6341                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
6342                 case LDKBalance_ContentiousClaimable: return 2;
6343                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
6344                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
6345                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
6346                 default: abort();
6347         }
6348 }
6349 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis(uint64_t ptr) {
6350         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6351         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
6352                         int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
6353         return claimable_amount_satoshis_conv;
6354 }
6355 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis(uint64_t ptr) {
6356         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6357         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6358                         int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
6359         return claimable_amount_satoshis_conv;
6360 }
6361 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
6362         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6363         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6364                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
6365         return confirmation_height_conv;
6366 }
6367 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
6368         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6369         assert(obj->tag == LDKBalance_ContentiousClaimable);
6370                         int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
6371         return claimable_amount_satoshis_conv;
6372 }
6373 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
6374         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6375         assert(obj->tag == LDKBalance_ContentiousClaimable);
6376                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
6377         return timeout_height_conv;
6378 }
6379 int64_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_amount_satoshis(uint64_t ptr) {
6380         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6381         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6382                         int64_t claimable_amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.claimable_amount_satoshis;
6383         return claimable_amount_satoshis_conv;
6384 }
6385 int32_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(uint64_t ptr) {
6386         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6387         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6388                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
6389         return claimable_height_conv;
6390 }
6391 int64_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_claimable_amount_satoshis(uint64_t ptr) {
6392         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6393         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6394                         int64_t claimable_amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.claimable_amount_satoshis;
6395         return claimable_amount_satoshis_conv;
6396 }
6397 int32_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(uint64_t ptr) {
6398         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6399         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6400                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
6401         return expiry_height_conv;
6402 }
6403 int64_t __attribute__((export_name("TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
6404         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6405         assert(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
6406                         int64_t claimable_amount_satoshis_conv = obj->counterparty_revoked_output_claimable.claimable_amount_satoshis;
6407         return claimable_amount_satoshis_conv;
6408 }
6409 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
6410         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
6411         for (size_t i = 0; i < ret.datalen; i++) {
6412                 ret.data[i] = Balance_clone(&orig->data[i]);
6413         }
6414         return ret;
6415 }
6416 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6417         return ThirtyTwoBytes_clone(&owner->a);
6418 }
6419 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint64_t owner) {
6420         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6421         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6422         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
6423         return ret_arr;
6424 }
6425
6426 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6427         LDKChannelMonitor ret = owner->b;
6428         ret.is_owned = false;
6429         return ret;
6430 }
6431 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint64_t owner) {
6432         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6433         LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
6434         uint64_t ret_ref = 0;
6435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6437         return ret_ref;
6438 }
6439
6440 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6441 CHECK(owner->result_ok);
6442         return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
6443 }
6444 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
6445         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6446         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6447         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
6448         return tag_ptr(ret_conv, true);
6449 }
6450
6451 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6452 CHECK(!owner->result_ok);
6453         return DecodeError_clone(&*owner->contents.err);
6454 }
6455 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
6456         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6457         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6458         *ret_copy = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
6459         uint64_t ret_ref = tag_ptr(ret_copy, true);
6460         return ret_ref;
6461 }
6462
6463 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6464         return owner->a;
6465 }
6466 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
6467         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6468         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6469         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
6470         return ret_arr;
6471 }
6472
6473 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6474         return Type_clone(&owner->b);
6475 }
6476 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
6477         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6478         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
6479         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
6480         return tag_ptr(ret_ret, true);
6481 }
6482
6483 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
6484         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
6485         for (size_t i = 0; i < ret.datalen; i++) {
6486                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
6487         }
6488         return ret;
6489 }
6490 typedef struct LDKCustomOnionMessageContents_JCalls {
6491         atomic_size_t refcnt;
6492         uint32_t instance_ptr;
6493 } LDKCustomOnionMessageContents_JCalls;
6494 static void LDKCustomOnionMessageContents_JCalls_free(void* this_arg) {
6495         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6496         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6497                 FREE(j_calls);
6498         }
6499 }
6500 uint64_t tlv_type_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
6501         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6502         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, 0, 0, 0, 0, 0, 0);
6503 }
6504 LDKCVec_u8Z write_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
6505         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6506         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 36, 0, 0, 0, 0, 0, 0);
6507         LDKCVec_u8Z ret_ref;
6508         ret_ref.datalen = ret->arr_len;
6509         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6510         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
6511         return ret_ref;
6512 }
6513 static void LDKCustomOnionMessageContents_JCalls_cloned(LDKCustomOnionMessageContents* new_obj) {
6514         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) new_obj->this_arg;
6515         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6516 }
6517 static inline LDKCustomOnionMessageContents LDKCustomOnionMessageContents_init (JSValue o) {
6518         LDKCustomOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageContents_JCalls), "LDKCustomOnionMessageContents_JCalls");
6519         atomic_init(&calls->refcnt, 1);
6520         calls->instance_ptr = o;
6521
6522         LDKCustomOnionMessageContents ret = {
6523                 .this_arg = (void*) calls,
6524                 .tlv_type = tlv_type_LDKCustomOnionMessageContents_jcall,
6525                 .write = write_LDKCustomOnionMessageContents_jcall,
6526                 .cloned = LDKCustomOnionMessageContents_JCalls_cloned,
6527                 .free = LDKCustomOnionMessageContents_JCalls_free,
6528         };
6529         return ret;
6530 }
6531 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageContents_new"))) TS_LDKCustomOnionMessageContents_new(JSValue o) {
6532         LDKCustomOnionMessageContents *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
6533         *res_ptr = LDKCustomOnionMessageContents_init(o);
6534         return tag_ptr(res_ptr, true);
6535 }
6536 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_tlv_type"))) TS_CustomOnionMessageContents_tlv_type(uint64_t this_arg) {
6537         void* this_arg_ptr = untag_ptr(this_arg);
6538         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6539         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
6540         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
6541         return ret_conv;
6542 }
6543
6544 int8_tArray  __attribute__((export_name("TS_CustomOnionMessageContents_write"))) TS_CustomOnionMessageContents_write(uint64_t this_arg) {
6545         void* this_arg_ptr = untag_ptr(this_arg);
6546         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6547         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
6548         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6549         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6550         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6551         CVec_u8Z_free(ret_var);
6552         return ret_arr;
6553 }
6554
6555 uint32_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr"))) TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr(uint64_t ptr) {
6556         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
6557         switch(obj->tag) {
6558                 case LDKCOption_CustomOnionMessageContentsZ_Some: return 0;
6559                 case LDKCOption_CustomOnionMessageContentsZ_None: return 1;
6560                 default: abort();
6561         }
6562 }
6563 uint64_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some"))) TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some(uint64_t ptr) {
6564         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
6565         assert(obj->tag == LDKCOption_CustomOnionMessageContentsZ_Some);
6566                         LDKCustomOnionMessageContents* some_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
6567                         *some_ret = CustomOnionMessageContents_clone(&obj->some);
6568         return tag_ptr(some_ret, true);
6569 }
6570 static inline struct LDKCOption_CustomOnionMessageContentsZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
6571 CHECK(owner->result_ok);
6572         return COption_CustomOnionMessageContentsZ_clone(&*owner->contents.result);
6573 }
6574 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(uint64_t owner) {
6575         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
6576         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
6577         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
6578         uint64_t ret_ref = tag_ptr(ret_copy, true);
6579         return ret_ref;
6580 }
6581
6582 static inline struct LDKDecodeError CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
6583 CHECK(!owner->result_ok);
6584         return DecodeError_clone(&*owner->contents.err);
6585 }
6586 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(uint64_t owner) {
6587         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
6588         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6589         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
6590         uint64_t ret_ref = tag_ptr(ret_copy, true);
6591         return ret_ref;
6592 }
6593
6594 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_ty_from_ptr"))) TS_LDKCOption_NetAddressZ_ty_from_ptr(uint64_t ptr) {
6595         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
6596         switch(obj->tag) {
6597                 case LDKCOption_NetAddressZ_Some: return 0;
6598                 case LDKCOption_NetAddressZ_None: return 1;
6599                 default: abort();
6600         }
6601 }
6602 uint64_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_Some_get_some"))) TS_LDKCOption_NetAddressZ_Some_get_some(uint64_t ptr) {
6603         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
6604         assert(obj->tag == LDKCOption_NetAddressZ_Some);
6605                         uint64_t some_ref = tag_ptr(&obj->some, false);
6606         return some_ref;
6607 }
6608 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6609 CHECK(owner->result_ok);
6610         return CVec_u8Z_clone(&*owner->contents.result);
6611 }
6612 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
6613         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
6614         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
6615         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6616         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6617         CVec_u8Z_free(ret_var);
6618         return ret_arr;
6619 }
6620
6621 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6622         LDKPeerHandleError ret = *owner->contents.err;
6623         ret.is_owned = false;
6624         return ret;
6625 }
6626 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
6627         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
6628         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
6629         uint64_t ret_ref = 0;
6630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6632         return ret_ref;
6633 }
6634
6635 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6636 CHECK(owner->result_ok);
6637         return *owner->contents.result;
6638 }
6639 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
6640         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
6641         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
6642 }
6643
6644 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6645         LDKPeerHandleError ret = *owner->contents.err;
6646         ret.is_owned = false;
6647         return ret;
6648 }
6649 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
6650         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
6651         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
6652         uint64_t ret_ref = 0;
6653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6655         return ret_ref;
6656 }
6657
6658 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6659 CHECK(owner->result_ok);
6660         return *owner->contents.result;
6661 }
6662 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
6663         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
6664         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
6665         return ret_conv;
6666 }
6667
6668 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6669         LDKPeerHandleError ret = *owner->contents.err;
6670         ret.is_owned = false;
6671         return ret;
6672 }
6673 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
6674         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
6675         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
6676         uint64_t ret_ref = 0;
6677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6679         return ret_ref;
6680 }
6681
6682 uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendError_ty_from_ptr(uint64_t ptr) {
6683         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
6684         switch(obj->tag) {
6685                 case LDKSendError_Secp256k1: return 0;
6686                 case LDKSendError_TooBigPacket: return 1;
6687                 case LDKSendError_TooFewBlindedHops: return 2;
6688                 case LDKSendError_InvalidFirstHop: return 3;
6689                 case LDKSendError_InvalidMessage: return 4;
6690                 case LDKSendError_BufferFull: return 5;
6691                 default: abort();
6692         }
6693 }
6694 uint32_t __attribute__((export_name("TS_LDKSendError_Secp256k1_get_secp256k1"))) TS_LDKSendError_Secp256k1_get_secp256k1(uint64_t ptr) {
6695         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
6696         assert(obj->tag == LDKSendError_Secp256k1);
6697                         uint32_t secp256k1_conv = LDKSecp256k1Error_to_js(obj->secp256k1);
6698         return secp256k1_conv;
6699 }
6700 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
6701 CHECK(owner->result_ok);
6702         return *owner->contents.result;
6703 }
6704 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_ok"))) TS_CResult_NoneSendErrorZ_get_ok(uint64_t owner) {
6705         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
6706         CResult_NoneSendErrorZ_get_ok(owner_conv);
6707 }
6708
6709 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
6710 CHECK(!owner->result_ok);
6711         return SendError_clone(&*owner->contents.err);
6712 }
6713 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_err"))) TS_CResult_NoneSendErrorZ_get_err(uint64_t owner) {
6714         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
6715         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
6716         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
6717         uint64_t ret_ref = tag_ptr(ret_copy, true);
6718         return ret_ref;
6719 }
6720
6721 uint32_t __attribute__((export_name("TS_LDKGraphSyncError_ty_from_ptr"))) TS_LDKGraphSyncError_ty_from_ptr(uint64_t ptr) {
6722         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
6723         switch(obj->tag) {
6724                 case LDKGraphSyncError_DecodeError: return 0;
6725                 case LDKGraphSyncError_LightningError: return 1;
6726                 default: abort();
6727         }
6728 }
6729 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_DecodeError_get_decode_error"))) TS_LDKGraphSyncError_DecodeError_get_decode_error(uint64_t ptr) {
6730         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
6731         assert(obj->tag == LDKGraphSyncError_DecodeError);
6732                         uint64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
6733         return decode_error_ref;
6734 }
6735 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_LightningError_get_lightning_error"))) TS_LDKGraphSyncError_LightningError_get_lightning_error(uint64_t ptr) {
6736         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
6737         assert(obj->tag == LDKGraphSyncError_LightningError);
6738                         LDKLightningError lightning_error_var = obj->lightning_error;
6739                         uint64_t lightning_error_ref = 0;
6740                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
6741                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
6742         return lightning_error_ref;
6743 }
6744 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
6745 CHECK(owner->result_ok);
6746         return *owner->contents.result;
6747 }
6748 int32_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_ok"))) TS_CResult_u32GraphSyncErrorZ_get_ok(uint64_t owner) {
6749         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
6750         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
6751         return ret_conv;
6752 }
6753
6754 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
6755 CHECK(!owner->result_ok);
6756         return GraphSyncError_clone(&*owner->contents.err);
6757 }
6758 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) TS_CResult_u32GraphSyncErrorZ_get_err(uint64_t owner) {
6759         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
6760         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
6761         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
6762         uint64_t ret_ref = tag_ptr(ret_copy, true);
6763         return ret_ref;
6764 }
6765
6766 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6767 CHECK(owner->result_ok);
6768         return *owner->contents.result;
6769 }
6770 void  __attribute__((export_name("TS_CResult_NoneErrorZ_get_ok"))) TS_CResult_NoneErrorZ_get_ok(uint64_t owner) {
6771         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
6772         CResult_NoneErrorZ_get_ok(owner_conv);
6773 }
6774
6775 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6776 CHECK(!owner->result_ok);
6777         return *owner->contents.err;
6778 }
6779 uint32_t  __attribute__((export_name("TS_CResult_NoneErrorZ_get_err"))) TS_CResult_NoneErrorZ_get_err(uint64_t owner) {
6780         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
6781         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneErrorZ_get_err(owner_conv));
6782         return ret_conv;
6783 }
6784
6785 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6786 CHECK(owner->result_ok);
6787         return NetAddress_clone(&*owner->contents.result);
6788 }
6789 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint64_t owner) {
6790         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
6791         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
6792         *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
6793         uint64_t ret_ref = tag_ptr(ret_copy, true);
6794         return ret_ref;
6795 }
6796
6797 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6798 CHECK(!owner->result_ok);
6799         return DecodeError_clone(&*owner->contents.err);
6800 }
6801 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint64_t owner) {
6802         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
6803         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6804         *ret_copy = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
6805         uint64_t ret_ref = tag_ptr(ret_copy, true);
6806         return ret_ref;
6807 }
6808
6809 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
6810         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
6811         for (size_t i = 0; i < ret.datalen; i++) {
6812                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
6813         }
6814         return ret;
6815 }
6816 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
6817         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
6818         for (size_t i = 0; i < ret.datalen; i++) {
6819                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
6820         }
6821         return ret;
6822 }
6823 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
6824         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
6825         for (size_t i = 0; i < ret.datalen; i++) {
6826                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
6827         }
6828         return ret;
6829 }
6830 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
6831         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
6832         for (size_t i = 0; i < ret.datalen; i++) {
6833                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
6834         }
6835         return ret;
6836 }
6837 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6838         LDKAcceptChannel ret = *owner->contents.result;
6839         ret.is_owned = false;
6840         return ret;
6841 }
6842 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
6843         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
6844         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
6845         uint64_t ret_ref = 0;
6846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6848         return ret_ref;
6849 }
6850
6851 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6852 CHECK(!owner->result_ok);
6853         return DecodeError_clone(&*owner->contents.err);
6854 }
6855 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
6856         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
6857         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6858         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
6859         uint64_t ret_ref = tag_ptr(ret_copy, true);
6860         return ret_ref;
6861 }
6862
6863 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6864         LDKAnnouncementSignatures ret = *owner->contents.result;
6865         ret.is_owned = false;
6866         return ret;
6867 }
6868 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
6869         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
6870         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
6871         uint64_t ret_ref = 0;
6872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6874         return ret_ref;
6875 }
6876
6877 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6878 CHECK(!owner->result_ok);
6879         return DecodeError_clone(&*owner->contents.err);
6880 }
6881 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
6882         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
6883         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6884         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
6885         uint64_t ret_ref = tag_ptr(ret_copy, true);
6886         return ret_ref;
6887 }
6888
6889 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6890         LDKChannelReestablish ret = *owner->contents.result;
6891         ret.is_owned = false;
6892         return ret;
6893 }
6894 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
6895         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
6896         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
6897         uint64_t ret_ref = 0;
6898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6900         return ret_ref;
6901 }
6902
6903 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6904 CHECK(!owner->result_ok);
6905         return DecodeError_clone(&*owner->contents.err);
6906 }
6907 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
6908         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
6909         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6910         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
6911         uint64_t ret_ref = tag_ptr(ret_copy, true);
6912         return ret_ref;
6913 }
6914
6915 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6916         LDKClosingSigned ret = *owner->contents.result;
6917         ret.is_owned = false;
6918         return ret;
6919 }
6920 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
6921         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
6922         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
6923         uint64_t ret_ref = 0;
6924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6926         return ret_ref;
6927 }
6928
6929 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6930 CHECK(!owner->result_ok);
6931         return DecodeError_clone(&*owner->contents.err);
6932 }
6933 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
6934         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
6935         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6936         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
6937         uint64_t ret_ref = tag_ptr(ret_copy, true);
6938         return ret_ref;
6939 }
6940
6941 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6942         LDKClosingSignedFeeRange ret = *owner->contents.result;
6943         ret.is_owned = false;
6944         return ret;
6945 }
6946 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
6947         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
6948         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
6949         uint64_t ret_ref = 0;
6950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6952         return ret_ref;
6953 }
6954
6955 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6956 CHECK(!owner->result_ok);
6957         return DecodeError_clone(&*owner->contents.err);
6958 }
6959 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
6960         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
6961         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6962         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
6963         uint64_t ret_ref = tag_ptr(ret_copy, true);
6964         return ret_ref;
6965 }
6966
6967 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6968         LDKCommitmentSigned ret = *owner->contents.result;
6969         ret.is_owned = false;
6970         return ret;
6971 }
6972 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
6973         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
6974         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
6975         uint64_t ret_ref = 0;
6976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6978         return ret_ref;
6979 }
6980
6981 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6982 CHECK(!owner->result_ok);
6983         return DecodeError_clone(&*owner->contents.err);
6984 }
6985 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
6986         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
6987         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6988         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
6989         uint64_t ret_ref = tag_ptr(ret_copy, true);
6990         return ret_ref;
6991 }
6992
6993 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
6994         LDKFundingCreated ret = *owner->contents.result;
6995         ret.is_owned = false;
6996         return ret;
6997 }
6998 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
6999         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7000         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
7001         uint64_t ret_ref = 0;
7002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7004         return ret_ref;
7005 }
7006
7007 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7008 CHECK(!owner->result_ok);
7009         return DecodeError_clone(&*owner->contents.err);
7010 }
7011 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
7012         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7013         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7014         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
7015         uint64_t ret_ref = tag_ptr(ret_copy, true);
7016         return ret_ref;
7017 }
7018
7019 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7020         LDKFundingSigned ret = *owner->contents.result;
7021         ret.is_owned = false;
7022         return ret;
7023 }
7024 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7025         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7026         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
7027         uint64_t ret_ref = 0;
7028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7030         return ret_ref;
7031 }
7032
7033 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7034 CHECK(!owner->result_ok);
7035         return DecodeError_clone(&*owner->contents.err);
7036 }
7037 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
7038         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7039         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7040         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
7041         uint64_t ret_ref = tag_ptr(ret_copy, true);
7042         return ret_ref;
7043 }
7044
7045 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7046         LDKChannelReady ret = *owner->contents.result;
7047         ret.is_owned = false;
7048         return ret;
7049 }
7050 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
7051         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7052         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
7053         uint64_t ret_ref = 0;
7054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7056         return ret_ref;
7057 }
7058
7059 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7060 CHECK(!owner->result_ok);
7061         return DecodeError_clone(&*owner->contents.err);
7062 }
7063 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
7064         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7065         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7066         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
7067         uint64_t ret_ref = tag_ptr(ret_copy, true);
7068         return ret_ref;
7069 }
7070
7071 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7072         LDKInit ret = *owner->contents.result;
7073         ret.is_owned = false;
7074         return ret;
7075 }
7076 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
7077         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7078         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
7079         uint64_t ret_ref = 0;
7080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7082         return ret_ref;
7083 }
7084
7085 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7086 CHECK(!owner->result_ok);
7087         return DecodeError_clone(&*owner->contents.err);
7088 }
7089 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
7090         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7091         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7092         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
7093         uint64_t ret_ref = tag_ptr(ret_copy, true);
7094         return ret_ref;
7095 }
7096
7097 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7098         LDKOpenChannel ret = *owner->contents.result;
7099         ret.is_owned = false;
7100         return ret;
7101 }
7102 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
7103         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7104         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
7105         uint64_t ret_ref = 0;
7106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7108         return ret_ref;
7109 }
7110
7111 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7112 CHECK(!owner->result_ok);
7113         return DecodeError_clone(&*owner->contents.err);
7114 }
7115 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
7116         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7117         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7118         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
7119         uint64_t ret_ref = tag_ptr(ret_copy, true);
7120         return ret_ref;
7121 }
7122
7123 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7124         LDKRevokeAndACK ret = *owner->contents.result;
7125         ret.is_owned = false;
7126         return ret;
7127 }
7128 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
7129         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7130         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
7131         uint64_t ret_ref = 0;
7132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7134         return ret_ref;
7135 }
7136
7137 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7138 CHECK(!owner->result_ok);
7139         return DecodeError_clone(&*owner->contents.err);
7140 }
7141 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
7142         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7143         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7144         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
7145         uint64_t ret_ref = tag_ptr(ret_copy, true);
7146         return ret_ref;
7147 }
7148
7149 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7150         LDKShutdown ret = *owner->contents.result;
7151         ret.is_owned = false;
7152         return ret;
7153 }
7154 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
7155         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7156         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
7157         uint64_t ret_ref = 0;
7158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7160         return ret_ref;
7161 }
7162
7163 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7164 CHECK(!owner->result_ok);
7165         return DecodeError_clone(&*owner->contents.err);
7166 }
7167 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
7168         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7169         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7170         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
7171         uint64_t ret_ref = tag_ptr(ret_copy, true);
7172         return ret_ref;
7173 }
7174
7175 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7176         LDKUpdateFailHTLC ret = *owner->contents.result;
7177         ret.is_owned = false;
7178         return ret;
7179 }
7180 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7181         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
7182         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
7183         uint64_t ret_ref = 0;
7184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7186         return ret_ref;
7187 }
7188
7189 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7190 CHECK(!owner->result_ok);
7191         return DecodeError_clone(&*owner->contents.err);
7192 }
7193 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
7194         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
7195         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7196         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
7197         uint64_t ret_ref = tag_ptr(ret_copy, true);
7198         return ret_ref;
7199 }
7200
7201 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7202         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
7203         ret.is_owned = false;
7204         return ret;
7205 }
7206 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7207         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
7208         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
7209         uint64_t ret_ref = 0;
7210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7212         return ret_ref;
7213 }
7214
7215 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7216 CHECK(!owner->result_ok);
7217         return DecodeError_clone(&*owner->contents.err);
7218 }
7219 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
7220         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
7221         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7222         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
7223         uint64_t ret_ref = tag_ptr(ret_copy, true);
7224         return ret_ref;
7225 }
7226
7227 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7228         LDKUpdateFee ret = *owner->contents.result;
7229         ret.is_owned = false;
7230         return ret;
7231 }
7232 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
7233         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
7234         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
7235         uint64_t ret_ref = 0;
7236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7238         return ret_ref;
7239 }
7240
7241 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7242 CHECK(!owner->result_ok);
7243         return DecodeError_clone(&*owner->contents.err);
7244 }
7245 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
7246         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
7247         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7248         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
7249         uint64_t ret_ref = tag_ptr(ret_copy, true);
7250         return ret_ref;
7251 }
7252
7253 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7254         LDKUpdateFulfillHTLC ret = *owner->contents.result;
7255         ret.is_owned = false;
7256         return ret;
7257 }
7258 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7259         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
7260         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
7261         uint64_t ret_ref = 0;
7262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7264         return ret_ref;
7265 }
7266
7267 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7268 CHECK(!owner->result_ok);
7269         return DecodeError_clone(&*owner->contents.err);
7270 }
7271 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
7272         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
7273         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7274         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
7275         uint64_t ret_ref = tag_ptr(ret_copy, true);
7276         return ret_ref;
7277 }
7278
7279 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7280         LDKUpdateAddHTLC ret = *owner->contents.result;
7281         ret.is_owned = false;
7282         return ret;
7283 }
7284 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7285         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
7286         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
7287         uint64_t ret_ref = 0;
7288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7290         return ret_ref;
7291 }
7292
7293 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7294 CHECK(!owner->result_ok);
7295         return DecodeError_clone(&*owner->contents.err);
7296 }
7297 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
7298         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
7299         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7300         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
7301         uint64_t ret_ref = tag_ptr(ret_copy, true);
7302         return ret_ref;
7303 }
7304
7305 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
7306         LDKOnionMessage ret = *owner->contents.result;
7307         ret.is_owned = false;
7308         return ret;
7309 }
7310 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_ok"))) TS_CResult_OnionMessageDecodeErrorZ_get_ok(uint64_t owner) {
7311         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
7312         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
7313         uint64_t ret_ref = 0;
7314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7316         return ret_ref;
7317 }
7318
7319 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
7320 CHECK(!owner->result_ok);
7321         return DecodeError_clone(&*owner->contents.err);
7322 }
7323 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_err"))) TS_CResult_OnionMessageDecodeErrorZ_get_err(uint64_t owner) {
7324         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
7325         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7326         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
7327         uint64_t ret_ref = tag_ptr(ret_copy, true);
7328         return ret_ref;
7329 }
7330
7331 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7332         LDKPing ret = *owner->contents.result;
7333         ret.is_owned = false;
7334         return ret;
7335 }
7336 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
7337         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
7338         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
7339         uint64_t ret_ref = 0;
7340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7342         return ret_ref;
7343 }
7344
7345 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7346 CHECK(!owner->result_ok);
7347         return DecodeError_clone(&*owner->contents.err);
7348 }
7349 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
7350         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
7351         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7352         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
7353         uint64_t ret_ref = tag_ptr(ret_copy, true);
7354         return ret_ref;
7355 }
7356
7357 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7358         LDKPong ret = *owner->contents.result;
7359         ret.is_owned = false;
7360         return ret;
7361 }
7362 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
7363         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
7364         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
7365         uint64_t ret_ref = 0;
7366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7368         return ret_ref;
7369 }
7370
7371 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7372 CHECK(!owner->result_ok);
7373         return DecodeError_clone(&*owner->contents.err);
7374 }
7375 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
7376         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
7377         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7378         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
7379         uint64_t ret_ref = tag_ptr(ret_copy, true);
7380         return ret_ref;
7381 }
7382
7383 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7384         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
7385         ret.is_owned = false;
7386         return ret;
7387 }
7388 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7389         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7390         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7391         uint64_t ret_ref = 0;
7392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7394         return ret_ref;
7395 }
7396
7397 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7398 CHECK(!owner->result_ok);
7399         return DecodeError_clone(&*owner->contents.err);
7400 }
7401 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7402         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7403         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7404         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7405         uint64_t ret_ref = tag_ptr(ret_copy, true);
7406         return ret_ref;
7407 }
7408
7409 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7410         LDKChannelAnnouncement ret = *owner->contents.result;
7411         ret.is_owned = false;
7412         return ret;
7413 }
7414 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7415         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7416         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7417         uint64_t ret_ref = 0;
7418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7420         return ret_ref;
7421 }
7422
7423 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7424 CHECK(!owner->result_ok);
7425         return DecodeError_clone(&*owner->contents.err);
7426 }
7427 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7428         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7429         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7430         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7431         uint64_t ret_ref = tag_ptr(ret_copy, true);
7432         return ret_ref;
7433 }
7434
7435 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7436         LDKUnsignedChannelUpdate ret = *owner->contents.result;
7437         ret.is_owned = false;
7438         return ret;
7439 }
7440 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7441         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7442         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7443         uint64_t ret_ref = 0;
7444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7446         return ret_ref;
7447 }
7448
7449 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7450 CHECK(!owner->result_ok);
7451         return DecodeError_clone(&*owner->contents.err);
7452 }
7453 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
7454         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7455         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7456         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
7457         uint64_t ret_ref = tag_ptr(ret_copy, true);
7458         return ret_ref;
7459 }
7460
7461 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7462         LDKChannelUpdate ret = *owner->contents.result;
7463         ret.is_owned = false;
7464         return ret;
7465 }
7466 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7467         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7468         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7469         uint64_t ret_ref = 0;
7470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7472         return ret_ref;
7473 }
7474
7475 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7476 CHECK(!owner->result_ok);
7477         return DecodeError_clone(&*owner->contents.err);
7478 }
7479 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
7480         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7481         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7482         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
7483         uint64_t ret_ref = tag_ptr(ret_copy, true);
7484         return ret_ref;
7485 }
7486
7487 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7488         LDKErrorMessage ret = *owner->contents.result;
7489         ret.is_owned = false;
7490         return ret;
7491 }
7492 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
7493         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
7494         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
7495         uint64_t ret_ref = 0;
7496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7498         return ret_ref;
7499 }
7500
7501 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7502 CHECK(!owner->result_ok);
7503         return DecodeError_clone(&*owner->contents.err);
7504 }
7505 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
7506         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
7507         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7508         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
7509         uint64_t ret_ref = tag_ptr(ret_copy, true);
7510         return ret_ref;
7511 }
7512
7513 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7514         LDKWarningMessage ret = *owner->contents.result;
7515         ret.is_owned = false;
7516         return ret;
7517 }
7518 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
7519         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
7520         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
7521         uint64_t ret_ref = 0;
7522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7524         return ret_ref;
7525 }
7526
7527 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7528 CHECK(!owner->result_ok);
7529         return DecodeError_clone(&*owner->contents.err);
7530 }
7531 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
7532         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
7533         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7534         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
7535         uint64_t ret_ref = tag_ptr(ret_copy, true);
7536         return ret_ref;
7537 }
7538
7539 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7540         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
7541         ret.is_owned = false;
7542         return ret;
7543 }
7544 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7545         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7546         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7547         uint64_t ret_ref = 0;
7548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7550         return ret_ref;
7551 }
7552
7553 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7554 CHECK(!owner->result_ok);
7555         return DecodeError_clone(&*owner->contents.err);
7556 }
7557 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7558         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7559         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7560         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7561         uint64_t ret_ref = tag_ptr(ret_copy, true);
7562         return ret_ref;
7563 }
7564
7565 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7566         LDKNodeAnnouncement ret = *owner->contents.result;
7567         ret.is_owned = false;
7568         return ret;
7569 }
7570 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7571         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7572         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7573         uint64_t ret_ref = 0;
7574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7576         return ret_ref;
7577 }
7578
7579 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7580 CHECK(!owner->result_ok);
7581         return DecodeError_clone(&*owner->contents.err);
7582 }
7583 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7584         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7585         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7586         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7587         uint64_t ret_ref = tag_ptr(ret_copy, true);
7588         return ret_ref;
7589 }
7590
7591 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7592         LDKQueryShortChannelIds ret = *owner->contents.result;
7593         ret.is_owned = false;
7594         return ret;
7595 }
7596 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
7597         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
7598         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
7599         uint64_t ret_ref = 0;
7600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7602         return ret_ref;
7603 }
7604
7605 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7606 CHECK(!owner->result_ok);
7607         return DecodeError_clone(&*owner->contents.err);
7608 }
7609 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
7610         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
7611         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7612         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
7613         uint64_t ret_ref = tag_ptr(ret_copy, true);
7614         return ret_ref;
7615 }
7616
7617 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7618         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
7619         ret.is_owned = false;
7620         return ret;
7621 }
7622 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
7623         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
7624         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
7625         uint64_t ret_ref = 0;
7626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7628         return ret_ref;
7629 }
7630
7631 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7632 CHECK(!owner->result_ok);
7633         return DecodeError_clone(&*owner->contents.err);
7634 }
7635 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
7636         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
7637         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7638         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
7639         uint64_t ret_ref = tag_ptr(ret_copy, true);
7640         return ret_ref;
7641 }
7642
7643 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7644         LDKQueryChannelRange ret = *owner->contents.result;
7645         ret.is_owned = false;
7646         return ret;
7647 }
7648 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
7649         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
7650         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
7651         uint64_t ret_ref = 0;
7652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7654         return ret_ref;
7655 }
7656
7657 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7658 CHECK(!owner->result_ok);
7659         return DecodeError_clone(&*owner->contents.err);
7660 }
7661 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
7662         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
7663         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7664         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
7665         uint64_t ret_ref = tag_ptr(ret_copy, true);
7666         return ret_ref;
7667 }
7668
7669 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7670         LDKReplyChannelRange ret = *owner->contents.result;
7671         ret.is_owned = false;
7672         return ret;
7673 }
7674 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
7675         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
7676         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
7677         uint64_t ret_ref = 0;
7678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7680         return ret_ref;
7681 }
7682
7683 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7684 CHECK(!owner->result_ok);
7685         return DecodeError_clone(&*owner->contents.err);
7686 }
7687 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
7688         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
7689         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7690         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
7691         uint64_t ret_ref = tag_ptr(ret_copy, true);
7692         return ret_ref;
7693 }
7694
7695 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7696         LDKGossipTimestampFilter ret = *owner->contents.result;
7697         ret.is_owned = false;
7698         return ret;
7699 }
7700 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
7701         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
7702         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
7703         uint64_t ret_ref = 0;
7704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7706         return ret_ref;
7707 }
7708
7709 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7710 CHECK(!owner->result_ok);
7711         return DecodeError_clone(&*owner->contents.err);
7712 }
7713 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
7714         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
7715         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7716         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
7717         uint64_t ret_ref = tag_ptr(ret_copy, true);
7718         return ret_ref;
7719 }
7720
7721 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
7722         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
7723         switch(obj->tag) {
7724                 case LDKSignOrCreationError_SignError: return 0;
7725                 case LDKSignOrCreationError_CreationError: return 1;
7726                 default: abort();
7727         }
7728 }
7729 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
7730         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
7731         assert(obj->tag == LDKSignOrCreationError_CreationError);
7732                         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
7733         return creation_error_conv;
7734 }
7735 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7736         LDKInvoice ret = *owner->contents.result;
7737         ret.is_owned = false;
7738         return ret;
7739 }
7740 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
7741         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
7742         LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
7743         uint64_t ret_ref = 0;
7744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7746         return ret_ref;
7747 }
7748
7749 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7750 CHECK(!owner->result_ok);
7751         return SignOrCreationError_clone(&*owner->contents.err);
7752 }
7753 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
7754         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
7755         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
7756         *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
7757         uint64_t ret_ref = tag_ptr(ret_copy, true);
7758         return ret_ref;
7759 }
7760
7761 typedef struct LDKFilter_JCalls {
7762         atomic_size_t refcnt;
7763         uint32_t instance_ptr;
7764 } LDKFilter_JCalls;
7765 static void LDKFilter_JCalls_free(void* this_arg) {
7766         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7767         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7768                 FREE(j_calls);
7769         }
7770 }
7771 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
7772         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7773         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
7774         memcpy(txid_arr->elems, *txid, 32);
7775         LDKu8slice script_pubkey_var = script_pubkey;
7776         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
7777         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
7778         js_invoke_function_uuuuuu(j_calls->instance_ptr, 37, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
7779 }
7780 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
7781         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7782         LDKWatchedOutput output_var = output;
7783         uint64_t output_ref = 0;
7784         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
7785         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
7786         js_invoke_function_buuuuu(j_calls->instance_ptr, 38, output_ref, 0, 0, 0, 0, 0);
7787 }
7788 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
7789         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
7790         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7791 }
7792 static inline LDKFilter LDKFilter_init (JSValue o) {
7793         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
7794         atomic_init(&calls->refcnt, 1);
7795         calls->instance_ptr = o;
7796
7797         LDKFilter ret = {
7798                 .this_arg = (void*) calls,
7799                 .register_tx = register_tx_LDKFilter_jcall,
7800                 .register_output = register_output_LDKFilter_jcall,
7801                 .free = LDKFilter_JCalls_free,
7802         };
7803         return ret;
7804 }
7805 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
7806         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
7807         *res_ptr = LDKFilter_init(o);
7808         return tag_ptr(res_ptr, true);
7809 }
7810 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
7811         void* this_arg_ptr = untag_ptr(this_arg);
7812         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7813         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7814         unsigned char txid_arr[32];
7815         CHECK(txid->arr_len == 32);
7816         memcpy(txid_arr, txid->elems, 32); FREE(txid);
7817         unsigned char (*txid_ref)[32] = &txid_arr;
7818         LDKu8slice script_pubkey_ref;
7819         script_pubkey_ref.datalen = script_pubkey->arr_len;
7820         script_pubkey_ref.data = script_pubkey->elems;
7821         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
7822         FREE(script_pubkey);
7823 }
7824
7825 void  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
7826         void* this_arg_ptr = untag_ptr(this_arg);
7827         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7828         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7829         LDKWatchedOutput output_conv;
7830         output_conv.inner = untag_ptr(output);
7831         output_conv.is_owned = ptr_is_owned(output);
7832         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
7833         output_conv = WatchedOutput_clone(&output_conv);
7834         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
7835 }
7836
7837 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
7838         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
7839         switch(obj->tag) {
7840                 case LDKCOption_FilterZ_Some: return 0;
7841                 case LDKCOption_FilterZ_None: return 1;
7842                 default: abort();
7843         }
7844 }
7845 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
7846         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
7847         assert(obj->tag == LDKCOption_FilterZ_Some);
7848                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
7849                         *some_ret = obj->some;
7850                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
7851                         if ((*some_ret).free == LDKFilter_JCalls_free) {
7852                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7853                                 LDKFilter_JCalls_cloned(&(*some_ret));
7854                         }
7855         return tag_ptr(some_ret, true);
7856 }
7857 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
7858         LDKLockedChannelMonitor ret = *owner->contents.result;
7859         ret.is_owned = false;
7860         return ret;
7861 }
7862 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
7863         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
7864         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
7865         uint64_t ret_ref = 0;
7866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7868         return ret_ref;
7869 }
7870
7871 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
7872 CHECK(!owner->result_ok);
7873         return *owner->contents.err;
7874 }
7875 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
7876         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
7877         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
7878 }
7879
7880 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
7881         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
7882         for (size_t i = 0; i < ret.datalen; i++) {
7883                 ret.data[i] = OutPoint_clone(&orig->data[i]);
7884         }
7885         return ret;
7886 }
7887 typedef struct LDKMessageSendEventsProvider_JCalls {
7888         atomic_size_t refcnt;
7889         uint32_t instance_ptr;
7890 } LDKMessageSendEventsProvider_JCalls;
7891 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
7892         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7893         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7894                 FREE(j_calls);
7895         }
7896 }
7897 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
7898         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7899         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 39, 0, 0, 0, 0, 0, 0);
7900         LDKCVec_MessageSendEventZ ret_constr;
7901         ret_constr.datalen = ret->arr_len;
7902         if (ret_constr.datalen > 0)
7903                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
7904         else
7905                 ret_constr.data = NULL;
7906         uint64_t* ret_vals = ret->elems;
7907         for (size_t s = 0; s < ret_constr.datalen; s++) {
7908                 uint64_t ret_conv_18 = ret_vals[s];
7909                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
7910                 CHECK_ACCESS(ret_conv_18_ptr);
7911                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
7912                 FREE(untag_ptr(ret_conv_18));
7913                 ret_constr.data[s] = ret_conv_18_conv;
7914         }
7915         FREE(ret);
7916         return ret_constr;
7917 }
7918 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
7919         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
7920         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7921 }
7922 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
7923         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
7924         atomic_init(&calls->refcnt, 1);
7925         calls->instance_ptr = o;
7926
7927         LDKMessageSendEventsProvider ret = {
7928                 .this_arg = (void*) calls,
7929                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
7930                 .free = LDKMessageSendEventsProvider_JCalls_free,
7931         };
7932         return ret;
7933 }
7934 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
7935         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7936         *res_ptr = LDKMessageSendEventsProvider_init(o);
7937         return tag_ptr(res_ptr, true);
7938 }
7939 uint64_tArray  __attribute__((export_name("TS_MessageSendEventsProvider_get_and_clear_pending_msg_events"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint64_t this_arg) {
7940         void* this_arg_ptr = untag_ptr(this_arg);
7941         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7942         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
7943         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
7944         uint64_tArray ret_arr = NULL;
7945         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7946         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7947         for (size_t s = 0; s < ret_var.datalen; s++) {
7948                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
7949                 *ret_conv_18_copy = ret_var.data[s];
7950                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
7951                 ret_arr_ptr[s] = ret_conv_18_ref;
7952         }
7953         
7954         FREE(ret_var.data);
7955         return ret_arr;
7956 }
7957
7958 typedef struct LDKOnionMessageProvider_JCalls {
7959         atomic_size_t refcnt;
7960         uint32_t instance_ptr;
7961 } LDKOnionMessageProvider_JCalls;
7962 static void LDKOnionMessageProvider_JCalls_free(void* this_arg) {
7963         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
7964         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7965                 FREE(j_calls);
7966         }
7967 }
7968 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
7969         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
7970         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
7971         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
7972         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 40, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0);
7973         LDKOnionMessage ret_conv;
7974         ret_conv.inner = untag_ptr(ret);
7975         ret_conv.is_owned = ptr_is_owned(ret);
7976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
7977         return ret_conv;
7978 }
7979 static void LDKOnionMessageProvider_JCalls_cloned(LDKOnionMessageProvider* new_obj) {
7980         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) new_obj->this_arg;
7981         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7982 }
7983 static inline LDKOnionMessageProvider LDKOnionMessageProvider_init (JSValue o) {
7984         LDKOnionMessageProvider_JCalls *calls = MALLOC(sizeof(LDKOnionMessageProvider_JCalls), "LDKOnionMessageProvider_JCalls");
7985         atomic_init(&calls->refcnt, 1);
7986         calls->instance_ptr = o;
7987
7988         LDKOnionMessageProvider ret = {
7989                 .this_arg = (void*) calls,
7990                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageProvider_jcall,
7991                 .free = LDKOnionMessageProvider_JCalls_free,
7992         };
7993         return ret;
7994 }
7995 uint64_t  __attribute__((export_name("TS_LDKOnionMessageProvider_new"))) TS_LDKOnionMessageProvider_new(JSValue o) {
7996         LDKOnionMessageProvider *res_ptr = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
7997         *res_ptr = LDKOnionMessageProvider_init(o);
7998         return tag_ptr(res_ptr, true);
7999 }
8000 uint64_t  __attribute__((export_name("TS_OnionMessageProvider_next_onion_message_for_peer"))) TS_OnionMessageProvider_next_onion_message_for_peer(uint64_t this_arg, int8_tArray peer_node_id) {
8001         void* this_arg_ptr = untag_ptr(this_arg);
8002         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8003         LDKOnionMessageProvider* this_arg_conv = (LDKOnionMessageProvider*)this_arg_ptr;
8004         LDKPublicKey peer_node_id_ref;
8005         CHECK(peer_node_id->arr_len == 33);
8006         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
8007         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
8008         uint64_t ret_ref = 0;
8009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8011         return ret_ref;
8012 }
8013
8014 typedef struct LDKEventHandler_JCalls {
8015         atomic_size_t refcnt;
8016         uint32_t instance_ptr;
8017 } LDKEventHandler_JCalls;
8018 static void LDKEventHandler_JCalls_free(void* this_arg) {
8019         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8020         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8021                 FREE(j_calls);
8022         }
8023 }
8024 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
8025         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8026         LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
8027         *ret_event = Event_clone(event);
8028         uint64_t ref_event = tag_ptr(ret_event, true);
8029         js_invoke_function_buuuuu(j_calls->instance_ptr, 41, ref_event, 0, 0, 0, 0, 0);
8030 }
8031 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
8032         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
8033         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8034 }
8035 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
8036         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
8037         atomic_init(&calls->refcnt, 1);
8038         calls->instance_ptr = o;
8039
8040         LDKEventHandler ret = {
8041                 .this_arg = (void*) calls,
8042                 .handle_event = handle_event_LDKEventHandler_jcall,
8043                 .free = LDKEventHandler_JCalls_free,
8044         };
8045         return ret;
8046 }
8047 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
8048         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8049         *res_ptr = LDKEventHandler_init(o);
8050         return tag_ptr(res_ptr, true);
8051 }
8052 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
8053         void* this_arg_ptr = untag_ptr(this_arg);
8054         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8055         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
8056         LDKEvent* event_conv = (LDKEvent*)untag_ptr(event);
8057         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
8058 }
8059
8060 typedef struct LDKEventsProvider_JCalls {
8061         atomic_size_t refcnt;
8062         uint32_t instance_ptr;
8063 } LDKEventsProvider_JCalls;
8064 static void LDKEventsProvider_JCalls_free(void* this_arg) {
8065         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8066         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8067                 FREE(j_calls);
8068         }
8069 }
8070 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
8071         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8072         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8073         *handler_ret = handler;
8074         js_invoke_function_buuuuu(j_calls->instance_ptr, 42, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
8075 }
8076 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
8077         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
8078         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8079 }
8080 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
8081         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
8082         atomic_init(&calls->refcnt, 1);
8083         calls->instance_ptr = o;
8084
8085         LDKEventsProvider ret = {
8086                 .this_arg = (void*) calls,
8087                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
8088                 .free = LDKEventsProvider_JCalls_free,
8089         };
8090         return ret;
8091 }
8092 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
8093         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
8094         *res_ptr = LDKEventsProvider_init(o);
8095         return tag_ptr(res_ptr, true);
8096 }
8097 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
8098         void* this_arg_ptr = untag_ptr(this_arg);
8099         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8100         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
8101         void* handler_ptr = untag_ptr(handler);
8102         CHECK_ACCESS(handler_ptr);
8103         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
8104         if (handler_conv.free == LDKEventHandler_JCalls_free) {
8105                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8106                 LDKEventHandler_JCalls_cloned(&handler_conv);
8107         }
8108         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
8109 }
8110
8111 typedef struct LDKScore_JCalls {
8112         atomic_size_t refcnt;
8113         uint32_t instance_ptr;
8114 } LDKScore_JCalls;
8115 static void LDKScore_JCalls_free(void* this_arg) {
8116         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8117         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8118                 FREE(j_calls);
8119         }
8120 }
8121 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
8122         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8123         int64_t short_channel_id_conv = short_channel_id;
8124         LDKNodeId source_var = *source;
8125         uint64_t source_ref = 0;
8126         source_var = NodeId_clone(&source_var);
8127         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
8128         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
8129         LDKNodeId target_var = *target;
8130         uint64_t target_ref = 0;
8131         target_var = NodeId_clone(&target_var);
8132         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
8133         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
8134         LDKChannelUsage usage_var = usage;
8135         uint64_t usage_ref = 0;
8136         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
8137         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
8138         return js_invoke_function_bbbbuu(j_calls->instance_ptr, 43, short_channel_id_conv, source_ref, target_ref, usage_ref, 0, 0);
8139 }
8140 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
8141         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8142         LDKCVec_RouteHopZ path_var = path;
8143         uint64_tArray path_arr = NULL;
8144         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8145         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8146         for (size_t k = 0; k < path_var.datalen; k++) {
8147                 LDKRouteHop path_conv_10_var = path_var.data[k];
8148                 uint64_t path_conv_10_ref = 0;
8149                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8150                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8151                 path_arr_ptr[k] = path_conv_10_ref;
8152         }
8153         
8154         FREE(path_var.data);
8155         int64_t short_channel_id_conv = short_channel_id;
8156         js_invoke_function_ubuuuu(j_calls->instance_ptr, 44, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
8157 }
8158 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
8159         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8160         LDKCVec_RouteHopZ path_var = path;
8161         uint64_tArray path_arr = NULL;
8162         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8163         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8164         for (size_t k = 0; k < path_var.datalen; k++) {
8165                 LDKRouteHop path_conv_10_var = path_var.data[k];
8166                 uint64_t path_conv_10_ref = 0;
8167                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8168                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8169                 path_arr_ptr[k] = path_conv_10_ref;
8170         }
8171         
8172         FREE(path_var.data);
8173         js_invoke_function_uuuuuu(j_calls->instance_ptr, 45, (uint32_t)path_arr, 0, 0, 0, 0, 0);
8174 }
8175 void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
8176         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8177         LDKCVec_RouteHopZ path_var = path;
8178         uint64_tArray path_arr = NULL;
8179         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8180         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8181         for (size_t k = 0; k < path_var.datalen; k++) {
8182                 LDKRouteHop path_conv_10_var = path_var.data[k];
8183                 uint64_t path_conv_10_ref = 0;
8184                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8185                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8186                 path_arr_ptr[k] = path_conv_10_ref;
8187         }
8188         
8189         FREE(path_var.data);
8190         int64_t short_channel_id_conv = short_channel_id;
8191         js_invoke_function_ubuuuu(j_calls->instance_ptr, 46, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
8192 }
8193 void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
8194         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8195         LDKCVec_RouteHopZ path_var = path;
8196         uint64_tArray path_arr = NULL;
8197         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8198         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8199         for (size_t k = 0; k < path_var.datalen; k++) {
8200                 LDKRouteHop path_conv_10_var = path_var.data[k];
8201                 uint64_t path_conv_10_ref = 0;
8202                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8203                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8204                 path_arr_ptr[k] = path_conv_10_ref;
8205         }
8206         
8207         FREE(path_var.data);
8208         js_invoke_function_uuuuuu(j_calls->instance_ptr, 47, (uint32_t)path_arr, 0, 0, 0, 0, 0);
8209 }
8210 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
8211         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8212         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 48, 0, 0, 0, 0, 0, 0);
8213         LDKCVec_u8Z ret_ref;
8214         ret_ref.datalen = ret->arr_len;
8215         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8216         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8217         return ret_ref;
8218 }
8219 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
8220         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
8221         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8222 }
8223 static inline LDKScore LDKScore_init (JSValue o) {
8224         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
8225         atomic_init(&calls->refcnt, 1);
8226         calls->instance_ptr = o;
8227
8228         LDKScore ret = {
8229                 .this_arg = (void*) calls,
8230                 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
8231                 .payment_path_failed = payment_path_failed_LDKScore_jcall,
8232                 .payment_path_successful = payment_path_successful_LDKScore_jcall,
8233                 .probe_failed = probe_failed_LDKScore_jcall,
8234                 .probe_successful = probe_successful_LDKScore_jcall,
8235                 .write = write_LDKScore_jcall,
8236                 .free = LDKScore_JCalls_free,
8237         };
8238         return ret;
8239 }
8240 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
8241         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
8242         *res_ptr = LDKScore_init(o);
8243         return tag_ptr(res_ptr, true);
8244 }
8245 int64_t  __attribute__((export_name("TS_Score_channel_penalty_msat"))) TS_Score_channel_penalty_msat(uint64_t this_arg, int64_t short_channel_id, uint64_t source, uint64_t target, uint64_t usage) {
8246         void* this_arg_ptr = untag_ptr(this_arg);
8247         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8248         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8249         LDKNodeId source_conv;
8250         source_conv.inner = untag_ptr(source);
8251         source_conv.is_owned = ptr_is_owned(source);
8252         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
8253         source_conv.is_owned = false;
8254         LDKNodeId target_conv;
8255         target_conv.inner = untag_ptr(target);
8256         target_conv.is_owned = ptr_is_owned(target);
8257         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
8258         target_conv.is_owned = false;
8259         LDKChannelUsage usage_conv;
8260         usage_conv.inner = untag_ptr(usage);
8261         usage_conv.is_owned = ptr_is_owned(usage);
8262         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
8263         usage_conv = ChannelUsage_clone(&usage_conv);
8264         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
8265         return ret_conv;
8266 }
8267
8268 void  __attribute__((export_name("TS_Score_payment_path_failed"))) TS_Score_payment_path_failed(uint64_t this_arg, uint64_tArray path, int64_t short_channel_id) {
8269         void* this_arg_ptr = untag_ptr(this_arg);
8270         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8271         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8272         LDKCVec_RouteHopZ path_constr;
8273         path_constr.datalen = path->arr_len;
8274         if (path_constr.datalen > 0)
8275                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8276         else
8277                 path_constr.data = NULL;
8278         uint64_t* path_vals = path->elems;
8279         for (size_t k = 0; k < path_constr.datalen; k++) {
8280                 uint64_t path_conv_10 = path_vals[k];
8281                 LDKRouteHop path_conv_10_conv;
8282                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8283                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8284                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8285                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8286                 path_constr.data[k] = path_conv_10_conv;
8287         }
8288         FREE(path);
8289         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
8290 }
8291
8292 void  __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint64_t this_arg, uint64_tArray path) {
8293         void* this_arg_ptr = untag_ptr(this_arg);
8294         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8295         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8296         LDKCVec_RouteHopZ path_constr;
8297         path_constr.datalen = path->arr_len;
8298         if (path_constr.datalen > 0)
8299                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8300         else
8301                 path_constr.data = NULL;
8302         uint64_t* path_vals = path->elems;
8303         for (size_t k = 0; k < path_constr.datalen; k++) {
8304                 uint64_t path_conv_10 = path_vals[k];
8305                 LDKRouteHop path_conv_10_conv;
8306                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8307                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8308                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8309                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8310                 path_constr.data[k] = path_conv_10_conv;
8311         }
8312         FREE(path);
8313         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
8314 }
8315
8316 void  __attribute__((export_name("TS_Score_probe_failed"))) TS_Score_probe_failed(uint64_t this_arg, uint64_tArray path, int64_t short_channel_id) {
8317         void* this_arg_ptr = untag_ptr(this_arg);
8318         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8319         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8320         LDKCVec_RouteHopZ path_constr;
8321         path_constr.datalen = path->arr_len;
8322         if (path_constr.datalen > 0)
8323                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8324         else
8325                 path_constr.data = NULL;
8326         uint64_t* path_vals = path->elems;
8327         for (size_t k = 0; k < path_constr.datalen; k++) {
8328                 uint64_t path_conv_10 = path_vals[k];
8329                 LDKRouteHop path_conv_10_conv;
8330                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8331                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8332                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8333                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8334                 path_constr.data[k] = path_conv_10_conv;
8335         }
8336         FREE(path);
8337         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
8338 }
8339
8340 void  __attribute__((export_name("TS_Score_probe_successful"))) TS_Score_probe_successful(uint64_t this_arg, uint64_tArray path) {
8341         void* this_arg_ptr = untag_ptr(this_arg);
8342         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8343         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8344         LDKCVec_RouteHopZ path_constr;
8345         path_constr.datalen = path->arr_len;
8346         if (path_constr.datalen > 0)
8347                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8348         else
8349                 path_constr.data = NULL;
8350         uint64_t* path_vals = path->elems;
8351         for (size_t k = 0; k < path_constr.datalen; k++) {
8352                 uint64_t path_conv_10 = path_vals[k];
8353                 LDKRouteHop path_conv_10_conv;
8354                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8355                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8356                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8357                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8358                 path_constr.data[k] = path_conv_10_conv;
8359         }
8360         FREE(path);
8361         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, path_constr);
8362 }
8363
8364 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
8365         void* this_arg_ptr = untag_ptr(this_arg);
8366         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8367         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8368         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8369         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8370         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8371         CVec_u8Z_free(ret_var);
8372         return ret_arr;
8373 }
8374
8375 typedef struct LDKLockableScore_JCalls {
8376         atomic_size_t refcnt;
8377         uint32_t instance_ptr;
8378 } LDKLockableScore_JCalls;
8379 static void LDKLockableScore_JCalls_free(void* this_arg) {
8380         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
8381         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8382                 FREE(j_calls);
8383         }
8384 }
8385 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
8386         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
8387         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 49, 0, 0, 0, 0, 0, 0);
8388         void* ret_ptr = untag_ptr(ret);
8389         CHECK_ACCESS(ret_ptr);
8390         LDKScore ret_conv = *(LDKScore*)(ret_ptr);
8391         if (ret_conv.free == LDKScore_JCalls_free) {
8392                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8393                 LDKScore_JCalls_cloned(&ret_conv);
8394         }// WARNING: we may need a move here but no clone is available for LDKScore
8395         
8396         return ret_conv;
8397 }
8398 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
8399         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
8400         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8401 }
8402 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
8403         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
8404         atomic_init(&calls->refcnt, 1);
8405         calls->instance_ptr = o;
8406
8407         LDKLockableScore ret = {
8408                 .this_arg = (void*) calls,
8409                 .lock = lock_LDKLockableScore_jcall,
8410                 .free = LDKLockableScore_JCalls_free,
8411         };
8412         return ret;
8413 }
8414 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
8415         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
8416         *res_ptr = LDKLockableScore_init(o);
8417         return tag_ptr(res_ptr, true);
8418 }
8419 uint64_t  __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint64_t this_arg) {
8420         void* this_arg_ptr = untag_ptr(this_arg);
8421         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8422         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
8423         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
8424         *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
8425         return tag_ptr(ret_ret, true);
8426 }
8427
8428 typedef struct LDKWriteableScore_JCalls {
8429         atomic_size_t refcnt;
8430         uint32_t instance_ptr;
8431         LDKLockableScore_JCalls* LockableScore;
8432 } LDKWriteableScore_JCalls;
8433 static void LDKWriteableScore_JCalls_free(void* this_arg) {
8434         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
8435         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8436                 FREE(j_calls);
8437         }
8438 }
8439 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
8440         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
8441         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 50, 0, 0, 0, 0, 0, 0);
8442         LDKCVec_u8Z ret_ref;
8443         ret_ref.datalen = ret->arr_len;
8444         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8445         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8446         return ret_ref;
8447 }
8448 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
8449         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
8450         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8451         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
8452 }
8453 static inline LDKWriteableScore LDKWriteableScore_init (JSValue o, JSValue LockableScore) {
8454         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
8455         atomic_init(&calls->refcnt, 1);
8456         calls->instance_ptr = o;
8457
8458         LDKWriteableScore ret = {
8459                 .this_arg = (void*) calls,
8460                 .write = write_LDKWriteableScore_jcall,
8461                 .free = LDKWriteableScore_JCalls_free,
8462                 .LockableScore = LDKLockableScore_init(LockableScore),
8463         };
8464         calls->LockableScore = ret.LockableScore.this_arg;
8465         return ret;
8466 }
8467 uint64_t  __attribute__((export_name("TS_LDKWriteableScore_new"))) TS_LDKWriteableScore_new(JSValue o, JSValue LockableScore) {
8468         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
8469         *res_ptr = LDKWriteableScore_init(o, LockableScore);
8470         return tag_ptr(res_ptr, true);
8471 }
8472 int8_tArray  __attribute__((export_name("TS_WriteableScore_write"))) TS_WriteableScore_write(uint64_t this_arg) {
8473         void* this_arg_ptr = untag_ptr(this_arg);
8474         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8475         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
8476         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8477         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8478         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8479         CVec_u8Z_free(ret_var);
8480         return ret_arr;
8481 }
8482
8483 typedef struct LDKPersister_JCalls {
8484         atomic_size_t refcnt;
8485         uint32_t instance_ptr;
8486 } LDKPersister_JCalls;
8487 static void LDKPersister_JCalls_free(void* this_arg) {
8488         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8489         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8490                 FREE(j_calls);
8491         }
8492 }
8493 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
8494         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8495         LDKChannelManager channel_manager_var = *channel_manager;
8496         uint64_t channel_manager_ref = 0;
8497         // WARNING: we may need a move here but no clone is available for LDKChannelManager
8498         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
8499         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
8500         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 51, channel_manager_ref, 0, 0, 0, 0, 0);
8501         void* ret_ptr = untag_ptr(ret);
8502         CHECK_ACCESS(ret_ptr);
8503         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8504         FREE(untag_ptr(ret));
8505         return ret_conv;
8506 }
8507 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
8508         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8509         LDKNetworkGraph network_graph_var = *network_graph;
8510         uint64_t network_graph_ref = 0;
8511         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
8512         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
8513         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
8514         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 52, network_graph_ref, 0, 0, 0, 0, 0);
8515         void* ret_ptr = untag_ptr(ret);
8516         CHECK_ACCESS(ret_ptr);
8517         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8518         FREE(untag_ptr(ret));
8519         return ret_conv;
8520 }
8521 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
8522         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8523         // WARNING: This object doesn't live past this scope, needs clone!
8524         uint64_t ret_scorer = tag_ptr(scorer, false);
8525         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 53, ret_scorer, 0, 0, 0, 0, 0);
8526         void* ret_ptr = untag_ptr(ret);
8527         CHECK_ACCESS(ret_ptr);
8528         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8529         FREE(untag_ptr(ret));
8530         return ret_conv;
8531 }
8532 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
8533         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
8534         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8535 }
8536 static inline LDKPersister LDKPersister_init (JSValue o) {
8537         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
8538         atomic_init(&calls->refcnt, 1);
8539         calls->instance_ptr = o;
8540
8541         LDKPersister ret = {
8542                 .this_arg = (void*) calls,
8543                 .persist_manager = persist_manager_LDKPersister_jcall,
8544                 .persist_graph = persist_graph_LDKPersister_jcall,
8545                 .persist_scorer = persist_scorer_LDKPersister_jcall,
8546                 .free = LDKPersister_JCalls_free,
8547         };
8548         return ret;
8549 }
8550 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
8551         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
8552         *res_ptr = LDKPersister_init(o);
8553         return tag_ptr(res_ptr, true);
8554 }
8555 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
8556         void* this_arg_ptr = untag_ptr(this_arg);
8557         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8558         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8559         LDKChannelManager channel_manager_conv;
8560         channel_manager_conv.inner = untag_ptr(channel_manager);
8561         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
8562         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
8563         channel_manager_conv.is_owned = false;
8564         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8565         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
8566         return tag_ptr(ret_conv, true);
8567 }
8568
8569 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
8570         void* this_arg_ptr = untag_ptr(this_arg);
8571         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8572         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8573         LDKNetworkGraph network_graph_conv;
8574         network_graph_conv.inner = untag_ptr(network_graph);
8575         network_graph_conv.is_owned = ptr_is_owned(network_graph);
8576         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
8577         network_graph_conv.is_owned = false;
8578         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8579         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
8580         return tag_ptr(ret_conv, true);
8581 }
8582
8583 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
8584         void* this_arg_ptr = untag_ptr(this_arg);
8585         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8586         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8587         void* scorer_ptr = untag_ptr(scorer);
8588         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
8589         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
8590         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8591         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
8592         return tag_ptr(ret_conv, true);
8593 }
8594
8595 typedef struct LDKFutureCallback_JCalls {
8596         atomic_size_t refcnt;
8597         uint32_t instance_ptr;
8598 } LDKFutureCallback_JCalls;
8599 static void LDKFutureCallback_JCalls_free(void* this_arg) {
8600         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
8601         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8602                 FREE(j_calls);
8603         }
8604 }
8605 void call_LDKFutureCallback_jcall(const void* this_arg) {
8606         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
8607         js_invoke_function_uuuuuu(j_calls->instance_ptr, 54, 0, 0, 0, 0, 0, 0);
8608 }
8609 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
8610         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
8611         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8612 }
8613 static inline LDKFutureCallback LDKFutureCallback_init (JSValue o) {
8614         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
8615         atomic_init(&calls->refcnt, 1);
8616         calls->instance_ptr = o;
8617
8618         LDKFutureCallback ret = {
8619                 .this_arg = (void*) calls,
8620                 .call = call_LDKFutureCallback_jcall,
8621                 .free = LDKFutureCallback_JCalls_free,
8622         };
8623         return ret;
8624 }
8625 uint64_t  __attribute__((export_name("TS_LDKFutureCallback_new"))) TS_LDKFutureCallback_new(JSValue o) {
8626         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
8627         *res_ptr = LDKFutureCallback_init(o);
8628         return tag_ptr(res_ptr, true);
8629 }
8630 void  __attribute__((export_name("TS_FutureCallback_call"))) TS_FutureCallback_call(uint64_t this_arg) {
8631         void* this_arg_ptr = untag_ptr(this_arg);
8632         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8633         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
8634         (this_arg_conv->call)(this_arg_conv->this_arg);
8635 }
8636
8637 typedef struct LDKListen_JCalls {
8638         atomic_size_t refcnt;
8639         uint32_t instance_ptr;
8640 } LDKListen_JCalls;
8641 static void LDKListen_JCalls_free(void* this_arg) {
8642         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8643         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8644                 FREE(j_calls);
8645         }
8646 }
8647 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8648         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8649         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8650         memcpy(header_arr->elems, *header, 80);
8651         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8652         uint64_tArray txdata_arr = NULL;
8653         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
8654         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
8655         for (size_t c = 0; c < txdata_var.datalen; c++) {
8656                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8657                 *txdata_conv_28_conv = txdata_var.data[c];
8658                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
8659         }
8660         
8661         FREE(txdata_var.data);
8662         int32_t height_conv = height;
8663         js_invoke_function_uuuuuu(j_calls->instance_ptr, 55, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
8664 }
8665 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
8666         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8667         LDKu8slice block_var = block;
8668         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
8669         memcpy(block_arr->elems, block_var.data, block_var.datalen);
8670         int32_t height_conv = height;
8671         js_invoke_function_uuuuuu(j_calls->instance_ptr, 56, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
8672 }
8673 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8674         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8675         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8676         memcpy(header_arr->elems, *header, 80);
8677         int32_t height_conv = height;
8678         js_invoke_function_uuuuuu(j_calls->instance_ptr, 57, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
8679 }
8680 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
8681         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
8682         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8683 }
8684 static inline LDKListen LDKListen_init (JSValue o) {
8685         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
8686         atomic_init(&calls->refcnt, 1);
8687         calls->instance_ptr = o;
8688
8689         LDKListen ret = {
8690                 .this_arg = (void*) calls,
8691                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
8692                 .block_connected = block_connected_LDKListen_jcall,
8693                 .block_disconnected = block_disconnected_LDKListen_jcall,
8694                 .free = LDKListen_JCalls_free,
8695         };
8696         return ret;
8697 }
8698 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
8699         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
8700         *res_ptr = LDKListen_init(o);
8701         return tag_ptr(res_ptr, true);
8702 }
8703 void  __attribute__((export_name("TS_Listen_filtered_block_connected"))) TS_Listen_filtered_block_connected(uint64_t this_arg, int8_tArray header, uint64_tArray txdata, int32_t height) {
8704         void* this_arg_ptr = untag_ptr(this_arg);
8705         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8706         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8707         unsigned char header_arr[80];
8708         CHECK(header->arr_len == 80);
8709         memcpy(header_arr, header->elems, 80); FREE(header);
8710         unsigned char (*header_ref)[80] = &header_arr;
8711         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8712         txdata_constr.datalen = txdata->arr_len;
8713         if (txdata_constr.datalen > 0)
8714                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8715         else
8716                 txdata_constr.data = NULL;
8717         uint64_t* txdata_vals = txdata->elems;
8718         for (size_t c = 0; c < txdata_constr.datalen; c++) {
8719                 uint64_t txdata_conv_28 = txdata_vals[c];
8720                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
8721                 CHECK_ACCESS(txdata_conv_28_ptr);
8722                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8723                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
8724                 txdata_constr.data[c] = txdata_conv_28_conv;
8725         }
8726         FREE(txdata);
8727         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8728 }
8729
8730 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
8731         void* this_arg_ptr = untag_ptr(this_arg);
8732         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8733         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8734         LDKu8slice block_ref;
8735         block_ref.datalen = block->arr_len;
8736         block_ref.data = block->elems;
8737         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
8738         FREE(block);
8739 }
8740
8741 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
8742         void* this_arg_ptr = untag_ptr(this_arg);
8743         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8744         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8745         unsigned char header_arr[80];
8746         CHECK(header->arr_len == 80);
8747         memcpy(header_arr, header->elems, 80); FREE(header);
8748         unsigned char (*header_ref)[80] = &header_arr;
8749         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
8750 }
8751
8752 typedef struct LDKConfirm_JCalls {
8753         atomic_size_t refcnt;
8754         uint32_t instance_ptr;
8755 } LDKConfirm_JCalls;
8756 static void LDKConfirm_JCalls_free(void* this_arg) {
8757         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8758         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8759                 FREE(j_calls);
8760         }
8761 }
8762 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8763         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8764         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8765         memcpy(header_arr->elems, *header, 80);
8766         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8767         uint64_tArray txdata_arr = NULL;
8768         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
8769         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
8770         for (size_t c = 0; c < txdata_var.datalen; c++) {
8771                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8772                 *txdata_conv_28_conv = txdata_var.data[c];
8773                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
8774         }
8775         
8776         FREE(txdata_var.data);
8777         int32_t height_conv = height;
8778         js_invoke_function_uuuuuu(j_calls->instance_ptr, 58, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
8779 }
8780 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
8781         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8782         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
8783         memcpy(txid_arr->elems, *txid, 32);
8784         js_invoke_function_uuuuuu(j_calls->instance_ptr, 59, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
8785 }
8786 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8787         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8788         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8789         memcpy(header_arr->elems, *header, 80);
8790         int32_t height_conv = height;
8791         js_invoke_function_uuuuuu(j_calls->instance_ptr, 60, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
8792 }
8793 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
8794         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8795         ptrArray ret = (ptrArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 61, 0, 0, 0, 0, 0, 0);
8796         LDKCVec_TxidZ ret_constr;
8797         ret_constr.datalen = ret->arr_len;
8798         if (ret_constr.datalen > 0)
8799                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
8800         else
8801                 ret_constr.data = NULL;
8802         int8_tArray* ret_vals = (void*) ret->elems;
8803         for (size_t m = 0; m < ret_constr.datalen; m++) {
8804                 int8_tArray ret_conv_12 = ret_vals[m];
8805                 LDKThirtyTwoBytes ret_conv_12_ref;
8806                 CHECK(ret_conv_12->arr_len == 32);
8807                 memcpy(ret_conv_12_ref.data, ret_conv_12->elems, 32); FREE(ret_conv_12);
8808                 ret_constr.data[m] = ret_conv_12_ref;
8809         }
8810         FREE(ret);
8811         return ret_constr;
8812 }
8813 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
8814         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
8815         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8816 }
8817 static inline LDKConfirm LDKConfirm_init (JSValue o) {
8818         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
8819         atomic_init(&calls->refcnt, 1);
8820         calls->instance_ptr = o;
8821
8822         LDKConfirm ret = {
8823                 .this_arg = (void*) calls,
8824                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
8825                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
8826                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
8827                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
8828                 .free = LDKConfirm_JCalls_free,
8829         };
8830         return ret;
8831 }
8832 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
8833         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
8834         *res_ptr = LDKConfirm_init(o);
8835         return tag_ptr(res_ptr, true);
8836 }
8837 void  __attribute__((export_name("TS_Confirm_transactions_confirmed"))) TS_Confirm_transactions_confirmed(uint64_t this_arg, int8_tArray header, uint64_tArray txdata, int32_t height) {
8838         void* this_arg_ptr = untag_ptr(this_arg);
8839         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8840         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8841         unsigned char header_arr[80];
8842         CHECK(header->arr_len == 80);
8843         memcpy(header_arr, header->elems, 80); FREE(header);
8844         unsigned char (*header_ref)[80] = &header_arr;
8845         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8846         txdata_constr.datalen = txdata->arr_len;
8847         if (txdata_constr.datalen > 0)
8848                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8849         else
8850                 txdata_constr.data = NULL;
8851         uint64_t* txdata_vals = txdata->elems;
8852         for (size_t c = 0; c < txdata_constr.datalen; c++) {
8853                 uint64_t txdata_conv_28 = txdata_vals[c];
8854                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
8855                 CHECK_ACCESS(txdata_conv_28_ptr);
8856                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8857                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
8858                 txdata_constr.data[c] = txdata_conv_28_conv;
8859         }
8860         FREE(txdata);
8861         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8862 }
8863
8864 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
8865         void* this_arg_ptr = untag_ptr(this_arg);
8866         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8867         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8868         unsigned char txid_arr[32];
8869         CHECK(txid->arr_len == 32);
8870         memcpy(txid_arr, txid->elems, 32); FREE(txid);
8871         unsigned char (*txid_ref)[32] = &txid_arr;
8872         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
8873 }
8874
8875 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
8876         void* this_arg_ptr = untag_ptr(this_arg);
8877         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8878         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8879         unsigned char header_arr[80];
8880         CHECK(header->arr_len == 80);
8881         memcpy(header_arr, header->elems, 80); FREE(header);
8882         unsigned char (*header_ref)[80] = &header_arr;
8883         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
8884 }
8885
8886 ptrArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
8887         void* this_arg_ptr = untag_ptr(this_arg);
8888         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8889         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8890         LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
8891         ptrArray ret_arr = NULL;
8892         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
8893         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
8894         for (size_t m = 0; m < ret_var.datalen; m++) {
8895                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
8896                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
8897                 ret_arr_ptr[m] = ret_conv_12_arr;
8898         }
8899         
8900         FREE(ret_var.data);
8901         return ret_arr;
8902 }
8903
8904 typedef struct LDKPersist_JCalls {
8905         atomic_size_t refcnt;
8906         uint32_t instance_ptr;
8907 } LDKPersist_JCalls;
8908 static void LDKPersist_JCalls_free(void* this_arg) {
8909         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8910         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8911                 FREE(j_calls);
8912         }
8913 }
8914 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8915         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8916         LDKOutPoint channel_id_var = channel_id;
8917         uint64_t channel_id_ref = 0;
8918         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8919         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
8920         LDKChannelMonitor data_var = *data;
8921         uint64_t data_ref = 0;
8922         data_var = ChannelMonitor_clone(&data_var);
8923         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8924         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
8925         LDKMonitorUpdateId update_id_var = update_id;
8926         uint64_t update_id_ref = 0;
8927         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8928         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
8929         uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 62, channel_id_ref, data_ref, update_id_ref, 0, 0, 0);
8930         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
8931         return ret_conv;
8932 }
8933 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8934         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8935         LDKOutPoint channel_id_var = channel_id;
8936         uint64_t channel_id_ref = 0;
8937         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8938         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
8939         LDKChannelMonitorUpdate update_var = *update;
8940         uint64_t update_ref = 0;
8941         update_var = ChannelMonitorUpdate_clone(&update_var);
8942         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
8943         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
8944         LDKChannelMonitor data_var = *data;
8945         uint64_t data_ref = 0;
8946         data_var = ChannelMonitor_clone(&data_var);
8947         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8948         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
8949         LDKMonitorUpdateId update_id_var = update_id;
8950         uint64_t update_id_ref = 0;
8951         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8952         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
8953         uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 63, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0);
8954         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
8955         return ret_conv;
8956 }
8957 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
8958         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
8959         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8960 }
8961 static inline LDKPersist LDKPersist_init (JSValue o) {
8962         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
8963         atomic_init(&calls->refcnt, 1);
8964         calls->instance_ptr = o;
8965
8966         LDKPersist ret = {
8967                 .this_arg = (void*) calls,
8968                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
8969                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
8970                 .free = LDKPersist_JCalls_free,
8971         };
8972         return ret;
8973 }
8974 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
8975         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
8976         *res_ptr = LDKPersist_init(o);
8977         return tag_ptr(res_ptr, true);
8978 }
8979 uint32_t  __attribute__((export_name("TS_Persist_persist_new_channel"))) TS_Persist_persist_new_channel(uint64_t this_arg, uint64_t channel_id, uint64_t data, uint64_t update_id) {
8980         void* this_arg_ptr = untag_ptr(this_arg);
8981         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8982         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
8983         LDKOutPoint channel_id_conv;
8984         channel_id_conv.inner = untag_ptr(channel_id);
8985         channel_id_conv.is_owned = ptr_is_owned(channel_id);
8986         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
8987         channel_id_conv = OutPoint_clone(&channel_id_conv);
8988         LDKChannelMonitor data_conv;
8989         data_conv.inner = untag_ptr(data);
8990         data_conv.is_owned = ptr_is_owned(data);
8991         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
8992         data_conv.is_owned = false;
8993         LDKMonitorUpdateId update_id_conv;
8994         update_id_conv.inner = untag_ptr(update_id);
8995         update_id_conv.is_owned = ptr_is_owned(update_id);
8996         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
8997         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
8998         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv));
8999         return ret_conv;
9000 }
9001
9002 uint32_t  __attribute__((export_name("TS_Persist_update_persisted_channel"))) TS_Persist_update_persisted_channel(uint64_t this_arg, uint64_t channel_id, uint64_t update, uint64_t data, uint64_t update_id) {
9003         void* this_arg_ptr = untag_ptr(this_arg);
9004         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9005         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9006         LDKOutPoint channel_id_conv;
9007         channel_id_conv.inner = untag_ptr(channel_id);
9008         channel_id_conv.is_owned = ptr_is_owned(channel_id);
9009         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9010         channel_id_conv = OutPoint_clone(&channel_id_conv);
9011         LDKChannelMonitorUpdate update_conv;
9012         update_conv.inner = untag_ptr(update);
9013         update_conv.is_owned = ptr_is_owned(update);
9014         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
9015         update_conv.is_owned = false;
9016         LDKChannelMonitor data_conv;
9017         data_conv.inner = untag_ptr(data);
9018         data_conv.is_owned = ptr_is_owned(data);
9019         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9020         data_conv.is_owned = false;
9021         LDKMonitorUpdateId update_id_conv;
9022         update_id_conv.inner = untag_ptr(update_id);
9023         update_id_conv.is_owned = ptr_is_owned(update_id);
9024         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9025         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9026         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv));
9027         return ret_conv;
9028 }
9029
9030 typedef struct LDKChannelMessageHandler_JCalls {
9031         atomic_size_t refcnt;
9032         uint32_t instance_ptr;
9033         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9034 } LDKChannelMessageHandler_JCalls;
9035 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
9036         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9037         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9038                 FREE(j_calls);
9039         }
9040 }
9041 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
9042         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9043         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9044         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9045         LDKInitFeatures their_features_var = their_features;
9046         uint64_t their_features_ref = 0;
9047         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9048         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
9049         LDKOpenChannel msg_var = *msg;
9050         uint64_t msg_ref = 0;
9051         msg_var = OpenChannel_clone(&msg_var);
9052         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9053         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9054         js_invoke_function_ubbuuu(j_calls->instance_ptr, 64, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
9055 }
9056 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
9057         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9058         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9059         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9060         LDKInitFeatures their_features_var = their_features;
9061         uint64_t their_features_ref = 0;
9062         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9063         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
9064         LDKAcceptChannel msg_var = *msg;
9065         uint64_t msg_ref = 0;
9066         msg_var = AcceptChannel_clone(&msg_var);
9067         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9068         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9069         js_invoke_function_ubbuuu(j_calls->instance_ptr, 65, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
9070 }
9071 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
9072         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9073         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9074         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9075         LDKFundingCreated msg_var = *msg;
9076         uint64_t msg_ref = 0;
9077         msg_var = FundingCreated_clone(&msg_var);
9078         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9079         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9080         js_invoke_function_ubuuuu(j_calls->instance_ptr, 66, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9081 }
9082 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
9083         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9084         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9085         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9086         LDKFundingSigned msg_var = *msg;
9087         uint64_t msg_ref = 0;
9088         msg_var = FundingSigned_clone(&msg_var);
9089         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9090         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9091         js_invoke_function_ubuuuu(j_calls->instance_ptr, 67, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9092 }
9093 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
9094         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9095         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9096         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9097         LDKChannelReady msg_var = *msg;
9098         uint64_t msg_ref = 0;
9099         msg_var = ChannelReady_clone(&msg_var);
9100         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9101         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9102         js_invoke_function_ubuuuu(j_calls->instance_ptr, 68, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9103 }
9104 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
9105         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9106         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9107         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9108         LDKInitFeatures their_features_var = *their_features;
9109         uint64_t their_features_ref = 0;
9110         their_features_var = InitFeatures_clone(&their_features_var);
9111         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9112         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
9113         LDKShutdown msg_var = *msg;
9114         uint64_t msg_ref = 0;
9115         msg_var = Shutdown_clone(&msg_var);
9116         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9117         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9118         js_invoke_function_ubbuuu(j_calls->instance_ptr, 69, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
9119 }
9120 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
9121         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9122         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9123         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9124         LDKClosingSigned msg_var = *msg;
9125         uint64_t msg_ref = 0;
9126         msg_var = ClosingSigned_clone(&msg_var);
9127         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9128         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9129         js_invoke_function_ubuuuu(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9130 }
9131 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
9132         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9133         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9134         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9135         LDKUpdateAddHTLC msg_var = *msg;
9136         uint64_t msg_ref = 0;
9137         msg_var = UpdateAddHTLC_clone(&msg_var);
9138         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9139         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9140         js_invoke_function_ubuuuu(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9141 }
9142 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
9143         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9144         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9145         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9146         LDKUpdateFulfillHTLC msg_var = *msg;
9147         uint64_t msg_ref = 0;
9148         msg_var = UpdateFulfillHTLC_clone(&msg_var);
9149         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9150         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9151         js_invoke_function_ubuuuu(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9152 }
9153 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
9154         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9155         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9156         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9157         LDKUpdateFailHTLC msg_var = *msg;
9158         uint64_t msg_ref = 0;
9159         msg_var = UpdateFailHTLC_clone(&msg_var);
9160         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9161         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9162         js_invoke_function_ubuuuu(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9163 }
9164 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
9165         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9166         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9167         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9168         LDKUpdateFailMalformedHTLC msg_var = *msg;
9169         uint64_t msg_ref = 0;
9170         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
9171         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9172         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9173         js_invoke_function_ubuuuu(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9174 }
9175 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
9176         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9177         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9178         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9179         LDKCommitmentSigned msg_var = *msg;
9180         uint64_t msg_ref = 0;
9181         msg_var = CommitmentSigned_clone(&msg_var);
9182         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9183         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9184         js_invoke_function_ubuuuu(j_calls->instance_ptr, 75, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9185 }
9186 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
9187         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9188         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9189         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9190         LDKRevokeAndACK msg_var = *msg;
9191         uint64_t msg_ref = 0;
9192         msg_var = RevokeAndACK_clone(&msg_var);
9193         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9194         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9195         js_invoke_function_ubuuuu(j_calls->instance_ptr, 76, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9196 }
9197 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
9198         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9199         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9200         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9201         LDKUpdateFee msg_var = *msg;
9202         uint64_t msg_ref = 0;
9203         msg_var = UpdateFee_clone(&msg_var);
9204         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9205         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9206         js_invoke_function_ubuuuu(j_calls->instance_ptr, 77, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9207 }
9208 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
9209         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9210         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9211         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9212         LDKAnnouncementSignatures msg_var = *msg;
9213         uint64_t msg_ref = 0;
9214         msg_var = AnnouncementSignatures_clone(&msg_var);
9215         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9216         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9217         js_invoke_function_ubuuuu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9218 }
9219 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
9220         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9221         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9222         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9223         jboolean no_connection_possible_conv = no_connection_possible;
9224         js_invoke_function_uuuuuu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, no_connection_possible_conv, 0, 0, 0, 0);
9225 }
9226 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
9227         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9228         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9229         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9230         LDKInit msg_var = *msg;
9231         uint64_t msg_ref = 0;
9232         msg_var = Init_clone(&msg_var);
9233         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9234         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9235         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9236         void* ret_ptr = untag_ptr(ret);
9237         CHECK_ACCESS(ret_ptr);
9238         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
9239         FREE(untag_ptr(ret));
9240         return ret_conv;
9241 }
9242 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
9243         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9244         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9245         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9246         LDKChannelReestablish msg_var = *msg;
9247         uint64_t msg_ref = 0;
9248         msg_var = ChannelReestablish_clone(&msg_var);
9249         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9250         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9251         js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9252 }
9253 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
9254         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9255         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9256         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9257         LDKChannelUpdate msg_var = *msg;
9258         uint64_t msg_ref = 0;
9259         msg_var = ChannelUpdate_clone(&msg_var);
9260         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9261         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9262         js_invoke_function_ubuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9263 }
9264 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
9265         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9266         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9267         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9268         LDKErrorMessage msg_var = *msg;
9269         uint64_t msg_ref = 0;
9270         msg_var = ErrorMessage_clone(&msg_var);
9271         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9272         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9273         js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9274 }
9275 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
9276         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9277         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 84, 0, 0, 0, 0, 0, 0);
9278         LDKNodeFeatures ret_conv;
9279         ret_conv.inner = untag_ptr(ret);
9280         ret_conv.is_owned = ptr_is_owned(ret);
9281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9282         return ret_conv;
9283 }
9284 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
9285         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9286         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9287         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9288         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 85, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
9289         LDKInitFeatures ret_conv;
9290         ret_conv.inner = untag_ptr(ret);
9291         ret_conv.is_owned = ptr_is_owned(ret);
9292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9293         return ret_conv;
9294 }
9295 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
9296         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
9297         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9298         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9299 }
9300 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
9301         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
9302         atomic_init(&calls->refcnt, 1);
9303         calls->instance_ptr = o;
9304
9305         LDKChannelMessageHandler ret = {
9306                 .this_arg = (void*) calls,
9307                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
9308                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
9309                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
9310                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
9311                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
9312                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
9313                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
9314                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
9315                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
9316                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
9317                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
9318                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
9319                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
9320                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
9321                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
9322                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
9323                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
9324                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
9325                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
9326                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
9327                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
9328                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
9329                 .free = LDKChannelMessageHandler_JCalls_free,
9330                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
9331         };
9332         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9333         return ret;
9334 }
9335 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
9336         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
9337         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
9338         return tag_ptr(res_ptr, true);
9339 }
9340 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_open_channel"))) TS_ChannelMessageHandler_handle_open_channel(uint64_t this_arg, int8_tArray their_node_id, uint64_t their_features, uint64_t msg) {
9341         void* this_arg_ptr = untag_ptr(this_arg);
9342         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9343         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9344         LDKPublicKey their_node_id_ref;
9345         CHECK(their_node_id->arr_len == 33);
9346         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9347         LDKInitFeatures their_features_conv;
9348         their_features_conv.inner = untag_ptr(their_features);
9349         their_features_conv.is_owned = ptr_is_owned(their_features);
9350         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9351         their_features_conv = InitFeatures_clone(&their_features_conv);
9352         LDKOpenChannel msg_conv;
9353         msg_conv.inner = untag_ptr(msg);
9354         msg_conv.is_owned = ptr_is_owned(msg);
9355         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9356         msg_conv.is_owned = false;
9357         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9358 }
9359
9360 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_accept_channel"))) TS_ChannelMessageHandler_handle_accept_channel(uint64_t this_arg, int8_tArray their_node_id, uint64_t their_features, uint64_t msg) {
9361         void* this_arg_ptr = untag_ptr(this_arg);
9362         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9363         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9364         LDKPublicKey their_node_id_ref;
9365         CHECK(their_node_id->arr_len == 33);
9366         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9367         LDKInitFeatures their_features_conv;
9368         their_features_conv.inner = untag_ptr(their_features);
9369         their_features_conv.is_owned = ptr_is_owned(their_features);
9370         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9371         their_features_conv = InitFeatures_clone(&their_features_conv);
9372         LDKAcceptChannel msg_conv;
9373         msg_conv.inner = untag_ptr(msg);
9374         msg_conv.is_owned = ptr_is_owned(msg);
9375         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9376         msg_conv.is_owned = false;
9377         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9378 }
9379
9380 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_funding_created"))) TS_ChannelMessageHandler_handle_funding_created(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9381         void* this_arg_ptr = untag_ptr(this_arg);
9382         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9383         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9384         LDKPublicKey their_node_id_ref;
9385         CHECK(their_node_id->arr_len == 33);
9386         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9387         LDKFundingCreated msg_conv;
9388         msg_conv.inner = untag_ptr(msg);
9389         msg_conv.is_owned = ptr_is_owned(msg);
9390         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9391         msg_conv.is_owned = false;
9392         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9393 }
9394
9395 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_funding_signed"))) TS_ChannelMessageHandler_handle_funding_signed(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9396         void* this_arg_ptr = untag_ptr(this_arg);
9397         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9398         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9399         LDKPublicKey their_node_id_ref;
9400         CHECK(their_node_id->arr_len == 33);
9401         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9402         LDKFundingSigned msg_conv;
9403         msg_conv.inner = untag_ptr(msg);
9404         msg_conv.is_owned = ptr_is_owned(msg);
9405         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9406         msg_conv.is_owned = false;
9407         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9408 }
9409
9410 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_channel_ready"))) TS_ChannelMessageHandler_handle_channel_ready(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9411         void* this_arg_ptr = untag_ptr(this_arg);
9412         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9413         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9414         LDKPublicKey their_node_id_ref;
9415         CHECK(their_node_id->arr_len == 33);
9416         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9417         LDKChannelReady msg_conv;
9418         msg_conv.inner = untag_ptr(msg);
9419         msg_conv.is_owned = ptr_is_owned(msg);
9420         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9421         msg_conv.is_owned = false;
9422         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9423 }
9424
9425 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_shutdown"))) TS_ChannelMessageHandler_handle_shutdown(uint64_t this_arg, int8_tArray their_node_id, uint64_t their_features, uint64_t msg) {
9426         void* this_arg_ptr = untag_ptr(this_arg);
9427         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9428         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9429         LDKPublicKey their_node_id_ref;
9430         CHECK(their_node_id->arr_len == 33);
9431         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9432         LDKInitFeatures their_features_conv;
9433         their_features_conv.inner = untag_ptr(their_features);
9434         their_features_conv.is_owned = ptr_is_owned(their_features);
9435         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9436         their_features_conv.is_owned = false;
9437         LDKShutdown msg_conv;
9438         msg_conv.inner = untag_ptr(msg);
9439         msg_conv.is_owned = ptr_is_owned(msg);
9440         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9441         msg_conv.is_owned = false;
9442         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
9443 }
9444
9445 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_closing_signed"))) TS_ChannelMessageHandler_handle_closing_signed(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9446         void* this_arg_ptr = untag_ptr(this_arg);
9447         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9448         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9449         LDKPublicKey their_node_id_ref;
9450         CHECK(their_node_id->arr_len == 33);
9451         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9452         LDKClosingSigned msg_conv;
9453         msg_conv.inner = untag_ptr(msg);
9454         msg_conv.is_owned = ptr_is_owned(msg);
9455         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9456         msg_conv.is_owned = false;
9457         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9458 }
9459
9460 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_update_add_htlc"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9461         void* this_arg_ptr = untag_ptr(this_arg);
9462         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9463         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9464         LDKPublicKey their_node_id_ref;
9465         CHECK(their_node_id->arr_len == 33);
9466         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9467         LDKUpdateAddHTLC msg_conv;
9468         msg_conv.inner = untag_ptr(msg);
9469         msg_conv.is_owned = ptr_is_owned(msg);
9470         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9471         msg_conv.is_owned = false;
9472         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9473 }
9474
9475 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_update_fulfill_htlc"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9476         void* this_arg_ptr = untag_ptr(this_arg);
9477         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9478         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9479         LDKPublicKey their_node_id_ref;
9480         CHECK(their_node_id->arr_len == 33);
9481         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9482         LDKUpdateFulfillHTLC msg_conv;
9483         msg_conv.inner = untag_ptr(msg);
9484         msg_conv.is_owned = ptr_is_owned(msg);
9485         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9486         msg_conv.is_owned = false;
9487         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9488 }
9489
9490 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_update_fail_htlc"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9491         void* this_arg_ptr = untag_ptr(this_arg);
9492         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9493         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9494         LDKPublicKey their_node_id_ref;
9495         CHECK(their_node_id->arr_len == 33);
9496         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9497         LDKUpdateFailHTLC msg_conv;
9498         msg_conv.inner = untag_ptr(msg);
9499         msg_conv.is_owned = ptr_is_owned(msg);
9500         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9501         msg_conv.is_owned = false;
9502         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9503 }
9504
9505 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_update_fail_malformed_htlc"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9506         void* this_arg_ptr = untag_ptr(this_arg);
9507         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9508         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9509         LDKPublicKey their_node_id_ref;
9510         CHECK(their_node_id->arr_len == 33);
9511         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9512         LDKUpdateFailMalformedHTLC msg_conv;
9513         msg_conv.inner = untag_ptr(msg);
9514         msg_conv.is_owned = ptr_is_owned(msg);
9515         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9516         msg_conv.is_owned = false;
9517         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9518 }
9519
9520 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_commitment_signed"))) TS_ChannelMessageHandler_handle_commitment_signed(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9521         void* this_arg_ptr = untag_ptr(this_arg);
9522         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9523         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9524         LDKPublicKey their_node_id_ref;
9525         CHECK(their_node_id->arr_len == 33);
9526         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9527         LDKCommitmentSigned msg_conv;
9528         msg_conv.inner = untag_ptr(msg);
9529         msg_conv.is_owned = ptr_is_owned(msg);
9530         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9531         msg_conv.is_owned = false;
9532         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9533 }
9534
9535 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_revoke_and_ack"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9536         void* this_arg_ptr = untag_ptr(this_arg);
9537         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9538         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9539         LDKPublicKey their_node_id_ref;
9540         CHECK(their_node_id->arr_len == 33);
9541         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9542         LDKRevokeAndACK msg_conv;
9543         msg_conv.inner = untag_ptr(msg);
9544         msg_conv.is_owned = ptr_is_owned(msg);
9545         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9546         msg_conv.is_owned = false;
9547         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9548 }
9549
9550 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_update_fee"))) TS_ChannelMessageHandler_handle_update_fee(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9551         void* this_arg_ptr = untag_ptr(this_arg);
9552         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9553         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9554         LDKPublicKey their_node_id_ref;
9555         CHECK(their_node_id->arr_len == 33);
9556         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9557         LDKUpdateFee msg_conv;
9558         msg_conv.inner = untag_ptr(msg);
9559         msg_conv.is_owned = ptr_is_owned(msg);
9560         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9561         msg_conv.is_owned = false;
9562         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9563 }
9564
9565 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_announcement_signatures"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9566         void* this_arg_ptr = untag_ptr(this_arg);
9567         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9568         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9569         LDKPublicKey their_node_id_ref;
9570         CHECK(their_node_id->arr_len == 33);
9571         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9572         LDKAnnouncementSignatures msg_conv;
9573         msg_conv.inner = untag_ptr(msg);
9574         msg_conv.is_owned = ptr_is_owned(msg);
9575         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9576         msg_conv.is_owned = false;
9577         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9578 }
9579
9580 void  __attribute__((export_name("TS_ChannelMessageHandler_peer_disconnected"))) TS_ChannelMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
9581         void* this_arg_ptr = untag_ptr(this_arg);
9582         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9583         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9584         LDKPublicKey their_node_id_ref;
9585         CHECK(their_node_id->arr_len == 33);
9586         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9587         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
9588 }
9589
9590 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_peer_connected"))) TS_ChannelMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9591         void* this_arg_ptr = untag_ptr(this_arg);
9592         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9593         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9594         LDKPublicKey their_node_id_ref;
9595         CHECK(their_node_id->arr_len == 33);
9596         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9597         LDKInit msg_conv;
9598         msg_conv.inner = untag_ptr(msg);
9599         msg_conv.is_owned = ptr_is_owned(msg);
9600         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9601         msg_conv.is_owned = false;
9602         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
9603         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9604         return tag_ptr(ret_conv, true);
9605 }
9606
9607 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_channel_reestablish"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9608         void* this_arg_ptr = untag_ptr(this_arg);
9609         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9610         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9611         LDKPublicKey their_node_id_ref;
9612         CHECK(their_node_id->arr_len == 33);
9613         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9614         LDKChannelReestablish msg_conv;
9615         msg_conv.inner = untag_ptr(msg);
9616         msg_conv.is_owned = ptr_is_owned(msg);
9617         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9618         msg_conv.is_owned = false;
9619         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9620 }
9621
9622 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_channel_update"))) TS_ChannelMessageHandler_handle_channel_update(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9623         void* this_arg_ptr = untag_ptr(this_arg);
9624         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9625         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9626         LDKPublicKey their_node_id_ref;
9627         CHECK(their_node_id->arr_len == 33);
9628         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9629         LDKChannelUpdate msg_conv;
9630         msg_conv.inner = untag_ptr(msg);
9631         msg_conv.is_owned = ptr_is_owned(msg);
9632         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9633         msg_conv.is_owned = false;
9634         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9635 }
9636
9637 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9638         void* this_arg_ptr = untag_ptr(this_arg);
9639         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9640         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9641         LDKPublicKey their_node_id_ref;
9642         CHECK(their_node_id->arr_len == 33);
9643         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9644         LDKErrorMessage msg_conv;
9645         msg_conv.inner = untag_ptr(msg);
9646         msg_conv.is_owned = ptr_is_owned(msg);
9647         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9648         msg_conv.is_owned = false;
9649         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9650 }
9651
9652 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_node_features"))) TS_ChannelMessageHandler_provided_node_features(uint64_t this_arg) {
9653         void* this_arg_ptr = untag_ptr(this_arg);
9654         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9655         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9656         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
9657         uint64_t ret_ref = 0;
9658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9660         return ret_ref;
9661 }
9662
9663 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_init_features"))) TS_ChannelMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
9664         void* this_arg_ptr = untag_ptr(this_arg);
9665         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9666         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9667         LDKPublicKey their_node_id_ref;
9668         CHECK(their_node_id->arr_len == 33);
9669         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9670         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
9671         uint64_t ret_ref = 0;
9672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9674         return ret_ref;
9675 }
9676
9677 typedef struct LDKRoutingMessageHandler_JCalls {
9678         atomic_size_t refcnt;
9679         uint32_t instance_ptr;
9680         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9681 } LDKRoutingMessageHandler_JCalls;
9682 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
9683         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9684         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9685                 FREE(j_calls);
9686         }
9687 }
9688 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
9689         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9690         LDKNodeAnnouncement msg_var = *msg;
9691         uint64_t msg_ref = 0;
9692         msg_var = NodeAnnouncement_clone(&msg_var);
9693         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9694         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9695         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 86, msg_ref, 0, 0, 0, 0, 0);
9696         void* ret_ptr = untag_ptr(ret);
9697         CHECK_ACCESS(ret_ptr);
9698         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9699         FREE(untag_ptr(ret));
9700         return ret_conv;
9701 }
9702 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
9703         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9704         LDKChannelAnnouncement msg_var = *msg;
9705         uint64_t msg_ref = 0;
9706         msg_var = ChannelAnnouncement_clone(&msg_var);
9707         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9708         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9709         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 87, msg_ref, 0, 0, 0, 0, 0);
9710         void* ret_ptr = untag_ptr(ret);
9711         CHECK_ACCESS(ret_ptr);
9712         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9713         FREE(untag_ptr(ret));
9714         return ret_conv;
9715 }
9716 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
9717         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9718         LDKChannelUpdate msg_var = *msg;
9719         uint64_t msg_ref = 0;
9720         msg_var = ChannelUpdate_clone(&msg_var);
9721         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9722         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9723         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 88, msg_ref, 0, 0, 0, 0, 0);
9724         void* ret_ptr = untag_ptr(ret);
9725         CHECK_ACCESS(ret_ptr);
9726         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9727         FREE(untag_ptr(ret));
9728         return ret_conv;
9729 }
9730 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
9731         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9732         int64_t starting_point_conv = starting_point;
9733         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 89, starting_point_conv, 0, 0, 0, 0, 0);
9734         void* ret_ptr = untag_ptr(ret);
9735         CHECK_ACCESS(ret_ptr);
9736         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
9737         FREE(untag_ptr(ret));
9738         return ret_conv;
9739 }
9740 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point) {
9741         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9742         int8_tArray starting_point_arr = init_int8_tArray(33, __LINE__);
9743         memcpy(starting_point_arr->elems, starting_point.compressed_form, 33);
9744         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 90, (uint32_t)starting_point_arr, 0, 0, 0, 0, 0);
9745         LDKNodeAnnouncement ret_conv;
9746         ret_conv.inner = untag_ptr(ret);
9747         ret_conv.is_owned = ptr_is_owned(ret);
9748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9749         return ret_conv;
9750 }
9751 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
9752         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9753         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9754         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9755         LDKInit init_var = *init;
9756         uint64_t init_ref = 0;
9757         init_var = Init_clone(&init_var);
9758         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
9759         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
9760         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 91, (uint32_t)their_node_id_arr, init_ref, 0, 0, 0, 0);
9761         void* ret_ptr = untag_ptr(ret);
9762         CHECK_ACCESS(ret_ptr);
9763         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
9764         FREE(untag_ptr(ret));
9765         return ret_conv;
9766 }
9767 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
9768         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9769         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9770         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9771         LDKReplyChannelRange msg_var = msg;
9772         uint64_t msg_ref = 0;
9773         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9774         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9775         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 92, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9776         void* ret_ptr = untag_ptr(ret);
9777         CHECK_ACCESS(ret_ptr);
9778         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9779         FREE(untag_ptr(ret));
9780         return ret_conv;
9781 }
9782 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
9783         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9784         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9785         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9786         LDKReplyShortChannelIdsEnd msg_var = msg;
9787         uint64_t msg_ref = 0;
9788         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9789         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9790         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 93, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9791         void* ret_ptr = untag_ptr(ret);
9792         CHECK_ACCESS(ret_ptr);
9793         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9794         FREE(untag_ptr(ret));
9795         return ret_conv;
9796 }
9797 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
9798         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9799         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9800         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9801         LDKQueryChannelRange msg_var = msg;
9802         uint64_t msg_ref = 0;
9803         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9804         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9805         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9806         void* ret_ptr = untag_ptr(ret);
9807         CHECK_ACCESS(ret_ptr);
9808         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9809         FREE(untag_ptr(ret));
9810         return ret_conv;
9811 }
9812 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
9813         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9814         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9815         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9816         LDKQueryShortChannelIds msg_var = msg;
9817         uint64_t msg_ref = 0;
9818         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9819         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9820         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9821         void* ret_ptr = untag_ptr(ret);
9822         CHECK_ACCESS(ret_ptr);
9823         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9824         FREE(untag_ptr(ret));
9825         return ret_conv;
9826 }
9827 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
9828         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9829         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 96, 0, 0, 0, 0, 0, 0);
9830         LDKNodeFeatures ret_conv;
9831         ret_conv.inner = untag_ptr(ret);
9832         ret_conv.is_owned = ptr_is_owned(ret);
9833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9834         return ret_conv;
9835 }
9836 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
9837         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9838         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9839         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9840         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 97, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
9841         LDKInitFeatures ret_conv;
9842         ret_conv.inner = untag_ptr(ret);
9843         ret_conv.is_owned = ptr_is_owned(ret);
9844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9845         return ret_conv;
9846 }
9847 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
9848         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
9849         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9850         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9851 }
9852 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
9853         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
9854         atomic_init(&calls->refcnt, 1);
9855         calls->instance_ptr = o;
9856
9857         LDKRoutingMessageHandler ret = {
9858                 .this_arg = (void*) calls,
9859                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
9860                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
9861                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
9862                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
9863                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
9864                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
9865                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
9866                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
9867                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
9868                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
9869                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
9870                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
9871                 .free = LDKRoutingMessageHandler_JCalls_free,
9872                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
9873         };
9874         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9875         return ret;
9876 }
9877 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
9878         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
9879         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
9880         return tag_ptr(res_ptr, true);
9881 }
9882 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
9883         void* this_arg_ptr = untag_ptr(this_arg);
9884         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9885         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9886         LDKNodeAnnouncement msg_conv;
9887         msg_conv.inner = untag_ptr(msg);
9888         msg_conv.is_owned = ptr_is_owned(msg);
9889         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9890         msg_conv.is_owned = false;
9891         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9892         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
9893         return tag_ptr(ret_conv, true);
9894 }
9895
9896 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
9897         void* this_arg_ptr = untag_ptr(this_arg);
9898         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9899         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9900         LDKChannelAnnouncement msg_conv;
9901         msg_conv.inner = untag_ptr(msg);
9902         msg_conv.is_owned = ptr_is_owned(msg);
9903         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9904         msg_conv.is_owned = false;
9905         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9906         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
9907         return tag_ptr(ret_conv, true);
9908 }
9909
9910 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
9911         void* this_arg_ptr = untag_ptr(this_arg);
9912         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9913         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9914         LDKChannelUpdate msg_conv;
9915         msg_conv.inner = untag_ptr(msg);
9916         msg_conv.is_owned = ptr_is_owned(msg);
9917         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9918         msg_conv.is_owned = false;
9919         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9920         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
9921         return tag_ptr(ret_conv, true);
9922 }
9923
9924 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_get_next_channel_announcement"))) TS_RoutingMessageHandler_get_next_channel_announcement(uint64_t this_arg, int64_t starting_point) {
9925         void* this_arg_ptr = untag_ptr(this_arg);
9926         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9927         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9928         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
9929         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
9930         uint64_t ret_ref = tag_ptr(ret_copy, true);
9931         return ret_ref;
9932 }
9933
9934 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_get_next_node_announcement"))) TS_RoutingMessageHandler_get_next_node_announcement(uint64_t this_arg, int8_tArray starting_point) {
9935         void* this_arg_ptr = untag_ptr(this_arg);
9936         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9937         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9938         LDKPublicKey starting_point_ref;
9939         CHECK(starting_point->arr_len == 33);
9940         memcpy(starting_point_ref.compressed_form, starting_point->elems, 33); FREE(starting_point);
9941         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_ref);
9942         uint64_t ret_ref = 0;
9943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9945         return ret_ref;
9946 }
9947
9948 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_peer_connected"))) TS_RoutingMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t init) {
9949         void* this_arg_ptr = untag_ptr(this_arg);
9950         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9951         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9952         LDKPublicKey their_node_id_ref;
9953         CHECK(their_node_id->arr_len == 33);
9954         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9955         LDKInit init_conv;
9956         init_conv.inner = untag_ptr(init);
9957         init_conv.is_owned = ptr_is_owned(init);
9958         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
9959         init_conv.is_owned = false;
9960         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
9961         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
9962         return tag_ptr(ret_conv, true);
9963 }
9964
9965 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_reply_channel_range"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9966         void* this_arg_ptr = untag_ptr(this_arg);
9967         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9968         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9969         LDKPublicKey their_node_id_ref;
9970         CHECK(their_node_id->arr_len == 33);
9971         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9972         LDKReplyChannelRange msg_conv;
9973         msg_conv.inner = untag_ptr(msg);
9974         msg_conv.is_owned = ptr_is_owned(msg);
9975         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9976         msg_conv = ReplyChannelRange_clone(&msg_conv);
9977         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9978         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9979         return tag_ptr(ret_conv, true);
9980 }
9981
9982 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_reply_short_channel_ids_end"))) TS_RoutingMessageHandler_handle_reply_short_channel_ids_end(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9983         void* this_arg_ptr = untag_ptr(this_arg);
9984         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9985         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9986         LDKPublicKey their_node_id_ref;
9987         CHECK(their_node_id->arr_len == 33);
9988         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9989         LDKReplyShortChannelIdsEnd msg_conv;
9990         msg_conv.inner = untag_ptr(msg);
9991         msg_conv.is_owned = ptr_is_owned(msg);
9992         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9993         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
9994         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9995         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9996         return tag_ptr(ret_conv, true);
9997 }
9998
9999 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_query_channel_range"))) TS_RoutingMessageHandler_handle_query_channel_range(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
10000         void* this_arg_ptr = untag_ptr(this_arg);
10001         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10002         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10003         LDKPublicKey their_node_id_ref;
10004         CHECK(their_node_id->arr_len == 33);
10005         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10006         LDKQueryChannelRange msg_conv;
10007         msg_conv.inner = untag_ptr(msg);
10008         msg_conv.is_owned = ptr_is_owned(msg);
10009         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10010         msg_conv = QueryChannelRange_clone(&msg_conv);
10011         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10012         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10013         return tag_ptr(ret_conv, true);
10014 }
10015
10016 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_query_short_channel_ids"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
10017         void* this_arg_ptr = untag_ptr(this_arg);
10018         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10019         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10020         LDKPublicKey their_node_id_ref;
10021         CHECK(their_node_id->arr_len == 33);
10022         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10023         LDKQueryShortChannelIds msg_conv;
10024         msg_conv.inner = untag_ptr(msg);
10025         msg_conv.is_owned = ptr_is_owned(msg);
10026         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10027         msg_conv = QueryShortChannelIds_clone(&msg_conv);
10028         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10029         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10030         return tag_ptr(ret_conv, true);
10031 }
10032
10033 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) {
10034         void* this_arg_ptr = untag_ptr(this_arg);
10035         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10036         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10037         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
10038         uint64_t ret_ref = 0;
10039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10041         return ret_ref;
10042 }
10043
10044 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_init_features"))) TS_RoutingMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
10045         void* this_arg_ptr = untag_ptr(this_arg);
10046         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10047         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10048         LDKPublicKey their_node_id_ref;
10049         CHECK(their_node_id->arr_len == 33);
10050         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10051         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
10052         uint64_t ret_ref = 0;
10053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10055         return ret_ref;
10056 }
10057
10058 typedef struct LDKOnionMessageHandler_JCalls {
10059         atomic_size_t refcnt;
10060         uint32_t instance_ptr;
10061         LDKOnionMessageProvider_JCalls* OnionMessageProvider;
10062 } LDKOnionMessageHandler_JCalls;
10063 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
10064         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10065         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10066                 FREE(j_calls);
10067         }
10068 }
10069 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
10070         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10071         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
10072         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
10073         LDKOnionMessage msg_var = *msg;
10074         uint64_t msg_ref = 0;
10075         msg_var = OnionMessage_clone(&msg_var);
10076         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10077         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10078         js_invoke_function_ubuuuu(j_calls->instance_ptr, 98, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0);
10079 }
10080 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
10081         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10082         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10083         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10084         LDKInit init_var = *init;
10085         uint64_t init_ref = 0;
10086         init_var = Init_clone(&init_var);
10087         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
10088         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
10089         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 99, (uint32_t)their_node_id_arr, init_ref, 0, 0, 0, 0);
10090         void* ret_ptr = untag_ptr(ret);
10091         CHECK_ACCESS(ret_ptr);
10092         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
10093         FREE(untag_ptr(ret));
10094         return ret_conv;
10095 }
10096 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
10097         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10098         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10099         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10100         jboolean no_connection_possible_conv = no_connection_possible;
10101         js_invoke_function_uuuuuu(j_calls->instance_ptr, 100, (uint32_t)their_node_id_arr, no_connection_possible_conv, 0, 0, 0, 0);
10102 }
10103 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
10104         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10105         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 101, 0, 0, 0, 0, 0, 0);
10106         LDKNodeFeatures ret_conv;
10107         ret_conv.inner = untag_ptr(ret);
10108         ret_conv.is_owned = ptr_is_owned(ret);
10109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10110         return ret_conv;
10111 }
10112 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10113         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10114         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10115         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10116         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 102, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10117         LDKInitFeatures ret_conv;
10118         ret_conv.inner = untag_ptr(ret);
10119         ret_conv.is_owned = ptr_is_owned(ret);
10120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10121         return ret_conv;
10122 }
10123 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
10124         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
10125         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10126         atomic_fetch_add_explicit(&j_calls->OnionMessageProvider->refcnt, 1, memory_order_release);
10127 }
10128 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JSValue o, JSValue OnionMessageProvider) {
10129         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
10130         atomic_init(&calls->refcnt, 1);
10131         calls->instance_ptr = o;
10132
10133         LDKOnionMessageHandler ret = {
10134                 .this_arg = (void*) calls,
10135                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
10136                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
10137                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
10138                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
10139                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
10140                 .free = LDKOnionMessageHandler_JCalls_free,
10141                 .OnionMessageProvider = LDKOnionMessageProvider_init(OnionMessageProvider),
10142         };
10143         calls->OnionMessageProvider = ret.OnionMessageProvider.this_arg;
10144         return ret;
10145 }
10146 uint64_t  __attribute__((export_name("TS_LDKOnionMessageHandler_new"))) TS_LDKOnionMessageHandler_new(JSValue o, JSValue OnionMessageProvider) {
10147         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
10148         *res_ptr = LDKOnionMessageHandler_init(o, OnionMessageProvider);
10149         return tag_ptr(res_ptr, true);
10150 }
10151 void  __attribute__((export_name("TS_OnionMessageHandler_handle_onion_message"))) TS_OnionMessageHandler_handle_onion_message(uint64_t this_arg, int8_tArray peer_node_id, uint64_t msg) {
10152         void* this_arg_ptr = untag_ptr(this_arg);
10153         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10154         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10155         LDKPublicKey peer_node_id_ref;
10156         CHECK(peer_node_id->arr_len == 33);
10157         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
10158         LDKOnionMessage msg_conv;
10159         msg_conv.inner = untag_ptr(msg);
10160         msg_conv.is_owned = ptr_is_owned(msg);
10161         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10162         msg_conv.is_owned = false;
10163         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
10164 }
10165
10166 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_peer_connected"))) TS_OnionMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t init) {
10167         void* this_arg_ptr = untag_ptr(this_arg);
10168         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10169         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10170         LDKPublicKey their_node_id_ref;
10171         CHECK(their_node_id->arr_len == 33);
10172         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10173         LDKInit init_conv;
10174         init_conv.inner = untag_ptr(init);
10175         init_conv.is_owned = ptr_is_owned(init);
10176         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
10177         init_conv.is_owned = false;
10178         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10179         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
10180         return tag_ptr(ret_conv, true);
10181 }
10182
10183 void  __attribute__((export_name("TS_OnionMessageHandler_peer_disconnected"))) TS_OnionMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
10184         void* this_arg_ptr = untag_ptr(this_arg);
10185         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10186         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10187         LDKPublicKey their_node_id_ref;
10188         CHECK(their_node_id->arr_len == 33);
10189         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10190         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
10191 }
10192
10193 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) {
10194         void* this_arg_ptr = untag_ptr(this_arg);
10195         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10196         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10197         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
10198         uint64_t ret_ref = 0;
10199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10201         return ret_ref;
10202 }
10203
10204 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_init_features"))) TS_OnionMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
10205         void* this_arg_ptr = untag_ptr(this_arg);
10206         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10207         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10208         LDKPublicKey their_node_id_ref;
10209         CHECK(their_node_id->arr_len == 33);
10210         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10211         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
10212         uint64_t ret_ref = 0;
10213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10215         return ret_ref;
10216 }
10217
10218 typedef struct LDKCustomMessageReader_JCalls {
10219         atomic_size_t refcnt;
10220         uint32_t instance_ptr;
10221 } LDKCustomMessageReader_JCalls;
10222 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
10223         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10224         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10225                 FREE(j_calls);
10226         }
10227 }
10228 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
10229         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10230         int16_t message_type_conv = message_type;
10231         LDKu8slice buffer_var = buffer;
10232         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
10233         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
10234         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 103, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
10235         void* ret_ptr = untag_ptr(ret);
10236         CHECK_ACCESS(ret_ptr);
10237         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
10238         FREE(untag_ptr(ret));
10239         return ret_conv;
10240 }
10241 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
10242         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
10243         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10244 }
10245 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
10246         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
10247         atomic_init(&calls->refcnt, 1);
10248         calls->instance_ptr = o;
10249
10250         LDKCustomMessageReader ret = {
10251                 .this_arg = (void*) calls,
10252                 .read = read_LDKCustomMessageReader_jcall,
10253                 .free = LDKCustomMessageReader_JCalls_free,
10254         };
10255         return ret;
10256 }
10257 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
10258         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
10259         *res_ptr = LDKCustomMessageReader_init(o);
10260         return tag_ptr(res_ptr, true);
10261 }
10262 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
10263         void* this_arg_ptr = untag_ptr(this_arg);
10264         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10265         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
10266         LDKu8slice buffer_ref;
10267         buffer_ref.datalen = buffer->arr_len;
10268         buffer_ref.data = buffer->elems;
10269         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10270         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
10271         FREE(buffer);
10272         return tag_ptr(ret_conv, true);
10273 }
10274
10275 typedef struct LDKCustomMessageHandler_JCalls {
10276         atomic_size_t refcnt;
10277         uint32_t instance_ptr;
10278         LDKCustomMessageReader_JCalls* CustomMessageReader;
10279 } LDKCustomMessageHandler_JCalls;
10280 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
10281         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10282         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10283                 FREE(j_calls);
10284         }
10285 }
10286 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
10287         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10288         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
10289         *msg_ret = msg;
10290         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
10291         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
10292         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 104, tag_ptr(msg_ret, true), (uint32_t)sender_node_id_arr, 0, 0, 0, 0);
10293         void* ret_ptr = untag_ptr(ret);
10294         CHECK_ACCESS(ret_ptr);
10295         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10296         FREE(untag_ptr(ret));
10297         return ret_conv;
10298 }
10299 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
10300         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10301         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 105, 0, 0, 0, 0, 0, 0);
10302         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
10303         ret_constr.datalen = ret->arr_len;
10304         if (ret_constr.datalen > 0)
10305                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
10306         else
10307                 ret_constr.data = NULL;
10308         uint64_t* ret_vals = ret->elems;
10309         for (size_t z = 0; z < ret_constr.datalen; z++) {
10310                 uint64_t ret_conv_25 = ret_vals[z];
10311                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
10312                 CHECK_ACCESS(ret_conv_25_ptr);
10313                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
10314                 FREE(untag_ptr(ret_conv_25));
10315                 ret_constr.data[z] = ret_conv_25_conv;
10316         }
10317         FREE(ret);
10318         return ret_constr;
10319 }
10320 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
10321         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
10322         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10323         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
10324 }
10325 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
10326         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
10327         atomic_init(&calls->refcnt, 1);
10328         calls->instance_ptr = o;
10329
10330         LDKCustomMessageHandler ret = {
10331                 .this_arg = (void*) calls,
10332                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
10333                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
10334                 .free = LDKCustomMessageHandler_JCalls_free,
10335                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
10336         };
10337         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
10338         return ret;
10339 }
10340 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
10341         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
10342         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
10343         return tag_ptr(res_ptr, true);
10344 }
10345 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_handle_custom_message"))) TS_CustomMessageHandler_handle_custom_message(uint64_t this_arg, uint64_t msg, int8_tArray sender_node_id) {
10346         void* this_arg_ptr = untag_ptr(this_arg);
10347         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10348         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10349         void* msg_ptr = untag_ptr(msg);
10350         CHECK_ACCESS(msg_ptr);
10351         LDKType msg_conv = *(LDKType*)(msg_ptr);
10352         if (msg_conv.free == LDKType_JCalls_free) {
10353                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10354                 LDKType_JCalls_cloned(&msg_conv);
10355         }
10356         LDKPublicKey sender_node_id_ref;
10357         CHECK(sender_node_id->arr_len == 33);
10358         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
10359         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10360         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
10361         return tag_ptr(ret_conv, true);
10362 }
10363
10364 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
10365         void* this_arg_ptr = untag_ptr(this_arg);
10366         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10367         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10368         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
10369         uint64_tArray ret_arr = NULL;
10370         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
10371         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
10372         for (size_t z = 0; z < ret_var.datalen; z++) {
10373                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10374                 *ret_conv_25_conv = ret_var.data[z];
10375                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
10376         }
10377         
10378         FREE(ret_var.data);
10379         return ret_arr;
10380 }
10381
10382 typedef struct LDKCustomOnionMessageHandler_JCalls {
10383         atomic_size_t refcnt;
10384         uint32_t instance_ptr;
10385 } LDKCustomOnionMessageHandler_JCalls;
10386 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
10387         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
10388         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10389                 FREE(j_calls);
10390         }
10391 }
10392 void handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKCustomOnionMessageContents msg) {
10393         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
10394         LDKCustomOnionMessageContents* msg_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
10395         *msg_ret = msg;
10396         js_invoke_function_buuuuu(j_calls->instance_ptr, 106, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0);
10397 }
10398 LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
10399         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
10400         int64_t message_type_conv = message_type;
10401         LDKu8slice buffer_var = buffer;
10402         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
10403         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
10404         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 107, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
10405         void* ret_ptr = untag_ptr(ret);
10406         CHECK_ACCESS(ret_ptr);
10407         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(ret_ptr);
10408         FREE(untag_ptr(ret));
10409         return ret_conv;
10410 }
10411 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
10412         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
10413         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10414 }
10415 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JSValue o) {
10416         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
10417         atomic_init(&calls->refcnt, 1);
10418         calls->instance_ptr = o;
10419
10420         LDKCustomOnionMessageHandler ret = {
10421                 .this_arg = (void*) calls,
10422                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
10423                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
10424                 .free = LDKCustomOnionMessageHandler_JCalls_free,
10425         };
10426         return ret;
10427 }
10428 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageHandler_new"))) TS_LDKCustomOnionMessageHandler_new(JSValue o) {
10429         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
10430         *res_ptr = LDKCustomOnionMessageHandler_init(o);
10431         return tag_ptr(res_ptr, true);
10432 }
10433 void  __attribute__((export_name("TS_CustomOnionMessageHandler_handle_custom_message"))) TS_CustomOnionMessageHandler_handle_custom_message(uint64_t this_arg, uint64_t msg) {
10434         void* this_arg_ptr = untag_ptr(this_arg);
10435         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10436         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
10437         void* msg_ptr = untag_ptr(msg);
10438         CHECK_ACCESS(msg_ptr);
10439         LDKCustomOnionMessageContents msg_conv = *(LDKCustomOnionMessageContents*)(msg_ptr);
10440         if (msg_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
10441                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10442                 LDKCustomOnionMessageContents_JCalls_cloned(&msg_conv);
10443         }
10444         (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
10445 }
10446
10447 uint64_t  __attribute__((export_name("TS_CustomOnionMessageHandler_read_custom_message"))) TS_CustomOnionMessageHandler_read_custom_message(uint64_t this_arg, int64_t message_type, int8_tArray buffer) {
10448         void* this_arg_ptr = untag_ptr(this_arg);
10449         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10450         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
10451         LDKu8slice buffer_ref;
10452         buffer_ref.datalen = buffer->arr_len;
10453         buffer_ref.data = buffer->elems;
10454         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
10455         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
10456         FREE(buffer);
10457         return tag_ptr(ret_conv, true);
10458 }
10459
10460 typedef struct LDKSocketDescriptor_JCalls {
10461         atomic_size_t refcnt;
10462         uint32_t instance_ptr;
10463 } LDKSocketDescriptor_JCalls;
10464 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
10465         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10466         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10467                 FREE(j_calls);
10468         }
10469 }
10470 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
10471         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10472         LDKu8slice data_var = data;
10473         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
10474         memcpy(data_arr->elems, data_var.data, data_var.datalen);
10475         jboolean resume_read_conv = resume_read;
10476         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 108, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
10477 }
10478 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
10479         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10480         js_invoke_function_uuuuuu(j_calls->instance_ptr, 109, 0, 0, 0, 0, 0, 0);
10481 }
10482 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
10483         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10484         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10485         *other_arg_clone = SocketDescriptor_clone(other_arg);
10486         return js_invoke_function_buuuuu(j_calls->instance_ptr, 110, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
10487 }
10488 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
10489         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10490         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 111, 0, 0, 0, 0, 0, 0);
10491 }
10492 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
10493         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
10494         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10495 }
10496 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
10497         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
10498         atomic_init(&calls->refcnt, 1);
10499         calls->instance_ptr = o;
10500
10501         LDKSocketDescriptor ret = {
10502                 .this_arg = (void*) calls,
10503                 .send_data = send_data_LDKSocketDescriptor_jcall,
10504                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
10505                 .eq = eq_LDKSocketDescriptor_jcall,
10506                 .hash = hash_LDKSocketDescriptor_jcall,
10507                 .cloned = LDKSocketDescriptor_JCalls_cloned,
10508                 .free = LDKSocketDescriptor_JCalls_free,
10509         };
10510         return ret;
10511 }
10512 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
10513         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10514         *res_ptr = LDKSocketDescriptor_init(o);
10515         return tag_ptr(res_ptr, true);
10516 }
10517 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
10518         void* this_arg_ptr = untag_ptr(this_arg);
10519         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10520         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10521         LDKu8slice data_ref;
10522         data_ref.datalen = data->arr_len;
10523         data_ref.data = data->elems;
10524         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
10525         FREE(data);
10526         return ret_conv;
10527 }
10528
10529 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
10530         void* this_arg_ptr = untag_ptr(this_arg);
10531         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10532         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10533         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
10534 }
10535
10536 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
10537         void* this_arg_ptr = untag_ptr(this_arg);
10538         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10539         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10540         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
10541         return ret_conv;
10542 }
10543
10544 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
10545         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10546         switch(obj->tag) {
10547                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
10548                 case LDKEffectiveCapacity_MaximumHTLC: return 1;
10549                 case LDKEffectiveCapacity_Total: return 2;
10550                 case LDKEffectiveCapacity_Infinite: return 3;
10551                 case LDKEffectiveCapacity_Unknown: return 4;
10552                 default: abort();
10553         }
10554 }
10555 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
10556         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10557         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
10558                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
10559         return liquidity_msat_conv;
10560 }
10561 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat(uint64_t ptr) {
10562         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10563         assert(obj->tag == LDKEffectiveCapacity_MaximumHTLC);
10564                         int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
10565         return amount_msat_conv;
10566 }
10567 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
10568         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10569         assert(obj->tag == LDKEffectiveCapacity_Total);
10570                         int64_t capacity_msat_conv = obj->total.capacity_msat;
10571         return capacity_msat_conv;
10572 }
10573 uint64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
10574         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10575         assert(obj->tag == LDKEffectiveCapacity_Total);
10576                         uint64_t htlc_maximum_msat_ref = tag_ptr(&obj->total.htlc_maximum_msat, false);
10577         return htlc_maximum_msat_ref;
10578 }
10579 uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) {
10580         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
10581         switch(obj->tag) {
10582                 case LDKDestination_Node: return 0;
10583                 case LDKDestination_BlindedRoute: return 1;
10584                 default: abort();
10585         }
10586 }
10587 int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) {
10588         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
10589         assert(obj->tag == LDKDestination_Node);
10590                         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
10591                         memcpy(node_arr->elems, obj->node.compressed_form, 33);
10592         return node_arr;
10593 }
10594 uint64_t __attribute__((export_name("TS_LDKDestination_BlindedRoute_get_blinded_route"))) TS_LDKDestination_BlindedRoute_get_blinded_route(uint64_t ptr) {
10595         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
10596         assert(obj->tag == LDKDestination_BlindedRoute);
10597                         LDKBlindedRoute blinded_route_var = obj->blinded_route;
10598                         uint64_t blinded_route_ref = 0;
10599                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_route_var);
10600                         blinded_route_ref = tag_ptr(blinded_route_var.inner, false);
10601         return blinded_route_ref;
10602 }
10603 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
10604         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
10605         switch(obj->tag) {
10606                 case LDKFallback_SegWitProgram: return 0;
10607                 case LDKFallback_PubKeyHash: return 1;
10608                 case LDKFallback_ScriptHash: return 2;
10609                 default: abort();
10610         }
10611 }
10612 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
10613         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
10614         assert(obj->tag == LDKFallback_SegWitProgram);
10615                         uint8_t version_val = obj->seg_wit_program.version._0;
10616         return version_val;
10617 }
10618 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
10619         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
10620         assert(obj->tag == LDKFallback_SegWitProgram);
10621                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
10622                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
10623                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
10624         return program_arr;
10625 }
10626 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
10627         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
10628         assert(obj->tag == LDKFallback_PubKeyHash);
10629                         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
10630                         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
10631         return pub_key_hash_arr;
10632 }
10633 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
10634         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
10635         assert(obj->tag == LDKFallback_ScriptHash);
10636                         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
10637                         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
10638         return script_hash_arr;
10639 }
10640 typedef struct LDKPayer_JCalls {
10641         atomic_size_t refcnt;
10642         uint32_t instance_ptr;
10643 } LDKPayer_JCalls;
10644 static void LDKPayer_JCalls_free(void* this_arg) {
10645         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10646         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10647                 FREE(j_calls);
10648         }
10649 }
10650 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
10651         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10652         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 112, 0, 0, 0, 0, 0, 0);
10653         LDKPublicKey ret_ref;
10654         CHECK(ret->arr_len == 33);
10655         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
10656         return ret_ref;
10657 }
10658 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
10659         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10660         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 113, 0, 0, 0, 0, 0, 0);
10661         LDKCVec_ChannelDetailsZ ret_constr;
10662         ret_constr.datalen = ret->arr_len;
10663         if (ret_constr.datalen > 0)
10664                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10665         else
10666                 ret_constr.data = NULL;
10667         uint64_t* ret_vals = ret->elems;
10668         for (size_t q = 0; q < ret_constr.datalen; q++) {
10669                 uint64_t ret_conv_16 = ret_vals[q];
10670                 LDKChannelDetails ret_conv_16_conv;
10671                 ret_conv_16_conv.inner = untag_ptr(ret_conv_16);
10672                 ret_conv_16_conv.is_owned = ptr_is_owned(ret_conv_16);
10673                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
10674                 ret_constr.data[q] = ret_conv_16_conv;
10675         }
10676         FREE(ret);
10677         return ret_constr;
10678 }
10679 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
10680         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10681         LDKRoute route_var = *route;
10682         uint64_t route_ref = 0;
10683         route_var = Route_clone(&route_var);
10684         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10685         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
10686         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10687         memcpy(payment_hash_arr->elems, payment_hash.data, 32);
10688         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
10689         memcpy(payment_secret_arr->elems, payment_secret.data, 32);
10690         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 114, route_ref, (uint32_t)payment_hash_arr, (uint32_t)payment_secret_arr, 0, 0, 0);
10691         void* ret_ptr = untag_ptr(ret);
10692         CHECK_ACCESS(ret_ptr);
10693         LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
10694         FREE(untag_ptr(ret));
10695         return ret_conv;
10696 }
10697 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
10698         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10699         LDKRoute route_var = *route;
10700         uint64_t route_ref = 0;
10701         route_var = Route_clone(&route_var);
10702         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10703         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
10704         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
10705         memcpy(payment_preimage_arr->elems, payment_preimage.data, 32);
10706         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 115, route_ref, (uint32_t)payment_preimage_arr, 0, 0, 0, 0);
10707         void* ret_ptr = untag_ptr(ret);
10708         CHECK_ACCESS(ret_ptr);
10709         LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
10710         FREE(untag_ptr(ret));
10711         return ret_conv;
10712 }
10713 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
10714         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10715         LDKRoute route_var = *route;
10716         uint64_t route_ref = 0;
10717         route_var = Route_clone(&route_var);
10718         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10719         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
10720         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10721         memcpy(payment_id_arr->elems, payment_id.data, 32);
10722         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 116, route_ref, (uint32_t)payment_id_arr, 0, 0, 0, 0);
10723         void* ret_ptr = untag_ptr(ret);
10724         CHECK_ACCESS(ret_ptr);
10725         LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
10726         FREE(untag_ptr(ret));
10727         return ret_conv;
10728 }
10729 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
10730         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10731         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10732         memcpy(payment_id_arr->elems, payment_id.data, 32);
10733         js_invoke_function_uuuuuu(j_calls->instance_ptr, 117, (uint32_t)payment_id_arr, 0, 0, 0, 0, 0);
10734 }
10735 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
10736         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
10737         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10738 }
10739 static inline LDKPayer LDKPayer_init (JSValue o) {
10740         LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
10741         atomic_init(&calls->refcnt, 1);
10742         calls->instance_ptr = o;
10743
10744         LDKPayer ret = {
10745                 .this_arg = (void*) calls,
10746                 .node_id = node_id_LDKPayer_jcall,
10747                 .first_hops = first_hops_LDKPayer_jcall,
10748                 .send_payment = send_payment_LDKPayer_jcall,
10749                 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
10750                 .retry_payment = retry_payment_LDKPayer_jcall,
10751                 .abandon_payment = abandon_payment_LDKPayer_jcall,
10752                 .free = LDKPayer_JCalls_free,
10753         };
10754         return ret;
10755 }
10756 uint64_t  __attribute__((export_name("TS_LDKPayer_new"))) TS_LDKPayer_new(JSValue o) {
10757         LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
10758         *res_ptr = LDKPayer_init(o);
10759         return tag_ptr(res_ptr, true);
10760 }
10761 int8_tArray  __attribute__((export_name("TS_Payer_node_id"))) TS_Payer_node_id(uint64_t this_arg) {
10762         void* this_arg_ptr = untag_ptr(this_arg);
10763         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10764         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10765         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
10766         memcpy(ret_arr->elems, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form, 33);
10767         return ret_arr;
10768 }
10769
10770 uint64_tArray  __attribute__((export_name("TS_Payer_first_hops"))) TS_Payer_first_hops(uint64_t this_arg) {
10771         void* this_arg_ptr = untag_ptr(this_arg);
10772         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10773         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10774         LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
10775         uint64_tArray ret_arr = NULL;
10776         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
10777         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
10778         for (size_t q = 0; q < ret_var.datalen; q++) {
10779                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
10780                 uint64_t ret_conv_16_ref = 0;
10781                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
10782                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
10783                 ret_arr_ptr[q] = ret_conv_16_ref;
10784         }
10785         
10786         FREE(ret_var.data);
10787         return ret_arr;
10788 }
10789
10790 uint64_t  __attribute__((export_name("TS_Payer_send_payment"))) TS_Payer_send_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
10791         void* this_arg_ptr = untag_ptr(this_arg);
10792         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10793         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10794         LDKRoute route_conv;
10795         route_conv.inner = untag_ptr(route);
10796         route_conv.is_owned = ptr_is_owned(route);
10797         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10798         route_conv.is_owned = false;
10799         LDKThirtyTwoBytes payment_hash_ref;
10800         CHECK(payment_hash->arr_len == 32);
10801         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
10802         LDKThirtyTwoBytes payment_secret_ref;
10803         CHECK(payment_secret->arr_len == 32);
10804         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
10805         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10806         *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
10807         return tag_ptr(ret_conv, true);
10808 }
10809
10810 uint64_t  __attribute__((export_name("TS_Payer_send_spontaneous_payment"))) TS_Payer_send_spontaneous_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_preimage) {
10811         void* this_arg_ptr = untag_ptr(this_arg);
10812         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10813         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10814         LDKRoute route_conv;
10815         route_conv.inner = untag_ptr(route);
10816         route_conv.is_owned = ptr_is_owned(route);
10817         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10818         route_conv.is_owned = false;
10819         LDKThirtyTwoBytes payment_preimage_ref;
10820         CHECK(payment_preimage->arr_len == 32);
10821         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
10822         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10823         *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
10824         return tag_ptr(ret_conv, true);
10825 }
10826
10827 uint64_t  __attribute__((export_name("TS_Payer_retry_payment"))) TS_Payer_retry_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_id) {
10828         void* this_arg_ptr = untag_ptr(this_arg);
10829         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10830         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10831         LDKRoute route_conv;
10832         route_conv.inner = untag_ptr(route);
10833         route_conv.is_owned = ptr_is_owned(route);
10834         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10835         route_conv.is_owned = false;
10836         LDKThirtyTwoBytes payment_id_ref;
10837         CHECK(payment_id->arr_len == 32);
10838         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
10839         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10840         *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
10841         return tag_ptr(ret_conv, true);
10842 }
10843
10844 void  __attribute__((export_name("TS_Payer_abandon_payment"))) TS_Payer_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
10845         void* this_arg_ptr = untag_ptr(this_arg);
10846         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10847         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10848         LDKThirtyTwoBytes payment_id_ref;
10849         CHECK(payment_id->arr_len == 32);
10850         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
10851         (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
10852 }
10853
10854 typedef struct LDKRouter_JCalls {
10855         atomic_size_t refcnt;
10856         uint32_t instance_ptr;
10857 } LDKRouter_JCalls;
10858 static void LDKRouter_JCalls_free(void* this_arg) {
10859         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10860         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10861                 FREE(j_calls);
10862         }
10863 }
10864 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, const uint8_t (* payment_hash)[32], LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
10865         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10866         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
10867         memcpy(payer_arr->elems, payer.compressed_form, 33);
10868         LDKRouteParameters route_params_var = *route_params;
10869         uint64_t route_params_ref = 0;
10870         route_params_var = RouteParameters_clone(&route_params_var);
10871         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
10872         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
10873         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10874         memcpy(payment_hash_arr->elems, *payment_hash, 32);
10875         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
10876         uint64_tArray first_hops_arr = NULL;
10877         if (first_hops != NULL) {
10878                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
10879                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
10880                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
10881                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
10882                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
10883                         uint64_t first_hops_conv_16_ref = 0;
10884                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10885                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
10886                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10887                 }
10888         
10889         }
10890         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
10891         uint64_t inflight_htlcs_ref = 0;
10892         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
10893         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
10894         uint64_t ret = js_invoke_function_ubuubu(j_calls->instance_ptr, 118, (uint32_t)payer_arr, route_params_ref, (uint32_t)payment_hash_arr, (uint32_t)first_hops_arr, inflight_htlcs_ref, 0);
10895         void* ret_ptr = untag_ptr(ret);
10896         CHECK_ACCESS(ret_ptr);
10897         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
10898         FREE(untag_ptr(ret));
10899         return ret_conv;
10900 }
10901 void notify_payment_path_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
10902         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10903         LDKCVec_RouteHopZ path_var = path;
10904         uint64_tArray path_arr = NULL;
10905         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10906         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10907         for (size_t k = 0; k < path_var.datalen; k++) {
10908                 LDKRouteHop path_conv_10_var = path_var.data[k];
10909                 uint64_t path_conv_10_ref = 0;
10910                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10911                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10912                 path_arr_ptr[k] = path_conv_10_ref;
10913         }
10914         
10915         FREE(path_var.data);
10916         int64_t short_channel_id_conv = short_channel_id;
10917         js_invoke_function_ubuuuu(j_calls->instance_ptr, 119, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
10918 }
10919 void notify_payment_path_successful_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path) {
10920         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10921         LDKCVec_RouteHopZ path_var = path;
10922         uint64_tArray path_arr = NULL;
10923         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10924         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10925         for (size_t k = 0; k < path_var.datalen; k++) {
10926                 LDKRouteHop path_conv_10_var = path_var.data[k];
10927                 uint64_t path_conv_10_ref = 0;
10928                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10929                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10930                 path_arr_ptr[k] = path_conv_10_ref;
10931         }
10932         
10933         FREE(path_var.data);
10934         js_invoke_function_uuuuuu(j_calls->instance_ptr, 120, (uint32_t)path_arr, 0, 0, 0, 0, 0);
10935 }
10936 void notify_payment_probe_successful_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path) {
10937         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10938         LDKCVec_RouteHopZ path_var = path;
10939         uint64_tArray path_arr = NULL;
10940         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10941         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10942         for (size_t k = 0; k < path_var.datalen; k++) {
10943                 LDKRouteHop path_conv_10_var = path_var.data[k];
10944                 uint64_t path_conv_10_ref = 0;
10945                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10946                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10947                 path_arr_ptr[k] = path_conv_10_ref;
10948         }
10949         
10950         FREE(path_var.data);
10951         js_invoke_function_uuuuuu(j_calls->instance_ptr, 121, (uint32_t)path_arr, 0, 0, 0, 0, 0);
10952 }
10953 void notify_payment_probe_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
10954         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10955         LDKCVec_RouteHopZ path_var = path;
10956         uint64_tArray path_arr = NULL;
10957         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10958         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10959         for (size_t k = 0; k < path_var.datalen; k++) {
10960                 LDKRouteHop path_conv_10_var = path_var.data[k];
10961                 uint64_t path_conv_10_ref = 0;
10962                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10963                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10964                 path_arr_ptr[k] = path_conv_10_ref;
10965         }
10966         
10967         FREE(path_var.data);
10968         int64_t short_channel_id_conv = short_channel_id;
10969         js_invoke_function_ubuuuu(j_calls->instance_ptr, 122, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
10970 }
10971 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
10972         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
10973         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10974 }
10975 static inline LDKRouter LDKRouter_init (JSValue o) {
10976         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
10977         atomic_init(&calls->refcnt, 1);
10978         calls->instance_ptr = o;
10979
10980         LDKRouter ret = {
10981                 .this_arg = (void*) calls,
10982                 .find_route = find_route_LDKRouter_jcall,
10983                 .notify_payment_path_failed = notify_payment_path_failed_LDKRouter_jcall,
10984                 .notify_payment_path_successful = notify_payment_path_successful_LDKRouter_jcall,
10985                 .notify_payment_probe_successful = notify_payment_probe_successful_LDKRouter_jcall,
10986                 .notify_payment_probe_failed = notify_payment_probe_failed_LDKRouter_jcall,
10987                 .free = LDKRouter_JCalls_free,
10988         };
10989         return ret;
10990 }
10991 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
10992         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
10993         *res_ptr = LDKRouter_init(o);
10994         return tag_ptr(res_ptr, true);
10995 }
10996 uint64_t  __attribute__((export_name("TS_Router_find_route"))) TS_Router_find_route(uint64_t this_arg, int8_tArray payer, uint64_t route_params, int8_tArray payment_hash, uint64_tArray first_hops, uint64_t inflight_htlcs) {
10997         void* this_arg_ptr = untag_ptr(this_arg);
10998         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10999         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11000         LDKPublicKey payer_ref;
11001         CHECK(payer->arr_len == 33);
11002         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
11003         LDKRouteParameters route_params_conv;
11004         route_params_conv.inner = untag_ptr(route_params);
11005         route_params_conv.is_owned = ptr_is_owned(route_params);
11006         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
11007         route_params_conv.is_owned = false;
11008         unsigned char payment_hash_arr[32];
11009         CHECK(payment_hash->arr_len == 32);
11010         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
11011         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
11012         LDKCVec_ChannelDetailsZ first_hops_constr;
11013         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
11014         if (first_hops != 0) {
11015                 first_hops_constr.datalen = first_hops->arr_len;
11016                 if (first_hops_constr.datalen > 0)
11017                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11018                 else
11019                         first_hops_constr.data = NULL;
11020                 uint64_t* first_hops_vals = first_hops->elems;
11021                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
11022                         uint64_t first_hops_conv_16 = first_hops_vals[q];
11023                         LDKChannelDetails first_hops_conv_16_conv;
11024                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
11025                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
11026                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
11027                         first_hops_conv_16_conv.is_owned = false;
11028                         first_hops_constr.data[q] = first_hops_conv_16_conv;
11029                 }
11030                 FREE(first_hops);
11031                 first_hops_ptr = &first_hops_constr;
11032         }
11033         LDKInFlightHtlcs inflight_htlcs_conv;
11034         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
11035         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
11036         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
11037         // WARNING: we need a move here but no clone is available for LDKInFlightHtlcs
11038         
11039         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11040         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, payment_hash_ref, first_hops_ptr, inflight_htlcs_conv);
11041         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
11042         return tag_ptr(ret_conv, true);
11043 }
11044
11045 void  __attribute__((export_name("TS_Router_notify_payment_path_failed"))) TS_Router_notify_payment_path_failed(uint64_t this_arg, uint64_tArray path, int64_t short_channel_id) {
11046         void* this_arg_ptr = untag_ptr(this_arg);
11047         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11048         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11049         LDKCVec_RouteHopZ path_constr;
11050         path_constr.datalen = path->arr_len;
11051         if (path_constr.datalen > 0)
11052                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11053         else
11054                 path_constr.data = NULL;
11055         uint64_t* path_vals = path->elems;
11056         for (size_t k = 0; k < path_constr.datalen; k++) {
11057                 uint64_t path_conv_10 = path_vals[k];
11058                 LDKRouteHop path_conv_10_conv;
11059                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11060                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11061                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11062                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11063                 path_constr.data[k] = path_conv_10_conv;
11064         }
11065         FREE(path);
11066         (this_arg_conv->notify_payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
11067 }
11068
11069 void  __attribute__((export_name("TS_Router_notify_payment_path_successful"))) TS_Router_notify_payment_path_successful(uint64_t this_arg, uint64_tArray path) {
11070         void* this_arg_ptr = untag_ptr(this_arg);
11071         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11072         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11073         LDKCVec_RouteHopZ path_constr;
11074         path_constr.datalen = path->arr_len;
11075         if (path_constr.datalen > 0)
11076                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11077         else
11078                 path_constr.data = NULL;
11079         uint64_t* path_vals = path->elems;
11080         for (size_t k = 0; k < path_constr.datalen; k++) {
11081                 uint64_t path_conv_10 = path_vals[k];
11082                 LDKRouteHop path_conv_10_conv;
11083                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11084                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11085                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11086                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11087                 path_constr.data[k] = path_conv_10_conv;
11088         }
11089         FREE(path);
11090         (this_arg_conv->notify_payment_path_successful)(this_arg_conv->this_arg, path_constr);
11091 }
11092
11093 void  __attribute__((export_name("TS_Router_notify_payment_probe_successful"))) TS_Router_notify_payment_probe_successful(uint64_t this_arg, uint64_tArray path) {
11094         void* this_arg_ptr = untag_ptr(this_arg);
11095         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11096         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11097         LDKCVec_RouteHopZ path_constr;
11098         path_constr.datalen = path->arr_len;
11099         if (path_constr.datalen > 0)
11100                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11101         else
11102                 path_constr.data = NULL;
11103         uint64_t* path_vals = path->elems;
11104         for (size_t k = 0; k < path_constr.datalen; k++) {
11105                 uint64_t path_conv_10 = path_vals[k];
11106                 LDKRouteHop path_conv_10_conv;
11107                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11108                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11109                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11110                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11111                 path_constr.data[k] = path_conv_10_conv;
11112         }
11113         FREE(path);
11114         (this_arg_conv->notify_payment_probe_successful)(this_arg_conv->this_arg, path_constr);
11115 }
11116
11117 void  __attribute__((export_name("TS_Router_notify_payment_probe_failed"))) TS_Router_notify_payment_probe_failed(uint64_t this_arg, uint64_tArray path, int64_t short_channel_id) {
11118         void* this_arg_ptr = untag_ptr(this_arg);
11119         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11120         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11121         LDKCVec_RouteHopZ path_constr;
11122         path_constr.datalen = path->arr_len;
11123         if (path_constr.datalen > 0)
11124                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11125         else
11126                 path_constr.data = NULL;
11127         uint64_t* path_vals = path->elems;
11128         for (size_t k = 0; k < path_constr.datalen; k++) {
11129                 uint64_t path_conv_10 = path_vals[k];
11130                 LDKRouteHop path_conv_10_conv;
11131                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11132                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11133                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11134                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11135                 path_constr.data[k] = path_conv_10_conv;
11136         }
11137         FREE(path);
11138         (this_arg_conv->notify_payment_probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
11139 }
11140
11141 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
11142         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
11143         switch(obj->tag) {
11144                 case LDKRetry_Attempts: return 0;
11145                 default: abort();
11146         }
11147 }
11148 uint32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
11149         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
11150         assert(obj->tag == LDKRetry_Attempts);
11151                         uint32_t attempts_conv = obj->attempts;
11152         return attempts_conv;
11153 }
11154 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
11155         LDKStr ret_str = _ldk_get_compiled_version();
11156         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11157         Str_free(ret_str);
11158         return ret_conv;
11159 }
11160
11161 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
11162         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
11163         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11164         Str_free(ret_str);
11165         return ret_conv;
11166 }
11167
11168 uint64_t  __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) {
11169         LDKThirtyTwoBytes big_endian_bytes_ref;
11170         CHECK(big_endian_bytes->arr_len == 32);
11171         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
11172         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
11173         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
11174         return tag_ptr(ret_ref, true);
11175 }
11176
11177 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
11178         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11179         *ret_copy = Bech32Error_clone(arg);
11180         uint64_t ret_ref = tag_ptr(ret_copy, true);
11181         return ret_ref;
11182 }
11183 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
11184         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
11185         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
11186         return ret_conv;
11187 }
11188
11189 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
11190         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
11191         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11192         *ret_copy = Bech32Error_clone(orig_conv);
11193         uint64_t ret_ref = tag_ptr(ret_copy, true);
11194         return ret_ref;
11195 }
11196
11197 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
11198         if (!ptr_is_owned(o)) return;
11199         void* o_ptr = untag_ptr(o);
11200         CHECK_ACCESS(o_ptr);
11201         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
11202         FREE(untag_ptr(o));
11203         Bech32Error_free(o_conv);
11204 }
11205
11206 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
11207         LDKTransaction _res_ref;
11208         _res_ref.datalen = _res->arr_len;
11209         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
11210         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
11211         _res_ref.data_is_owned = true;
11212         Transaction_free(_res_ref);
11213 }
11214
11215 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
11216         LDKCVec_u8Z script_pubkey_ref;
11217         script_pubkey_ref.datalen = script_pubkey->arr_len;
11218         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
11219         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
11220         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11221         *ret_ref = TxOut_new(script_pubkey_ref, value);
11222         return tag_ptr(ret_ref, true);
11223 }
11224
11225 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
11226         if (!ptr_is_owned(_res)) return;
11227         void* _res_ptr = untag_ptr(_res);
11228         CHECK_ACCESS(_res_ptr);
11229         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
11230         FREE(untag_ptr(_res));
11231         TxOut_free(_res_conv);
11232 }
11233
11234 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
11235         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11236         *ret_ref = TxOut_clone(arg);
11237         return tag_ptr(ret_ref, true);
11238 }
11239 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
11240         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
11241         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
11242         return ret_conv;
11243 }
11244
11245 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
11246         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
11247         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11248         *ret_ref = TxOut_clone(orig_conv);
11249         return tag_ptr(ret_ref, true);
11250 }
11251
11252 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
11253         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
11254         Str_free(dummy);
11255 }
11256
11257 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
11258         LDKCVec_PublicKeyZ _res_constr;
11259         _res_constr.datalen = _res->arr_len;
11260         if (_res_constr.datalen > 0)
11261                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
11262         else
11263                 _res_constr.data = NULL;
11264         int8_tArray* _res_vals = (void*) _res->elems;
11265         for (size_t m = 0; m < _res_constr.datalen; m++) {
11266                 int8_tArray _res_conv_12 = _res_vals[m];
11267                 LDKPublicKey _res_conv_12_ref;
11268                 CHECK(_res_conv_12->arr_len == 33);
11269                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
11270                 _res_constr.data[m] = _res_conv_12_ref;
11271         }
11272         FREE(_res);
11273         CVec_PublicKeyZ_free(_res_constr);
11274 }
11275
11276 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_ok"))) TS_CResult_BlindedRouteNoneZ_ok(uint64_t o) {
11277         LDKBlindedRoute o_conv;
11278         o_conv.inner = untag_ptr(o);
11279         o_conv.is_owned = ptr_is_owned(o);
11280         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11281         // WARNING: we need a move here but no clone is available for LDKBlindedRoute
11282         
11283         LDKCResult_BlindedRouteNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteNoneZ), "LDKCResult_BlindedRouteNoneZ");
11284         *ret_conv = CResult_BlindedRouteNoneZ_ok(o_conv);
11285         return tag_ptr(ret_conv, true);
11286 }
11287
11288 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_err"))) TS_CResult_BlindedRouteNoneZ_err() {
11289         LDKCResult_BlindedRouteNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteNoneZ), "LDKCResult_BlindedRouteNoneZ");
11290         *ret_conv = CResult_BlindedRouteNoneZ_err();
11291         return tag_ptr(ret_conv, true);
11292 }
11293
11294 jboolean  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_is_ok"))) TS_CResult_BlindedRouteNoneZ_is_ok(uint64_t o) {
11295         LDKCResult_BlindedRouteNoneZ* o_conv = (LDKCResult_BlindedRouteNoneZ*)untag_ptr(o);
11296         jboolean ret_conv = CResult_BlindedRouteNoneZ_is_ok(o_conv);
11297         return ret_conv;
11298 }
11299
11300 void  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_free"))) TS_CResult_BlindedRouteNoneZ_free(uint64_t _res) {
11301         if (!ptr_is_owned(_res)) return;
11302         void* _res_ptr = untag_ptr(_res);
11303         CHECK_ACCESS(_res_ptr);
11304         LDKCResult_BlindedRouteNoneZ _res_conv = *(LDKCResult_BlindedRouteNoneZ*)(_res_ptr);
11305         FREE(untag_ptr(_res));
11306         CResult_BlindedRouteNoneZ_free(_res_conv);
11307 }
11308
11309 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_ok"))) TS_CResult_BlindedRouteDecodeErrorZ_ok(uint64_t o) {
11310         LDKBlindedRoute o_conv;
11311         o_conv.inner = untag_ptr(o);
11312         o_conv.is_owned = ptr_is_owned(o);
11313         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11314         // WARNING: we need a move here but no clone is available for LDKBlindedRoute
11315         
11316         LDKCResult_BlindedRouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteDecodeErrorZ), "LDKCResult_BlindedRouteDecodeErrorZ");
11317         *ret_conv = CResult_BlindedRouteDecodeErrorZ_ok(o_conv);
11318         return tag_ptr(ret_conv, true);
11319 }
11320
11321 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_err"))) TS_CResult_BlindedRouteDecodeErrorZ_err(uint64_t e) {
11322         void* e_ptr = untag_ptr(e);
11323         CHECK_ACCESS(e_ptr);
11324         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11325         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11326         LDKCResult_BlindedRouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteDecodeErrorZ), "LDKCResult_BlindedRouteDecodeErrorZ");
11327         *ret_conv = CResult_BlindedRouteDecodeErrorZ_err(e_conv);
11328         return tag_ptr(ret_conv, true);
11329 }
11330
11331 jboolean  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_is_ok"))) TS_CResult_BlindedRouteDecodeErrorZ_is_ok(uint64_t o) {
11332         LDKCResult_BlindedRouteDecodeErrorZ* o_conv = (LDKCResult_BlindedRouteDecodeErrorZ*)untag_ptr(o);
11333         jboolean ret_conv = CResult_BlindedRouteDecodeErrorZ_is_ok(o_conv);
11334         return ret_conv;
11335 }
11336
11337 void  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_free"))) TS_CResult_BlindedRouteDecodeErrorZ_free(uint64_t _res) {
11338         if (!ptr_is_owned(_res)) return;
11339         void* _res_ptr = untag_ptr(_res);
11340         CHECK_ACCESS(_res_ptr);
11341         LDKCResult_BlindedRouteDecodeErrorZ _res_conv = *(LDKCResult_BlindedRouteDecodeErrorZ*)(_res_ptr);
11342         FREE(untag_ptr(_res));
11343         CResult_BlindedRouteDecodeErrorZ_free(_res_conv);
11344 }
11345
11346 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
11347         LDKBlindedHop o_conv;
11348         o_conv.inner = untag_ptr(o);
11349         o_conv.is_owned = ptr_is_owned(o);
11350         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11351         // WARNING: we need a move here but no clone is available for LDKBlindedHop
11352         
11353         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
11354         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
11355         return tag_ptr(ret_conv, true);
11356 }
11357
11358 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
11359         void* e_ptr = untag_ptr(e);
11360         CHECK_ACCESS(e_ptr);
11361         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11362         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11363         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
11364         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
11365         return tag_ptr(ret_conv, true);
11366 }
11367
11368 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
11369         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
11370         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
11371         return ret_conv;
11372 }
11373
11374 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
11375         if (!ptr_is_owned(_res)) return;
11376         void* _res_ptr = untag_ptr(_res);
11377         CHECK_ACCESS(_res_ptr);
11378         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
11379         FREE(untag_ptr(_res));
11380         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
11381 }
11382
11383 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
11384         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11385         *ret_conv = CResult_NoneNoneZ_ok();
11386         return tag_ptr(ret_conv, true);
11387 }
11388
11389 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
11390         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11391         *ret_conv = CResult_NoneNoneZ_err();
11392         return tag_ptr(ret_conv, true);
11393 }
11394
11395 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
11396         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
11397         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
11398         return ret_conv;
11399 }
11400
11401 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
11402         if (!ptr_is_owned(_res)) return;
11403         void* _res_ptr = untag_ptr(_res);
11404         CHECK_ACCESS(_res_ptr);
11405         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
11406         FREE(untag_ptr(_res));
11407         CResult_NoneNoneZ_free(_res_conv);
11408 }
11409
11410 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
11411         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11412         *ret_conv = CResult_NoneNoneZ_clone(arg);
11413         return tag_ptr(ret_conv, true);
11414 }
11415 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
11416         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
11417         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
11418         return ret_conv;
11419 }
11420
11421 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
11422         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
11423         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11424         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
11425         return tag_ptr(ret_conv, true);
11426 }
11427
11428 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
11429         LDKCounterpartyCommitmentSecrets o_conv;
11430         o_conv.inner = untag_ptr(o);
11431         o_conv.is_owned = ptr_is_owned(o);
11432         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11433         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
11434         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11435         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
11436         return tag_ptr(ret_conv, true);
11437 }
11438
11439 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
11440         void* e_ptr = untag_ptr(e);
11441         CHECK_ACCESS(e_ptr);
11442         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11443         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11444         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11445         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
11446         return tag_ptr(ret_conv, true);
11447 }
11448
11449 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
11450         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
11451         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
11452         return ret_conv;
11453 }
11454
11455 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
11456         if (!ptr_is_owned(_res)) return;
11457         void* _res_ptr = untag_ptr(_res);
11458         CHECK_ACCESS(_res_ptr);
11459         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
11460         FREE(untag_ptr(_res));
11461         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
11462 }
11463
11464 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
11465         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11466         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
11467         return tag_ptr(ret_conv, true);
11468 }
11469 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
11470         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
11471         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
11472         return ret_conv;
11473 }
11474
11475 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
11476         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
11477         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11478         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
11479         return tag_ptr(ret_conv, true);
11480 }
11481
11482 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_ok"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
11483         LDKSecretKey o_ref;
11484         CHECK(o->arr_len == 32);
11485         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
11486         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11487         *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
11488         return tag_ptr(ret_conv, true);
11489 }
11490
11491 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_err"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
11492         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11493         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11494         *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
11495         return tag_ptr(ret_conv, true);
11496 }
11497
11498 jboolean  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_is_ok"))) TS_CResult_SecretKeyErrorZ_is_ok(uint64_t o) {
11499         LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(o);
11500         jboolean ret_conv = CResult_SecretKeyErrorZ_is_ok(o_conv);
11501         return ret_conv;
11502 }
11503
11504 void  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_free"))) TS_CResult_SecretKeyErrorZ_free(uint64_t _res) {
11505         if (!ptr_is_owned(_res)) return;
11506         void* _res_ptr = untag_ptr(_res);
11507         CHECK_ACCESS(_res_ptr);
11508         LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
11509         FREE(untag_ptr(_res));
11510         CResult_SecretKeyErrorZ_free(_res_conv);
11511 }
11512
11513 static inline uint64_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
11514         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11515         *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
11516         return tag_ptr(ret_conv, true);
11517 }
11518 int64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone_ptr"))) TS_CResult_SecretKeyErrorZ_clone_ptr(uint64_t arg) {
11519         LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(arg);
11520         int64_t ret_conv = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
11521         return ret_conv;
11522 }
11523
11524 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone"))) TS_CResult_SecretKeyErrorZ_clone(uint64_t orig) {
11525         LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(orig);
11526         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11527         *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
11528         return tag_ptr(ret_conv, true);
11529 }
11530
11531 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
11532         LDKPublicKey o_ref;
11533         CHECK(o->arr_len == 33);
11534         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
11535         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11536         *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
11537         return tag_ptr(ret_conv, true);
11538 }
11539
11540 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
11541         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11542         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11543         *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
11544         return tag_ptr(ret_conv, true);
11545 }
11546
11547 jboolean  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint64_t o) {
11548         LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o);
11549         jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
11550         return ret_conv;
11551 }
11552
11553 void  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint64_t _res) {
11554         if (!ptr_is_owned(_res)) return;
11555         void* _res_ptr = untag_ptr(_res);
11556         CHECK_ACCESS(_res_ptr);
11557         LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
11558         FREE(untag_ptr(_res));
11559         CResult_PublicKeyErrorZ_free(_res_conv);
11560 }
11561
11562 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
11563         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11564         *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
11565         return tag_ptr(ret_conv, true);
11566 }
11567 int64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint64_t arg) {
11568         LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg);
11569         int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
11570         return ret_conv;
11571 }
11572
11573 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint64_t orig) {
11574         LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig);
11575         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11576         *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
11577         return tag_ptr(ret_conv, true);
11578 }
11579
11580 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
11581         LDKTxCreationKeys o_conv;
11582         o_conv.inner = untag_ptr(o);
11583         o_conv.is_owned = ptr_is_owned(o);
11584         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11585         o_conv = TxCreationKeys_clone(&o_conv);
11586         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11587         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
11588         return tag_ptr(ret_conv, true);
11589 }
11590
11591 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
11592         void* e_ptr = untag_ptr(e);
11593         CHECK_ACCESS(e_ptr);
11594         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11595         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11596         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11597         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
11598         return tag_ptr(ret_conv, true);
11599 }
11600
11601 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
11602         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
11603         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
11604         return ret_conv;
11605 }
11606
11607 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
11608         if (!ptr_is_owned(_res)) return;
11609         void* _res_ptr = untag_ptr(_res);
11610         CHECK_ACCESS(_res_ptr);
11611         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
11612         FREE(untag_ptr(_res));
11613         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
11614 }
11615
11616 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
11617         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11618         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
11619         return tag_ptr(ret_conv, true);
11620 }
11621 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
11622         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
11623         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
11624         return ret_conv;
11625 }
11626
11627 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
11628         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
11629         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11630         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
11631         return tag_ptr(ret_conv, true);
11632 }
11633
11634 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
11635         LDKChannelPublicKeys o_conv;
11636         o_conv.inner = untag_ptr(o);
11637         o_conv.is_owned = ptr_is_owned(o);
11638         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11639         o_conv = ChannelPublicKeys_clone(&o_conv);
11640         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11641         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
11642         return tag_ptr(ret_conv, true);
11643 }
11644
11645 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
11646         void* e_ptr = untag_ptr(e);
11647         CHECK_ACCESS(e_ptr);
11648         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11649         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11650         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11651         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
11652         return tag_ptr(ret_conv, true);
11653 }
11654
11655 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
11656         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
11657         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
11658         return ret_conv;
11659 }
11660
11661 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
11662         if (!ptr_is_owned(_res)) return;
11663         void* _res_ptr = untag_ptr(_res);
11664         CHECK_ACCESS(_res_ptr);
11665         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
11666         FREE(untag_ptr(_res));
11667         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
11668 }
11669
11670 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
11671         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11672         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
11673         return tag_ptr(ret_conv, true);
11674 }
11675 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
11676         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
11677         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
11678         return ret_conv;
11679 }
11680
11681 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
11682         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
11683         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11684         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
11685         return tag_ptr(ret_conv, true);
11686 }
11687
11688 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_ok"))) TS_CResult_TxCreationKeysErrorZ_ok(uint64_t o) {
11689         LDKTxCreationKeys o_conv;
11690         o_conv.inner = untag_ptr(o);
11691         o_conv.is_owned = ptr_is_owned(o);
11692         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11693         o_conv = TxCreationKeys_clone(&o_conv);
11694         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11695         *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
11696         return tag_ptr(ret_conv, true);
11697 }
11698
11699 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_err"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
11700         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11701         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11702         *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
11703         return tag_ptr(ret_conv, true);
11704 }
11705
11706 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_is_ok"))) TS_CResult_TxCreationKeysErrorZ_is_ok(uint64_t o) {
11707         LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(o);
11708         jboolean ret_conv = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
11709         return ret_conv;
11710 }
11711
11712 void  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_free"))) TS_CResult_TxCreationKeysErrorZ_free(uint64_t _res) {
11713         if (!ptr_is_owned(_res)) return;
11714         void* _res_ptr = untag_ptr(_res);
11715         CHECK_ACCESS(_res_ptr);
11716         LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
11717         FREE(untag_ptr(_res));
11718         CResult_TxCreationKeysErrorZ_free(_res_conv);
11719 }
11720
11721 static inline uint64_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
11722         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11723         *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
11724         return tag_ptr(ret_conv, true);
11725 }
11726 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysErrorZ_clone_ptr(uint64_t arg) {
11727         LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(arg);
11728         int64_t ret_conv = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
11729         return ret_conv;
11730 }
11731
11732 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone"))) TS_CResult_TxCreationKeysErrorZ_clone(uint64_t orig) {
11733         LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(orig);
11734         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11735         *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
11736         return tag_ptr(ret_conv, true);
11737 }
11738
11739 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
11740         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11741         *ret_copy = COption_u32Z_some(o);
11742         uint64_t ret_ref = tag_ptr(ret_copy, true);
11743         return ret_ref;
11744 }
11745
11746 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
11747         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11748         *ret_copy = COption_u32Z_none();
11749         uint64_t ret_ref = tag_ptr(ret_copy, true);
11750         return ret_ref;
11751 }
11752
11753 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
11754         if (!ptr_is_owned(_res)) return;
11755         void* _res_ptr = untag_ptr(_res);
11756         CHECK_ACCESS(_res_ptr);
11757         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
11758         FREE(untag_ptr(_res));
11759         COption_u32Z_free(_res_conv);
11760 }
11761
11762 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
11763         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11764         *ret_copy = COption_u32Z_clone(arg);
11765         uint64_t ret_ref = tag_ptr(ret_copy, true);
11766         return ret_ref;
11767 }
11768 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
11769         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
11770         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
11771         return ret_conv;
11772 }
11773
11774 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
11775         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
11776         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11777         *ret_copy = COption_u32Z_clone(orig_conv);
11778         uint64_t ret_ref = tag_ptr(ret_copy, true);
11779         return ret_ref;
11780 }
11781
11782 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
11783         LDKHTLCOutputInCommitment o_conv;
11784         o_conv.inner = untag_ptr(o);
11785         o_conv.is_owned = ptr_is_owned(o);
11786         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11787         o_conv = HTLCOutputInCommitment_clone(&o_conv);
11788         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11789         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
11790         return tag_ptr(ret_conv, true);
11791 }
11792
11793 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
11794         void* e_ptr = untag_ptr(e);
11795         CHECK_ACCESS(e_ptr);
11796         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11797         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11798         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11799         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
11800         return tag_ptr(ret_conv, true);
11801 }
11802
11803 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
11804         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
11805         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
11806         return ret_conv;
11807 }
11808
11809 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
11810         if (!ptr_is_owned(_res)) return;
11811         void* _res_ptr = untag_ptr(_res);
11812         CHECK_ACCESS(_res_ptr);
11813         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
11814         FREE(untag_ptr(_res));
11815         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
11816 }
11817
11818 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
11819         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11820         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
11821         return tag_ptr(ret_conv, true);
11822 }
11823 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
11824         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
11825         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
11826         return ret_conv;
11827 }
11828
11829 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
11830         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
11831         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11832         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
11833         return tag_ptr(ret_conv, true);
11834 }
11835
11836 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
11837         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
11838         return ret_conv;
11839 }
11840
11841 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
11842         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
11843         return ret_conv;
11844 }
11845
11846 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
11847         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
11848         COption_NoneZ_free(_res_conv);
11849 }
11850
11851 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
11852         LDKCounterpartyChannelTransactionParameters o_conv;
11853         o_conv.inner = untag_ptr(o);
11854         o_conv.is_owned = ptr_is_owned(o);
11855         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11856         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
11857         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11858         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
11859         return tag_ptr(ret_conv, true);
11860 }
11861
11862 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
11863         void* e_ptr = untag_ptr(e);
11864         CHECK_ACCESS(e_ptr);
11865         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11866         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11867         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11868         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
11869         return tag_ptr(ret_conv, true);
11870 }
11871
11872 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
11873         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
11874         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
11875         return ret_conv;
11876 }
11877
11878 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
11879         if (!ptr_is_owned(_res)) return;
11880         void* _res_ptr = untag_ptr(_res);
11881         CHECK_ACCESS(_res_ptr);
11882         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
11883         FREE(untag_ptr(_res));
11884         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
11885 }
11886
11887 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
11888         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11889         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
11890         return tag_ptr(ret_conv, true);
11891 }
11892 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
11893         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
11894         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
11895         return ret_conv;
11896 }
11897
11898 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
11899         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
11900         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11901         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
11902         return tag_ptr(ret_conv, true);
11903 }
11904
11905 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
11906         LDKChannelTransactionParameters o_conv;
11907         o_conv.inner = untag_ptr(o);
11908         o_conv.is_owned = ptr_is_owned(o);
11909         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11910         o_conv = ChannelTransactionParameters_clone(&o_conv);
11911         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11912         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
11913         return tag_ptr(ret_conv, true);
11914 }
11915
11916 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
11917         void* e_ptr = untag_ptr(e);
11918         CHECK_ACCESS(e_ptr);
11919         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11920         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11921         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11922         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
11923         return tag_ptr(ret_conv, true);
11924 }
11925
11926 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
11927         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
11928         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
11929         return ret_conv;
11930 }
11931
11932 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
11933         if (!ptr_is_owned(_res)) return;
11934         void* _res_ptr = untag_ptr(_res);
11935         CHECK_ACCESS(_res_ptr);
11936         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
11937         FREE(untag_ptr(_res));
11938         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
11939 }
11940
11941 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
11942         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11943         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
11944         return tag_ptr(ret_conv, true);
11945 }
11946 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
11947         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
11948         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
11949         return ret_conv;
11950 }
11951
11952 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
11953         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
11954         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11955         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
11956         return tag_ptr(ret_conv, true);
11957 }
11958
11959 void  __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
11960         LDKCVec_SignatureZ _res_constr;
11961         _res_constr.datalen = _res->arr_len;
11962         if (_res_constr.datalen > 0)
11963                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11964         else
11965                 _res_constr.data = NULL;
11966         int8_tArray* _res_vals = (void*) _res->elems;
11967         for (size_t m = 0; m < _res_constr.datalen; m++) {
11968                 int8_tArray _res_conv_12 = _res_vals[m];
11969                 LDKSignature _res_conv_12_ref;
11970                 CHECK(_res_conv_12->arr_len == 64);
11971                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
11972                 _res_constr.data[m] = _res_conv_12_ref;
11973         }
11974         FREE(_res);
11975         CVec_SignatureZ_free(_res_constr);
11976 }
11977
11978 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
11979         LDKHolderCommitmentTransaction o_conv;
11980         o_conv.inner = untag_ptr(o);
11981         o_conv.is_owned = ptr_is_owned(o);
11982         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11983         o_conv = HolderCommitmentTransaction_clone(&o_conv);
11984         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11985         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
11986         return tag_ptr(ret_conv, true);
11987 }
11988
11989 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
11990         void* e_ptr = untag_ptr(e);
11991         CHECK_ACCESS(e_ptr);
11992         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11993         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11994         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11995         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
11996         return tag_ptr(ret_conv, true);
11997 }
11998
11999 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12000         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12001         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12002         return ret_conv;
12003 }
12004
12005 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12006         if (!ptr_is_owned(_res)) return;
12007         void* _res_ptr = untag_ptr(_res);
12008         CHECK_ACCESS(_res_ptr);
12009         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
12010         FREE(untag_ptr(_res));
12011         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
12012 }
12013
12014 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12015         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12016         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
12017         return tag_ptr(ret_conv, true);
12018 }
12019 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12020         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12021         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12022         return ret_conv;
12023 }
12024
12025 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12026         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12027         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12028         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12029         return tag_ptr(ret_conv, true);
12030 }
12031
12032 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12033         LDKBuiltCommitmentTransaction o_conv;
12034         o_conv.inner = untag_ptr(o);
12035         o_conv.is_owned = ptr_is_owned(o);
12036         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12037         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
12038         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12039         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
12040         return tag_ptr(ret_conv, true);
12041 }
12042
12043 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12044         void* e_ptr = untag_ptr(e);
12045         CHECK_ACCESS(e_ptr);
12046         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12047         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12048         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12049         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
12050         return tag_ptr(ret_conv, true);
12051 }
12052
12053 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12054         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12055         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12056         return ret_conv;
12057 }
12058
12059 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12060         if (!ptr_is_owned(_res)) return;
12061         void* _res_ptr = untag_ptr(_res);
12062         CHECK_ACCESS(_res_ptr);
12063         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
12064         FREE(untag_ptr(_res));
12065         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
12066 }
12067
12068 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12069         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12070         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
12071         return tag_ptr(ret_conv, true);
12072 }
12073 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12074         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12075         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12076         return ret_conv;
12077 }
12078
12079 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12080         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12081         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12082         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12083         return tag_ptr(ret_conv, true);
12084 }
12085
12086 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
12087         LDKTrustedClosingTransaction o_conv;
12088         o_conv.inner = untag_ptr(o);
12089         o_conv.is_owned = ptr_is_owned(o);
12090         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12091         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
12092         
12093         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12094         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
12095         return tag_ptr(ret_conv, true);
12096 }
12097
12098 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
12099         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12100         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
12101         return tag_ptr(ret_conv, true);
12102 }
12103
12104 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
12105         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
12106         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
12107         return ret_conv;
12108 }
12109
12110 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
12111         if (!ptr_is_owned(_res)) return;
12112         void* _res_ptr = untag_ptr(_res);
12113         CHECK_ACCESS(_res_ptr);
12114         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
12115         FREE(untag_ptr(_res));
12116         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
12117 }
12118
12119 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12120         LDKCommitmentTransaction o_conv;
12121         o_conv.inner = untag_ptr(o);
12122         o_conv.is_owned = ptr_is_owned(o);
12123         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12124         o_conv = CommitmentTransaction_clone(&o_conv);
12125         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12126         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
12127         return tag_ptr(ret_conv, true);
12128 }
12129
12130 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12131         void* e_ptr = untag_ptr(e);
12132         CHECK_ACCESS(e_ptr);
12133         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12134         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12135         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12136         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
12137         return tag_ptr(ret_conv, true);
12138 }
12139
12140 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12141         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12142         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12143         return ret_conv;
12144 }
12145
12146 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12147         if (!ptr_is_owned(_res)) return;
12148         void* _res_ptr = untag_ptr(_res);
12149         CHECK_ACCESS(_res_ptr);
12150         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
12151         FREE(untag_ptr(_res));
12152         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
12153 }
12154
12155 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12156         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12157         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
12158         return tag_ptr(ret_conv, true);
12159 }
12160 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12161         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12162         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12163         return ret_conv;
12164 }
12165
12166 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12167         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12168         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12169         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
12170         return tag_ptr(ret_conv, true);
12171 }
12172
12173 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
12174         LDKTrustedCommitmentTransaction o_conv;
12175         o_conv.inner = untag_ptr(o);
12176         o_conv.is_owned = ptr_is_owned(o);
12177         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12178         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
12179         
12180         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12181         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
12182         return tag_ptr(ret_conv, true);
12183 }
12184
12185 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
12186         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12187         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
12188         return tag_ptr(ret_conv, true);
12189 }
12190
12191 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
12192         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
12193         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
12194         return ret_conv;
12195 }
12196
12197 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
12198         if (!ptr_is_owned(_res)) return;
12199         void* _res_ptr = untag_ptr(_res);
12200         CHECK_ACCESS(_res_ptr);
12201         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
12202         FREE(untag_ptr(_res));
12203         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
12204 }
12205
12206 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
12207         LDKCVec_SignatureZ o_constr;
12208         o_constr.datalen = o->arr_len;
12209         if (o_constr.datalen > 0)
12210                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12211         else
12212                 o_constr.data = NULL;
12213         int8_tArray* o_vals = (void*) o->elems;
12214         for (size_t m = 0; m < o_constr.datalen; m++) {
12215                 int8_tArray o_conv_12 = o_vals[m];
12216                 LDKSignature o_conv_12_ref;
12217                 CHECK(o_conv_12->arr_len == 64);
12218                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
12219                 o_constr.data[m] = o_conv_12_ref;
12220         }
12221         FREE(o);
12222         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12223         *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
12224         return tag_ptr(ret_conv, true);
12225 }
12226
12227 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
12228         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12229         *ret_conv = CResult_CVec_SignatureZNoneZ_err();
12230         return tag_ptr(ret_conv, true);
12231 }
12232
12233 jboolean  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint64_t o) {
12234         LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(o);
12235         jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
12236         return ret_conv;
12237 }
12238
12239 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint64_t _res) {
12240         if (!ptr_is_owned(_res)) return;
12241         void* _res_ptr = untag_ptr(_res);
12242         CHECK_ACCESS(_res_ptr);
12243         LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
12244         FREE(untag_ptr(_res));
12245         CResult_CVec_SignatureZNoneZ_free(_res_conv);
12246 }
12247
12248 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
12249         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12250         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
12251         return tag_ptr(ret_conv, true);
12252 }
12253 int64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint64_t arg) {
12254         LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(arg);
12255         int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
12256         return ret_conv;
12257 }
12258
12259 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint64_t orig) {
12260         LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(orig);
12261         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12262         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
12263         return tag_ptr(ret_conv, true);
12264 }
12265
12266 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
12267         LDKShutdownScript o_conv;
12268         o_conv.inner = untag_ptr(o);
12269         o_conv.is_owned = ptr_is_owned(o);
12270         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12271         o_conv = ShutdownScript_clone(&o_conv);
12272         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12273         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
12274         return tag_ptr(ret_conv, true);
12275 }
12276
12277 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
12278         void* e_ptr = untag_ptr(e);
12279         CHECK_ACCESS(e_ptr);
12280         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12281         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12282         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12283         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
12284         return tag_ptr(ret_conv, true);
12285 }
12286
12287 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
12288         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
12289         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
12290         return ret_conv;
12291 }
12292
12293 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
12294         if (!ptr_is_owned(_res)) return;
12295         void* _res_ptr = untag_ptr(_res);
12296         CHECK_ACCESS(_res_ptr);
12297         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
12298         FREE(untag_ptr(_res));
12299         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
12300 }
12301
12302 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
12303         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12304         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
12305         return tag_ptr(ret_conv, true);
12306 }
12307 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
12308         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
12309         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
12310         return ret_conv;
12311 }
12312
12313 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
12314         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
12315         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12316         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
12317         return tag_ptr(ret_conv, true);
12318 }
12319
12320 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
12321         LDKShutdownScript o_conv;
12322         o_conv.inner = untag_ptr(o);
12323         o_conv.is_owned = ptr_is_owned(o);
12324         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12325         o_conv = ShutdownScript_clone(&o_conv);
12326         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12327         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
12328         return tag_ptr(ret_conv, true);
12329 }
12330
12331 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
12332         LDKInvalidShutdownScript e_conv;
12333         e_conv.inner = untag_ptr(e);
12334         e_conv.is_owned = ptr_is_owned(e);
12335         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12336         e_conv = InvalidShutdownScript_clone(&e_conv);
12337         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12338         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
12339         return tag_ptr(ret_conv, true);
12340 }
12341
12342 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
12343         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
12344         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
12345         return ret_conv;
12346 }
12347
12348 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
12349         if (!ptr_is_owned(_res)) return;
12350         void* _res_ptr = untag_ptr(_res);
12351         CHECK_ACCESS(_res_ptr);
12352         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
12353         FREE(untag_ptr(_res));
12354         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
12355 }
12356
12357 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
12358         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12359         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
12360         return tag_ptr(ret_conv, true);
12361 }
12362 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
12363         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
12364         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
12365         return ret_conv;
12366 }
12367
12368 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
12369         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
12370         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12371         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
12372         return tag_ptr(ret_conv, true);
12373 }
12374
12375 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
12376         LDKRouteHop o_conv;
12377         o_conv.inner = untag_ptr(o);
12378         o_conv.is_owned = ptr_is_owned(o);
12379         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12380         o_conv = RouteHop_clone(&o_conv);
12381         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12382         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
12383         return tag_ptr(ret_conv, true);
12384 }
12385
12386 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
12387         void* e_ptr = untag_ptr(e);
12388         CHECK_ACCESS(e_ptr);
12389         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12390         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12391         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12392         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
12393         return tag_ptr(ret_conv, true);
12394 }
12395
12396 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
12397         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
12398         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
12399         return ret_conv;
12400 }
12401
12402 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
12403         if (!ptr_is_owned(_res)) return;
12404         void* _res_ptr = untag_ptr(_res);
12405         CHECK_ACCESS(_res_ptr);
12406         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
12407         FREE(untag_ptr(_res));
12408         CResult_RouteHopDecodeErrorZ_free(_res_conv);
12409 }
12410
12411 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
12412         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12413         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
12414         return tag_ptr(ret_conv, true);
12415 }
12416 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
12417         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
12418         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
12419         return ret_conv;
12420 }
12421
12422 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
12423         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
12424         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12425         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
12426         return tag_ptr(ret_conv, true);
12427 }
12428
12429 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
12430         LDKCVec_RouteHopZ _res_constr;
12431         _res_constr.datalen = _res->arr_len;
12432         if (_res_constr.datalen > 0)
12433                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12434         else
12435                 _res_constr.data = NULL;
12436         uint64_t* _res_vals = _res->elems;
12437         for (size_t k = 0; k < _res_constr.datalen; k++) {
12438                 uint64_t _res_conv_10 = _res_vals[k];
12439                 LDKRouteHop _res_conv_10_conv;
12440                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
12441                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
12442                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
12443                 _res_constr.data[k] = _res_conv_10_conv;
12444         }
12445         FREE(_res);
12446         CVec_RouteHopZ_free(_res_constr);
12447 }
12448
12449 void  __attribute__((export_name("TS_CVec_CVec_RouteHopZZ_free"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
12450         LDKCVec_CVec_RouteHopZZ _res_constr;
12451         _res_constr.datalen = _res->arr_len;
12452         if (_res_constr.datalen > 0)
12453                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12454         else
12455                 _res_constr.data = NULL;
12456         uint64_tArray* _res_vals = (void*) _res->elems;
12457         for (size_t m = 0; m < _res_constr.datalen; m++) {
12458                 uint64_tArray _res_conv_12 = _res_vals[m];
12459                 LDKCVec_RouteHopZ _res_conv_12_constr;
12460                 _res_conv_12_constr.datalen = _res_conv_12->arr_len;
12461                 if (_res_conv_12_constr.datalen > 0)
12462                         _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12463                 else
12464                         _res_conv_12_constr.data = NULL;
12465                 uint64_t* _res_conv_12_vals = _res_conv_12->elems;
12466                 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
12467                         uint64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
12468                         LDKRouteHop _res_conv_12_conv_10_conv;
12469                         _res_conv_12_conv_10_conv.inner = untag_ptr(_res_conv_12_conv_10);
12470                         _res_conv_12_conv_10_conv.is_owned = ptr_is_owned(_res_conv_12_conv_10);
12471                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
12472                         _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
12473                 }
12474                 FREE(_res_conv_12);
12475                 _res_constr.data[m] = _res_conv_12_constr;
12476         }
12477         FREE(_res);
12478         CVec_CVec_RouteHopZZ_free(_res_constr);
12479 }
12480
12481 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
12482         LDKRoute o_conv;
12483         o_conv.inner = untag_ptr(o);
12484         o_conv.is_owned = ptr_is_owned(o);
12485         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12486         o_conv = Route_clone(&o_conv);
12487         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12488         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
12489         return tag_ptr(ret_conv, true);
12490 }
12491
12492 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
12493         void* e_ptr = untag_ptr(e);
12494         CHECK_ACCESS(e_ptr);
12495         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12496         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12497         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12498         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
12499         return tag_ptr(ret_conv, true);
12500 }
12501
12502 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
12503         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
12504         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
12505         return ret_conv;
12506 }
12507
12508 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
12509         if (!ptr_is_owned(_res)) return;
12510         void* _res_ptr = untag_ptr(_res);
12511         CHECK_ACCESS(_res_ptr);
12512         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
12513         FREE(untag_ptr(_res));
12514         CResult_RouteDecodeErrorZ_free(_res_conv);
12515 }
12516
12517 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
12518         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12519         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
12520         return tag_ptr(ret_conv, true);
12521 }
12522 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
12523         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
12524         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
12525         return ret_conv;
12526 }
12527
12528 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
12529         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
12530         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12531         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
12532         return tag_ptr(ret_conv, true);
12533 }
12534
12535 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
12536         LDKRouteParameters o_conv;
12537         o_conv.inner = untag_ptr(o);
12538         o_conv.is_owned = ptr_is_owned(o);
12539         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12540         o_conv = RouteParameters_clone(&o_conv);
12541         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12542         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
12543         return tag_ptr(ret_conv, true);
12544 }
12545
12546 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
12547         void* e_ptr = untag_ptr(e);
12548         CHECK_ACCESS(e_ptr);
12549         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12550         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12551         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12552         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
12553         return tag_ptr(ret_conv, true);
12554 }
12555
12556 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
12557         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
12558         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
12559         return ret_conv;
12560 }
12561
12562 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
12563         if (!ptr_is_owned(_res)) return;
12564         void* _res_ptr = untag_ptr(_res);
12565         CHECK_ACCESS(_res_ptr);
12566         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
12567         FREE(untag_ptr(_res));
12568         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
12569 }
12570
12571 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
12572         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12573         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
12574         return tag_ptr(ret_conv, true);
12575 }
12576 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
12577         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
12578         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
12579         return ret_conv;
12580 }
12581
12582 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
12583         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
12584         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12585         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
12586         return tag_ptr(ret_conv, true);
12587 }
12588
12589 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
12590         LDKCVec_RouteHintZ _res_constr;
12591         _res_constr.datalen = _res->arr_len;
12592         if (_res_constr.datalen > 0)
12593                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
12594         else
12595                 _res_constr.data = NULL;
12596         uint64_t* _res_vals = _res->elems;
12597         for (size_t l = 0; l < _res_constr.datalen; l++) {
12598                 uint64_t _res_conv_11 = _res_vals[l];
12599                 LDKRouteHint _res_conv_11_conv;
12600                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
12601                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
12602                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
12603                 _res_constr.data[l] = _res_conv_11_conv;
12604         }
12605         FREE(_res);
12606         CVec_RouteHintZ_free(_res_constr);
12607 }
12608
12609 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
12610         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12611         *ret_copy = COption_u64Z_some(o);
12612         uint64_t ret_ref = tag_ptr(ret_copy, true);
12613         return ret_ref;
12614 }
12615
12616 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
12617         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12618         *ret_copy = COption_u64Z_none();
12619         uint64_t ret_ref = tag_ptr(ret_copy, true);
12620         return ret_ref;
12621 }
12622
12623 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
12624         if (!ptr_is_owned(_res)) return;
12625         void* _res_ptr = untag_ptr(_res);
12626         CHECK_ACCESS(_res_ptr);
12627         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
12628         FREE(untag_ptr(_res));
12629         COption_u64Z_free(_res_conv);
12630 }
12631
12632 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
12633         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12634         *ret_copy = COption_u64Z_clone(arg);
12635         uint64_t ret_ref = tag_ptr(ret_copy, true);
12636         return ret_ref;
12637 }
12638 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
12639         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
12640         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
12641         return ret_conv;
12642 }
12643
12644 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
12645         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
12646         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12647         *ret_copy = COption_u64Z_clone(orig_conv);
12648         uint64_t ret_ref = tag_ptr(ret_copy, true);
12649         return ret_ref;
12650 }
12651
12652 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
12653         LDKCVec_u64Z _res_constr;
12654         _res_constr.datalen = _res->arr_len;
12655         if (_res_constr.datalen > 0)
12656                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12657         else
12658                 _res_constr.data = NULL;
12659         int64_t* _res_vals = _res->elems;
12660         for (size_t i = 0; i < _res_constr.datalen; i++) {
12661                 int64_t _res_conv_8 = _res_vals[i];
12662                 _res_constr.data[i] = _res_conv_8;
12663         }
12664         FREE(_res);
12665         CVec_u64Z_free(_res_constr);
12666 }
12667
12668 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
12669         LDKPaymentParameters o_conv;
12670         o_conv.inner = untag_ptr(o);
12671         o_conv.is_owned = ptr_is_owned(o);
12672         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12673         o_conv = PaymentParameters_clone(&o_conv);
12674         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12675         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
12676         return tag_ptr(ret_conv, true);
12677 }
12678
12679 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
12680         void* e_ptr = untag_ptr(e);
12681         CHECK_ACCESS(e_ptr);
12682         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12683         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12684         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12685         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
12686         return tag_ptr(ret_conv, true);
12687 }
12688
12689 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
12690         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
12691         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
12692         return ret_conv;
12693 }
12694
12695 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
12696         if (!ptr_is_owned(_res)) return;
12697         void* _res_ptr = untag_ptr(_res);
12698         CHECK_ACCESS(_res_ptr);
12699         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
12700         FREE(untag_ptr(_res));
12701         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
12702 }
12703
12704 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
12705         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12706         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
12707         return tag_ptr(ret_conv, true);
12708 }
12709 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
12710         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
12711         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
12712         return ret_conv;
12713 }
12714
12715 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
12716         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
12717         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12718         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
12719         return tag_ptr(ret_conv, true);
12720 }
12721
12722 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
12723         LDKCVec_RouteHintHopZ _res_constr;
12724         _res_constr.datalen = _res->arr_len;
12725         if (_res_constr.datalen > 0)
12726                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
12727         else
12728                 _res_constr.data = NULL;
12729         uint64_t* _res_vals = _res->elems;
12730         for (size_t o = 0; o < _res_constr.datalen; o++) {
12731                 uint64_t _res_conv_14 = _res_vals[o];
12732                 LDKRouteHintHop _res_conv_14_conv;
12733                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
12734                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
12735                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
12736                 _res_constr.data[o] = _res_conv_14_conv;
12737         }
12738         FREE(_res);
12739         CVec_RouteHintHopZ_free(_res_constr);
12740 }
12741
12742 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
12743         LDKRouteHint o_conv;
12744         o_conv.inner = untag_ptr(o);
12745         o_conv.is_owned = ptr_is_owned(o);
12746         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12747         o_conv = RouteHint_clone(&o_conv);
12748         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12749         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
12750         return tag_ptr(ret_conv, true);
12751 }
12752
12753 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
12754         void* e_ptr = untag_ptr(e);
12755         CHECK_ACCESS(e_ptr);
12756         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12757         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12758         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12759         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
12760         return tag_ptr(ret_conv, true);
12761 }
12762
12763 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
12764         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
12765         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
12766         return ret_conv;
12767 }
12768
12769 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
12770         if (!ptr_is_owned(_res)) return;
12771         void* _res_ptr = untag_ptr(_res);
12772         CHECK_ACCESS(_res_ptr);
12773         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
12774         FREE(untag_ptr(_res));
12775         CResult_RouteHintDecodeErrorZ_free(_res_conv);
12776 }
12777
12778 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
12779         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12780         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
12781         return tag_ptr(ret_conv, true);
12782 }
12783 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
12784         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
12785         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
12786         return ret_conv;
12787 }
12788
12789 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
12790         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
12791         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12792         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
12793         return tag_ptr(ret_conv, true);
12794 }
12795
12796 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
12797         LDKRouteHintHop o_conv;
12798         o_conv.inner = untag_ptr(o);
12799         o_conv.is_owned = ptr_is_owned(o);
12800         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12801         o_conv = RouteHintHop_clone(&o_conv);
12802         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12803         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
12804         return tag_ptr(ret_conv, true);
12805 }
12806
12807 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
12808         void* e_ptr = untag_ptr(e);
12809         CHECK_ACCESS(e_ptr);
12810         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12811         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12812         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12813         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
12814         return tag_ptr(ret_conv, true);
12815 }
12816
12817 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
12818         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
12819         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
12820         return ret_conv;
12821 }
12822
12823 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
12824         if (!ptr_is_owned(_res)) return;
12825         void* _res_ptr = untag_ptr(_res);
12826         CHECK_ACCESS(_res_ptr);
12827         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
12828         FREE(untag_ptr(_res));
12829         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
12830 }
12831
12832 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
12833         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12834         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
12835         return tag_ptr(ret_conv, true);
12836 }
12837 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
12838         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
12839         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
12840         return ret_conv;
12841 }
12842
12843 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
12844         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
12845         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12846         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
12847         return tag_ptr(ret_conv, true);
12848 }
12849
12850 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
12851         LDKCVec_ChannelDetailsZ _res_constr;
12852         _res_constr.datalen = _res->arr_len;
12853         if (_res_constr.datalen > 0)
12854                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
12855         else
12856                 _res_constr.data = NULL;
12857         uint64_t* _res_vals = _res->elems;
12858         for (size_t q = 0; q < _res_constr.datalen; q++) {
12859                 uint64_t _res_conv_16 = _res_vals[q];
12860                 LDKChannelDetails _res_conv_16_conv;
12861                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
12862                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
12863                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
12864                 _res_constr.data[q] = _res_conv_16_conv;
12865         }
12866         FREE(_res);
12867         CVec_ChannelDetailsZ_free(_res_constr);
12868 }
12869
12870 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
12871         LDKRoute o_conv;
12872         o_conv.inner = untag_ptr(o);
12873         o_conv.is_owned = ptr_is_owned(o);
12874         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12875         o_conv = Route_clone(&o_conv);
12876         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12877         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
12878         return tag_ptr(ret_conv, true);
12879 }
12880
12881 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
12882         LDKLightningError e_conv;
12883         e_conv.inner = untag_ptr(e);
12884         e_conv.is_owned = ptr_is_owned(e);
12885         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12886         e_conv = LightningError_clone(&e_conv);
12887         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12888         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
12889         return tag_ptr(ret_conv, true);
12890 }
12891
12892 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
12893         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
12894         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
12895         return ret_conv;
12896 }
12897
12898 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
12899         if (!ptr_is_owned(_res)) return;
12900         void* _res_ptr = untag_ptr(_res);
12901         CHECK_ACCESS(_res_ptr);
12902         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
12903         FREE(untag_ptr(_res));
12904         CResult_RouteLightningErrorZ_free(_res_conv);
12905 }
12906
12907 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
12908         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12909         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
12910         return tag_ptr(ret_conv, true);
12911 }
12912 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
12913         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
12914         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
12915         return ret_conv;
12916 }
12917
12918 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
12919         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
12920         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12921         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
12922         return tag_ptr(ret_conv, true);
12923 }
12924
12925 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
12926         void* o_ptr = untag_ptr(o);
12927         CHECK_ACCESS(o_ptr);
12928         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
12929         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
12930         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12931         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
12932         return tag_ptr(ret_conv, true);
12933 }
12934
12935 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
12936         void* e_ptr = untag_ptr(e);
12937         CHECK_ACCESS(e_ptr);
12938         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12939         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12940         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12941         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
12942         return tag_ptr(ret_conv, true);
12943 }
12944
12945 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
12946         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
12947         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
12948         return ret_conv;
12949 }
12950
12951 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
12952         if (!ptr_is_owned(_res)) return;
12953         void* _res_ptr = untag_ptr(_res);
12954         CHECK_ACCESS(_res_ptr);
12955         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
12956         FREE(untag_ptr(_res));
12957         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
12958 }
12959
12960 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
12961         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12962         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
12963         return tag_ptr(ret_conv, true);
12964 }
12965 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
12966         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
12967         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
12968         return ret_conv;
12969 }
12970
12971 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
12972         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
12973         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12974         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
12975         return tag_ptr(ret_conv, true);
12976 }
12977
12978 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
12979         void* o_ptr = untag_ptr(o);
12980         CHECK_ACCESS(o_ptr);
12981         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
12982         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
12983         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12984         *ret_copy = COption_ClosureReasonZ_some(o_conv);
12985         uint64_t ret_ref = tag_ptr(ret_copy, true);
12986         return ret_ref;
12987 }
12988
12989 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
12990         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12991         *ret_copy = COption_ClosureReasonZ_none();
12992         uint64_t ret_ref = tag_ptr(ret_copy, true);
12993         return ret_ref;
12994 }
12995
12996 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
12997         if (!ptr_is_owned(_res)) return;
12998         void* _res_ptr = untag_ptr(_res);
12999         CHECK_ACCESS(_res_ptr);
13000         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
13001         FREE(untag_ptr(_res));
13002         COption_ClosureReasonZ_free(_res_conv);
13003 }
13004
13005 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
13006         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13007         *ret_copy = COption_ClosureReasonZ_clone(arg);
13008         uint64_t ret_ref = tag_ptr(ret_copy, true);
13009         return ret_ref;
13010 }
13011 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
13012         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
13013         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
13014         return ret_conv;
13015 }
13016
13017 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
13018         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
13019         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13020         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
13021         uint64_t ret_ref = tag_ptr(ret_copy, true);
13022         return ret_ref;
13023 }
13024
13025 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
13026         void* o_ptr = untag_ptr(o);
13027         CHECK_ACCESS(o_ptr);
13028         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
13029         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
13030         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13031         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
13032         return tag_ptr(ret_conv, true);
13033 }
13034
13035 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
13036         void* e_ptr = untag_ptr(e);
13037         CHECK_ACCESS(e_ptr);
13038         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13039         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13040         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13041         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
13042         return tag_ptr(ret_conv, true);
13043 }
13044
13045 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
13046         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
13047         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
13048         return ret_conv;
13049 }
13050
13051 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
13052         if (!ptr_is_owned(_res)) return;
13053         void* _res_ptr = untag_ptr(_res);
13054         CHECK_ACCESS(_res_ptr);
13055         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
13056         FREE(untag_ptr(_res));
13057         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
13058 }
13059
13060 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
13061         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13062         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
13063         return tag_ptr(ret_conv, true);
13064 }
13065 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
13066         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
13067         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
13068         return ret_conv;
13069 }
13070
13071 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
13072         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
13073         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13074         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
13075         return tag_ptr(ret_conv, true);
13076 }
13077
13078 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
13079         void* o_ptr = untag_ptr(o);
13080         CHECK_ACCESS(o_ptr);
13081         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
13082         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
13083         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13084         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
13085         uint64_t ret_ref = tag_ptr(ret_copy, true);
13086         return ret_ref;
13087 }
13088
13089 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
13090         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13091         *ret_copy = COption_HTLCDestinationZ_none();
13092         uint64_t ret_ref = tag_ptr(ret_copy, true);
13093         return ret_ref;
13094 }
13095
13096 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
13097         if (!ptr_is_owned(_res)) return;
13098         void* _res_ptr = untag_ptr(_res);
13099         CHECK_ACCESS(_res_ptr);
13100         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
13101         FREE(untag_ptr(_res));
13102         COption_HTLCDestinationZ_free(_res_conv);
13103 }
13104
13105 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
13106         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13107         *ret_copy = COption_HTLCDestinationZ_clone(arg);
13108         uint64_t ret_ref = tag_ptr(ret_copy, true);
13109         return ret_ref;
13110 }
13111 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
13112         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
13113         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
13114         return ret_conv;
13115 }
13116
13117 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
13118         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
13119         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13120         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
13121         uint64_t ret_ref = tag_ptr(ret_copy, true);
13122         return ret_ref;
13123 }
13124
13125 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
13126         void* o_ptr = untag_ptr(o);
13127         CHECK_ACCESS(o_ptr);
13128         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
13129         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
13130         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13131         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
13132         return tag_ptr(ret_conv, true);
13133 }
13134
13135 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
13136         void* e_ptr = untag_ptr(e);
13137         CHECK_ACCESS(e_ptr);
13138         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13139         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13140         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13141         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
13142         return tag_ptr(ret_conv, true);
13143 }
13144
13145 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
13146         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
13147         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
13148         return ret_conv;
13149 }
13150
13151 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
13152         if (!ptr_is_owned(_res)) return;
13153         void* _res_ptr = untag_ptr(_res);
13154         CHECK_ACCESS(_res_ptr);
13155         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
13156         FREE(untag_ptr(_res));
13157         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
13158 }
13159
13160 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
13161         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13162         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
13163         return tag_ptr(ret_conv, true);
13164 }
13165 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
13166         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
13167         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
13168         return ret_conv;
13169 }
13170
13171 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
13172         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
13173         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13174         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
13175         return tag_ptr(ret_conv, true);
13176 }
13177
13178 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
13179         void* o_ptr = untag_ptr(o);
13180         CHECK_ACCESS(o_ptr);
13181         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
13182         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
13183         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13184         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
13185         uint64_t ret_ref = tag_ptr(ret_copy, true);
13186         return ret_ref;
13187 }
13188
13189 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
13190         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13191         *ret_copy = COption_NetworkUpdateZ_none();
13192         uint64_t ret_ref = tag_ptr(ret_copy, true);
13193         return ret_ref;
13194 }
13195
13196 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
13197         if (!ptr_is_owned(_res)) return;
13198         void* _res_ptr = untag_ptr(_res);
13199         CHECK_ACCESS(_res_ptr);
13200         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
13201         FREE(untag_ptr(_res));
13202         COption_NetworkUpdateZ_free(_res_conv);
13203 }
13204
13205 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
13206         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13207         *ret_copy = COption_NetworkUpdateZ_clone(arg);
13208         uint64_t ret_ref = tag_ptr(ret_copy, true);
13209         return ret_ref;
13210 }
13211 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
13212         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
13213         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
13214         return ret_conv;
13215 }
13216
13217 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
13218         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
13219         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13220         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
13221         uint64_t ret_ref = tag_ptr(ret_copy, true);
13222         return ret_ref;
13223 }
13224
13225 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
13226         LDKCVec_SpendableOutputDescriptorZ _res_constr;
13227         _res_constr.datalen = _res->arr_len;
13228         if (_res_constr.datalen > 0)
13229                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
13230         else
13231                 _res_constr.data = NULL;
13232         uint64_t* _res_vals = _res->elems;
13233         for (size_t b = 0; b < _res_constr.datalen; b++) {
13234                 uint64_t _res_conv_27 = _res_vals[b];
13235                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
13236                 CHECK_ACCESS(_res_conv_27_ptr);
13237                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
13238                 FREE(untag_ptr(_res_conv_27));
13239                 _res_constr.data[b] = _res_conv_27_conv;
13240         }
13241         FREE(_res);
13242         CVec_SpendableOutputDescriptorZ_free(_res_constr);
13243 }
13244
13245 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
13246         void* o_ptr = untag_ptr(o);
13247         CHECK_ACCESS(o_ptr);
13248         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
13249         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
13250         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13251         *ret_copy = COption_EventZ_some(o_conv);
13252         uint64_t ret_ref = tag_ptr(ret_copy, true);
13253         return ret_ref;
13254 }
13255
13256 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
13257         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13258         *ret_copy = COption_EventZ_none();
13259         uint64_t ret_ref = tag_ptr(ret_copy, true);
13260         return ret_ref;
13261 }
13262
13263 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
13264         if (!ptr_is_owned(_res)) return;
13265         void* _res_ptr = untag_ptr(_res);
13266         CHECK_ACCESS(_res_ptr);
13267         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
13268         FREE(untag_ptr(_res));
13269         COption_EventZ_free(_res_conv);
13270 }
13271
13272 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
13273         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13274         *ret_copy = COption_EventZ_clone(arg);
13275         uint64_t ret_ref = tag_ptr(ret_copy, true);
13276         return ret_ref;
13277 }
13278 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
13279         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
13280         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
13281         return ret_conv;
13282 }
13283
13284 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
13285         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
13286         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13287         *ret_copy = COption_EventZ_clone(orig_conv);
13288         uint64_t ret_ref = tag_ptr(ret_copy, true);
13289         return ret_ref;
13290 }
13291
13292 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
13293         void* o_ptr = untag_ptr(o);
13294         CHECK_ACCESS(o_ptr);
13295         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
13296         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
13297         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13298         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
13299         return tag_ptr(ret_conv, true);
13300 }
13301
13302 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
13303         void* e_ptr = untag_ptr(e);
13304         CHECK_ACCESS(e_ptr);
13305         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13306         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13307         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13308         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
13309         return tag_ptr(ret_conv, true);
13310 }
13311
13312 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
13313         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
13314         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
13315         return ret_conv;
13316 }
13317
13318 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
13319         if (!ptr_is_owned(_res)) return;
13320         void* _res_ptr = untag_ptr(_res);
13321         CHECK_ACCESS(_res_ptr);
13322         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
13323         FREE(untag_ptr(_res));
13324         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
13325 }
13326
13327 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
13328         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13329         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
13330         return tag_ptr(ret_conv, true);
13331 }
13332 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
13333         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
13334         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
13335         return ret_conv;
13336 }
13337
13338 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
13339         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
13340         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13341         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
13342         return tag_ptr(ret_conv, true);
13343 }
13344
13345 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
13346         LDKCVec_MessageSendEventZ _res_constr;
13347         _res_constr.datalen = _res->arr_len;
13348         if (_res_constr.datalen > 0)
13349                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
13350         else
13351                 _res_constr.data = NULL;
13352         uint64_t* _res_vals = _res->elems;
13353         for (size_t s = 0; s < _res_constr.datalen; s++) {
13354                 uint64_t _res_conv_18 = _res_vals[s];
13355                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
13356                 CHECK_ACCESS(_res_conv_18_ptr);
13357                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
13358                 FREE(untag_ptr(_res_conv_18));
13359                 _res_constr.data[s] = _res_conv_18_conv;
13360         }
13361         FREE(_res);
13362         CVec_MessageSendEventZ_free(_res_constr);
13363 }
13364
13365 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_ok"))) TS_CResult_TxOutAccessErrorZ_ok(uint64_t o) {
13366         void* o_ptr = untag_ptr(o);
13367         CHECK_ACCESS(o_ptr);
13368         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
13369         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
13370         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13371         *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
13372         return tag_ptr(ret_conv, true);
13373 }
13374
13375 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_err"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
13376         LDKAccessError e_conv = LDKAccessError_from_js(e);
13377         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13378         *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
13379         return tag_ptr(ret_conv, true);
13380 }
13381
13382 jboolean  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_is_ok"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint64_t o) {
13383         LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(o);
13384         jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv);
13385         return ret_conv;
13386 }
13387
13388 void  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_free"))) TS_CResult_TxOutAccessErrorZ_free(uint64_t _res) {
13389         if (!ptr_is_owned(_res)) return;
13390         void* _res_ptr = untag_ptr(_res);
13391         CHECK_ACCESS(_res_ptr);
13392         LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
13393         FREE(untag_ptr(_res));
13394         CResult_TxOutAccessErrorZ_free(_res_conv);
13395 }
13396
13397 static inline uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
13398         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13399         *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
13400         return tag_ptr(ret_conv, true);
13401 }
13402 int64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone_ptr"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint64_t arg) {
13403         LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(arg);
13404         int64_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
13405         return ret_conv;
13406 }
13407
13408 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone"))) TS_CResult_TxOutAccessErrorZ_clone(uint64_t orig) {
13409         LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(orig);
13410         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13411         *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
13412         return tag_ptr(ret_conv, true);
13413 }
13414
13415 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
13416         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13417         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
13418         return tag_ptr(ret_conv, true);
13419 }
13420 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
13421         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
13422         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
13423         return ret_conv;
13424 }
13425
13426 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
13427         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
13428         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13429         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
13430         return tag_ptr(ret_conv, true);
13431 }
13432
13433 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
13434         LDKTransaction b_ref;
13435         b_ref.datalen = b->arr_len;
13436         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
13437         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
13438         b_ref.data_is_owned = true;
13439         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13440         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
13441         return tag_ptr(ret_conv, true);
13442 }
13443
13444 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
13445         if (!ptr_is_owned(_res)) return;
13446         void* _res_ptr = untag_ptr(_res);
13447         CHECK_ACCESS(_res_ptr);
13448         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
13449         FREE(untag_ptr(_res));
13450         C2Tuple_usizeTransactionZ_free(_res_conv);
13451 }
13452
13453 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
13454         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
13455         _res_constr.datalen = _res->arr_len;
13456         if (_res_constr.datalen > 0)
13457                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13458         else
13459                 _res_constr.data = NULL;
13460         uint64_t* _res_vals = _res->elems;
13461         for (size_t c = 0; c < _res_constr.datalen; c++) {
13462                 uint64_t _res_conv_28 = _res_vals[c];
13463                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
13464                 CHECK_ACCESS(_res_conv_28_ptr);
13465                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
13466                 FREE(untag_ptr(_res_conv_28));
13467                 _res_constr.data[c] = _res_conv_28_conv;
13468         }
13469         FREE(_res);
13470         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
13471 }
13472
13473 void  __attribute__((export_name("TS_CVec_TxidZ_free"))) TS_CVec_TxidZ_free(ptrArray _res) {
13474         LDKCVec_TxidZ _res_constr;
13475         _res_constr.datalen = _res->arr_len;
13476         if (_res_constr.datalen > 0)
13477                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
13478         else
13479                 _res_constr.data = NULL;
13480         int8_tArray* _res_vals = (void*) _res->elems;
13481         for (size_t m = 0; m < _res_constr.datalen; m++) {
13482                 int8_tArray _res_conv_12 = _res_vals[m];
13483                 LDKThirtyTwoBytes _res_conv_12_ref;
13484                 CHECK(_res_conv_12->arr_len == 32);
13485                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
13486                 _res_constr.data[m] = _res_conv_12_ref;
13487         }
13488         FREE(_res);
13489         CVec_TxidZ_free(_res_constr);
13490 }
13491
13492 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
13493         LDKCVec_MonitorEventZ _res_constr;
13494         _res_constr.datalen = _res->arr_len;
13495         if (_res_constr.datalen > 0)
13496                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
13497         else
13498                 _res_constr.data = NULL;
13499         uint64_t* _res_vals = _res->elems;
13500         for (size_t o = 0; o < _res_constr.datalen; o++) {
13501                 uint64_t _res_conv_14 = _res_vals[o];
13502                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
13503                 CHECK_ACCESS(_res_conv_14_ptr);
13504                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
13505                 FREE(untag_ptr(_res_conv_14));
13506                 _res_constr.data[o] = _res_conv_14_conv;
13507         }
13508         FREE(_res);
13509         CVec_MonitorEventZ_free(_res_constr);
13510 }
13511
13512 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
13513         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
13514         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
13515         return tag_ptr(ret_conv, true);
13516 }
13517 int64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
13518         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
13519         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
13520         return ret_conv;
13521 }
13522
13523 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
13524         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
13525         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
13526         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
13527         return tag_ptr(ret_conv, true);
13528 }
13529
13530 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(uint64_t a, uint64_tArray b, int8_tArray c) {
13531         LDKOutPoint a_conv;
13532         a_conv.inner = untag_ptr(a);
13533         a_conv.is_owned = ptr_is_owned(a);
13534         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
13535         a_conv = OutPoint_clone(&a_conv);
13536         LDKCVec_MonitorEventZ b_constr;
13537         b_constr.datalen = b->arr_len;
13538         if (b_constr.datalen > 0)
13539                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
13540         else
13541                 b_constr.data = NULL;
13542         uint64_t* b_vals = b->elems;
13543         for (size_t o = 0; o < b_constr.datalen; o++) {
13544                 uint64_t b_conv_14 = b_vals[o];
13545                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
13546                 CHECK_ACCESS(b_conv_14_ptr);
13547                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
13548                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
13549                 b_constr.data[o] = b_conv_14_conv;
13550         }
13551         FREE(b);
13552         LDKPublicKey c_ref;
13553         CHECK(c->arr_len == 33);
13554         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
13555         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
13556         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
13557         return tag_ptr(ret_conv, true);
13558 }
13559
13560 void  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
13561         if (!ptr_is_owned(_res)) return;
13562         void* _res_ptr = untag_ptr(_res);
13563         CHECK_ACCESS(_res_ptr);
13564         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
13565         FREE(untag_ptr(_res));
13566         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
13567 }
13568
13569 void  __attribute__((export_name("TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
13570         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
13571         _res_constr.datalen = _res->arr_len;
13572         if (_res_constr.datalen > 0)
13573                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
13574         else
13575                 _res_constr.data = NULL;
13576         uint64_t* _res_vals = _res->elems;
13577         for (size_t x = 0; x < _res_constr.datalen; x++) {
13578                 uint64_t _res_conv_49 = _res_vals[x];
13579                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
13580                 CHECK_ACCESS(_res_conv_49_ptr);
13581                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
13582                 FREE(untag_ptr(_res_conv_49));
13583                 _res_constr.data[x] = _res_conv_49_conv;
13584         }
13585         FREE(_res);
13586         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
13587 }
13588
13589 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
13590         LDKFixedPenaltyScorer o_conv;
13591         o_conv.inner = untag_ptr(o);
13592         o_conv.is_owned = ptr_is_owned(o);
13593         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13594         o_conv = FixedPenaltyScorer_clone(&o_conv);
13595         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13596         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
13597         return tag_ptr(ret_conv, true);
13598 }
13599
13600 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
13601         void* e_ptr = untag_ptr(e);
13602         CHECK_ACCESS(e_ptr);
13603         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13604         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13605         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13606         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
13607         return tag_ptr(ret_conv, true);
13608 }
13609
13610 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
13611         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
13612         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
13613         return ret_conv;
13614 }
13615
13616 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
13617         if (!ptr_is_owned(_res)) return;
13618         void* _res_ptr = untag_ptr(_res);
13619         CHECK_ACCESS(_res_ptr);
13620         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
13621         FREE(untag_ptr(_res));
13622         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
13623 }
13624
13625 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
13626         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13627         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
13628         return tag_ptr(ret_conv, true);
13629 }
13630 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
13631         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
13632         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
13633         return ret_conv;
13634 }
13635
13636 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
13637         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
13638         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13639         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
13640         return tag_ptr(ret_conv, true);
13641 }
13642
13643 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
13644         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
13645         *ret_conv = C2Tuple_u64u64Z_clone(arg);
13646         return tag_ptr(ret_conv, true);
13647 }
13648 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
13649         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
13650         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
13651         return ret_conv;
13652 }
13653
13654 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
13655         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
13656         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
13657         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
13658         return tag_ptr(ret_conv, true);
13659 }
13660
13661 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
13662         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
13663         *ret_conv = C2Tuple_u64u64Z_new(a, b);
13664         return tag_ptr(ret_conv, true);
13665 }
13666
13667 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
13668         if (!ptr_is_owned(_res)) return;
13669         void* _res_ptr = untag_ptr(_res);
13670         CHECK_ACCESS(_res_ptr);
13671         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
13672         FREE(untag_ptr(_res));
13673         C2Tuple_u64u64Z_free(_res_conv);
13674 }
13675
13676 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
13677         void* o_ptr = untag_ptr(o);
13678         CHECK_ACCESS(o_ptr);
13679         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
13680         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
13681         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
13682         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
13683         uint64_t ret_ref = tag_ptr(ret_copy, true);
13684         return ret_ref;
13685 }
13686
13687 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
13688         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
13689         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
13690         uint64_t ret_ref = tag_ptr(ret_copy, true);
13691         return ret_ref;
13692 }
13693
13694 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
13695         if (!ptr_is_owned(_res)) return;
13696         void* _res_ptr = untag_ptr(_res);
13697         CHECK_ACCESS(_res_ptr);
13698         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
13699         FREE(untag_ptr(_res));
13700         COption_C2Tuple_u64u64ZZ_free(_res_conv);
13701 }
13702
13703 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
13704         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
13705         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
13706         uint64_t ret_ref = tag_ptr(ret_copy, true);
13707         return ret_ref;
13708 }
13709 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
13710         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
13711         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
13712         return ret_conv;
13713 }
13714
13715 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
13716         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
13717         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
13718         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
13719         uint64_t ret_ref = tag_ptr(ret_copy, true);
13720         return ret_ref;
13721 }
13722
13723 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
13724         LDKCVec_NodeIdZ _res_constr;
13725         _res_constr.datalen = _res->arr_len;
13726         if (_res_constr.datalen > 0)
13727                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
13728         else
13729                 _res_constr.data = NULL;
13730         uint64_t* _res_vals = _res->elems;
13731         for (size_t i = 0; i < _res_constr.datalen; i++) {
13732                 uint64_t _res_conv_8 = _res_vals[i];
13733                 LDKNodeId _res_conv_8_conv;
13734                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
13735                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
13736                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
13737                 _res_constr.data[i] = _res_conv_8_conv;
13738         }
13739         FREE(_res);
13740         CVec_NodeIdZ_free(_res_constr);
13741 }
13742
13743 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
13744         LDKProbabilisticScorer o_conv;
13745         o_conv.inner = untag_ptr(o);
13746         o_conv.is_owned = ptr_is_owned(o);
13747         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13748         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
13749         
13750         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
13751         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
13752         return tag_ptr(ret_conv, true);
13753 }
13754
13755 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
13756         void* e_ptr = untag_ptr(e);
13757         CHECK_ACCESS(e_ptr);
13758         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13759         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13760         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
13761         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
13762         return tag_ptr(ret_conv, true);
13763 }
13764
13765 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
13766         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
13767         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
13768         return ret_conv;
13769 }
13770
13771 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
13772         if (!ptr_is_owned(_res)) return;
13773         void* _res_ptr = untag_ptr(_res);
13774         CHECK_ACCESS(_res_ptr);
13775         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
13776         FREE(untag_ptr(_res));
13777         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
13778 }
13779
13780 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
13781         LDKInitFeatures o_conv;
13782         o_conv.inner = untag_ptr(o);
13783         o_conv.is_owned = ptr_is_owned(o);
13784         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13785         o_conv = InitFeatures_clone(&o_conv);
13786         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13787         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
13788         return tag_ptr(ret_conv, true);
13789 }
13790
13791 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
13792         void* e_ptr = untag_ptr(e);
13793         CHECK_ACCESS(e_ptr);
13794         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13795         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13796         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13797         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
13798         return tag_ptr(ret_conv, true);
13799 }
13800
13801 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
13802         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
13803         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
13804         return ret_conv;
13805 }
13806
13807 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
13808         if (!ptr_is_owned(_res)) return;
13809         void* _res_ptr = untag_ptr(_res);
13810         CHECK_ACCESS(_res_ptr);
13811         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
13812         FREE(untag_ptr(_res));
13813         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
13814 }
13815
13816 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13817         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13818         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
13819         return tag_ptr(ret_conv, true);
13820 }
13821 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
13822         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
13823         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13824         return ret_conv;
13825 }
13826
13827 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
13828         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
13829         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13830         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
13831         return tag_ptr(ret_conv, true);
13832 }
13833
13834 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
13835         LDKChannelFeatures o_conv;
13836         o_conv.inner = untag_ptr(o);
13837         o_conv.is_owned = ptr_is_owned(o);
13838         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13839         o_conv = ChannelFeatures_clone(&o_conv);
13840         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13841         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
13842         return tag_ptr(ret_conv, true);
13843 }
13844
13845 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
13846         void* e_ptr = untag_ptr(e);
13847         CHECK_ACCESS(e_ptr);
13848         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13849         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13850         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13851         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
13852         return tag_ptr(ret_conv, true);
13853 }
13854
13855 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
13856         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
13857         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
13858         return ret_conv;
13859 }
13860
13861 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
13862         if (!ptr_is_owned(_res)) return;
13863         void* _res_ptr = untag_ptr(_res);
13864         CHECK_ACCESS(_res_ptr);
13865         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
13866         FREE(untag_ptr(_res));
13867         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
13868 }
13869
13870 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13871         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13872         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
13873         return tag_ptr(ret_conv, true);
13874 }
13875 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
13876         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
13877         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13878         return ret_conv;
13879 }
13880
13881 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
13882         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
13883         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13884         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
13885         return tag_ptr(ret_conv, true);
13886 }
13887
13888 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
13889         LDKNodeFeatures o_conv;
13890         o_conv.inner = untag_ptr(o);
13891         o_conv.is_owned = ptr_is_owned(o);
13892         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13893         o_conv = NodeFeatures_clone(&o_conv);
13894         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13895         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
13896         return tag_ptr(ret_conv, true);
13897 }
13898
13899 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
13900         void* e_ptr = untag_ptr(e);
13901         CHECK_ACCESS(e_ptr);
13902         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13903         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13904         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13905         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
13906         return tag_ptr(ret_conv, true);
13907 }
13908
13909 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
13910         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
13911         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
13912         return ret_conv;
13913 }
13914
13915 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
13916         if (!ptr_is_owned(_res)) return;
13917         void* _res_ptr = untag_ptr(_res);
13918         CHECK_ACCESS(_res_ptr);
13919         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
13920         FREE(untag_ptr(_res));
13921         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
13922 }
13923
13924 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13925         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13926         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
13927         return tag_ptr(ret_conv, true);
13928 }
13929 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
13930         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
13931         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13932         return ret_conv;
13933 }
13934
13935 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
13936         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
13937         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13938         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
13939         return tag_ptr(ret_conv, true);
13940 }
13941
13942 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
13943         LDKInvoiceFeatures o_conv;
13944         o_conv.inner = untag_ptr(o);
13945         o_conv.is_owned = ptr_is_owned(o);
13946         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13947         o_conv = InvoiceFeatures_clone(&o_conv);
13948         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13949         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
13950         return tag_ptr(ret_conv, true);
13951 }
13952
13953 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
13954         void* e_ptr = untag_ptr(e);
13955         CHECK_ACCESS(e_ptr);
13956         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13957         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13958         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13959         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
13960         return tag_ptr(ret_conv, true);
13961 }
13962
13963 jboolean  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
13964         LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
13965         jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
13966         return ret_conv;
13967 }
13968
13969 void  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
13970         if (!ptr_is_owned(_res)) return;
13971         void* _res_ptr = untag_ptr(_res);
13972         CHECK_ACCESS(_res_ptr);
13973         LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
13974         FREE(untag_ptr(_res));
13975         CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
13976 }
13977
13978 static inline uint64_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13979         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13980         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
13981         return tag_ptr(ret_conv, true);
13982 }
13983 int64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
13984         LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
13985         int64_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13986         return ret_conv;
13987 }
13988
13989 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
13990         LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
13991         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13992         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
13993         return tag_ptr(ret_conv, true);
13994 }
13995
13996 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
13997         LDKChannelTypeFeatures o_conv;
13998         o_conv.inner = untag_ptr(o);
13999         o_conv.is_owned = ptr_is_owned(o);
14000         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14001         o_conv = ChannelTypeFeatures_clone(&o_conv);
14002         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14003         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
14004         return tag_ptr(ret_conv, true);
14005 }
14006
14007 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
14008         void* e_ptr = untag_ptr(e);
14009         CHECK_ACCESS(e_ptr);
14010         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14011         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14012         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14013         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
14014         return tag_ptr(ret_conv, true);
14015 }
14016
14017 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14018         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
14019         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
14020         return ret_conv;
14021 }
14022
14023 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
14024         if (!ptr_is_owned(_res)) return;
14025         void* _res_ptr = untag_ptr(_res);
14026         CHECK_ACCESS(_res_ptr);
14027         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
14028         FREE(untag_ptr(_res));
14029         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
14030 }
14031
14032 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14033         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14034         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
14035         return tag_ptr(ret_conv, true);
14036 }
14037 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14038         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
14039         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14040         return ret_conv;
14041 }
14042
14043 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
14044         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
14045         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14046         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
14047         return tag_ptr(ret_conv, true);
14048 }
14049
14050 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
14051         LDKNodeId o_conv;
14052         o_conv.inner = untag_ptr(o);
14053         o_conv.is_owned = ptr_is_owned(o);
14054         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14055         o_conv = NodeId_clone(&o_conv);
14056         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14057         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
14058         return tag_ptr(ret_conv, true);
14059 }
14060
14061 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
14062         void* e_ptr = untag_ptr(e);
14063         CHECK_ACCESS(e_ptr);
14064         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14065         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14066         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14067         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
14068         return tag_ptr(ret_conv, true);
14069 }
14070
14071 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
14072         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
14073         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
14074         return ret_conv;
14075 }
14076
14077 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
14078         if (!ptr_is_owned(_res)) return;
14079         void* _res_ptr = untag_ptr(_res);
14080         CHECK_ACCESS(_res_ptr);
14081         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
14082         FREE(untag_ptr(_res));
14083         CResult_NodeIdDecodeErrorZ_free(_res_conv);
14084 }
14085
14086 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
14087         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14088         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
14089         return tag_ptr(ret_conv, true);
14090 }
14091 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
14092         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
14093         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
14094         return ret_conv;
14095 }
14096
14097 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
14098         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
14099         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14100         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
14101         return tag_ptr(ret_conv, true);
14102 }
14103
14104 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
14105         void* o_ptr = untag_ptr(o);
14106         CHECK_ACCESS(o_ptr);
14107         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
14108         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
14109         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14110         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
14111         return tag_ptr(ret_conv, true);
14112 }
14113
14114 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
14115         void* e_ptr = untag_ptr(e);
14116         CHECK_ACCESS(e_ptr);
14117         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14118         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14119         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14120         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
14121         return tag_ptr(ret_conv, true);
14122 }
14123
14124 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
14125         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
14126         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
14127         return ret_conv;
14128 }
14129
14130 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
14131         if (!ptr_is_owned(_res)) return;
14132         void* _res_ptr = untag_ptr(_res);
14133         CHECK_ACCESS(_res_ptr);
14134         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
14135         FREE(untag_ptr(_res));
14136         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
14137 }
14138
14139 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
14140         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14141         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
14142         return tag_ptr(ret_conv, true);
14143 }
14144 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
14145         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
14146         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
14147         return ret_conv;
14148 }
14149
14150 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
14151         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
14152         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14153         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
14154         return tag_ptr(ret_conv, true);
14155 }
14156
14157 uint64_t  __attribute__((export_name("TS_COption_AccessZ_some"))) TS_COption_AccessZ_some(uint64_t o) {
14158         void* o_ptr = untag_ptr(o);
14159         CHECK_ACCESS(o_ptr);
14160         LDKAccess o_conv = *(LDKAccess*)(o_ptr);
14161         if (o_conv.free == LDKAccess_JCalls_free) {
14162                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14163                 LDKAccess_JCalls_cloned(&o_conv);
14164         }
14165         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
14166         *ret_copy = COption_AccessZ_some(o_conv);
14167         uint64_t ret_ref = tag_ptr(ret_copy, true);
14168         return ret_ref;
14169 }
14170
14171 uint64_t  __attribute__((export_name("TS_COption_AccessZ_none"))) TS_COption_AccessZ_none() {
14172         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
14173         *ret_copy = COption_AccessZ_none();
14174         uint64_t ret_ref = tag_ptr(ret_copy, true);
14175         return ret_ref;
14176 }
14177
14178 void  __attribute__((export_name("TS_COption_AccessZ_free"))) TS_COption_AccessZ_free(uint64_t _res) {
14179         if (!ptr_is_owned(_res)) return;
14180         void* _res_ptr = untag_ptr(_res);
14181         CHECK_ACCESS(_res_ptr);
14182         LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
14183         FREE(untag_ptr(_res));
14184         COption_AccessZ_free(_res_conv);
14185 }
14186
14187 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
14188         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14189         *ret_conv = CResult_boolLightningErrorZ_ok(o);
14190         return tag_ptr(ret_conv, true);
14191 }
14192
14193 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
14194         LDKLightningError e_conv;
14195         e_conv.inner = untag_ptr(e);
14196         e_conv.is_owned = ptr_is_owned(e);
14197         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14198         e_conv = LightningError_clone(&e_conv);
14199         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14200         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
14201         return tag_ptr(ret_conv, true);
14202 }
14203
14204 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
14205         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
14206         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
14207         return ret_conv;
14208 }
14209
14210 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
14211         if (!ptr_is_owned(_res)) return;
14212         void* _res_ptr = untag_ptr(_res);
14213         CHECK_ACCESS(_res_ptr);
14214         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
14215         FREE(untag_ptr(_res));
14216         CResult_boolLightningErrorZ_free(_res_conv);
14217 }
14218
14219 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
14220         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14221         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
14222         return tag_ptr(ret_conv, true);
14223 }
14224 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
14225         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
14226         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
14227         return ret_conv;
14228 }
14229
14230 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
14231         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
14232         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14233         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
14234         return tag_ptr(ret_conv, true);
14235 }
14236
14237 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
14238         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
14239         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
14240         return tag_ptr(ret_conv, true);
14241 }
14242 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
14243         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
14244         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
14245         return ret_conv;
14246 }
14247
14248 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
14249         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
14250         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
14251         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
14252         return tag_ptr(ret_conv, true);
14253 }
14254
14255 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
14256         LDKChannelAnnouncement a_conv;
14257         a_conv.inner = untag_ptr(a);
14258         a_conv.is_owned = ptr_is_owned(a);
14259         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
14260         a_conv = ChannelAnnouncement_clone(&a_conv);
14261         LDKChannelUpdate b_conv;
14262         b_conv.inner = untag_ptr(b);
14263         b_conv.is_owned = ptr_is_owned(b);
14264         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
14265         b_conv = ChannelUpdate_clone(&b_conv);
14266         LDKChannelUpdate c_conv;
14267         c_conv.inner = untag_ptr(c);
14268         c_conv.is_owned = ptr_is_owned(c);
14269         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
14270         c_conv = ChannelUpdate_clone(&c_conv);
14271         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
14272         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
14273         return tag_ptr(ret_conv, true);
14274 }
14275
14276 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
14277         if (!ptr_is_owned(_res)) return;
14278         void* _res_ptr = untag_ptr(_res);
14279         CHECK_ACCESS(_res_ptr);
14280         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
14281         FREE(untag_ptr(_res));
14282         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
14283 }
14284
14285 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(uint64_t o) {
14286         void* o_ptr = untag_ptr(o);
14287         CHECK_ACCESS(o_ptr);
14288         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
14289         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
14290         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14291         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
14292         uint64_t ret_ref = tag_ptr(ret_copy, true);
14293         return ret_ref;
14294 }
14295
14296 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
14297         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14298         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
14299         uint64_t ret_ref = tag_ptr(ret_copy, true);
14300         return ret_ref;
14301 }
14302
14303 void  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_t _res) {
14304         if (!ptr_is_owned(_res)) return;
14305         void* _res_ptr = untag_ptr(_res);
14306         CHECK_ACCESS(_res_ptr);
14307         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
14308         FREE(untag_ptr(_res));
14309         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
14310 }
14311
14312 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
14313         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14314         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
14315         uint64_t ret_ref = tag_ptr(ret_copy, true);
14316         return ret_ref;
14317 }
14318 int64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(uint64_t arg) {
14319         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
14320         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
14321         return ret_conv;
14322 }
14323
14324 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(uint64_t orig) {
14325         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
14326         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14327         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
14328         uint64_t ret_ref = tag_ptr(ret_copy, true);
14329         return ret_ref;
14330 }
14331
14332 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
14333         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14334         *ret_conv = CResult_NoneLightningErrorZ_ok();
14335         return tag_ptr(ret_conv, true);
14336 }
14337
14338 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
14339         LDKLightningError e_conv;
14340         e_conv.inner = untag_ptr(e);
14341         e_conv.is_owned = ptr_is_owned(e);
14342         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14343         e_conv = LightningError_clone(&e_conv);
14344         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14345         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
14346         return tag_ptr(ret_conv, true);
14347 }
14348
14349 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
14350         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
14351         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
14352         return ret_conv;
14353 }
14354
14355 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
14356         if (!ptr_is_owned(_res)) return;
14357         void* _res_ptr = untag_ptr(_res);
14358         CHECK_ACCESS(_res_ptr);
14359         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
14360         FREE(untag_ptr(_res));
14361         CResult_NoneLightningErrorZ_free(_res_conv);
14362 }
14363
14364 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
14365         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14366         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
14367         return tag_ptr(ret_conv, true);
14368 }
14369 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
14370         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
14371         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
14372         return ret_conv;
14373 }
14374
14375 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
14376         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
14377         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14378         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
14379         return tag_ptr(ret_conv, true);
14380 }
14381
14382 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
14383         LDKChannelUpdateInfo o_conv;
14384         o_conv.inner = untag_ptr(o);
14385         o_conv.is_owned = ptr_is_owned(o);
14386         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14387         o_conv = ChannelUpdateInfo_clone(&o_conv);
14388         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
14389         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
14390         return tag_ptr(ret_conv, true);
14391 }
14392
14393 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
14394         void* e_ptr = untag_ptr(e);
14395         CHECK_ACCESS(e_ptr);
14396         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14397         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14398         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
14399         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
14400         return tag_ptr(ret_conv, true);
14401 }
14402
14403 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
14404         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
14405         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
14406         return ret_conv;
14407 }
14408
14409 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
14410         if (!ptr_is_owned(_res)) return;
14411         void* _res_ptr = untag_ptr(_res);
14412         CHECK_ACCESS(_res_ptr);
14413         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
14414         FREE(untag_ptr(_res));
14415         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
14416 }
14417
14418 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
14419         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
14420         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
14421         return tag_ptr(ret_conv, true);
14422 }
14423 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
14424         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
14425         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
14426         return ret_conv;
14427 }
14428
14429 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
14430         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
14431         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
14432         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
14433         return tag_ptr(ret_conv, true);
14434 }
14435
14436 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
14437         LDKChannelInfo o_conv;
14438         o_conv.inner = untag_ptr(o);
14439         o_conv.is_owned = ptr_is_owned(o);
14440         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14441         o_conv = ChannelInfo_clone(&o_conv);
14442         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14443         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
14444         return tag_ptr(ret_conv, true);
14445 }
14446
14447 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
14448         void* e_ptr = untag_ptr(e);
14449         CHECK_ACCESS(e_ptr);
14450         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14451         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14452         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14453         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
14454         return tag_ptr(ret_conv, true);
14455 }
14456
14457 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
14458         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
14459         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
14460         return ret_conv;
14461 }
14462
14463 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
14464         if (!ptr_is_owned(_res)) return;
14465         void* _res_ptr = untag_ptr(_res);
14466         CHECK_ACCESS(_res_ptr);
14467         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
14468         FREE(untag_ptr(_res));
14469         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
14470 }
14471
14472 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
14473         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14474         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
14475         return tag_ptr(ret_conv, true);
14476 }
14477 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
14478         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
14479         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
14480         return ret_conv;
14481 }
14482
14483 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
14484         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
14485         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14486         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
14487         return tag_ptr(ret_conv, true);
14488 }
14489
14490 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
14491         LDKRoutingFees o_conv;
14492         o_conv.inner = untag_ptr(o);
14493         o_conv.is_owned = ptr_is_owned(o);
14494         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14495         o_conv = RoutingFees_clone(&o_conv);
14496         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14497         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
14498         return tag_ptr(ret_conv, true);
14499 }
14500
14501 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
14502         void* e_ptr = untag_ptr(e);
14503         CHECK_ACCESS(e_ptr);
14504         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14505         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14506         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14507         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
14508         return tag_ptr(ret_conv, true);
14509 }
14510
14511 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
14512         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
14513         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
14514         return ret_conv;
14515 }
14516
14517 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
14518         if (!ptr_is_owned(_res)) return;
14519         void* _res_ptr = untag_ptr(_res);
14520         CHECK_ACCESS(_res_ptr);
14521         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
14522         FREE(untag_ptr(_res));
14523         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
14524 }
14525
14526 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
14527         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14528         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
14529         return tag_ptr(ret_conv, true);
14530 }
14531 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
14532         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
14533         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
14534         return ret_conv;
14535 }
14536
14537 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
14538         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
14539         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14540         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
14541         return tag_ptr(ret_conv, true);
14542 }
14543
14544 void  __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint64_tArray _res) {
14545         LDKCVec_NetAddressZ _res_constr;
14546         _res_constr.datalen = _res->arr_len;
14547         if (_res_constr.datalen > 0)
14548                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14549         else
14550                 _res_constr.data = NULL;
14551         uint64_t* _res_vals = _res->elems;
14552         for (size_t m = 0; m < _res_constr.datalen; m++) {
14553                 uint64_t _res_conv_12 = _res_vals[m];
14554                 void* _res_conv_12_ptr = untag_ptr(_res_conv_12);
14555                 CHECK_ACCESS(_res_conv_12_ptr);
14556                 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
14557                 FREE(untag_ptr(_res_conv_12));
14558                 _res_constr.data[m] = _res_conv_12_conv;
14559         }
14560         FREE(_res);
14561         CVec_NetAddressZ_free(_res_constr);
14562 }
14563
14564 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
14565         LDKNodeAnnouncementInfo o_conv;
14566         o_conv.inner = untag_ptr(o);
14567         o_conv.is_owned = ptr_is_owned(o);
14568         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14569         o_conv = NodeAnnouncementInfo_clone(&o_conv);
14570         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14571         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
14572         return tag_ptr(ret_conv, true);
14573 }
14574
14575 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
14576         void* e_ptr = untag_ptr(e);
14577         CHECK_ACCESS(e_ptr);
14578         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14579         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14580         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14581         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
14582         return tag_ptr(ret_conv, true);
14583 }
14584
14585 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
14586         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
14587         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
14588         return ret_conv;
14589 }
14590
14591 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
14592         if (!ptr_is_owned(_res)) return;
14593         void* _res_ptr = untag_ptr(_res);
14594         CHECK_ACCESS(_res_ptr);
14595         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
14596         FREE(untag_ptr(_res));
14597         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
14598 }
14599
14600 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
14601         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14602         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
14603         return tag_ptr(ret_conv, true);
14604 }
14605 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
14606         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
14607         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
14608         return ret_conv;
14609 }
14610
14611 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
14612         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
14613         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14614         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
14615         return tag_ptr(ret_conv, true);
14616 }
14617
14618 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
14619         LDKNodeAlias o_conv;
14620         o_conv.inner = untag_ptr(o);
14621         o_conv.is_owned = ptr_is_owned(o);
14622         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14623         o_conv = NodeAlias_clone(&o_conv);
14624         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
14625         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
14626         return tag_ptr(ret_conv, true);
14627 }
14628
14629 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
14630         void* e_ptr = untag_ptr(e);
14631         CHECK_ACCESS(e_ptr);
14632         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14633         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14634         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
14635         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
14636         return tag_ptr(ret_conv, true);
14637 }
14638
14639 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
14640         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
14641         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
14642         return ret_conv;
14643 }
14644
14645 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
14646         if (!ptr_is_owned(_res)) return;
14647         void* _res_ptr = untag_ptr(_res);
14648         CHECK_ACCESS(_res_ptr);
14649         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
14650         FREE(untag_ptr(_res));
14651         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
14652 }
14653
14654 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
14655         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
14656         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
14657         return tag_ptr(ret_conv, true);
14658 }
14659 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
14660         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
14661         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
14662         return ret_conv;
14663 }
14664
14665 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
14666         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
14667         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
14668         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
14669         return tag_ptr(ret_conv, true);
14670 }
14671
14672 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
14673         LDKNodeInfo o_conv;
14674         o_conv.inner = untag_ptr(o);
14675         o_conv.is_owned = ptr_is_owned(o);
14676         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14677         o_conv = NodeInfo_clone(&o_conv);
14678         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14679         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
14680         return tag_ptr(ret_conv, true);
14681 }
14682
14683 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
14684         void* e_ptr = untag_ptr(e);
14685         CHECK_ACCESS(e_ptr);
14686         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14687         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14688         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14689         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
14690         return tag_ptr(ret_conv, true);
14691 }
14692
14693 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
14694         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
14695         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
14696         return ret_conv;
14697 }
14698
14699 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
14700         if (!ptr_is_owned(_res)) return;
14701         void* _res_ptr = untag_ptr(_res);
14702         CHECK_ACCESS(_res_ptr);
14703         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
14704         FREE(untag_ptr(_res));
14705         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
14706 }
14707
14708 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
14709         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14710         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
14711         return tag_ptr(ret_conv, true);
14712 }
14713 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
14714         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
14715         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
14716         return ret_conv;
14717 }
14718
14719 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
14720         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
14721         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14722         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
14723         return tag_ptr(ret_conv, true);
14724 }
14725
14726 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
14727         LDKNetworkGraph o_conv;
14728         o_conv.inner = untag_ptr(o);
14729         o_conv.is_owned = ptr_is_owned(o);
14730         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14731         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
14732         
14733         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14734         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
14735         return tag_ptr(ret_conv, true);
14736 }
14737
14738 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
14739         void* e_ptr = untag_ptr(e);
14740         CHECK_ACCESS(e_ptr);
14741         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14742         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14743         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14744         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
14745         return tag_ptr(ret_conv, true);
14746 }
14747
14748 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
14749         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
14750         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
14751         return ret_conv;
14752 }
14753
14754 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
14755         if (!ptr_is_owned(_res)) return;
14756         void* _res_ptr = untag_ptr(_res);
14757         CHECK_ACCESS(_res_ptr);
14758         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
14759         FREE(untag_ptr(_res));
14760         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
14761 }
14762
14763 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint64_tArray o) {
14764         LDKCVec_NetAddressZ o_constr;
14765         o_constr.datalen = o->arr_len;
14766         if (o_constr.datalen > 0)
14767                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14768         else
14769                 o_constr.data = NULL;
14770         uint64_t* o_vals = o->elems;
14771         for (size_t m = 0; m < o_constr.datalen; m++) {
14772                 uint64_t o_conv_12 = o_vals[m];
14773                 void* o_conv_12_ptr = untag_ptr(o_conv_12);
14774                 CHECK_ACCESS(o_conv_12_ptr);
14775                 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
14776                 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o_conv_12));
14777                 o_constr.data[m] = o_conv_12_conv;
14778         }
14779         FREE(o);
14780         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14781         *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
14782         uint64_t ret_ref = tag_ptr(ret_copy, true);
14783         return ret_ref;
14784 }
14785
14786 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
14787         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14788         *ret_copy = COption_CVec_NetAddressZZ_none();
14789         uint64_t ret_ref = tag_ptr(ret_copy, true);
14790         return ret_ref;
14791 }
14792
14793 void  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint64_t _res) {
14794         if (!ptr_is_owned(_res)) return;
14795         void* _res_ptr = untag_ptr(_res);
14796         CHECK_ACCESS(_res_ptr);
14797         LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
14798         FREE(untag_ptr(_res));
14799         COption_CVec_NetAddressZZ_free(_res_conv);
14800 }
14801
14802 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
14803         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14804         *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
14805         uint64_t ret_ref = tag_ptr(ret_copy, true);
14806         return ret_ref;
14807 }
14808 int64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint64_t arg) {
14809         LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(arg);
14810         int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
14811         return ret_conv;
14812 }
14813
14814 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint64_t orig) {
14815         LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(orig);
14816         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14817         *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
14818         uint64_t ret_ref = tag_ptr(ret_copy, true);
14819         return ret_ref;
14820 }
14821
14822 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
14823         LDKDelayedPaymentOutputDescriptor o_conv;
14824         o_conv.inner = untag_ptr(o);
14825         o_conv.is_owned = ptr_is_owned(o);
14826         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14827         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
14828         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14829         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14830         return tag_ptr(ret_conv, true);
14831 }
14832
14833 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
14834         void* e_ptr = untag_ptr(e);
14835         CHECK_ACCESS(e_ptr);
14836         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14837         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14838         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14839         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14840         return tag_ptr(ret_conv, true);
14841 }
14842
14843 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
14844         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
14845         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14846         return ret_conv;
14847 }
14848
14849 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
14850         if (!ptr_is_owned(_res)) return;
14851         void* _res_ptr = untag_ptr(_res);
14852         CHECK_ACCESS(_res_ptr);
14853         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14854         FREE(untag_ptr(_res));
14855         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14856 }
14857
14858 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14859         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14860         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14861         return tag_ptr(ret_conv, true);
14862 }
14863 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
14864         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
14865         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14866         return ret_conv;
14867 }
14868
14869 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
14870         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
14871         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14872         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
14873         return tag_ptr(ret_conv, true);
14874 }
14875
14876 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
14877         LDKStaticPaymentOutputDescriptor o_conv;
14878         o_conv.inner = untag_ptr(o);
14879         o_conv.is_owned = ptr_is_owned(o);
14880         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14881         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
14882         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14883         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14884         return tag_ptr(ret_conv, true);
14885 }
14886
14887 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
14888         void* e_ptr = untag_ptr(e);
14889         CHECK_ACCESS(e_ptr);
14890         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14891         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14892         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14893         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14894         return tag_ptr(ret_conv, true);
14895 }
14896
14897 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
14898         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
14899         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14900         return ret_conv;
14901 }
14902
14903 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
14904         if (!ptr_is_owned(_res)) return;
14905         void* _res_ptr = untag_ptr(_res);
14906         CHECK_ACCESS(_res_ptr);
14907         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14908         FREE(untag_ptr(_res));
14909         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14910 }
14911
14912 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14913         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14914         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14915         return tag_ptr(ret_conv, true);
14916 }
14917 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
14918         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
14919         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14920         return ret_conv;
14921 }
14922
14923 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
14924         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
14925         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14926         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
14927         return tag_ptr(ret_conv, true);
14928 }
14929
14930 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
14931         void* o_ptr = untag_ptr(o);
14932         CHECK_ACCESS(o_ptr);
14933         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
14934         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
14935         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14936         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
14937         return tag_ptr(ret_conv, true);
14938 }
14939
14940 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
14941         void* e_ptr = untag_ptr(e);
14942         CHECK_ACCESS(e_ptr);
14943         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14944         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14945         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14946         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
14947         return tag_ptr(ret_conv, true);
14948 }
14949
14950 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
14951         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
14952         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14953         return ret_conv;
14954 }
14955
14956 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
14957         if (!ptr_is_owned(_res)) return;
14958         void* _res_ptr = untag_ptr(_res);
14959         CHECK_ACCESS(_res_ptr);
14960         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
14961         FREE(untag_ptr(_res));
14962         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
14963 }
14964
14965 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14966         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14967         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
14968         return tag_ptr(ret_conv, true);
14969 }
14970 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
14971         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
14972         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14973         return ret_conv;
14974 }
14975
14976 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
14977         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
14978         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14979         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
14980         return tag_ptr(ret_conv, true);
14981 }
14982
14983 void  __attribute__((export_name("TS_CVec_PaymentPreimageZ_free"))) TS_CVec_PaymentPreimageZ_free(ptrArray _res) {
14984         LDKCVec_PaymentPreimageZ _res_constr;
14985         _res_constr.datalen = _res->arr_len;
14986         if (_res_constr.datalen > 0)
14987                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
14988         else
14989                 _res_constr.data = NULL;
14990         int8_tArray* _res_vals = (void*) _res->elems;
14991         for (size_t m = 0; m < _res_constr.datalen; m++) {
14992                 int8_tArray _res_conv_12 = _res_vals[m];
14993                 LDKThirtyTwoBytes _res_conv_12_ref;
14994                 CHECK(_res_conv_12->arr_len == 32);
14995                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
14996                 _res_constr.data[m] = _res_conv_12_ref;
14997         }
14998         FREE(_res);
14999         CVec_PaymentPreimageZ_free(_res_constr);
15000 }
15001
15002 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
15003         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15004         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
15005         return tag_ptr(ret_conv, true);
15006 }
15007 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint64_t arg) {
15008         LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(arg);
15009         int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
15010         return ret_conv;
15011 }
15012
15013 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint64_t orig) {
15014         LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(orig);
15015         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15016         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
15017         return tag_ptr(ret_conv, true);
15018 }
15019
15020 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
15021         LDKSignature a_ref;
15022         CHECK(a->arr_len == 64);
15023         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
15024         LDKCVec_SignatureZ b_constr;
15025         b_constr.datalen = b->arr_len;
15026         if (b_constr.datalen > 0)
15027                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15028         else
15029                 b_constr.data = NULL;
15030         int8_tArray* b_vals = (void*) b->elems;
15031         for (size_t m = 0; m < b_constr.datalen; m++) {
15032                 int8_tArray b_conv_12 = b_vals[m];
15033                 LDKSignature b_conv_12_ref;
15034                 CHECK(b_conv_12->arr_len == 64);
15035                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
15036                 b_constr.data[m] = b_conv_12_ref;
15037         }
15038         FREE(b);
15039         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15040         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
15041         return tag_ptr(ret_conv, true);
15042 }
15043
15044 void  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint64_t _res) {
15045         if (!ptr_is_owned(_res)) return;
15046         void* _res_ptr = untag_ptr(_res);
15047         CHECK_ACCESS(_res_ptr);
15048         LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
15049         FREE(untag_ptr(_res));
15050         C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
15051 }
15052
15053 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint64_t o) {
15054         void* o_ptr = untag_ptr(o);
15055         CHECK_ACCESS(o_ptr);
15056         LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
15057         o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(o));
15058         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15059         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
15060         return tag_ptr(ret_conv, true);
15061 }
15062
15063 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
15064         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15065         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
15066         return tag_ptr(ret_conv, true);
15067 }
15068
15069 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint64_t o) {
15070         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(o);
15071         jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
15072         return ret_conv;
15073 }
15074
15075 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint64_t _res) {
15076         if (!ptr_is_owned(_res)) return;
15077         void* _res_ptr = untag_ptr(_res);
15078         CHECK_ACCESS(_res_ptr);
15079         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
15080         FREE(untag_ptr(_res));
15081         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
15082 }
15083
15084 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
15085         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15086         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
15087         return tag_ptr(ret_conv, true);
15088 }
15089 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint64_t arg) {
15090         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(arg);
15091         int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
15092         return ret_conv;
15093 }
15094
15095 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint64_t orig) {
15096         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(orig);
15097         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15098         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
15099         return tag_ptr(ret_conv, true);
15100 }
15101
15102 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
15103         LDKSignature o_ref;
15104         CHECK(o->arr_len == 64);
15105         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
15106         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15107         *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
15108         return tag_ptr(ret_conv, true);
15109 }
15110
15111 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
15112         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15113         *ret_conv = CResult_SignatureNoneZ_err();
15114         return tag_ptr(ret_conv, true);
15115 }
15116
15117 jboolean  __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint64_t o) {
15118         LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(o);
15119         jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
15120         return ret_conv;
15121 }
15122
15123 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint64_t _res) {
15124         if (!ptr_is_owned(_res)) return;
15125         void* _res_ptr = untag_ptr(_res);
15126         CHECK_ACCESS(_res_ptr);
15127         LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
15128         FREE(untag_ptr(_res));
15129         CResult_SignatureNoneZ_free(_res_conv);
15130 }
15131
15132 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
15133         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15134         *ret_conv = CResult_SignatureNoneZ_clone(arg);
15135         return tag_ptr(ret_conv, true);
15136 }
15137 int64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint64_t arg) {
15138         LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(arg);
15139         int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
15140         return ret_conv;
15141 }
15142
15143 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint64_t orig) {
15144         LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(orig);
15145         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15146         *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
15147         return tag_ptr(ret_conv, true);
15148 }
15149
15150 static inline uint64_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
15151         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
15152         *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
15153         return tag_ptr(ret_conv, true);
15154 }
15155 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone_ptr"))) TS_C2Tuple_SignatureSignatureZ_clone_ptr(uint64_t arg) {
15156         LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(arg);
15157         int64_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
15158         return ret_conv;
15159 }
15160
15161 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone"))) TS_C2Tuple_SignatureSignatureZ_clone(uint64_t orig) {
15162         LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(orig);
15163         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
15164         *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
15165         return tag_ptr(ret_conv, true);
15166 }
15167
15168 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_new"))) TS_C2Tuple_SignatureSignatureZ_new(int8_tArray a, int8_tArray b) {
15169         LDKSignature a_ref;
15170         CHECK(a->arr_len == 64);
15171         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
15172         LDKSignature b_ref;
15173         CHECK(b->arr_len == 64);
15174         memcpy(b_ref.compact_form, b->elems, 64); FREE(b);
15175         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
15176         *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
15177         return tag_ptr(ret_conv, true);
15178 }
15179
15180 void  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_free"))) TS_C2Tuple_SignatureSignatureZ_free(uint64_t _res) {
15181         if (!ptr_is_owned(_res)) return;
15182         void* _res_ptr = untag_ptr(_res);
15183         CHECK_ACCESS(_res_ptr);
15184         LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
15185         FREE(untag_ptr(_res));
15186         C2Tuple_SignatureSignatureZ_free(_res_conv);
15187 }
15188
15189 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok(uint64_t o) {
15190         void* o_ptr = untag_ptr(o);
15191         CHECK_ACCESS(o_ptr);
15192         LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
15193         o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)untag_ptr(o));
15194         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15195         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
15196         return tag_ptr(ret_conv, true);
15197 }
15198
15199 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err() {
15200         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15201         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
15202         return tag_ptr(ret_conv, true);
15203 }
15204
15205 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(uint64_t o) {
15206         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(o);
15207         jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
15208         return ret_conv;
15209 }
15210
15211 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free(uint64_t _res) {
15212         if (!ptr_is_owned(_res)) return;
15213         void* _res_ptr = untag_ptr(_res);
15214         CHECK_ACCESS(_res_ptr);
15215         LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
15216         FREE(untag_ptr(_res));
15217         CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
15218 }
15219
15220 static inline uint64_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
15221         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15222         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
15223         return tag_ptr(ret_conv, true);
15224 }
15225 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(uint64_t arg) {
15226         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(arg);
15227         int64_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
15228         return ret_conv;
15229 }
15230
15231 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone(uint64_t orig) {
15232         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(orig);
15233         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15234         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
15235         return tag_ptr(ret_conv, true);
15236 }
15237
15238 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_ok"))) TS_CResult_SecretKeyNoneZ_ok(int8_tArray o) {
15239         LDKSecretKey o_ref;
15240         CHECK(o->arr_len == 32);
15241         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
15242         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15243         *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
15244         return tag_ptr(ret_conv, true);
15245 }
15246
15247 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_err"))) TS_CResult_SecretKeyNoneZ_err() {
15248         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15249         *ret_conv = CResult_SecretKeyNoneZ_err();
15250         return tag_ptr(ret_conv, true);
15251 }
15252
15253 jboolean  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_is_ok"))) TS_CResult_SecretKeyNoneZ_is_ok(uint64_t o) {
15254         LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(o);
15255         jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv);
15256         return ret_conv;
15257 }
15258
15259 void  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_free"))) TS_CResult_SecretKeyNoneZ_free(uint64_t _res) {
15260         if (!ptr_is_owned(_res)) return;
15261         void* _res_ptr = untag_ptr(_res);
15262         CHECK_ACCESS(_res_ptr);
15263         LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
15264         FREE(untag_ptr(_res));
15265         CResult_SecretKeyNoneZ_free(_res_conv);
15266 }
15267
15268 static inline uint64_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
15269         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15270         *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
15271         return tag_ptr(ret_conv, true);
15272 }
15273 int64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone_ptr"))) TS_CResult_SecretKeyNoneZ_clone_ptr(uint64_t arg) {
15274         LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(arg);
15275         int64_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
15276         return ret_conv;
15277 }
15278
15279 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone"))) TS_CResult_SecretKeyNoneZ_clone(uint64_t orig) {
15280         LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(orig);
15281         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15282         *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
15283         return tag_ptr(ret_conv, true);
15284 }
15285
15286 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_ok"))) TS_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
15287         LDKPublicKey o_ref;
15288         CHECK(o->arr_len == 33);
15289         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
15290         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15291         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
15292         return tag_ptr(ret_conv, true);
15293 }
15294
15295 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_err"))) TS_CResult_PublicKeyNoneZ_err() {
15296         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15297         *ret_conv = CResult_PublicKeyNoneZ_err();
15298         return tag_ptr(ret_conv, true);
15299 }
15300
15301 jboolean  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_is_ok"))) TS_CResult_PublicKeyNoneZ_is_ok(uint64_t o) {
15302         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
15303         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
15304         return ret_conv;
15305 }
15306
15307 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_free"))) TS_CResult_PublicKeyNoneZ_free(uint64_t _res) {
15308         if (!ptr_is_owned(_res)) return;
15309         void* _res_ptr = untag_ptr(_res);
15310         CHECK_ACCESS(_res_ptr);
15311         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
15312         FREE(untag_ptr(_res));
15313         CResult_PublicKeyNoneZ_free(_res_conv);
15314 }
15315
15316 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
15317         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15318         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
15319         return tag_ptr(ret_conv, true);
15320 }
15321 int64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone_ptr"))) TS_CResult_PublicKeyNoneZ_clone_ptr(uint64_t arg) {
15322         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
15323         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
15324         return ret_conv;
15325 }
15326
15327 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone"))) TS_CResult_PublicKeyNoneZ_clone(uint64_t orig) {
15328         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
15329         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15330         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
15331         return tag_ptr(ret_conv, true);
15332 }
15333
15334 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_some"))) TS_COption_ScalarZ_some(uint64_t o) {
15335         void* o_ptr = untag_ptr(o);
15336         CHECK_ACCESS(o_ptr);
15337         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
15338         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
15339         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
15340         *ret_copy = COption_ScalarZ_some(o_conv);
15341         uint64_t ret_ref = tag_ptr(ret_copy, true);
15342         return ret_ref;
15343 }
15344
15345 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_none"))) TS_COption_ScalarZ_none() {
15346         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
15347         *ret_copy = COption_ScalarZ_none();
15348         uint64_t ret_ref = tag_ptr(ret_copy, true);
15349         return ret_ref;
15350 }
15351
15352 void  __attribute__((export_name("TS_COption_ScalarZ_free"))) TS_COption_ScalarZ_free(uint64_t _res) {
15353         if (!ptr_is_owned(_res)) return;
15354         void* _res_ptr = untag_ptr(_res);
15355         CHECK_ACCESS(_res_ptr);
15356         LDKCOption_ScalarZ _res_conv = *(LDKCOption_ScalarZ*)(_res_ptr);
15357         FREE(untag_ptr(_res));
15358         COption_ScalarZ_free(_res_conv);
15359 }
15360
15361 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_ok"))) TS_CResult_SharedSecretNoneZ_ok(int8_tArray o) {
15362         LDKThirtyTwoBytes o_ref;
15363         CHECK(o->arr_len == 32);
15364         memcpy(o_ref.data, o->elems, 32); FREE(o);
15365         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
15366         *ret_conv = CResult_SharedSecretNoneZ_ok(o_ref);
15367         return tag_ptr(ret_conv, true);
15368 }
15369
15370 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_err"))) TS_CResult_SharedSecretNoneZ_err() {
15371         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
15372         *ret_conv = CResult_SharedSecretNoneZ_err();
15373         return tag_ptr(ret_conv, true);
15374 }
15375
15376 jboolean  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_is_ok"))) TS_CResult_SharedSecretNoneZ_is_ok(uint64_t o) {
15377         LDKCResult_SharedSecretNoneZ* o_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(o);
15378         jboolean ret_conv = CResult_SharedSecretNoneZ_is_ok(o_conv);
15379         return ret_conv;
15380 }
15381
15382 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_free"))) TS_CResult_SharedSecretNoneZ_free(uint64_t _res) {
15383         if (!ptr_is_owned(_res)) return;
15384         void* _res_ptr = untag_ptr(_res);
15385         CHECK_ACCESS(_res_ptr);
15386         LDKCResult_SharedSecretNoneZ _res_conv = *(LDKCResult_SharedSecretNoneZ*)(_res_ptr);
15387         FREE(untag_ptr(_res));
15388         CResult_SharedSecretNoneZ_free(_res_conv);
15389 }
15390
15391 static inline uint64_t CResult_SharedSecretNoneZ_clone_ptr(LDKCResult_SharedSecretNoneZ *NONNULL_PTR arg) {
15392         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
15393         *ret_conv = CResult_SharedSecretNoneZ_clone(arg);
15394         return tag_ptr(ret_conv, true);
15395 }
15396 int64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone_ptr"))) TS_CResult_SharedSecretNoneZ_clone_ptr(uint64_t arg) {
15397         LDKCResult_SharedSecretNoneZ* arg_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(arg);
15398         int64_t ret_conv = CResult_SharedSecretNoneZ_clone_ptr(arg_conv);
15399         return ret_conv;
15400 }
15401
15402 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone"))) TS_CResult_SharedSecretNoneZ_clone(uint64_t orig) {
15403         LDKCResult_SharedSecretNoneZ* orig_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(orig);
15404         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
15405         *ret_conv = CResult_SharedSecretNoneZ_clone(orig_conv);
15406         return tag_ptr(ret_conv, true);
15407 }
15408
15409 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_ok"))) TS_CResult_SignDecodeErrorZ_ok(uint64_t o) {
15410         void* o_ptr = untag_ptr(o);
15411         CHECK_ACCESS(o_ptr);
15412         LDKSign o_conv = *(LDKSign*)(o_ptr);
15413         if (o_conv.free == LDKSign_JCalls_free) {
15414                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15415                 LDKSign_JCalls_cloned(&o_conv);
15416         }
15417         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15418         *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
15419         return tag_ptr(ret_conv, true);
15420 }
15421
15422 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_err"))) TS_CResult_SignDecodeErrorZ_err(uint64_t e) {
15423         void* e_ptr = untag_ptr(e);
15424         CHECK_ACCESS(e_ptr);
15425         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15426         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15427         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15428         *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
15429         return tag_ptr(ret_conv, true);
15430 }
15431
15432 jboolean  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_is_ok"))) TS_CResult_SignDecodeErrorZ_is_ok(uint64_t o) {
15433         LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(o);
15434         jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv);
15435         return ret_conv;
15436 }
15437
15438 void  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_free"))) TS_CResult_SignDecodeErrorZ_free(uint64_t _res) {
15439         if (!ptr_is_owned(_res)) return;
15440         void* _res_ptr = untag_ptr(_res);
15441         CHECK_ACCESS(_res_ptr);
15442         LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
15443         FREE(untag_ptr(_res));
15444         CResult_SignDecodeErrorZ_free(_res_conv);
15445 }
15446
15447 static inline uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
15448         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15449         *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
15450         return tag_ptr(ret_conv, true);
15451 }
15452 int64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone_ptr"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint64_t arg) {
15453         LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(arg);
15454         int64_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
15455         return ret_conv;
15456 }
15457
15458 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone"))) TS_CResult_SignDecodeErrorZ_clone(uint64_t orig) {
15459         LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(orig);
15460         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15461         *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
15462         return tag_ptr(ret_conv, true);
15463 }
15464
15465 void  __attribute__((export_name("TS_CVec_u5Z_free"))) TS_CVec_u5Z_free(ptrArray _res) {
15466         LDKCVec_u5Z _res_constr;
15467         _res_constr.datalen = _res->arr_len;
15468         if (_res_constr.datalen > 0)
15469                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
15470         else
15471                 _res_constr.data = NULL;
15472         int8_t* _res_vals = (void*) _res->elems;
15473         for (size_t h = 0; h < _res_constr.datalen; h++) {
15474                 int8_t _res_conv_7 = _res_vals[h];
15475                 
15476                 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
15477         }
15478         FREE(_res);
15479         CVec_u5Z_free(_res_constr);
15480 }
15481
15482 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
15483         LDKRecoverableSignature o_ref;
15484         CHECK(o->arr_len == 68);
15485         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
15486         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15487         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
15488         return tag_ptr(ret_conv, true);
15489 }
15490
15491 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
15492         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15493         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
15494         return tag_ptr(ret_conv, true);
15495 }
15496
15497 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
15498         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
15499         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
15500         return ret_conv;
15501 }
15502
15503 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
15504         if (!ptr_is_owned(_res)) return;
15505         void* _res_ptr = untag_ptr(_res);
15506         CHECK_ACCESS(_res_ptr);
15507         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
15508         FREE(untag_ptr(_res));
15509         CResult_RecoverableSignatureNoneZ_free(_res_conv);
15510 }
15511
15512 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
15513         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15514         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
15515         return tag_ptr(ret_conv, true);
15516 }
15517 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
15518         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
15519         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
15520         return ret_conv;
15521 }
15522
15523 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
15524         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
15525         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15526         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
15527         return tag_ptr(ret_conv, true);
15528 }
15529
15530 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
15531         LDKCVec_u8Z _res_ref;
15532         _res_ref.datalen = _res->arr_len;
15533         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
15534         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
15535         CVec_u8Z_free(_res_ref);
15536 }
15537
15538 void  __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
15539         LDKCVec_CVec_u8ZZ _res_constr;
15540         _res_constr.datalen = _res->arr_len;
15541         if (_res_constr.datalen > 0)
15542                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
15543         else
15544                 _res_constr.data = NULL;
15545         int8_tArray* _res_vals = (void*) _res->elems;
15546         for (size_t m = 0; m < _res_constr.datalen; m++) {
15547                 int8_tArray _res_conv_12 = _res_vals[m];
15548                 LDKCVec_u8Z _res_conv_12_ref;
15549                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
15550                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
15551                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
15552                 _res_constr.data[m] = _res_conv_12_ref;
15553         }
15554         FREE(_res);
15555         CVec_CVec_u8ZZ_free(_res_constr);
15556 }
15557
15558 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
15559         LDKCVec_CVec_u8ZZ o_constr;
15560         o_constr.datalen = o->arr_len;
15561         if (o_constr.datalen > 0)
15562                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
15563         else
15564                 o_constr.data = NULL;
15565         int8_tArray* o_vals = (void*) o->elems;
15566         for (size_t m = 0; m < o_constr.datalen; m++) {
15567                 int8_tArray o_conv_12 = o_vals[m];
15568                 LDKCVec_u8Z o_conv_12_ref;
15569                 o_conv_12_ref.datalen = o_conv_12->arr_len;
15570                 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
15571                 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
15572                 o_constr.data[m] = o_conv_12_ref;
15573         }
15574         FREE(o);
15575         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15576         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
15577         return tag_ptr(ret_conv, true);
15578 }
15579
15580 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
15581         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15582         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
15583         return tag_ptr(ret_conv, true);
15584 }
15585
15586 jboolean  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint64_t o) {
15587         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
15588         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
15589         return ret_conv;
15590 }
15591
15592 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint64_t _res) {
15593         if (!ptr_is_owned(_res)) return;
15594         void* _res_ptr = untag_ptr(_res);
15595         CHECK_ACCESS(_res_ptr);
15596         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
15597         FREE(untag_ptr(_res));
15598         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
15599 }
15600
15601 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
15602         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15603         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
15604         return tag_ptr(ret_conv, true);
15605 }
15606 int64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint64_t arg) {
15607         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
15608         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
15609         return ret_conv;
15610 }
15611
15612 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint64_t orig) {
15613         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
15614         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15615         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
15616         return tag_ptr(ret_conv, true);
15617 }
15618
15619 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
15620         LDKInMemorySigner o_conv;
15621         o_conv.inner = untag_ptr(o);
15622         o_conv.is_owned = ptr_is_owned(o);
15623         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15624         o_conv = InMemorySigner_clone(&o_conv);
15625         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15626         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
15627         return tag_ptr(ret_conv, true);
15628 }
15629
15630 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
15631         void* e_ptr = untag_ptr(e);
15632         CHECK_ACCESS(e_ptr);
15633         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15634         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15635         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15636         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
15637         return tag_ptr(ret_conv, true);
15638 }
15639
15640 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
15641         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
15642         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
15643         return ret_conv;
15644 }
15645
15646 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
15647         if (!ptr_is_owned(_res)) return;
15648         void* _res_ptr = untag_ptr(_res);
15649         CHECK_ACCESS(_res_ptr);
15650         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
15651         FREE(untag_ptr(_res));
15652         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
15653 }
15654
15655 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
15656         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15657         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
15658         return tag_ptr(ret_conv, true);
15659 }
15660 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
15661         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
15662         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
15663         return ret_conv;
15664 }
15665
15666 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
15667         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
15668         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15669         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
15670         return tag_ptr(ret_conv, true);
15671 }
15672
15673 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
15674         LDKCVec_TxOutZ _res_constr;
15675         _res_constr.datalen = _res->arr_len;
15676         if (_res_constr.datalen > 0)
15677                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15678         else
15679                 _res_constr.data = NULL;
15680         uint64_t* _res_vals = _res->elems;
15681         for (size_t h = 0; h < _res_constr.datalen; h++) {
15682                 uint64_t _res_conv_7 = _res_vals[h];
15683                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
15684                 CHECK_ACCESS(_res_conv_7_ptr);
15685                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
15686                 FREE(untag_ptr(_res_conv_7));
15687                 _res_constr.data[h] = _res_conv_7_conv;
15688         }
15689         FREE(_res);
15690         CVec_TxOutZ_free(_res_constr);
15691 }
15692
15693 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
15694         LDKTransaction o_ref;
15695         o_ref.datalen = o->arr_len;
15696         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
15697         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
15698         o_ref.data_is_owned = true;
15699         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15700         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
15701         return tag_ptr(ret_conv, true);
15702 }
15703
15704 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
15705         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15706         *ret_conv = CResult_TransactionNoneZ_err();
15707         return tag_ptr(ret_conv, true);
15708 }
15709
15710 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
15711         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
15712         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
15713         return ret_conv;
15714 }
15715
15716 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
15717         if (!ptr_is_owned(_res)) return;
15718         void* _res_ptr = untag_ptr(_res);
15719         CHECK_ACCESS(_res_ptr);
15720         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
15721         FREE(untag_ptr(_res));
15722         CResult_TransactionNoneZ_free(_res_conv);
15723 }
15724
15725 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
15726         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15727         *ret_conv = CResult_TransactionNoneZ_clone(arg);
15728         return tag_ptr(ret_conv, true);
15729 }
15730 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
15731         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
15732         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
15733         return ret_conv;
15734 }
15735
15736 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
15737         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
15738         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15739         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
15740         return tag_ptr(ret_conv, true);
15741 }
15742
15743 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
15744         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15745         *ret_copy = COption_u16Z_some(o);
15746         uint64_t ret_ref = tag_ptr(ret_copy, true);
15747         return ret_ref;
15748 }
15749
15750 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
15751         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15752         *ret_copy = COption_u16Z_none();
15753         uint64_t ret_ref = tag_ptr(ret_copy, true);
15754         return ret_ref;
15755 }
15756
15757 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
15758         if (!ptr_is_owned(_res)) return;
15759         void* _res_ptr = untag_ptr(_res);
15760         CHECK_ACCESS(_res_ptr);
15761         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
15762         FREE(untag_ptr(_res));
15763         COption_u16Z_free(_res_conv);
15764 }
15765
15766 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
15767         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15768         *ret_copy = COption_u16Z_clone(arg);
15769         uint64_t ret_ref = tag_ptr(ret_copy, true);
15770         return ret_ref;
15771 }
15772 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
15773         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
15774         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
15775         return ret_conv;
15776 }
15777
15778 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
15779         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
15780         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15781         *ret_copy = COption_u16Z_clone(orig_conv);
15782         uint64_t ret_ref = tag_ptr(ret_copy, true);
15783         return ret_ref;
15784 }
15785
15786 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
15787         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15788         *ret_conv = CResult_NoneAPIErrorZ_ok();
15789         return tag_ptr(ret_conv, true);
15790 }
15791
15792 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
15793         void* e_ptr = untag_ptr(e);
15794         CHECK_ACCESS(e_ptr);
15795         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15796         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
15797         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15798         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
15799         return tag_ptr(ret_conv, true);
15800 }
15801
15802 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
15803         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
15804         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
15805         return ret_conv;
15806 }
15807
15808 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) {
15809         if (!ptr_is_owned(_res)) return;
15810         void* _res_ptr = untag_ptr(_res);
15811         CHECK_ACCESS(_res_ptr);
15812         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
15813         FREE(untag_ptr(_res));
15814         CResult_NoneAPIErrorZ_free(_res_conv);
15815 }
15816
15817 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
15818         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15819         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
15820         return tag_ptr(ret_conv, true);
15821 }
15822 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
15823         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
15824         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
15825         return ret_conv;
15826 }
15827
15828 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
15829         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
15830         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15831         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
15832         return tag_ptr(ret_conv, true);
15833 }
15834
15835 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
15836         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
15837         _res_constr.datalen = _res->arr_len;
15838         if (_res_constr.datalen > 0)
15839                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15840         else
15841                 _res_constr.data = NULL;
15842         uint64_t* _res_vals = _res->elems;
15843         for (size_t w = 0; w < _res_constr.datalen; w++) {
15844                 uint64_t _res_conv_22 = _res_vals[w];
15845                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
15846                 CHECK_ACCESS(_res_conv_22_ptr);
15847                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
15848                 FREE(untag_ptr(_res_conv_22));
15849                 _res_constr.data[w] = _res_conv_22_conv;
15850         }
15851         FREE(_res);
15852         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
15853 }
15854
15855 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
15856         LDKCVec_APIErrorZ _res_constr;
15857         _res_constr.datalen = _res->arr_len;
15858         if (_res_constr.datalen > 0)
15859                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
15860         else
15861                 _res_constr.data = NULL;
15862         uint64_t* _res_vals = _res->elems;
15863         for (size_t k = 0; k < _res_constr.datalen; k++) {
15864                 uint64_t _res_conv_10 = _res_vals[k];
15865                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
15866                 CHECK_ACCESS(_res_conv_10_ptr);
15867                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
15868                 FREE(untag_ptr(_res_conv_10));
15869                 _res_constr.data[k] = _res_conv_10_conv;
15870         }
15871         FREE(_res);
15872         CVec_APIErrorZ_free(_res_constr);
15873 }
15874
15875 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
15876         LDKThirtyTwoBytes o_ref;
15877         CHECK(o->arr_len == 32);
15878         memcpy(o_ref.data, o->elems, 32); FREE(o);
15879         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15880         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
15881         return tag_ptr(ret_conv, true);
15882 }
15883
15884 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint64_t e) {
15885         void* e_ptr = untag_ptr(e);
15886         CHECK_ACCESS(e_ptr);
15887         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15888         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
15889         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15890         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
15891         return tag_ptr(ret_conv, true);
15892 }
15893
15894 jboolean  __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint64_t o) {
15895         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
15896         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
15897         return ret_conv;
15898 }
15899
15900 void  __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint64_t _res) {
15901         if (!ptr_is_owned(_res)) return;
15902         void* _res_ptr = untag_ptr(_res);
15903         CHECK_ACCESS(_res_ptr);
15904         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
15905         FREE(untag_ptr(_res));
15906         CResult__u832APIErrorZ_free(_res_conv);
15907 }
15908
15909 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
15910         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15911         *ret_conv = CResult__u832APIErrorZ_clone(arg);
15912         return tag_ptr(ret_conv, true);
15913 }
15914 int64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint64_t arg) {
15915         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
15916         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
15917         return ret_conv;
15918 }
15919
15920 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint64_t orig) {
15921         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
15922         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15923         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
15924         return tag_ptr(ret_conv, true);
15925 }
15926
15927 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(int8_tArray o) {
15928         LDKThirtyTwoBytes o_ref;
15929         CHECK(o->arr_len == 32);
15930         memcpy(o_ref.data, o->elems, 32); FREE(o);
15931         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15932         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
15933         return tag_ptr(ret_conv, true);
15934 }
15935
15936 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint64_t e) {
15937         void* e_ptr = untag_ptr(e);
15938         CHECK_ACCESS(e_ptr);
15939         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15940         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
15941         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15942         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
15943         return tag_ptr(ret_conv, true);
15944 }
15945
15946 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_is_ok(uint64_t o) {
15947         LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(o);
15948         jboolean ret_conv = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
15949         return ret_conv;
15950 }
15951
15952 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_free"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint64_t _res) {
15953         if (!ptr_is_owned(_res)) return;
15954         void* _res_ptr = untag_ptr(_res);
15955         CHECK_ACCESS(_res_ptr);
15956         LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
15957         FREE(untag_ptr(_res));
15958         CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
15959 }
15960
15961 static inline uint64_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
15962         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15963         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
15964         return tag_ptr(ret_conv, true);
15965 }
15966 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr(uint64_t arg) {
15967         LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(arg);
15968         int64_t ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
15969         return ret_conv;
15970 }
15971
15972 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint64_t orig) {
15973         LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(orig);
15974         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15975         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
15976         return tag_ptr(ret_conv, true);
15977 }
15978
15979 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
15980         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15981         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
15982         return tag_ptr(ret_conv, true);
15983 }
15984
15985 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
15986         void* e_ptr = untag_ptr(e);
15987         CHECK_ACCESS(e_ptr);
15988         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15989         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
15990         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15991         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
15992         return tag_ptr(ret_conv, true);
15993 }
15994
15995 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
15996         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
15997         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
15998         return ret_conv;
15999 }
16000
16001 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
16002         if (!ptr_is_owned(_res)) return;
16003         void* _res_ptr = untag_ptr(_res);
16004         CHECK_ACCESS(_res_ptr);
16005         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
16006         FREE(untag_ptr(_res));
16007         CResult_NonePaymentSendFailureZ_free(_res_conv);
16008 }
16009
16010 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
16011         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16012         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
16013         return tag_ptr(ret_conv, true);
16014 }
16015 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
16016         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
16017         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
16018         return ret_conv;
16019 }
16020
16021 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
16022         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
16023         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16024         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
16025         return tag_ptr(ret_conv, true);
16026 }
16027
16028 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
16029         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16030         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
16031         return tag_ptr(ret_conv, true);
16032 }
16033 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint64_t arg) {
16034         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
16035         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
16036         return ret_conv;
16037 }
16038
16039 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint64_t orig) {
16040         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
16041         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16042         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
16043         return tag_ptr(ret_conv, true);
16044 }
16045
16046 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
16047         LDKThirtyTwoBytes a_ref;
16048         CHECK(a->arr_len == 32);
16049         memcpy(a_ref.data, a->elems, 32); FREE(a);
16050         LDKThirtyTwoBytes b_ref;
16051         CHECK(b->arr_len == 32);
16052         memcpy(b_ref.data, b->elems, 32); FREE(b);
16053         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16054         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
16055         return tag_ptr(ret_conv, true);
16056 }
16057
16058 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint64_t _res) {
16059         if (!ptr_is_owned(_res)) return;
16060         void* _res_ptr = untag_ptr(_res);
16061         CHECK_ACCESS(_res_ptr);
16062         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
16063         FREE(untag_ptr(_res));
16064         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
16065 }
16066
16067 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint64_t o) {
16068         void* o_ptr = untag_ptr(o);
16069         CHECK_ACCESS(o_ptr);
16070         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
16071         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
16072         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16073         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
16074         return tag_ptr(ret_conv, true);
16075 }
16076
16077 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint64_t e) {
16078         void* e_ptr = untag_ptr(e);
16079         CHECK_ACCESS(e_ptr);
16080         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
16081         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
16082         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16083         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
16084         return tag_ptr(ret_conv, true);
16085 }
16086
16087 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint64_t o) {
16088         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
16089         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
16090         return ret_conv;
16091 }
16092
16093 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint64_t _res) {
16094         if (!ptr_is_owned(_res)) return;
16095         void* _res_ptr = untag_ptr(_res);
16096         CHECK_ACCESS(_res_ptr);
16097         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
16098         FREE(untag_ptr(_res));
16099         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
16100 }
16101
16102 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
16103         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16104         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
16105         return tag_ptr(ret_conv, true);
16106 }
16107 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
16108         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
16109         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
16110         return ret_conv;
16111 }
16112
16113 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint64_t orig) {
16114         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
16115         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16116         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
16117         return tag_ptr(ret_conv, true);
16118 }
16119
16120 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
16121         LDKCVec_ThirtyTwoBytesZ _res_constr;
16122         _res_constr.datalen = _res->arr_len;
16123         if (_res_constr.datalen > 0)
16124                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
16125         else
16126                 _res_constr.data = NULL;
16127         int8_tArray* _res_vals = (void*) _res->elems;
16128         for (size_t m = 0; m < _res_constr.datalen; m++) {
16129                 int8_tArray _res_conv_12 = _res_vals[m];
16130                 LDKThirtyTwoBytes _res_conv_12_ref;
16131                 CHECK(_res_conv_12->arr_len == 32);
16132                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
16133                 _res_constr.data[m] = _res_conv_12_ref;
16134         }
16135         FREE(_res);
16136         CVec_ThirtyTwoBytesZ_free(_res_constr);
16137 }
16138
16139 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
16140         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16141         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
16142         return tag_ptr(ret_conv, true);
16143 }
16144 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint64_t arg) {
16145         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
16146         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
16147         return ret_conv;
16148 }
16149
16150 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint64_t orig) {
16151         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
16152         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16153         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
16154         return tag_ptr(ret_conv, true);
16155 }
16156
16157 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
16158         LDKThirtyTwoBytes a_ref;
16159         CHECK(a->arr_len == 32);
16160         memcpy(a_ref.data, a->elems, 32); FREE(a);
16161         LDKThirtyTwoBytes b_ref;
16162         CHECK(b->arr_len == 32);
16163         memcpy(b_ref.data, b->elems, 32); FREE(b);
16164         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16165         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
16166         return tag_ptr(ret_conv, true);
16167 }
16168
16169 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint64_t _res) {
16170         if (!ptr_is_owned(_res)) return;
16171         void* _res_ptr = untag_ptr(_res);
16172         CHECK_ACCESS(_res_ptr);
16173         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
16174         FREE(untag_ptr(_res));
16175         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
16176 }
16177
16178 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint64_t o) {
16179         void* o_ptr = untag_ptr(o);
16180         CHECK_ACCESS(o_ptr);
16181         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16182         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
16183         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16184         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
16185         return tag_ptr(ret_conv, true);
16186 }
16187
16188 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
16189         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16190         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
16191         return tag_ptr(ret_conv, true);
16192 }
16193
16194 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint64_t o) {
16195         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
16196         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
16197         return ret_conv;
16198 }
16199
16200 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint64_t _res) {
16201         if (!ptr_is_owned(_res)) return;
16202         void* _res_ptr = untag_ptr(_res);
16203         CHECK_ACCESS(_res_ptr);
16204         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
16205         FREE(untag_ptr(_res));
16206         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
16207 }
16208
16209 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
16210         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16211         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
16212         return tag_ptr(ret_conv, true);
16213 }
16214 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint64_t arg) {
16215         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
16216         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
16217         return ret_conv;
16218 }
16219
16220 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint64_t orig) {
16221         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
16222         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16223         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
16224         return tag_ptr(ret_conv, true);
16225 }
16226
16227 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint64_t o) {
16228         void* o_ptr = untag_ptr(o);
16229         CHECK_ACCESS(o_ptr);
16230         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16231         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
16232         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16233         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
16234         return tag_ptr(ret_conv, true);
16235 }
16236
16237 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint64_t e) {
16238         void* e_ptr = untag_ptr(e);
16239         CHECK_ACCESS(e_ptr);
16240         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16241         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16242         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16243         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
16244         return tag_ptr(ret_conv, true);
16245 }
16246
16247 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint64_t o) {
16248         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(o);
16249         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
16250         return ret_conv;
16251 }
16252
16253 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint64_t _res) {
16254         if (!ptr_is_owned(_res)) return;
16255         void* _res_ptr = untag_ptr(_res);
16256         CHECK_ACCESS(_res_ptr);
16257         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
16258         FREE(untag_ptr(_res));
16259         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
16260 }
16261
16262 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
16263         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16264         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
16265         return tag_ptr(ret_conv, true);
16266 }
16267 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint64_t arg) {
16268         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(arg);
16269         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
16270         return ret_conv;
16271 }
16272
16273 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint64_t orig) {
16274         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(orig);
16275         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16276         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
16277         return tag_ptr(ret_conv, true);
16278 }
16279
16280 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
16281         LDKThirtyTwoBytes o_ref;
16282         CHECK(o->arr_len == 32);
16283         memcpy(o_ref.data, o->elems, 32); FREE(o);
16284         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16285         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
16286         return tag_ptr(ret_conv, true);
16287 }
16288
16289 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
16290         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16291         *ret_conv = CResult_PaymentSecretNoneZ_err();
16292         return tag_ptr(ret_conv, true);
16293 }
16294
16295 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint64_t o) {
16296         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
16297         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
16298         return ret_conv;
16299 }
16300
16301 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint64_t _res) {
16302         if (!ptr_is_owned(_res)) return;
16303         void* _res_ptr = untag_ptr(_res);
16304         CHECK_ACCESS(_res_ptr);
16305         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
16306         FREE(untag_ptr(_res));
16307         CResult_PaymentSecretNoneZ_free(_res_conv);
16308 }
16309
16310 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
16311         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16312         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
16313         return tag_ptr(ret_conv, true);
16314 }
16315 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint64_t arg) {
16316         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
16317         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
16318         return ret_conv;
16319 }
16320
16321 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint64_t orig) {
16322         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
16323         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16324         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
16325         return tag_ptr(ret_conv, true);
16326 }
16327
16328 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
16329         LDKThirtyTwoBytes o_ref;
16330         CHECK(o->arr_len == 32);
16331         memcpy(o_ref.data, o->elems, 32); FREE(o);
16332         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16333         *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
16334         return tag_ptr(ret_conv, true);
16335 }
16336
16337 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint64_t e) {
16338         void* e_ptr = untag_ptr(e);
16339         CHECK_ACCESS(e_ptr);
16340         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16341         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16342         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16343         *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
16344         return tag_ptr(ret_conv, true);
16345 }
16346
16347 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint64_t o) {
16348         LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(o);
16349         jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
16350         return ret_conv;
16351 }
16352
16353 void  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint64_t _res) {
16354         if (!ptr_is_owned(_res)) return;
16355         void* _res_ptr = untag_ptr(_res);
16356         CHECK_ACCESS(_res_ptr);
16357         LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
16358         FREE(untag_ptr(_res));
16359         CResult_PaymentSecretAPIErrorZ_free(_res_conv);
16360 }
16361
16362 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
16363         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16364         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
16365         return tag_ptr(ret_conv, true);
16366 }
16367 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint64_t arg) {
16368         LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(arg);
16369         int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
16370         return ret_conv;
16371 }
16372
16373 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint64_t orig) {
16374         LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(orig);
16375         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16376         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
16377         return tag_ptr(ret_conv, true);
16378 }
16379
16380 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
16381         LDKThirtyTwoBytes o_ref;
16382         CHECK(o->arr_len == 32);
16383         memcpy(o_ref.data, o->elems, 32); FREE(o);
16384         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16385         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
16386         return tag_ptr(ret_conv, true);
16387 }
16388
16389 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint64_t e) {
16390         void* e_ptr = untag_ptr(e);
16391         CHECK_ACCESS(e_ptr);
16392         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16393         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16394         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16395         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
16396         return tag_ptr(ret_conv, true);
16397 }
16398
16399 jboolean  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint64_t o) {
16400         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
16401         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
16402         return ret_conv;
16403 }
16404
16405 void  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint64_t _res) {
16406         if (!ptr_is_owned(_res)) return;
16407         void* _res_ptr = untag_ptr(_res);
16408         CHECK_ACCESS(_res_ptr);
16409         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
16410         FREE(untag_ptr(_res));
16411         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
16412 }
16413
16414 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
16415         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16416         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
16417         return tag_ptr(ret_conv, true);
16418 }
16419 int64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint64_t arg) {
16420         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
16421         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
16422         return ret_conv;
16423 }
16424
16425 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint64_t orig) {
16426         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
16427         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16428         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
16429         return tag_ptr(ret_conv, true);
16430 }
16431
16432 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
16433         LDKCounterpartyForwardingInfo o_conv;
16434         o_conv.inner = untag_ptr(o);
16435         o_conv.is_owned = ptr_is_owned(o);
16436         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16437         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
16438         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
16439         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
16440         return tag_ptr(ret_conv, true);
16441 }
16442
16443 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
16444         void* e_ptr = untag_ptr(e);
16445         CHECK_ACCESS(e_ptr);
16446         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16447         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16448         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
16449         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
16450         return tag_ptr(ret_conv, true);
16451 }
16452
16453 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
16454         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
16455         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
16456         return ret_conv;
16457 }
16458
16459 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
16460         if (!ptr_is_owned(_res)) return;
16461         void* _res_ptr = untag_ptr(_res);
16462         CHECK_ACCESS(_res_ptr);
16463         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
16464         FREE(untag_ptr(_res));
16465         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
16466 }
16467
16468 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
16469         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
16470         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
16471         return tag_ptr(ret_conv, true);
16472 }
16473 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
16474         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
16475         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
16476         return ret_conv;
16477 }
16478
16479 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
16480         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
16481         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
16482         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
16483         return tag_ptr(ret_conv, true);
16484 }
16485
16486 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
16487         LDKChannelCounterparty o_conv;
16488         o_conv.inner = untag_ptr(o);
16489         o_conv.is_owned = ptr_is_owned(o);
16490         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16491         o_conv = ChannelCounterparty_clone(&o_conv);
16492         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
16493         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
16494         return tag_ptr(ret_conv, true);
16495 }
16496
16497 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
16498         void* e_ptr = untag_ptr(e);
16499         CHECK_ACCESS(e_ptr);
16500         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16501         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16502         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
16503         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
16504         return tag_ptr(ret_conv, true);
16505 }
16506
16507 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
16508         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
16509         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
16510         return ret_conv;
16511 }
16512
16513 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
16514         if (!ptr_is_owned(_res)) return;
16515         void* _res_ptr = untag_ptr(_res);
16516         CHECK_ACCESS(_res_ptr);
16517         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
16518         FREE(untag_ptr(_res));
16519         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
16520 }
16521
16522 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
16523         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
16524         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
16525         return tag_ptr(ret_conv, true);
16526 }
16527 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
16528         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
16529         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
16530         return ret_conv;
16531 }
16532
16533 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
16534         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
16535         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
16536         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
16537         return tag_ptr(ret_conv, true);
16538 }
16539
16540 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
16541         LDKChannelDetails o_conv;
16542         o_conv.inner = untag_ptr(o);
16543         o_conv.is_owned = ptr_is_owned(o);
16544         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16545         o_conv = ChannelDetails_clone(&o_conv);
16546         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
16547         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
16548         return tag_ptr(ret_conv, true);
16549 }
16550
16551 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
16552         void* e_ptr = untag_ptr(e);
16553         CHECK_ACCESS(e_ptr);
16554         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16555         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16556         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
16557         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
16558         return tag_ptr(ret_conv, true);
16559 }
16560
16561 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
16562         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
16563         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
16564         return ret_conv;
16565 }
16566
16567 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
16568         if (!ptr_is_owned(_res)) return;
16569         void* _res_ptr = untag_ptr(_res);
16570         CHECK_ACCESS(_res_ptr);
16571         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
16572         FREE(untag_ptr(_res));
16573         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
16574 }
16575
16576 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
16577         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
16578         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
16579         return tag_ptr(ret_conv, true);
16580 }
16581 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
16582         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
16583         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
16584         return ret_conv;
16585 }
16586
16587 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
16588         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
16589         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
16590         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
16591         return tag_ptr(ret_conv, true);
16592 }
16593
16594 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
16595         LDKPhantomRouteHints o_conv;
16596         o_conv.inner = untag_ptr(o);
16597         o_conv.is_owned = ptr_is_owned(o);
16598         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16599         o_conv = PhantomRouteHints_clone(&o_conv);
16600         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16601         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
16602         return tag_ptr(ret_conv, true);
16603 }
16604
16605 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
16606         void* e_ptr = untag_ptr(e);
16607         CHECK_ACCESS(e_ptr);
16608         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16609         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16610         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16611         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
16612         return tag_ptr(ret_conv, true);
16613 }
16614
16615 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
16616         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
16617         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
16618         return ret_conv;
16619 }
16620
16621 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
16622         if (!ptr_is_owned(_res)) return;
16623         void* _res_ptr = untag_ptr(_res);
16624         CHECK_ACCESS(_res_ptr);
16625         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
16626         FREE(untag_ptr(_res));
16627         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
16628 }
16629
16630 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
16631         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16632         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
16633         return tag_ptr(ret_conv, true);
16634 }
16635 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
16636         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
16637         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
16638         return ret_conv;
16639 }
16640
16641 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
16642         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
16643         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16644         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
16645         return tag_ptr(ret_conv, true);
16646 }
16647
16648 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
16649         LDKCVec_ChannelMonitorZ _res_constr;
16650         _res_constr.datalen = _res->arr_len;
16651         if (_res_constr.datalen > 0)
16652                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
16653         else
16654                 _res_constr.data = NULL;
16655         uint64_t* _res_vals = _res->elems;
16656         for (size_t q = 0; q < _res_constr.datalen; q++) {
16657                 uint64_t _res_conv_16 = _res_vals[q];
16658                 LDKChannelMonitor _res_conv_16_conv;
16659                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
16660                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
16661                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
16662                 _res_constr.data[q] = _res_conv_16_conv;
16663         }
16664         FREE(_res);
16665         CVec_ChannelMonitorZ_free(_res_constr);
16666 }
16667
16668 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint64_t b) {
16669         LDKThirtyTwoBytes a_ref;
16670         CHECK(a->arr_len == 32);
16671         memcpy(a_ref.data, a->elems, 32); FREE(a);
16672         LDKChannelManager b_conv;
16673         b_conv.inner = untag_ptr(b);
16674         b_conv.is_owned = ptr_is_owned(b);
16675         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
16676         // WARNING: we need a move here but no clone is available for LDKChannelManager
16677         
16678         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
16679         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
16680         return tag_ptr(ret_conv, true);
16681 }
16682
16683 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint64_t _res) {
16684         if (!ptr_is_owned(_res)) return;
16685         void* _res_ptr = untag_ptr(_res);
16686         CHECK_ACCESS(_res_ptr);
16687         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
16688         FREE(untag_ptr(_res));
16689         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
16690 }
16691
16692 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint64_t o) {
16693         void* o_ptr = untag_ptr(o);
16694         CHECK_ACCESS(o_ptr);
16695         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
16696         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
16697         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16698         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
16699         return tag_ptr(ret_conv, true);
16700 }
16701
16702 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint64_t e) {
16703         void* e_ptr = untag_ptr(e);
16704         CHECK_ACCESS(e_ptr);
16705         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16706         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16707         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16708         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
16709         return tag_ptr(ret_conv, true);
16710 }
16711
16712 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
16713         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
16714         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
16715         return ret_conv;
16716 }
16717
16718 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint64_t _res) {
16719         if (!ptr_is_owned(_res)) return;
16720         void* _res_ptr = untag_ptr(_res);
16721         CHECK_ACCESS(_res_ptr);
16722         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
16723         FREE(untag_ptr(_res));
16724         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
16725 }
16726
16727 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
16728         LDKChannelConfig o_conv;
16729         o_conv.inner = untag_ptr(o);
16730         o_conv.is_owned = ptr_is_owned(o);
16731         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16732         o_conv = ChannelConfig_clone(&o_conv);
16733         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16734         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
16735         return tag_ptr(ret_conv, true);
16736 }
16737
16738 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
16739         void* e_ptr = untag_ptr(e);
16740         CHECK_ACCESS(e_ptr);
16741         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16742         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16743         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16744         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
16745         return tag_ptr(ret_conv, true);
16746 }
16747
16748 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
16749         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
16750         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
16751         return ret_conv;
16752 }
16753
16754 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
16755         if (!ptr_is_owned(_res)) return;
16756         void* _res_ptr = untag_ptr(_res);
16757         CHECK_ACCESS(_res_ptr);
16758         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
16759         FREE(untag_ptr(_res));
16760         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
16761 }
16762
16763 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
16764         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16765         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
16766         return tag_ptr(ret_conv, true);
16767 }
16768 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
16769         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
16770         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
16771         return ret_conv;
16772 }
16773
16774 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
16775         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
16776         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16777         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
16778         return tag_ptr(ret_conv, true);
16779 }
16780
16781 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
16782         LDKOutPoint o_conv;
16783         o_conv.inner = untag_ptr(o);
16784         o_conv.is_owned = ptr_is_owned(o);
16785         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16786         o_conv = OutPoint_clone(&o_conv);
16787         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16788         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
16789         return tag_ptr(ret_conv, true);
16790 }
16791
16792 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
16793         void* e_ptr = untag_ptr(e);
16794         CHECK_ACCESS(e_ptr);
16795         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16796         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16797         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16798         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
16799         return tag_ptr(ret_conv, true);
16800 }
16801
16802 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
16803         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
16804         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
16805         return ret_conv;
16806 }
16807
16808 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
16809         if (!ptr_is_owned(_res)) return;
16810         void* _res_ptr = untag_ptr(_res);
16811         CHECK_ACCESS(_res_ptr);
16812         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
16813         FREE(untag_ptr(_res));
16814         CResult_OutPointDecodeErrorZ_free(_res_conv);
16815 }
16816
16817 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
16818         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16819         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
16820         return tag_ptr(ret_conv, true);
16821 }
16822 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
16823         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
16824         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
16825         return ret_conv;
16826 }
16827
16828 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
16829         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
16830         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16831         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
16832         return tag_ptr(ret_conv, true);
16833 }
16834
16835 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
16836         void* o_ptr = untag_ptr(o);
16837         CHECK_ACCESS(o_ptr);
16838         LDKType o_conv = *(LDKType*)(o_ptr);
16839         if (o_conv.free == LDKType_JCalls_free) {
16840                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16841                 LDKType_JCalls_cloned(&o_conv);
16842         }
16843         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16844         *ret_copy = COption_TypeZ_some(o_conv);
16845         uint64_t ret_ref = tag_ptr(ret_copy, true);
16846         return ret_ref;
16847 }
16848
16849 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
16850         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16851         *ret_copy = COption_TypeZ_none();
16852         uint64_t ret_ref = tag_ptr(ret_copy, true);
16853         return ret_ref;
16854 }
16855
16856 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
16857         if (!ptr_is_owned(_res)) return;
16858         void* _res_ptr = untag_ptr(_res);
16859         CHECK_ACCESS(_res_ptr);
16860         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
16861         FREE(untag_ptr(_res));
16862         COption_TypeZ_free(_res_conv);
16863 }
16864
16865 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
16866         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16867         *ret_copy = COption_TypeZ_clone(arg);
16868         uint64_t ret_ref = tag_ptr(ret_copy, true);
16869         return ret_ref;
16870 }
16871 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
16872         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
16873         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
16874         return ret_conv;
16875 }
16876
16877 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
16878         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
16879         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16880         *ret_copy = COption_TypeZ_clone(orig_conv);
16881         uint64_t ret_ref = tag_ptr(ret_copy, true);
16882         return ret_ref;
16883 }
16884
16885 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
16886         void* o_ptr = untag_ptr(o);
16887         CHECK_ACCESS(o_ptr);
16888         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
16889         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
16890         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16891         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
16892         return tag_ptr(ret_conv, true);
16893 }
16894
16895 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
16896         void* e_ptr = untag_ptr(e);
16897         CHECK_ACCESS(e_ptr);
16898         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16899         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16900         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16901         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
16902         return tag_ptr(ret_conv, true);
16903 }
16904
16905 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
16906         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
16907         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
16908         return ret_conv;
16909 }
16910
16911 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
16912         if (!ptr_is_owned(_res)) return;
16913         void* _res_ptr = untag_ptr(_res);
16914         CHECK_ACCESS(_res_ptr);
16915         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
16916         FREE(untag_ptr(_res));
16917         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
16918 }
16919
16920 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
16921         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16922         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
16923         return tag_ptr(ret_conv, true);
16924 }
16925 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
16926         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
16927         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
16928         return ret_conv;
16929 }
16930
16931 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
16932         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
16933         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16934         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
16935         return tag_ptr(ret_conv, true);
16936 }
16937
16938 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
16939         LDKThirtyTwoBytes o_ref;
16940         CHECK(o->arr_len == 32);
16941         memcpy(o_ref.data, o->elems, 32); FREE(o);
16942         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16943         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
16944         return tag_ptr(ret_conv, true);
16945 }
16946
16947 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint64_t e) {
16948         void* e_ptr = untag_ptr(e);
16949         CHECK_ACCESS(e_ptr);
16950         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
16951         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
16952         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16953         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
16954         return tag_ptr(ret_conv, true);
16955 }
16956
16957 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint64_t o) {
16958         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
16959         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
16960         return ret_conv;
16961 }
16962
16963 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint64_t _res) {
16964         if (!ptr_is_owned(_res)) return;
16965         void* _res_ptr = untag_ptr(_res);
16966         CHECK_ACCESS(_res_ptr);
16967         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
16968         FREE(untag_ptr(_res));
16969         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
16970 }
16971
16972 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
16973         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16974         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
16975         return tag_ptr(ret_conv, true);
16976 }
16977 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint64_t arg) {
16978         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
16979         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
16980         return ret_conv;
16981 }
16982
16983 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint64_t orig) {
16984         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
16985         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16986         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
16987         return tag_ptr(ret_conv, true);
16988 }
16989
16990 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) {
16991         LDKInFlightHtlcs o_conv;
16992         o_conv.inner = untag_ptr(o);
16993         o_conv.is_owned = ptr_is_owned(o);
16994         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16995         // WARNING: we need a move here but no clone is available for LDKInFlightHtlcs
16996         
16997         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
16998         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
16999         return tag_ptr(ret_conv, true);
17000 }
17001
17002 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) {
17003         void* e_ptr = untag_ptr(e);
17004         CHECK_ACCESS(e_ptr);
17005         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17006         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17007         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17008         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
17009         return tag_ptr(ret_conv, true);
17010 }
17011
17012 jboolean  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) {
17013         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
17014         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
17015         return ret_conv;
17016 }
17017
17018 void  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) {
17019         if (!ptr_is_owned(_res)) return;
17020         void* _res_ptr = untag_ptr(_res);
17021         CHECK_ACCESS(_res_ptr);
17022         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
17023         FREE(untag_ptr(_res));
17024         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
17025 }
17026
17027 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_ok"))) TS_CResult_SiPrefixParseErrorZ_ok(uint32_t o) {
17028         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
17029         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
17030         *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
17031         return tag_ptr(ret_conv, true);
17032 }
17033
17034 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_err"))) TS_CResult_SiPrefixParseErrorZ_err(uint64_t e) {
17035         void* e_ptr = untag_ptr(e);
17036         CHECK_ACCESS(e_ptr);
17037         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
17038         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
17039         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
17040         *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
17041         return tag_ptr(ret_conv, true);
17042 }
17043
17044 jboolean  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_is_ok"))) TS_CResult_SiPrefixParseErrorZ_is_ok(uint64_t o) {
17045         LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(o);
17046         jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
17047         return ret_conv;
17048 }
17049
17050 void  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_free"))) TS_CResult_SiPrefixParseErrorZ_free(uint64_t _res) {
17051         if (!ptr_is_owned(_res)) return;
17052         void* _res_ptr = untag_ptr(_res);
17053         CHECK_ACCESS(_res_ptr);
17054         LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
17055         FREE(untag_ptr(_res));
17056         CResult_SiPrefixParseErrorZ_free(_res_conv);
17057 }
17058
17059 static inline uint64_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
17060         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
17061         *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
17062         return tag_ptr(ret_conv, true);
17063 }
17064 int64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixParseErrorZ_clone_ptr(uint64_t arg) {
17065         LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(arg);
17066         int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
17067         return ret_conv;
17068 }
17069
17070 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone"))) TS_CResult_SiPrefixParseErrorZ_clone(uint64_t orig) {
17071         LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(orig);
17072         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
17073         *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
17074         return tag_ptr(ret_conv, true);
17075 }
17076
17077 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
17078         LDKInvoice o_conv;
17079         o_conv.inner = untag_ptr(o);
17080         o_conv.is_owned = ptr_is_owned(o);
17081         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17082         o_conv = Invoice_clone(&o_conv);
17083         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
17084         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
17085         return tag_ptr(ret_conv, true);
17086 }
17087
17088 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
17089         void* e_ptr = untag_ptr(e);
17090         CHECK_ACCESS(e_ptr);
17091         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
17092         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
17093         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
17094         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
17095         return tag_ptr(ret_conv, true);
17096 }
17097
17098 jboolean  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
17099         LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
17100         jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
17101         return ret_conv;
17102 }
17103
17104 void  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
17105         if (!ptr_is_owned(_res)) return;
17106         void* _res_ptr = untag_ptr(_res);
17107         CHECK_ACCESS(_res_ptr);
17108         LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
17109         FREE(untag_ptr(_res));
17110         CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
17111 }
17112
17113 static inline uint64_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
17114         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
17115         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
17116         return tag_ptr(ret_conv, true);
17117 }
17118 int64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
17119         LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
17120         int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
17121         return ret_conv;
17122 }
17123
17124 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
17125         LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
17126         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
17127         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
17128         return tag_ptr(ret_conv, true);
17129 }
17130
17131 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_ok(uint64_t o) {
17132         LDKSignedRawInvoice o_conv;
17133         o_conv.inner = untag_ptr(o);
17134         o_conv.is_owned = ptr_is_owned(o);
17135         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17136         o_conv = SignedRawInvoice_clone(&o_conv);
17137         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
17138         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
17139         return tag_ptr(ret_conv, true);
17140 }
17141
17142 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_err(uint64_t e) {
17143         void* e_ptr = untag_ptr(e);
17144         CHECK_ACCESS(e_ptr);
17145         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
17146         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
17147         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
17148         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
17149         return tag_ptr(ret_conv, true);
17150 }
17151
17152 jboolean  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_is_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_is_ok(uint64_t o) {
17153         LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(o);
17154         jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
17155         return ret_conv;
17156 }
17157
17158 void  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_free"))) TS_CResult_SignedRawInvoiceParseErrorZ_free(uint64_t _res) {
17159         if (!ptr_is_owned(_res)) return;
17160         void* _res_ptr = untag_ptr(_res);
17161         CHECK_ACCESS(_res_ptr);
17162         LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
17163         FREE(untag_ptr(_res));
17164         CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
17165 }
17166
17167 static inline uint64_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
17168         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
17169         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
17170         return tag_ptr(ret_conv, true);
17171 }
17172 int64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr(uint64_t arg) {
17173         LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(arg);
17174         int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
17175         return ret_conv;
17176 }
17177
17178 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone(uint64_t orig) {
17179         LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(orig);
17180         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
17181         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
17182         return tag_ptr(ret_conv, true);
17183 }
17184
17185 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
17186         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
17187         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
17188         return tag_ptr(ret_conv, true);
17189 }
17190 int64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint64_t arg) {
17191         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(arg);
17192         int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
17193         return ret_conv;
17194 }
17195
17196 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint64_t orig) {
17197         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(orig);
17198         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
17199         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
17200         return tag_ptr(ret_conv, true);
17201 }
17202
17203 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
17204         LDKRawInvoice a_conv;
17205         a_conv.inner = untag_ptr(a);
17206         a_conv.is_owned = ptr_is_owned(a);
17207         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17208         a_conv = RawInvoice_clone(&a_conv);
17209         LDKThirtyTwoBytes b_ref;
17210         CHECK(b->arr_len == 32);
17211         memcpy(b_ref.data, b->elems, 32); FREE(b);
17212         LDKInvoiceSignature c_conv;
17213         c_conv.inner = untag_ptr(c);
17214         c_conv.is_owned = ptr_is_owned(c);
17215         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
17216         c_conv = InvoiceSignature_clone(&c_conv);
17217         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
17218         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
17219         return tag_ptr(ret_conv, true);
17220 }
17221
17222 void  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint64_t _res) {
17223         if (!ptr_is_owned(_res)) return;
17224         void* _res_ptr = untag_ptr(_res);
17225         CHECK_ACCESS(_res_ptr);
17226         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
17227         FREE(untag_ptr(_res));
17228         C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
17229 }
17230
17231 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint64_t o) {
17232         LDKPayeePubKey o_conv;
17233         o_conv.inner = untag_ptr(o);
17234         o_conv.is_owned = ptr_is_owned(o);
17235         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17236         o_conv = PayeePubKey_clone(&o_conv);
17237         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17238         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
17239         return tag_ptr(ret_conv, true);
17240 }
17241
17242 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
17243         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
17244         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17245         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
17246         return tag_ptr(ret_conv, true);
17247 }
17248
17249 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint64_t o) {
17250         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
17251         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
17252         return ret_conv;
17253 }
17254
17255 void  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint64_t _res) {
17256         if (!ptr_is_owned(_res)) return;
17257         void* _res_ptr = untag_ptr(_res);
17258         CHECK_ACCESS(_res_ptr);
17259         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
17260         FREE(untag_ptr(_res));
17261         CResult_PayeePubKeyErrorZ_free(_res_conv);
17262 }
17263
17264 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
17265         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17266         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
17267         return tag_ptr(ret_conv, true);
17268 }
17269 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint64_t arg) {
17270         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
17271         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
17272         return ret_conv;
17273 }
17274
17275 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint64_t orig) {
17276         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
17277         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17278         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
17279         return tag_ptr(ret_conv, true);
17280 }
17281
17282 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
17283         LDKCVec_PrivateRouteZ _res_constr;
17284         _res_constr.datalen = _res->arr_len;
17285         if (_res_constr.datalen > 0)
17286                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
17287         else
17288                 _res_constr.data = NULL;
17289         uint64_t* _res_vals = _res->elems;
17290         for (size_t o = 0; o < _res_constr.datalen; o++) {
17291                 uint64_t _res_conv_14 = _res_vals[o];
17292                 LDKPrivateRoute _res_conv_14_conv;
17293                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
17294                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
17295                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
17296                 _res_constr.data[o] = _res_conv_14_conv;
17297         }
17298         FREE(_res);
17299         CVec_PrivateRouteZ_free(_res_constr);
17300 }
17301
17302 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
17303         LDKPositiveTimestamp o_conv;
17304         o_conv.inner = untag_ptr(o);
17305         o_conv.is_owned = ptr_is_owned(o);
17306         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17307         o_conv = PositiveTimestamp_clone(&o_conv);
17308         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17309         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
17310         return tag_ptr(ret_conv, true);
17311 }
17312
17313 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
17314         LDKCreationError e_conv = LDKCreationError_from_js(e);
17315         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17316         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
17317         return tag_ptr(ret_conv, true);
17318 }
17319
17320 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
17321         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
17322         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
17323         return ret_conv;
17324 }
17325
17326 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
17327         if (!ptr_is_owned(_res)) return;
17328         void* _res_ptr = untag_ptr(_res);
17329         CHECK_ACCESS(_res_ptr);
17330         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
17331         FREE(untag_ptr(_res));
17332         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
17333 }
17334
17335 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
17336         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17337         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
17338         return tag_ptr(ret_conv, true);
17339 }
17340 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
17341         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
17342         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
17343         return ret_conv;
17344 }
17345
17346 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
17347         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
17348         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17349         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
17350         return tag_ptr(ret_conv, true);
17351 }
17352
17353 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() {
17354         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17355         *ret_conv = CResult_NoneSemanticErrorZ_ok();
17356         return tag_ptr(ret_conv, true);
17357 }
17358
17359 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
17360         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
17361         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17362         *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
17363         return tag_ptr(ret_conv, true);
17364 }
17365
17366 jboolean  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint64_t o) {
17367         LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(o);
17368         jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
17369         return ret_conv;
17370 }
17371
17372 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint64_t _res) {
17373         if (!ptr_is_owned(_res)) return;
17374         void* _res_ptr = untag_ptr(_res);
17375         CHECK_ACCESS(_res_ptr);
17376         LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
17377         FREE(untag_ptr(_res));
17378         CResult_NoneSemanticErrorZ_free(_res_conv);
17379 }
17380
17381 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
17382         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17383         *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
17384         return tag_ptr(ret_conv, true);
17385 }
17386 int64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint64_t arg) {
17387         LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(arg);
17388         int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
17389         return ret_conv;
17390 }
17391
17392 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint64_t orig) {
17393         LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(orig);
17394         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17395         *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
17396         return tag_ptr(ret_conv, true);
17397 }
17398
17399 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint64_t o) {
17400         LDKInvoice o_conv;
17401         o_conv.inner = untag_ptr(o);
17402         o_conv.is_owned = ptr_is_owned(o);
17403         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17404         o_conv = Invoice_clone(&o_conv);
17405         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17406         *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
17407         return tag_ptr(ret_conv, true);
17408 }
17409
17410 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
17411         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
17412         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17413         *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
17414         return tag_ptr(ret_conv, true);
17415 }
17416
17417 jboolean  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint64_t o) {
17418         LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(o);
17419         jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
17420         return ret_conv;
17421 }
17422
17423 void  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint64_t _res) {
17424         if (!ptr_is_owned(_res)) return;
17425         void* _res_ptr = untag_ptr(_res);
17426         CHECK_ACCESS(_res_ptr);
17427         LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
17428         FREE(untag_ptr(_res));
17429         CResult_InvoiceSemanticErrorZ_free(_res_conv);
17430 }
17431
17432 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
17433         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17434         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
17435         return tag_ptr(ret_conv, true);
17436 }
17437 int64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint64_t arg) {
17438         LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(arg);
17439         int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
17440         return ret_conv;
17441 }
17442
17443 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint64_t orig) {
17444         LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(orig);
17445         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17446         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
17447         return tag_ptr(ret_conv, true);
17448 }
17449
17450 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
17451         LDKDescription o_conv;
17452         o_conv.inner = untag_ptr(o);
17453         o_conv.is_owned = ptr_is_owned(o);
17454         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17455         o_conv = Description_clone(&o_conv);
17456         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17457         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
17458         return tag_ptr(ret_conv, true);
17459 }
17460
17461 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
17462         LDKCreationError e_conv = LDKCreationError_from_js(e);
17463         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17464         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
17465         return tag_ptr(ret_conv, true);
17466 }
17467
17468 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
17469         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
17470         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
17471         return ret_conv;
17472 }
17473
17474 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
17475         if (!ptr_is_owned(_res)) return;
17476         void* _res_ptr = untag_ptr(_res);
17477         CHECK_ACCESS(_res_ptr);
17478         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
17479         FREE(untag_ptr(_res));
17480         CResult_DescriptionCreationErrorZ_free(_res_conv);
17481 }
17482
17483 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
17484         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17485         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
17486         return tag_ptr(ret_conv, true);
17487 }
17488 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
17489         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
17490         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
17491         return ret_conv;
17492 }
17493
17494 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
17495         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
17496         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17497         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
17498         return tag_ptr(ret_conv, true);
17499 }
17500
17501 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
17502         LDKPrivateRoute o_conv;
17503         o_conv.inner = untag_ptr(o);
17504         o_conv.is_owned = ptr_is_owned(o);
17505         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17506         o_conv = PrivateRoute_clone(&o_conv);
17507         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17508         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
17509         return tag_ptr(ret_conv, true);
17510 }
17511
17512 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
17513         LDKCreationError e_conv = LDKCreationError_from_js(e);
17514         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17515         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
17516         return tag_ptr(ret_conv, true);
17517 }
17518
17519 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
17520         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
17521         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
17522         return ret_conv;
17523 }
17524
17525 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
17526         if (!ptr_is_owned(_res)) return;
17527         void* _res_ptr = untag_ptr(_res);
17528         CHECK_ACCESS(_res_ptr);
17529         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
17530         FREE(untag_ptr(_res));
17531         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
17532 }
17533
17534 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
17535         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17536         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
17537         return tag_ptr(ret_conv, true);
17538 }
17539 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
17540         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
17541         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
17542         return ret_conv;
17543 }
17544
17545 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
17546         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
17547         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17548         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
17549         return tag_ptr(ret_conv, true);
17550 }
17551
17552 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
17553         LDKStr o_conv = str_ref_to_owned_c(o);
17554         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17555         *ret_conv = CResult_StringErrorZ_ok(o_conv);
17556         return tag_ptr(ret_conv, true);
17557 }
17558
17559 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
17560         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
17561         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17562         *ret_conv = CResult_StringErrorZ_err(e_conv);
17563         return tag_ptr(ret_conv, true);
17564 }
17565
17566 jboolean  __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint64_t o) {
17567         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
17568         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
17569         return ret_conv;
17570 }
17571
17572 void  __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint64_t _res) {
17573         if (!ptr_is_owned(_res)) return;
17574         void* _res_ptr = untag_ptr(_res);
17575         CHECK_ACCESS(_res_ptr);
17576         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
17577         FREE(untag_ptr(_res));
17578         CResult_StringErrorZ_free(_res_conv);
17579 }
17580
17581 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
17582         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17583         *ret_conv = CResult_StringErrorZ_clone(arg);
17584         return tag_ptr(ret_conv, true);
17585 }
17586 int64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint64_t arg) {
17587         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
17588         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
17589         return ret_conv;
17590 }
17591
17592 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint64_t orig) {
17593         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
17594         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17595         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
17596         return tag_ptr(ret_conv, true);
17597 }
17598
17599 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
17600         LDKChannelMonitorUpdate o_conv;
17601         o_conv.inner = untag_ptr(o);
17602         o_conv.is_owned = ptr_is_owned(o);
17603         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17604         o_conv = ChannelMonitorUpdate_clone(&o_conv);
17605         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17606         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
17607         return tag_ptr(ret_conv, true);
17608 }
17609
17610 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
17611         void* e_ptr = untag_ptr(e);
17612         CHECK_ACCESS(e_ptr);
17613         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17614         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17615         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17616         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
17617         return tag_ptr(ret_conv, true);
17618 }
17619
17620 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
17621         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
17622         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
17623         return ret_conv;
17624 }
17625
17626 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
17627         if (!ptr_is_owned(_res)) return;
17628         void* _res_ptr = untag_ptr(_res);
17629         CHECK_ACCESS(_res_ptr);
17630         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
17631         FREE(untag_ptr(_res));
17632         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
17633 }
17634
17635 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
17636         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17637         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
17638         return tag_ptr(ret_conv, true);
17639 }
17640 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
17641         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
17642         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
17643         return ret_conv;
17644 }
17645
17646 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
17647         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
17648         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17649         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
17650         return tag_ptr(ret_conv, true);
17651 }
17652
17653 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
17654         void* o_ptr = untag_ptr(o);
17655         CHECK_ACCESS(o_ptr);
17656         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
17657         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
17658         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17659         *ret_copy = COption_MonitorEventZ_some(o_conv);
17660         uint64_t ret_ref = tag_ptr(ret_copy, true);
17661         return ret_ref;
17662 }
17663
17664 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
17665         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17666         *ret_copy = COption_MonitorEventZ_none();
17667         uint64_t ret_ref = tag_ptr(ret_copy, true);
17668         return ret_ref;
17669 }
17670
17671 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
17672         if (!ptr_is_owned(_res)) return;
17673         void* _res_ptr = untag_ptr(_res);
17674         CHECK_ACCESS(_res_ptr);
17675         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
17676         FREE(untag_ptr(_res));
17677         COption_MonitorEventZ_free(_res_conv);
17678 }
17679
17680 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
17681         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17682         *ret_copy = COption_MonitorEventZ_clone(arg);
17683         uint64_t ret_ref = tag_ptr(ret_copy, true);
17684         return ret_ref;
17685 }
17686 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
17687         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
17688         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
17689         return ret_conv;
17690 }
17691
17692 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
17693         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
17694         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17695         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
17696         uint64_t ret_ref = tag_ptr(ret_copy, true);
17697         return ret_ref;
17698 }
17699
17700 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
17701         void* o_ptr = untag_ptr(o);
17702         CHECK_ACCESS(o_ptr);
17703         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
17704         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
17705         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17706         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
17707         return tag_ptr(ret_conv, true);
17708 }
17709
17710 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
17711         void* e_ptr = untag_ptr(e);
17712         CHECK_ACCESS(e_ptr);
17713         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17714         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17715         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17716         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
17717         return tag_ptr(ret_conv, true);
17718 }
17719
17720 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
17721         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
17722         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
17723         return ret_conv;
17724 }
17725
17726 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
17727         if (!ptr_is_owned(_res)) return;
17728         void* _res_ptr = untag_ptr(_res);
17729         CHECK_ACCESS(_res_ptr);
17730         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
17731         FREE(untag_ptr(_res));
17732         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
17733 }
17734
17735 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
17736         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17737         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
17738         return tag_ptr(ret_conv, true);
17739 }
17740 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
17741         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
17742         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
17743         return ret_conv;
17744 }
17745
17746 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
17747         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
17748         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17749         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
17750         return tag_ptr(ret_conv, true);
17751 }
17752
17753 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
17754         LDKHTLCUpdate o_conv;
17755         o_conv.inner = untag_ptr(o);
17756         o_conv.is_owned = ptr_is_owned(o);
17757         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17758         o_conv = HTLCUpdate_clone(&o_conv);
17759         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17760         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
17761         return tag_ptr(ret_conv, true);
17762 }
17763
17764 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
17765         void* e_ptr = untag_ptr(e);
17766         CHECK_ACCESS(e_ptr);
17767         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17768         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17769         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17770         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
17771         return tag_ptr(ret_conv, true);
17772 }
17773
17774 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
17775         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
17776         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
17777         return ret_conv;
17778 }
17779
17780 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
17781         if (!ptr_is_owned(_res)) return;
17782         void* _res_ptr = untag_ptr(_res);
17783         CHECK_ACCESS(_res_ptr);
17784         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
17785         FREE(untag_ptr(_res));
17786         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
17787 }
17788
17789 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
17790         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17791         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
17792         return tag_ptr(ret_conv, true);
17793 }
17794 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
17795         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
17796         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
17797         return ret_conv;
17798 }
17799
17800 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
17801         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
17802         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17803         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
17804         return tag_ptr(ret_conv, true);
17805 }
17806
17807 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
17808         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17809         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
17810         return tag_ptr(ret_conv, true);
17811 }
17812 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint64_t arg) {
17813         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
17814         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
17815         return ret_conv;
17816 }
17817
17818 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint64_t orig) {
17819         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
17820         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17821         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
17822         return tag_ptr(ret_conv, true);
17823 }
17824
17825 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint64_t a, int8_tArray b) {
17826         LDKOutPoint a_conv;
17827         a_conv.inner = untag_ptr(a);
17828         a_conv.is_owned = ptr_is_owned(a);
17829         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17830         a_conv = OutPoint_clone(&a_conv);
17831         LDKCVec_u8Z b_ref;
17832         b_ref.datalen = b->arr_len;
17833         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17834         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17835         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17836         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
17837         return tag_ptr(ret_conv, true);
17838 }
17839
17840 void  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint64_t _res) {
17841         if (!ptr_is_owned(_res)) return;
17842         void* _res_ptr = untag_ptr(_res);
17843         CHECK_ACCESS(_res_ptr);
17844         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
17845         FREE(untag_ptr(_res));
17846         C2Tuple_OutPointScriptZ_free(_res_conv);
17847 }
17848
17849 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
17850         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17851         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
17852         return tag_ptr(ret_conv, true);
17853 }
17854 int64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint64_t arg) {
17855         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
17856         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
17857         return ret_conv;
17858 }
17859
17860 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint64_t orig) {
17861         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
17862         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17863         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
17864         return tag_ptr(ret_conv, true);
17865 }
17866
17867 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
17868         LDKCVec_u8Z b_ref;
17869         b_ref.datalen = b->arr_len;
17870         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17871         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17872         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17873         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
17874         return tag_ptr(ret_conv, true);
17875 }
17876
17877 void  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint64_t _res) {
17878         if (!ptr_is_owned(_res)) return;
17879         void* _res_ptr = untag_ptr(_res);
17880         CHECK_ACCESS(_res_ptr);
17881         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
17882         FREE(untag_ptr(_res));
17883         C2Tuple_u32ScriptZ_free(_res_conv);
17884 }
17885
17886 void  __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint64_tArray _res) {
17887         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
17888         _res_constr.datalen = _res->arr_len;
17889         if (_res_constr.datalen > 0)
17890                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
17891         else
17892                 _res_constr.data = NULL;
17893         uint64_t* _res_vals = _res->elems;
17894         for (size_t v = 0; v < _res_constr.datalen; v++) {
17895                 uint64_t _res_conv_21 = _res_vals[v];
17896                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
17897                 CHECK_ACCESS(_res_conv_21_ptr);
17898                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
17899                 FREE(untag_ptr(_res_conv_21));
17900                 _res_constr.data[v] = _res_conv_21_conv;
17901         }
17902         FREE(_res);
17903         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
17904 }
17905
17906 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
17907         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17908         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
17909         return tag_ptr(ret_conv, true);
17910 }
17911 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint64_t arg) {
17912         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
17913         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
17914         return ret_conv;
17915 }
17916
17917 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint64_t orig) {
17918         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
17919         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17920         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
17921         return tag_ptr(ret_conv, true);
17922 }
17923
17924 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint64_tArray b) {
17925         LDKThirtyTwoBytes a_ref;
17926         CHECK(a->arr_len == 32);
17927         memcpy(a_ref.data, a->elems, 32); FREE(a);
17928         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
17929         b_constr.datalen = b->arr_len;
17930         if (b_constr.datalen > 0)
17931                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
17932         else
17933                 b_constr.data = NULL;
17934         uint64_t* b_vals = b->elems;
17935         for (size_t v = 0; v < b_constr.datalen; v++) {
17936                 uint64_t b_conv_21 = b_vals[v];
17937                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
17938                 CHECK_ACCESS(b_conv_21_ptr);
17939                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
17940                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
17941                 b_constr.data[v] = b_conv_21_conv;
17942         }
17943         FREE(b);
17944         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17945         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
17946         return tag_ptr(ret_conv, true);
17947 }
17948
17949 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint64_t _res) {
17950         if (!ptr_is_owned(_res)) return;
17951         void* _res_ptr = untag_ptr(_res);
17952         CHECK_ACCESS(_res_ptr);
17953         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
17954         FREE(untag_ptr(_res));
17955         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
17956 }
17957
17958 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint64_tArray _res) {
17959         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
17960         _res_constr.datalen = _res->arr_len;
17961         if (_res_constr.datalen > 0)
17962                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
17963         else
17964                 _res_constr.data = NULL;
17965         uint64_t* _res_vals = _res->elems;
17966         for (size_t o = 0; o < _res_constr.datalen; o++) {
17967                 uint64_t _res_conv_40 = _res_vals[o];
17968                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
17969                 CHECK_ACCESS(_res_conv_40_ptr);
17970                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
17971                 FREE(untag_ptr(_res_conv_40));
17972                 _res_constr.data[o] = _res_conv_40_conv;
17973         }
17974         FREE(_res);
17975         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
17976 }
17977
17978 void  __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint64_tArray _res) {
17979         LDKCVec_EventZ _res_constr;
17980         _res_constr.datalen = _res->arr_len;
17981         if (_res_constr.datalen > 0)
17982                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
17983         else
17984                 _res_constr.data = NULL;
17985         uint64_t* _res_vals = _res->elems;
17986         for (size_t h = 0; h < _res_constr.datalen; h++) {
17987                 uint64_t _res_conv_7 = _res_vals[h];
17988                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
17989                 CHECK_ACCESS(_res_conv_7_ptr);
17990                 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
17991                 FREE(untag_ptr(_res_conv_7));
17992                 _res_constr.data[h] = _res_conv_7_conv;
17993         }
17994         FREE(_res);
17995         CVec_EventZ_free(_res_constr);
17996 }
17997
17998 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
17999         LDKCVec_TransactionZ _res_constr;
18000         _res_constr.datalen = _res->arr_len;
18001         if (_res_constr.datalen > 0)
18002                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
18003         else
18004                 _res_constr.data = NULL;
18005         int8_tArray* _res_vals = (void*) _res->elems;
18006         for (size_t m = 0; m < _res_constr.datalen; m++) {
18007                 int8_tArray _res_conv_12 = _res_vals[m];
18008                 LDKTransaction _res_conv_12_ref;
18009                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
18010                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
18011                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
18012                 _res_conv_12_ref.data_is_owned = true;
18013                 _res_constr.data[m] = _res_conv_12_ref;
18014         }
18015         FREE(_res);
18016         CVec_TransactionZ_free(_res_constr);
18017 }
18018
18019 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
18020         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18021         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
18022         return tag_ptr(ret_conv, true);
18023 }
18024 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
18025         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
18026         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
18027         return ret_conv;
18028 }
18029
18030 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
18031         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
18032         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18033         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
18034         return tag_ptr(ret_conv, true);
18035 }
18036
18037 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
18038         void* b_ptr = untag_ptr(b);
18039         CHECK_ACCESS(b_ptr);
18040         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
18041         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
18042         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18043         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
18044         return tag_ptr(ret_conv, true);
18045 }
18046
18047 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
18048         if (!ptr_is_owned(_res)) return;
18049         void* _res_ptr = untag_ptr(_res);
18050         CHECK_ACCESS(_res_ptr);
18051         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
18052         FREE(untag_ptr(_res));
18053         C2Tuple_u32TxOutZ_free(_res_conv);
18054 }
18055
18056 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
18057         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
18058         _res_constr.datalen = _res->arr_len;
18059         if (_res_constr.datalen > 0)
18060                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18061         else
18062                 _res_constr.data = NULL;
18063         uint64_t* _res_vals = _res->elems;
18064         for (size_t u = 0; u < _res_constr.datalen; u++) {
18065                 uint64_t _res_conv_20 = _res_vals[u];
18066                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
18067                 CHECK_ACCESS(_res_conv_20_ptr);
18068                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
18069                 FREE(untag_ptr(_res_conv_20));
18070                 _res_constr.data[u] = _res_conv_20_conv;
18071         }
18072         FREE(_res);
18073         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
18074 }
18075
18076 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
18077         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18078         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
18079         return tag_ptr(ret_conv, true);
18080 }
18081 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
18082         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
18083         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
18084         return ret_conv;
18085 }
18086
18087 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
18088         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
18089         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18090         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
18091         return tag_ptr(ret_conv, true);
18092 }
18093
18094 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
18095         LDKThirtyTwoBytes a_ref;
18096         CHECK(a->arr_len == 32);
18097         memcpy(a_ref.data, a->elems, 32); FREE(a);
18098         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
18099         b_constr.datalen = b->arr_len;
18100         if (b_constr.datalen > 0)
18101                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18102         else
18103                 b_constr.data = NULL;
18104         uint64_t* b_vals = b->elems;
18105         for (size_t u = 0; u < b_constr.datalen; u++) {
18106                 uint64_t b_conv_20 = b_vals[u];
18107                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
18108                 CHECK_ACCESS(b_conv_20_ptr);
18109                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
18110                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
18111                 b_constr.data[u] = b_conv_20_conv;
18112         }
18113         FREE(b);
18114         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18115         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
18116         return tag_ptr(ret_conv, true);
18117 }
18118
18119 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
18120         if (!ptr_is_owned(_res)) return;
18121         void* _res_ptr = untag_ptr(_res);
18122         CHECK_ACCESS(_res_ptr);
18123         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
18124         FREE(untag_ptr(_res));
18125         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
18126 }
18127
18128 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
18129         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
18130         _res_constr.datalen = _res->arr_len;
18131         if (_res_constr.datalen > 0)
18132                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
18133         else
18134                 _res_constr.data = NULL;
18135         uint64_t* _res_vals = _res->elems;
18136         for (size_t n = 0; n < _res_constr.datalen; n++) {
18137                 uint64_t _res_conv_39 = _res_vals[n];
18138                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
18139                 CHECK_ACCESS(_res_conv_39_ptr);
18140                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
18141                 FREE(untag_ptr(_res_conv_39));
18142                 _res_constr.data[n] = _res_conv_39_conv;
18143         }
18144         FREE(_res);
18145         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
18146 }
18147
18148 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
18149         LDKCVec_BalanceZ _res_constr;
18150         _res_constr.datalen = _res->arr_len;
18151         if (_res_constr.datalen > 0)
18152                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
18153         else
18154                 _res_constr.data = NULL;
18155         uint64_t* _res_vals = _res->elems;
18156         for (size_t j = 0; j < _res_constr.datalen; j++) {
18157                 uint64_t _res_conv_9 = _res_vals[j];
18158                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
18159                 CHECK_ACCESS(_res_conv_9_ptr);
18160                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
18161                 FREE(untag_ptr(_res_conv_9));
18162                 _res_constr.data[j] = _res_conv_9_conv;
18163         }
18164         FREE(_res);
18165         CVec_BalanceZ_free(_res_constr);
18166 }
18167
18168 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
18169         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18170         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
18171         return tag_ptr(ret_conv, true);
18172 }
18173 int64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint64_t arg) {
18174         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
18175         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
18176         return ret_conv;
18177 }
18178
18179 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint64_t orig) {
18180         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
18181         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18182         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
18183         return tag_ptr(ret_conv, true);
18184 }
18185
18186 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint64_t b) {
18187         LDKThirtyTwoBytes a_ref;
18188         CHECK(a->arr_len == 32);
18189         memcpy(a_ref.data, a->elems, 32); FREE(a);
18190         LDKChannelMonitor b_conv;
18191         b_conv.inner = untag_ptr(b);
18192         b_conv.is_owned = ptr_is_owned(b);
18193         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18194         b_conv = ChannelMonitor_clone(&b_conv);
18195         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18196         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
18197         return tag_ptr(ret_conv, true);
18198 }
18199
18200 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint64_t _res) {
18201         if (!ptr_is_owned(_res)) return;
18202         void* _res_ptr = untag_ptr(_res);
18203         CHECK_ACCESS(_res_ptr);
18204         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
18205         FREE(untag_ptr(_res));
18206         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
18207 }
18208
18209 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
18210         void* o_ptr = untag_ptr(o);
18211         CHECK_ACCESS(o_ptr);
18212         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
18213         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
18214         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18215         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
18216         return tag_ptr(ret_conv, true);
18217 }
18218
18219 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint64_t e) {
18220         void* e_ptr = untag_ptr(e);
18221         CHECK_ACCESS(e_ptr);
18222         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18223         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18224         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18225         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
18226         return tag_ptr(ret_conv, true);
18227 }
18228
18229 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
18230         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
18231         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
18232         return ret_conv;
18233 }
18234
18235 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
18236         if (!ptr_is_owned(_res)) return;
18237         void* _res_ptr = untag_ptr(_res);
18238         CHECK_ACCESS(_res_ptr);
18239         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
18240         FREE(untag_ptr(_res));
18241         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
18242 }
18243
18244 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
18245         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18246         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
18247         return tag_ptr(ret_conv, true);
18248 }
18249 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
18250         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
18251         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
18252         return ret_conv;
18253 }
18254
18255 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
18256         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
18257         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18258         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
18259         return tag_ptr(ret_conv, true);
18260 }
18261
18262 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
18263         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18264         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
18265         return tag_ptr(ret_conv, true);
18266 }
18267 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
18268         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
18269         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
18270         return ret_conv;
18271 }
18272
18273 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
18274         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
18275         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18276         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
18277         return tag_ptr(ret_conv, true);
18278 }
18279
18280 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
18281         LDKPublicKey a_ref;
18282         CHECK(a->arr_len == 33);
18283         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
18284         void* b_ptr = untag_ptr(b);
18285         CHECK_ACCESS(b_ptr);
18286         LDKType b_conv = *(LDKType*)(b_ptr);
18287         if (b_conv.free == LDKType_JCalls_free) {
18288                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18289                 LDKType_JCalls_cloned(&b_conv);
18290         }
18291         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18292         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
18293         return tag_ptr(ret_conv, true);
18294 }
18295
18296 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
18297         if (!ptr_is_owned(_res)) return;
18298         void* _res_ptr = untag_ptr(_res);
18299         CHECK_ACCESS(_res_ptr);
18300         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
18301         FREE(untag_ptr(_res));
18302         C2Tuple_PublicKeyTypeZ_free(_res_conv);
18303 }
18304
18305 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
18306         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
18307         _res_constr.datalen = _res->arr_len;
18308         if (_res_constr.datalen > 0)
18309                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
18310         else
18311                 _res_constr.data = NULL;
18312         uint64_t* _res_vals = _res->elems;
18313         for (size_t z = 0; z < _res_constr.datalen; z++) {
18314                 uint64_t _res_conv_25 = _res_vals[z];
18315                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
18316                 CHECK_ACCESS(_res_conv_25_ptr);
18317                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
18318                 FREE(untag_ptr(_res_conv_25));
18319                 _res_constr.data[z] = _res_conv_25_conv;
18320         }
18321         FREE(_res);
18322         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
18323 }
18324
18325 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_some"))) TS_COption_CustomOnionMessageContentsZ_some(uint64_t o) {
18326         void* o_ptr = untag_ptr(o);
18327         CHECK_ACCESS(o_ptr);
18328         LDKCustomOnionMessageContents o_conv = *(LDKCustomOnionMessageContents*)(o_ptr);
18329         if (o_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
18330                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18331                 LDKCustomOnionMessageContents_JCalls_cloned(&o_conv);
18332         }
18333         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18334         *ret_copy = COption_CustomOnionMessageContentsZ_some(o_conv);
18335         uint64_t ret_ref = tag_ptr(ret_copy, true);
18336         return ret_ref;
18337 }
18338
18339 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_none"))) TS_COption_CustomOnionMessageContentsZ_none() {
18340         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18341         *ret_copy = COption_CustomOnionMessageContentsZ_none();
18342         uint64_t ret_ref = tag_ptr(ret_copy, true);
18343         return ret_ref;
18344 }
18345
18346 void  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_free"))) TS_COption_CustomOnionMessageContentsZ_free(uint64_t _res) {
18347         if (!ptr_is_owned(_res)) return;
18348         void* _res_ptr = untag_ptr(_res);
18349         CHECK_ACCESS(_res_ptr);
18350         LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr);
18351         FREE(untag_ptr(_res));
18352         COption_CustomOnionMessageContentsZ_free(_res_conv);
18353 }
18354
18355 static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) {
18356         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18357         *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg);
18358         uint64_t ret_ref = tag_ptr(ret_copy, true);
18359         return ret_ref;
18360 }
18361 int64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone_ptr"))) TS_COption_CustomOnionMessageContentsZ_clone_ptr(uint64_t arg) {
18362         LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg);
18363         int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv);
18364         return ret_conv;
18365 }
18366
18367 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone"))) TS_COption_CustomOnionMessageContentsZ_clone(uint64_t orig) {
18368         LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig);
18369         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18370         *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv);
18371         uint64_t ret_ref = tag_ptr(ret_copy, true);
18372         return ret_ref;
18373 }
18374
18375 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(uint64_t o) {
18376         void* o_ptr = untag_ptr(o);
18377         CHECK_ACCESS(o_ptr);
18378         LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr);
18379         o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o));
18380         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18381         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv);
18382         return tag_ptr(ret_conv, true);
18383 }
18384
18385 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(uint64_t e) {
18386         void* e_ptr = untag_ptr(e);
18387         CHECK_ACCESS(e_ptr);
18388         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18389         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18390         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18391         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv);
18392         return tag_ptr(ret_conv, true);
18393 }
18394
18395 jboolean  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) {
18396         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
18397         jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
18398         return ret_conv;
18399 }
18400
18401 void  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(uint64_t _res) {
18402         if (!ptr_is_owned(_res)) return;
18403         void* _res_ptr = untag_ptr(_res);
18404         CHECK_ACCESS(_res_ptr);
18405         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr);
18406         FREE(untag_ptr(_res));
18407         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv);
18408 }
18409
18410 static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
18411         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18412         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg);
18413         return tag_ptr(ret_conv, true);
18414 }
18415 int64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) {
18416         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
18417         int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
18418         return ret_conv;
18419 }
18420
18421 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) {
18422         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
18423         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18424         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv);
18425         return tag_ptr(ret_conv, true);
18426 }
18427
18428 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint64_t o) {
18429         void* o_ptr = untag_ptr(o);
18430         CHECK_ACCESS(o_ptr);
18431         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
18432         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
18433         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18434         *ret_copy = COption_NetAddressZ_some(o_conv);
18435         uint64_t ret_ref = tag_ptr(ret_copy, true);
18436         return ret_ref;
18437 }
18438
18439 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() {
18440         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18441         *ret_copy = COption_NetAddressZ_none();
18442         uint64_t ret_ref = tag_ptr(ret_copy, true);
18443         return ret_ref;
18444 }
18445
18446 void  __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint64_t _res) {
18447         if (!ptr_is_owned(_res)) return;
18448         void* _res_ptr = untag_ptr(_res);
18449         CHECK_ACCESS(_res_ptr);
18450         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
18451         FREE(untag_ptr(_res));
18452         COption_NetAddressZ_free(_res_conv);
18453 }
18454
18455 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
18456         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18457         *ret_copy = COption_NetAddressZ_clone(arg);
18458         uint64_t ret_ref = tag_ptr(ret_copy, true);
18459         return ret_ref;
18460 }
18461 int64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint64_t arg) {
18462         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
18463         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
18464         return ret_conv;
18465 }
18466
18467 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint64_t orig) {
18468         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
18469         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18470         *ret_copy = COption_NetAddressZ_clone(orig_conv);
18471         uint64_t ret_ref = tag_ptr(ret_copy, true);
18472         return ret_ref;
18473 }
18474
18475 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
18476         LDKCVec_u8Z o_ref;
18477         o_ref.datalen = o->arr_len;
18478         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
18479         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18480         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18481         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
18482         return tag_ptr(ret_conv, true);
18483 }
18484
18485 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
18486         LDKPeerHandleError e_conv;
18487         e_conv.inner = untag_ptr(e);
18488         e_conv.is_owned = ptr_is_owned(e);
18489         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18490         e_conv = PeerHandleError_clone(&e_conv);
18491         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18492         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
18493         return tag_ptr(ret_conv, true);
18494 }
18495
18496 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
18497         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
18498         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
18499         return ret_conv;
18500 }
18501
18502 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
18503         if (!ptr_is_owned(_res)) return;
18504         void* _res_ptr = untag_ptr(_res);
18505         CHECK_ACCESS(_res_ptr);
18506         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
18507         FREE(untag_ptr(_res));
18508         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
18509 }
18510
18511 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
18512         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18513         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
18514         return tag_ptr(ret_conv, true);
18515 }
18516 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
18517         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
18518         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
18519         return ret_conv;
18520 }
18521
18522 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
18523         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
18524         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18525         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
18526         return tag_ptr(ret_conv, true);
18527 }
18528
18529 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
18530         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18531         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
18532         return tag_ptr(ret_conv, true);
18533 }
18534
18535 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
18536         LDKPeerHandleError e_conv;
18537         e_conv.inner = untag_ptr(e);
18538         e_conv.is_owned = ptr_is_owned(e);
18539         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18540         e_conv = PeerHandleError_clone(&e_conv);
18541         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18542         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
18543         return tag_ptr(ret_conv, true);
18544 }
18545
18546 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
18547         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
18548         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
18549         return ret_conv;
18550 }
18551
18552 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
18553         if (!ptr_is_owned(_res)) return;
18554         void* _res_ptr = untag_ptr(_res);
18555         CHECK_ACCESS(_res_ptr);
18556         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
18557         FREE(untag_ptr(_res));
18558         CResult_NonePeerHandleErrorZ_free(_res_conv);
18559 }
18560
18561 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
18562         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18563         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
18564         return tag_ptr(ret_conv, true);
18565 }
18566 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
18567         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
18568         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
18569         return ret_conv;
18570 }
18571
18572 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
18573         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
18574         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18575         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
18576         return tag_ptr(ret_conv, true);
18577 }
18578
18579 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
18580         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18581         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
18582         return tag_ptr(ret_conv, true);
18583 }
18584
18585 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
18586         LDKPeerHandleError e_conv;
18587         e_conv.inner = untag_ptr(e);
18588         e_conv.is_owned = ptr_is_owned(e);
18589         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18590         e_conv = PeerHandleError_clone(&e_conv);
18591         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18592         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
18593         return tag_ptr(ret_conv, true);
18594 }
18595
18596 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
18597         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
18598         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
18599         return ret_conv;
18600 }
18601
18602 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
18603         if (!ptr_is_owned(_res)) return;
18604         void* _res_ptr = untag_ptr(_res);
18605         CHECK_ACCESS(_res_ptr);
18606         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
18607         FREE(untag_ptr(_res));
18608         CResult_boolPeerHandleErrorZ_free(_res_conv);
18609 }
18610
18611 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
18612         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18613         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
18614         return tag_ptr(ret_conv, true);
18615 }
18616 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
18617         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
18618         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
18619         return ret_conv;
18620 }
18621
18622 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
18623         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
18624         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18625         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
18626         return tag_ptr(ret_conv, true);
18627 }
18628
18629 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_ok"))) TS_CResult_NoneSendErrorZ_ok() {
18630         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
18631         *ret_conv = CResult_NoneSendErrorZ_ok();
18632         return tag_ptr(ret_conv, true);
18633 }
18634
18635 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_err"))) TS_CResult_NoneSendErrorZ_err(uint64_t e) {
18636         void* e_ptr = untag_ptr(e);
18637         CHECK_ACCESS(e_ptr);
18638         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
18639         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
18640         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
18641         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
18642         return tag_ptr(ret_conv, true);
18643 }
18644
18645 jboolean  __attribute__((export_name("TS_CResult_NoneSendErrorZ_is_ok"))) TS_CResult_NoneSendErrorZ_is_ok(uint64_t o) {
18646         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
18647         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
18648         return ret_conv;
18649 }
18650
18651 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_free"))) TS_CResult_NoneSendErrorZ_free(uint64_t _res) {
18652         if (!ptr_is_owned(_res)) return;
18653         void* _res_ptr = untag_ptr(_res);
18654         CHECK_ACCESS(_res_ptr);
18655         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
18656         FREE(untag_ptr(_res));
18657         CResult_NoneSendErrorZ_free(_res_conv);
18658 }
18659
18660 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
18661         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
18662         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
18663         return tag_ptr(ret_conv, true);
18664 }
18665
18666 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
18667         void* e_ptr = untag_ptr(e);
18668         CHECK_ACCESS(e_ptr);
18669         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
18670         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
18671         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
18672         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
18673         return tag_ptr(ret_conv, true);
18674 }
18675
18676 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
18677         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
18678         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
18679         return ret_conv;
18680 }
18681
18682 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
18683         if (!ptr_is_owned(_res)) return;
18684         void* _res_ptr = untag_ptr(_res);
18685         CHECK_ACCESS(_res_ptr);
18686         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
18687         FREE(untag_ptr(_res));
18688         CResult_u32GraphSyncErrorZ_free(_res_conv);
18689 }
18690
18691 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_ok"))) TS_CResult_NoneErrorZ_ok() {
18692         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
18693         *ret_conv = CResult_NoneErrorZ_ok();
18694         return tag_ptr(ret_conv, true);
18695 }
18696
18697 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_err"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
18698         LDKIOError e_conv = LDKIOError_from_js(e);
18699         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
18700         *ret_conv = CResult_NoneErrorZ_err(e_conv);
18701         return tag_ptr(ret_conv, true);
18702 }
18703
18704 jboolean  __attribute__((export_name("TS_CResult_NoneErrorZ_is_ok"))) TS_CResult_NoneErrorZ_is_ok(uint64_t o) {
18705         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
18706         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
18707         return ret_conv;
18708 }
18709
18710 void  __attribute__((export_name("TS_CResult_NoneErrorZ_free"))) TS_CResult_NoneErrorZ_free(uint64_t _res) {
18711         if (!ptr_is_owned(_res)) return;
18712         void* _res_ptr = untag_ptr(_res);
18713         CHECK_ACCESS(_res_ptr);
18714         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
18715         FREE(untag_ptr(_res));
18716         CResult_NoneErrorZ_free(_res_conv);
18717 }
18718
18719 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
18720         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
18721         *ret_conv = CResult_NoneErrorZ_clone(arg);
18722         return tag_ptr(ret_conv, true);
18723 }
18724 int64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone_ptr"))) TS_CResult_NoneErrorZ_clone_ptr(uint64_t arg) {
18725         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
18726         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
18727         return ret_conv;
18728 }
18729
18730 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone"))) TS_CResult_NoneErrorZ_clone(uint64_t orig) {
18731         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
18732         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
18733         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
18734         return tag_ptr(ret_conv, true);
18735 }
18736
18737 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint64_t o) {
18738         void* o_ptr = untag_ptr(o);
18739         CHECK_ACCESS(o_ptr);
18740         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
18741         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
18742         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18743         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
18744         return tag_ptr(ret_conv, true);
18745 }
18746
18747 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint64_t e) {
18748         void* e_ptr = untag_ptr(e);
18749         CHECK_ACCESS(e_ptr);
18750         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18751         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18752         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18753         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
18754         return tag_ptr(ret_conv, true);
18755 }
18756
18757 jboolean  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint64_t o) {
18758         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
18759         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
18760         return ret_conv;
18761 }
18762
18763 void  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint64_t _res) {
18764         if (!ptr_is_owned(_res)) return;
18765         void* _res_ptr = untag_ptr(_res);
18766         CHECK_ACCESS(_res_ptr);
18767         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
18768         FREE(untag_ptr(_res));
18769         CResult_NetAddressDecodeErrorZ_free(_res_conv);
18770 }
18771
18772 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
18773         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18774         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
18775         return tag_ptr(ret_conv, true);
18776 }
18777 int64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
18778         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
18779         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
18780         return ret_conv;
18781 }
18782
18783 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint64_t orig) {
18784         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
18785         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18786         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
18787         return tag_ptr(ret_conv, true);
18788 }
18789
18790 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
18791         LDKCVec_UpdateAddHTLCZ _res_constr;
18792         _res_constr.datalen = _res->arr_len;
18793         if (_res_constr.datalen > 0)
18794                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
18795         else
18796                 _res_constr.data = NULL;
18797         uint64_t* _res_vals = _res->elems;
18798         for (size_t p = 0; p < _res_constr.datalen; p++) {
18799                 uint64_t _res_conv_15 = _res_vals[p];
18800                 LDKUpdateAddHTLC _res_conv_15_conv;
18801                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
18802                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
18803                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
18804                 _res_constr.data[p] = _res_conv_15_conv;
18805         }
18806         FREE(_res);
18807         CVec_UpdateAddHTLCZ_free(_res_constr);
18808 }
18809
18810 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
18811         LDKCVec_UpdateFulfillHTLCZ _res_constr;
18812         _res_constr.datalen = _res->arr_len;
18813         if (_res_constr.datalen > 0)
18814                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
18815         else
18816                 _res_constr.data = NULL;
18817         uint64_t* _res_vals = _res->elems;
18818         for (size_t t = 0; t < _res_constr.datalen; t++) {
18819                 uint64_t _res_conv_19 = _res_vals[t];
18820                 LDKUpdateFulfillHTLC _res_conv_19_conv;
18821                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
18822                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
18823                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
18824                 _res_constr.data[t] = _res_conv_19_conv;
18825         }
18826         FREE(_res);
18827         CVec_UpdateFulfillHTLCZ_free(_res_constr);
18828 }
18829
18830 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
18831         LDKCVec_UpdateFailHTLCZ _res_constr;
18832         _res_constr.datalen = _res->arr_len;
18833         if (_res_constr.datalen > 0)
18834                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
18835         else
18836                 _res_constr.data = NULL;
18837         uint64_t* _res_vals = _res->elems;
18838         for (size_t q = 0; q < _res_constr.datalen; q++) {
18839                 uint64_t _res_conv_16 = _res_vals[q];
18840                 LDKUpdateFailHTLC _res_conv_16_conv;
18841                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
18842                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
18843                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
18844                 _res_constr.data[q] = _res_conv_16_conv;
18845         }
18846         FREE(_res);
18847         CVec_UpdateFailHTLCZ_free(_res_constr);
18848 }
18849
18850 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
18851         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
18852         _res_constr.datalen = _res->arr_len;
18853         if (_res_constr.datalen > 0)
18854                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
18855         else
18856                 _res_constr.data = NULL;
18857         uint64_t* _res_vals = _res->elems;
18858         for (size_t z = 0; z < _res_constr.datalen; z++) {
18859                 uint64_t _res_conv_25 = _res_vals[z];
18860                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
18861                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
18862                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
18863                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
18864                 _res_constr.data[z] = _res_conv_25_conv;
18865         }
18866         FREE(_res);
18867         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
18868 }
18869
18870 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
18871         LDKAcceptChannel o_conv;
18872         o_conv.inner = untag_ptr(o);
18873         o_conv.is_owned = ptr_is_owned(o);
18874         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18875         o_conv = AcceptChannel_clone(&o_conv);
18876         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18877         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
18878         return tag_ptr(ret_conv, true);
18879 }
18880
18881 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
18882         void* e_ptr = untag_ptr(e);
18883         CHECK_ACCESS(e_ptr);
18884         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18885         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18886         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18887         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
18888         return tag_ptr(ret_conv, true);
18889 }
18890
18891 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
18892         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
18893         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
18894         return ret_conv;
18895 }
18896
18897 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
18898         if (!ptr_is_owned(_res)) return;
18899         void* _res_ptr = untag_ptr(_res);
18900         CHECK_ACCESS(_res_ptr);
18901         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
18902         FREE(untag_ptr(_res));
18903         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
18904 }
18905
18906 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
18907         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18908         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
18909         return tag_ptr(ret_conv, true);
18910 }
18911 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
18912         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
18913         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
18914         return ret_conv;
18915 }
18916
18917 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
18918         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
18919         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18920         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
18921         return tag_ptr(ret_conv, true);
18922 }
18923
18924 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
18925         LDKAnnouncementSignatures o_conv;
18926         o_conv.inner = untag_ptr(o);
18927         o_conv.is_owned = ptr_is_owned(o);
18928         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18929         o_conv = AnnouncementSignatures_clone(&o_conv);
18930         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18931         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
18932         return tag_ptr(ret_conv, true);
18933 }
18934
18935 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
18936         void* e_ptr = untag_ptr(e);
18937         CHECK_ACCESS(e_ptr);
18938         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18939         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18940         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18941         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
18942         return tag_ptr(ret_conv, true);
18943 }
18944
18945 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
18946         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
18947         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
18948         return ret_conv;
18949 }
18950
18951 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
18952         if (!ptr_is_owned(_res)) return;
18953         void* _res_ptr = untag_ptr(_res);
18954         CHECK_ACCESS(_res_ptr);
18955         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
18956         FREE(untag_ptr(_res));
18957         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
18958 }
18959
18960 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
18961         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18962         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
18963         return tag_ptr(ret_conv, true);
18964 }
18965 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18966         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
18967         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
18968         return ret_conv;
18969 }
18970
18971 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
18972         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
18973         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18974         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
18975         return tag_ptr(ret_conv, true);
18976 }
18977
18978 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
18979         LDKChannelReestablish o_conv;
18980         o_conv.inner = untag_ptr(o);
18981         o_conv.is_owned = ptr_is_owned(o);
18982         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18983         o_conv = ChannelReestablish_clone(&o_conv);
18984         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18985         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
18986         return tag_ptr(ret_conv, true);
18987 }
18988
18989 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
18990         void* e_ptr = untag_ptr(e);
18991         CHECK_ACCESS(e_ptr);
18992         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18993         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18994         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18995         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
18996         return tag_ptr(ret_conv, true);
18997 }
18998
18999 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
19000         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
19001         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
19002         return ret_conv;
19003 }
19004
19005 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
19006         if (!ptr_is_owned(_res)) return;
19007         void* _res_ptr = untag_ptr(_res);
19008         CHECK_ACCESS(_res_ptr);
19009         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
19010         FREE(untag_ptr(_res));
19011         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
19012 }
19013
19014 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
19015         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19016         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
19017         return tag_ptr(ret_conv, true);
19018 }
19019 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
19020         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
19021         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
19022         return ret_conv;
19023 }
19024
19025 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
19026         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
19027         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19028         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
19029         return tag_ptr(ret_conv, true);
19030 }
19031
19032 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
19033         LDKClosingSigned o_conv;
19034         o_conv.inner = untag_ptr(o);
19035         o_conv.is_owned = ptr_is_owned(o);
19036         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19037         o_conv = ClosingSigned_clone(&o_conv);
19038         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19039         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
19040         return tag_ptr(ret_conv, true);
19041 }
19042
19043 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
19044         void* e_ptr = untag_ptr(e);
19045         CHECK_ACCESS(e_ptr);
19046         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19047         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19048         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19049         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
19050         return tag_ptr(ret_conv, true);
19051 }
19052
19053 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
19054         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
19055         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
19056         return ret_conv;
19057 }
19058
19059 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
19060         if (!ptr_is_owned(_res)) return;
19061         void* _res_ptr = untag_ptr(_res);
19062         CHECK_ACCESS(_res_ptr);
19063         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
19064         FREE(untag_ptr(_res));
19065         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
19066 }
19067
19068 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
19069         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19070         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
19071         return tag_ptr(ret_conv, true);
19072 }
19073 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
19074         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
19075         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
19076         return ret_conv;
19077 }
19078
19079 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
19080         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
19081         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19082         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
19083         return tag_ptr(ret_conv, true);
19084 }
19085
19086 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
19087         LDKClosingSignedFeeRange o_conv;
19088         o_conv.inner = untag_ptr(o);
19089         o_conv.is_owned = ptr_is_owned(o);
19090         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19091         o_conv = ClosingSignedFeeRange_clone(&o_conv);
19092         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19093         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
19094         return tag_ptr(ret_conv, true);
19095 }
19096
19097 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
19098         void* e_ptr = untag_ptr(e);
19099         CHECK_ACCESS(e_ptr);
19100         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19101         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19102         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19103         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
19104         return tag_ptr(ret_conv, true);
19105 }
19106
19107 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
19108         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
19109         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
19110         return ret_conv;
19111 }
19112
19113 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
19114         if (!ptr_is_owned(_res)) return;
19115         void* _res_ptr = untag_ptr(_res);
19116         CHECK_ACCESS(_res_ptr);
19117         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
19118         FREE(untag_ptr(_res));
19119         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
19120 }
19121
19122 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
19123         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19124         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
19125         return tag_ptr(ret_conv, true);
19126 }
19127 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
19128         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
19129         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
19130         return ret_conv;
19131 }
19132
19133 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
19134         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
19135         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19136         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
19137         return tag_ptr(ret_conv, true);
19138 }
19139
19140 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
19141         LDKCommitmentSigned o_conv;
19142         o_conv.inner = untag_ptr(o);
19143         o_conv.is_owned = ptr_is_owned(o);
19144         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19145         o_conv = CommitmentSigned_clone(&o_conv);
19146         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19147         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
19148         return tag_ptr(ret_conv, true);
19149 }
19150
19151 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
19152         void* e_ptr = untag_ptr(e);
19153         CHECK_ACCESS(e_ptr);
19154         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19155         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19156         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19157         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
19158         return tag_ptr(ret_conv, true);
19159 }
19160
19161 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
19162         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
19163         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
19164         return ret_conv;
19165 }
19166
19167 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
19168         if (!ptr_is_owned(_res)) return;
19169         void* _res_ptr = untag_ptr(_res);
19170         CHECK_ACCESS(_res_ptr);
19171         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
19172         FREE(untag_ptr(_res));
19173         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
19174 }
19175
19176 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
19177         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19178         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
19179         return tag_ptr(ret_conv, true);
19180 }
19181 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
19182         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
19183         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
19184         return ret_conv;
19185 }
19186
19187 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
19188         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
19189         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19190         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
19191         return tag_ptr(ret_conv, true);
19192 }
19193
19194 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
19195         LDKFundingCreated o_conv;
19196         o_conv.inner = untag_ptr(o);
19197         o_conv.is_owned = ptr_is_owned(o);
19198         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19199         o_conv = FundingCreated_clone(&o_conv);
19200         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19201         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
19202         return tag_ptr(ret_conv, true);
19203 }
19204
19205 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
19206         void* e_ptr = untag_ptr(e);
19207         CHECK_ACCESS(e_ptr);
19208         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19209         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19210         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19211         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
19212         return tag_ptr(ret_conv, true);
19213 }
19214
19215 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
19216         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
19217         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
19218         return ret_conv;
19219 }
19220
19221 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
19222         if (!ptr_is_owned(_res)) return;
19223         void* _res_ptr = untag_ptr(_res);
19224         CHECK_ACCESS(_res_ptr);
19225         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
19226         FREE(untag_ptr(_res));
19227         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
19228 }
19229
19230 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
19231         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19232         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
19233         return tag_ptr(ret_conv, true);
19234 }
19235 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
19236         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
19237         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
19238         return ret_conv;
19239 }
19240
19241 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
19242         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
19243         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19244         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
19245         return tag_ptr(ret_conv, true);
19246 }
19247
19248 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
19249         LDKFundingSigned o_conv;
19250         o_conv.inner = untag_ptr(o);
19251         o_conv.is_owned = ptr_is_owned(o);
19252         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19253         o_conv = FundingSigned_clone(&o_conv);
19254         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19255         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
19256         return tag_ptr(ret_conv, true);
19257 }
19258
19259 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
19260         void* e_ptr = untag_ptr(e);
19261         CHECK_ACCESS(e_ptr);
19262         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19263         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19264         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19265         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
19266         return tag_ptr(ret_conv, true);
19267 }
19268
19269 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
19270         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
19271         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
19272         return ret_conv;
19273 }
19274
19275 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
19276         if (!ptr_is_owned(_res)) return;
19277         void* _res_ptr = untag_ptr(_res);
19278         CHECK_ACCESS(_res_ptr);
19279         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
19280         FREE(untag_ptr(_res));
19281         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
19282 }
19283
19284 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
19285         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19286         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
19287         return tag_ptr(ret_conv, true);
19288 }
19289 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
19290         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
19291         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
19292         return ret_conv;
19293 }
19294
19295 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
19296         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
19297         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19298         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
19299         return tag_ptr(ret_conv, true);
19300 }
19301
19302 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
19303         LDKChannelReady o_conv;
19304         o_conv.inner = untag_ptr(o);
19305         o_conv.is_owned = ptr_is_owned(o);
19306         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19307         o_conv = ChannelReady_clone(&o_conv);
19308         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19309         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
19310         return tag_ptr(ret_conv, true);
19311 }
19312
19313 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
19314         void* e_ptr = untag_ptr(e);
19315         CHECK_ACCESS(e_ptr);
19316         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19317         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19318         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19319         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
19320         return tag_ptr(ret_conv, true);
19321 }
19322
19323 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
19324         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
19325         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
19326         return ret_conv;
19327 }
19328
19329 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
19330         if (!ptr_is_owned(_res)) return;
19331         void* _res_ptr = untag_ptr(_res);
19332         CHECK_ACCESS(_res_ptr);
19333         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
19334         FREE(untag_ptr(_res));
19335         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
19336 }
19337
19338 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
19339         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19340         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
19341         return tag_ptr(ret_conv, true);
19342 }
19343 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
19344         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
19345         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
19346         return ret_conv;
19347 }
19348
19349 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
19350         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
19351         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19352         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
19353         return tag_ptr(ret_conv, true);
19354 }
19355
19356 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
19357         LDKInit o_conv;
19358         o_conv.inner = untag_ptr(o);
19359         o_conv.is_owned = ptr_is_owned(o);
19360         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19361         o_conv = Init_clone(&o_conv);
19362         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
19363         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
19364         return tag_ptr(ret_conv, true);
19365 }
19366
19367 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
19368         void* e_ptr = untag_ptr(e);
19369         CHECK_ACCESS(e_ptr);
19370         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19371         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19372         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
19373         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
19374         return tag_ptr(ret_conv, true);
19375 }
19376
19377 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
19378         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
19379         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
19380         return ret_conv;
19381 }
19382
19383 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
19384         if (!ptr_is_owned(_res)) return;
19385         void* _res_ptr = untag_ptr(_res);
19386         CHECK_ACCESS(_res_ptr);
19387         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
19388         FREE(untag_ptr(_res));
19389         CResult_InitDecodeErrorZ_free(_res_conv);
19390 }
19391
19392 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
19393         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
19394         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
19395         return tag_ptr(ret_conv, true);
19396 }
19397 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
19398         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
19399         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
19400         return ret_conv;
19401 }
19402
19403 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
19404         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
19405         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
19406         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
19407         return tag_ptr(ret_conv, true);
19408 }
19409
19410 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
19411         LDKOpenChannel o_conv;
19412         o_conv.inner = untag_ptr(o);
19413         o_conv.is_owned = ptr_is_owned(o);
19414         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19415         o_conv = OpenChannel_clone(&o_conv);
19416         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
19417         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
19418         return tag_ptr(ret_conv, true);
19419 }
19420
19421 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
19422         void* e_ptr = untag_ptr(e);
19423         CHECK_ACCESS(e_ptr);
19424         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19425         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19426         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
19427         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
19428         return tag_ptr(ret_conv, true);
19429 }
19430
19431 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
19432         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
19433         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
19434         return ret_conv;
19435 }
19436
19437 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
19438         if (!ptr_is_owned(_res)) return;
19439         void* _res_ptr = untag_ptr(_res);
19440         CHECK_ACCESS(_res_ptr);
19441         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
19442         FREE(untag_ptr(_res));
19443         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
19444 }
19445
19446 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
19447         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
19448         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
19449         return tag_ptr(ret_conv, true);
19450 }
19451 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
19452         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
19453         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
19454         return ret_conv;
19455 }
19456
19457 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
19458         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
19459         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
19460         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
19461         return tag_ptr(ret_conv, true);
19462 }
19463
19464 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
19465         LDKRevokeAndACK o_conv;
19466         o_conv.inner = untag_ptr(o);
19467         o_conv.is_owned = ptr_is_owned(o);
19468         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19469         o_conv = RevokeAndACK_clone(&o_conv);
19470         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
19471         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
19472         return tag_ptr(ret_conv, true);
19473 }
19474
19475 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
19476         void* e_ptr = untag_ptr(e);
19477         CHECK_ACCESS(e_ptr);
19478         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19479         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19480         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
19481         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
19482         return tag_ptr(ret_conv, true);
19483 }
19484
19485 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
19486         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
19487         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
19488         return ret_conv;
19489 }
19490
19491 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
19492         if (!ptr_is_owned(_res)) return;
19493         void* _res_ptr = untag_ptr(_res);
19494         CHECK_ACCESS(_res_ptr);
19495         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
19496         FREE(untag_ptr(_res));
19497         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
19498 }
19499
19500 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
19501         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
19502         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
19503         return tag_ptr(ret_conv, true);
19504 }
19505 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
19506         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
19507         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
19508         return ret_conv;
19509 }
19510
19511 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
19512         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
19513         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
19514         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
19515         return tag_ptr(ret_conv, true);
19516 }
19517
19518 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
19519         LDKShutdown o_conv;
19520         o_conv.inner = untag_ptr(o);
19521         o_conv.is_owned = ptr_is_owned(o);
19522         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19523         o_conv = Shutdown_clone(&o_conv);
19524         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
19525         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
19526         return tag_ptr(ret_conv, true);
19527 }
19528
19529 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
19530         void* e_ptr = untag_ptr(e);
19531         CHECK_ACCESS(e_ptr);
19532         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19533         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19534         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
19535         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
19536         return tag_ptr(ret_conv, true);
19537 }
19538
19539 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
19540         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
19541         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
19542         return ret_conv;
19543 }
19544
19545 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
19546         if (!ptr_is_owned(_res)) return;
19547         void* _res_ptr = untag_ptr(_res);
19548         CHECK_ACCESS(_res_ptr);
19549         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
19550         FREE(untag_ptr(_res));
19551         CResult_ShutdownDecodeErrorZ_free(_res_conv);
19552 }
19553
19554 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
19555         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
19556         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
19557         return tag_ptr(ret_conv, true);
19558 }
19559 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
19560         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
19561         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
19562         return ret_conv;
19563 }
19564
19565 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
19566         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
19567         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
19568         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
19569         return tag_ptr(ret_conv, true);
19570 }
19571
19572 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
19573         LDKUpdateFailHTLC o_conv;
19574         o_conv.inner = untag_ptr(o);
19575         o_conv.is_owned = ptr_is_owned(o);
19576         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19577         o_conv = UpdateFailHTLC_clone(&o_conv);
19578         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
19579         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
19580         return tag_ptr(ret_conv, true);
19581 }
19582
19583 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
19584         void* e_ptr = untag_ptr(e);
19585         CHECK_ACCESS(e_ptr);
19586         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19587         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19588         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
19589         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
19590         return tag_ptr(ret_conv, true);
19591 }
19592
19593 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
19594         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
19595         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
19596         return ret_conv;
19597 }
19598
19599 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
19600         if (!ptr_is_owned(_res)) return;
19601         void* _res_ptr = untag_ptr(_res);
19602         CHECK_ACCESS(_res_ptr);
19603         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
19604         FREE(untag_ptr(_res));
19605         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
19606 }
19607
19608 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
19609         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
19610         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
19611         return tag_ptr(ret_conv, true);
19612 }
19613 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
19614         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
19615         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
19616         return ret_conv;
19617 }
19618
19619 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
19620         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
19621         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
19622         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
19623         return tag_ptr(ret_conv, true);
19624 }
19625
19626 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
19627         LDKUpdateFailMalformedHTLC o_conv;
19628         o_conv.inner = untag_ptr(o);
19629         o_conv.is_owned = ptr_is_owned(o);
19630         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19631         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
19632         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
19633         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
19634         return tag_ptr(ret_conv, true);
19635 }
19636
19637 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
19638         void* e_ptr = untag_ptr(e);
19639         CHECK_ACCESS(e_ptr);
19640         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19641         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19642         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
19643         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
19644         return tag_ptr(ret_conv, true);
19645 }
19646
19647 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
19648         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
19649         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
19650         return ret_conv;
19651 }
19652
19653 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
19654         if (!ptr_is_owned(_res)) return;
19655         void* _res_ptr = untag_ptr(_res);
19656         CHECK_ACCESS(_res_ptr);
19657         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
19658         FREE(untag_ptr(_res));
19659         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
19660 }
19661
19662 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
19663         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
19664         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
19665         return tag_ptr(ret_conv, true);
19666 }
19667 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
19668         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
19669         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
19670         return ret_conv;
19671 }
19672
19673 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
19674         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
19675         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
19676         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
19677         return tag_ptr(ret_conv, true);
19678 }
19679
19680 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
19681         LDKUpdateFee o_conv;
19682         o_conv.inner = untag_ptr(o);
19683         o_conv.is_owned = ptr_is_owned(o);
19684         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19685         o_conv = UpdateFee_clone(&o_conv);
19686         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
19687         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
19688         return tag_ptr(ret_conv, true);
19689 }
19690
19691 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
19692         void* e_ptr = untag_ptr(e);
19693         CHECK_ACCESS(e_ptr);
19694         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19695         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19696         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
19697         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
19698         return tag_ptr(ret_conv, true);
19699 }
19700
19701 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
19702         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
19703         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
19704         return ret_conv;
19705 }
19706
19707 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
19708         if (!ptr_is_owned(_res)) return;
19709         void* _res_ptr = untag_ptr(_res);
19710         CHECK_ACCESS(_res_ptr);
19711         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
19712         FREE(untag_ptr(_res));
19713         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
19714 }
19715
19716 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
19717         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
19718         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
19719         return tag_ptr(ret_conv, true);
19720 }
19721 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
19722         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
19723         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
19724         return ret_conv;
19725 }
19726
19727 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
19728         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
19729         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
19730         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
19731         return tag_ptr(ret_conv, true);
19732 }
19733
19734 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
19735         LDKUpdateFulfillHTLC o_conv;
19736         o_conv.inner = untag_ptr(o);
19737         o_conv.is_owned = ptr_is_owned(o);
19738         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19739         o_conv = UpdateFulfillHTLC_clone(&o_conv);
19740         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
19741         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
19742         return tag_ptr(ret_conv, true);
19743 }
19744
19745 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
19746         void* e_ptr = untag_ptr(e);
19747         CHECK_ACCESS(e_ptr);
19748         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19749         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19750         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
19751         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
19752         return tag_ptr(ret_conv, true);
19753 }
19754
19755 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
19756         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
19757         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
19758         return ret_conv;
19759 }
19760
19761 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
19762         if (!ptr_is_owned(_res)) return;
19763         void* _res_ptr = untag_ptr(_res);
19764         CHECK_ACCESS(_res_ptr);
19765         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
19766         FREE(untag_ptr(_res));
19767         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
19768 }
19769
19770 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
19771         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
19772         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
19773         return tag_ptr(ret_conv, true);
19774 }
19775 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
19776         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
19777         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
19778         return ret_conv;
19779 }
19780
19781 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
19782         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
19783         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
19784         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
19785         return tag_ptr(ret_conv, true);
19786 }
19787
19788 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
19789         LDKUpdateAddHTLC o_conv;
19790         o_conv.inner = untag_ptr(o);
19791         o_conv.is_owned = ptr_is_owned(o);
19792         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19793         o_conv = UpdateAddHTLC_clone(&o_conv);
19794         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19795         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
19796         return tag_ptr(ret_conv, true);
19797 }
19798
19799 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
19800         void* e_ptr = untag_ptr(e);
19801         CHECK_ACCESS(e_ptr);
19802         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19803         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19804         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19805         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
19806         return tag_ptr(ret_conv, true);
19807 }
19808
19809 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
19810         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
19811         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
19812         return ret_conv;
19813 }
19814
19815 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
19816         if (!ptr_is_owned(_res)) return;
19817         void* _res_ptr = untag_ptr(_res);
19818         CHECK_ACCESS(_res_ptr);
19819         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
19820         FREE(untag_ptr(_res));
19821         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
19822 }
19823
19824 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
19825         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19826         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
19827         return tag_ptr(ret_conv, true);
19828 }
19829 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
19830         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
19831         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
19832         return ret_conv;
19833 }
19834
19835 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
19836         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
19837         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19838         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
19839         return tag_ptr(ret_conv, true);
19840 }
19841
19842 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
19843         LDKOnionMessage o_conv;
19844         o_conv.inner = untag_ptr(o);
19845         o_conv.is_owned = ptr_is_owned(o);
19846         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19847         o_conv = OnionMessage_clone(&o_conv);
19848         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
19849         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
19850         return tag_ptr(ret_conv, true);
19851 }
19852
19853 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
19854         void* e_ptr = untag_ptr(e);
19855         CHECK_ACCESS(e_ptr);
19856         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19857         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19858         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
19859         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
19860         return tag_ptr(ret_conv, true);
19861 }
19862
19863 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
19864         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
19865         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
19866         return ret_conv;
19867 }
19868
19869 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
19870         if (!ptr_is_owned(_res)) return;
19871         void* _res_ptr = untag_ptr(_res);
19872         CHECK_ACCESS(_res_ptr);
19873         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
19874         FREE(untag_ptr(_res));
19875         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
19876 }
19877
19878 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
19879         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
19880         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
19881         return tag_ptr(ret_conv, true);
19882 }
19883 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
19884         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
19885         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
19886         return ret_conv;
19887 }
19888
19889 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
19890         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
19891         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
19892         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
19893         return tag_ptr(ret_conv, true);
19894 }
19895
19896 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
19897         LDKPing o_conv;
19898         o_conv.inner = untag_ptr(o);
19899         o_conv.is_owned = ptr_is_owned(o);
19900         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19901         o_conv = Ping_clone(&o_conv);
19902         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19903         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
19904         return tag_ptr(ret_conv, true);
19905 }
19906
19907 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
19908         void* e_ptr = untag_ptr(e);
19909         CHECK_ACCESS(e_ptr);
19910         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19911         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19912         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19913         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
19914         return tag_ptr(ret_conv, true);
19915 }
19916
19917 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
19918         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
19919         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
19920         return ret_conv;
19921 }
19922
19923 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
19924         if (!ptr_is_owned(_res)) return;
19925         void* _res_ptr = untag_ptr(_res);
19926         CHECK_ACCESS(_res_ptr);
19927         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
19928         FREE(untag_ptr(_res));
19929         CResult_PingDecodeErrorZ_free(_res_conv);
19930 }
19931
19932 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
19933         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19934         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
19935         return tag_ptr(ret_conv, true);
19936 }
19937 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
19938         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
19939         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
19940         return ret_conv;
19941 }
19942
19943 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
19944         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
19945         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19946         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
19947         return tag_ptr(ret_conv, true);
19948 }
19949
19950 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
19951         LDKPong o_conv;
19952         o_conv.inner = untag_ptr(o);
19953         o_conv.is_owned = ptr_is_owned(o);
19954         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19955         o_conv = Pong_clone(&o_conv);
19956         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19957         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
19958         return tag_ptr(ret_conv, true);
19959 }
19960
19961 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
19962         void* e_ptr = untag_ptr(e);
19963         CHECK_ACCESS(e_ptr);
19964         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19965         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19966         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19967         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
19968         return tag_ptr(ret_conv, true);
19969 }
19970
19971 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
19972         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
19973         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
19974         return ret_conv;
19975 }
19976
19977 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
19978         if (!ptr_is_owned(_res)) return;
19979         void* _res_ptr = untag_ptr(_res);
19980         CHECK_ACCESS(_res_ptr);
19981         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
19982         FREE(untag_ptr(_res));
19983         CResult_PongDecodeErrorZ_free(_res_conv);
19984 }
19985
19986 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
19987         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19988         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
19989         return tag_ptr(ret_conv, true);
19990 }
19991 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
19992         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
19993         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
19994         return ret_conv;
19995 }
19996
19997 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
19998         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
19999         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20000         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
20001         return tag_ptr(ret_conv, true);
20002 }
20003
20004 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
20005         LDKUnsignedChannelAnnouncement o_conv;
20006         o_conv.inner = untag_ptr(o);
20007         o_conv.is_owned = ptr_is_owned(o);
20008         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20009         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
20010         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20011         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
20012         return tag_ptr(ret_conv, true);
20013 }
20014
20015 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
20016         void* e_ptr = untag_ptr(e);
20017         CHECK_ACCESS(e_ptr);
20018         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20019         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20020         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20021         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
20022         return tag_ptr(ret_conv, true);
20023 }
20024
20025 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
20026         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
20027         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
20028         return ret_conv;
20029 }
20030
20031 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
20032         if (!ptr_is_owned(_res)) return;
20033         void* _res_ptr = untag_ptr(_res);
20034         CHECK_ACCESS(_res_ptr);
20035         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
20036         FREE(untag_ptr(_res));
20037         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
20038 }
20039
20040 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20041         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20042         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
20043         return tag_ptr(ret_conv, true);
20044 }
20045 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
20046         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
20047         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20048         return ret_conv;
20049 }
20050
20051 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
20052         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
20053         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20054         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
20055         return tag_ptr(ret_conv, true);
20056 }
20057
20058 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
20059         LDKChannelAnnouncement o_conv;
20060         o_conv.inner = untag_ptr(o);
20061         o_conv.is_owned = ptr_is_owned(o);
20062         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20063         o_conv = ChannelAnnouncement_clone(&o_conv);
20064         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20065         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
20066         return tag_ptr(ret_conv, true);
20067 }
20068
20069 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
20070         void* e_ptr = untag_ptr(e);
20071         CHECK_ACCESS(e_ptr);
20072         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20073         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20074         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20075         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
20076         return tag_ptr(ret_conv, true);
20077 }
20078
20079 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
20080         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
20081         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
20082         return ret_conv;
20083 }
20084
20085 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
20086         if (!ptr_is_owned(_res)) return;
20087         void* _res_ptr = untag_ptr(_res);
20088         CHECK_ACCESS(_res_ptr);
20089         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
20090         FREE(untag_ptr(_res));
20091         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
20092 }
20093
20094 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20095         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20096         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
20097         return tag_ptr(ret_conv, true);
20098 }
20099 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
20100         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
20101         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20102         return ret_conv;
20103 }
20104
20105 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
20106         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
20107         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20108         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
20109         return tag_ptr(ret_conv, true);
20110 }
20111
20112 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
20113         LDKUnsignedChannelUpdate o_conv;
20114         o_conv.inner = untag_ptr(o);
20115         o_conv.is_owned = ptr_is_owned(o);
20116         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20117         o_conv = UnsignedChannelUpdate_clone(&o_conv);
20118         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20119         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
20120         return tag_ptr(ret_conv, true);
20121 }
20122
20123 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
20124         void* e_ptr = untag_ptr(e);
20125         CHECK_ACCESS(e_ptr);
20126         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20127         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20128         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20129         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
20130         return tag_ptr(ret_conv, true);
20131 }
20132
20133 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
20134         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
20135         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
20136         return ret_conv;
20137 }
20138
20139 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
20140         if (!ptr_is_owned(_res)) return;
20141         void* _res_ptr = untag_ptr(_res);
20142         CHECK_ACCESS(_res_ptr);
20143         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
20144         FREE(untag_ptr(_res));
20145         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
20146 }
20147
20148 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
20149         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20150         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
20151         return tag_ptr(ret_conv, true);
20152 }
20153 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
20154         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
20155         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
20156         return ret_conv;
20157 }
20158
20159 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
20160         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
20161         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20162         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
20163         return tag_ptr(ret_conv, true);
20164 }
20165
20166 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
20167         LDKChannelUpdate o_conv;
20168         o_conv.inner = untag_ptr(o);
20169         o_conv.is_owned = ptr_is_owned(o);
20170         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20171         o_conv = ChannelUpdate_clone(&o_conv);
20172         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20173         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
20174         return tag_ptr(ret_conv, true);
20175 }
20176
20177 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
20178         void* e_ptr = untag_ptr(e);
20179         CHECK_ACCESS(e_ptr);
20180         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20181         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20182         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20183         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
20184         return tag_ptr(ret_conv, true);
20185 }
20186
20187 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
20188         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
20189         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
20190         return ret_conv;
20191 }
20192
20193 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
20194         if (!ptr_is_owned(_res)) return;
20195         void* _res_ptr = untag_ptr(_res);
20196         CHECK_ACCESS(_res_ptr);
20197         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
20198         FREE(untag_ptr(_res));
20199         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
20200 }
20201
20202 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
20203         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20204         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
20205         return tag_ptr(ret_conv, true);
20206 }
20207 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
20208         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
20209         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
20210         return ret_conv;
20211 }
20212
20213 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
20214         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
20215         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20216         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
20217         return tag_ptr(ret_conv, true);
20218 }
20219
20220 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
20221         LDKErrorMessage o_conv;
20222         o_conv.inner = untag_ptr(o);
20223         o_conv.is_owned = ptr_is_owned(o);
20224         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20225         o_conv = ErrorMessage_clone(&o_conv);
20226         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20227         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
20228         return tag_ptr(ret_conv, true);
20229 }
20230
20231 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
20232         void* e_ptr = untag_ptr(e);
20233         CHECK_ACCESS(e_ptr);
20234         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20235         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20236         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20237         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
20238         return tag_ptr(ret_conv, true);
20239 }
20240
20241 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
20242         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
20243         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
20244         return ret_conv;
20245 }
20246
20247 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
20248         if (!ptr_is_owned(_res)) return;
20249         void* _res_ptr = untag_ptr(_res);
20250         CHECK_ACCESS(_res_ptr);
20251         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
20252         FREE(untag_ptr(_res));
20253         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
20254 }
20255
20256 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
20257         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20258         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
20259         return tag_ptr(ret_conv, true);
20260 }
20261 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
20262         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
20263         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
20264         return ret_conv;
20265 }
20266
20267 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
20268         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
20269         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20270         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
20271         return tag_ptr(ret_conv, true);
20272 }
20273
20274 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
20275         LDKWarningMessage o_conv;
20276         o_conv.inner = untag_ptr(o);
20277         o_conv.is_owned = ptr_is_owned(o);
20278         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20279         o_conv = WarningMessage_clone(&o_conv);
20280         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20281         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
20282         return tag_ptr(ret_conv, true);
20283 }
20284
20285 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
20286         void* e_ptr = untag_ptr(e);
20287         CHECK_ACCESS(e_ptr);
20288         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20289         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20290         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20291         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
20292         return tag_ptr(ret_conv, true);
20293 }
20294
20295 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
20296         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
20297         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
20298         return ret_conv;
20299 }
20300
20301 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
20302         if (!ptr_is_owned(_res)) return;
20303         void* _res_ptr = untag_ptr(_res);
20304         CHECK_ACCESS(_res_ptr);
20305         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
20306         FREE(untag_ptr(_res));
20307         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
20308 }
20309
20310 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
20311         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20312         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
20313         return tag_ptr(ret_conv, true);
20314 }
20315 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
20316         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
20317         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
20318         return ret_conv;
20319 }
20320
20321 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
20322         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
20323         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20324         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
20325         return tag_ptr(ret_conv, true);
20326 }
20327
20328 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
20329         LDKUnsignedNodeAnnouncement o_conv;
20330         o_conv.inner = untag_ptr(o);
20331         o_conv.is_owned = ptr_is_owned(o);
20332         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20333         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
20334         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20335         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
20336         return tag_ptr(ret_conv, true);
20337 }
20338
20339 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
20340         void* e_ptr = untag_ptr(e);
20341         CHECK_ACCESS(e_ptr);
20342         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20343         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20344         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20345         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
20346         return tag_ptr(ret_conv, true);
20347 }
20348
20349 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
20350         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
20351         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
20352         return ret_conv;
20353 }
20354
20355 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
20356         if (!ptr_is_owned(_res)) return;
20357         void* _res_ptr = untag_ptr(_res);
20358         CHECK_ACCESS(_res_ptr);
20359         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
20360         FREE(untag_ptr(_res));
20361         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
20362 }
20363
20364 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20365         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20366         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
20367         return tag_ptr(ret_conv, true);
20368 }
20369 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
20370         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
20371         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20372         return ret_conv;
20373 }
20374
20375 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
20376         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
20377         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20378         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
20379         return tag_ptr(ret_conv, true);
20380 }
20381
20382 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
20383         LDKNodeAnnouncement o_conv;
20384         o_conv.inner = untag_ptr(o);
20385         o_conv.is_owned = ptr_is_owned(o);
20386         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20387         o_conv = NodeAnnouncement_clone(&o_conv);
20388         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20389         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
20390         return tag_ptr(ret_conv, true);
20391 }
20392
20393 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
20394         void* e_ptr = untag_ptr(e);
20395         CHECK_ACCESS(e_ptr);
20396         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20397         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20398         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20399         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
20400         return tag_ptr(ret_conv, true);
20401 }
20402
20403 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
20404         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
20405         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
20406         return ret_conv;
20407 }
20408
20409 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
20410         if (!ptr_is_owned(_res)) return;
20411         void* _res_ptr = untag_ptr(_res);
20412         CHECK_ACCESS(_res_ptr);
20413         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
20414         FREE(untag_ptr(_res));
20415         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
20416 }
20417
20418 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20419         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20420         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
20421         return tag_ptr(ret_conv, true);
20422 }
20423 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
20424         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
20425         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20426         return ret_conv;
20427 }
20428
20429 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
20430         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
20431         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20432         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
20433         return tag_ptr(ret_conv, true);
20434 }
20435
20436 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
20437         LDKQueryShortChannelIds o_conv;
20438         o_conv.inner = untag_ptr(o);
20439         o_conv.is_owned = ptr_is_owned(o);
20440         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20441         o_conv = QueryShortChannelIds_clone(&o_conv);
20442         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20443         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
20444         return tag_ptr(ret_conv, true);
20445 }
20446
20447 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
20448         void* e_ptr = untag_ptr(e);
20449         CHECK_ACCESS(e_ptr);
20450         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20451         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20452         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20453         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
20454         return tag_ptr(ret_conv, true);
20455 }
20456
20457 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
20458         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
20459         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
20460         return ret_conv;
20461 }
20462
20463 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
20464         if (!ptr_is_owned(_res)) return;
20465         void* _res_ptr = untag_ptr(_res);
20466         CHECK_ACCESS(_res_ptr);
20467         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
20468         FREE(untag_ptr(_res));
20469         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
20470 }
20471
20472 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
20473         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20474         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
20475         return tag_ptr(ret_conv, true);
20476 }
20477 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
20478         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
20479         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
20480         return ret_conv;
20481 }
20482
20483 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
20484         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
20485         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20486         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
20487         return tag_ptr(ret_conv, true);
20488 }
20489
20490 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
20491         LDKReplyShortChannelIdsEnd o_conv;
20492         o_conv.inner = untag_ptr(o);
20493         o_conv.is_owned = ptr_is_owned(o);
20494         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20495         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
20496         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20497         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
20498         return tag_ptr(ret_conv, true);
20499 }
20500
20501 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
20502         void* e_ptr = untag_ptr(e);
20503         CHECK_ACCESS(e_ptr);
20504         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20505         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20506         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20507         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
20508         return tag_ptr(ret_conv, true);
20509 }
20510
20511 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
20512         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
20513         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
20514         return ret_conv;
20515 }
20516
20517 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
20518         if (!ptr_is_owned(_res)) return;
20519         void* _res_ptr = untag_ptr(_res);
20520         CHECK_ACCESS(_res_ptr);
20521         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
20522         FREE(untag_ptr(_res));
20523         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
20524 }
20525
20526 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
20527         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20528         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
20529         return tag_ptr(ret_conv, true);
20530 }
20531 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
20532         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
20533         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
20534         return ret_conv;
20535 }
20536
20537 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
20538         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
20539         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20540         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
20541         return tag_ptr(ret_conv, true);
20542 }
20543
20544 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
20545         LDKQueryChannelRange o_conv;
20546         o_conv.inner = untag_ptr(o);
20547         o_conv.is_owned = ptr_is_owned(o);
20548         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20549         o_conv = QueryChannelRange_clone(&o_conv);
20550         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20551         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
20552         return tag_ptr(ret_conv, true);
20553 }
20554
20555 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
20556         void* e_ptr = untag_ptr(e);
20557         CHECK_ACCESS(e_ptr);
20558         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20559         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20560         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20561         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
20562         return tag_ptr(ret_conv, true);
20563 }
20564
20565 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
20566         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
20567         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
20568         return ret_conv;
20569 }
20570
20571 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
20572         if (!ptr_is_owned(_res)) return;
20573         void* _res_ptr = untag_ptr(_res);
20574         CHECK_ACCESS(_res_ptr);
20575         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
20576         FREE(untag_ptr(_res));
20577         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
20578 }
20579
20580 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
20581         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20582         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
20583         return tag_ptr(ret_conv, true);
20584 }
20585 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
20586         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
20587         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
20588         return ret_conv;
20589 }
20590
20591 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
20592         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
20593         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20594         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
20595         return tag_ptr(ret_conv, true);
20596 }
20597
20598 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
20599         LDKReplyChannelRange o_conv;
20600         o_conv.inner = untag_ptr(o);
20601         o_conv.is_owned = ptr_is_owned(o);
20602         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20603         o_conv = ReplyChannelRange_clone(&o_conv);
20604         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20605         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
20606         return tag_ptr(ret_conv, true);
20607 }
20608
20609 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
20610         void* e_ptr = untag_ptr(e);
20611         CHECK_ACCESS(e_ptr);
20612         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20613         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20614         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20615         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
20616         return tag_ptr(ret_conv, true);
20617 }
20618
20619 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
20620         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
20621         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
20622         return ret_conv;
20623 }
20624
20625 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
20626         if (!ptr_is_owned(_res)) return;
20627         void* _res_ptr = untag_ptr(_res);
20628         CHECK_ACCESS(_res_ptr);
20629         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
20630         FREE(untag_ptr(_res));
20631         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
20632 }
20633
20634 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
20635         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20636         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
20637         return tag_ptr(ret_conv, true);
20638 }
20639 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
20640         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
20641         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
20642         return ret_conv;
20643 }
20644
20645 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
20646         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
20647         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20648         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
20649         return tag_ptr(ret_conv, true);
20650 }
20651
20652 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
20653         LDKGossipTimestampFilter o_conv;
20654         o_conv.inner = untag_ptr(o);
20655         o_conv.is_owned = ptr_is_owned(o);
20656         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20657         o_conv = GossipTimestampFilter_clone(&o_conv);
20658         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20659         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
20660         return tag_ptr(ret_conv, true);
20661 }
20662
20663 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
20664         void* e_ptr = untag_ptr(e);
20665         CHECK_ACCESS(e_ptr);
20666         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20667         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20668         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20669         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
20670         return tag_ptr(ret_conv, true);
20671 }
20672
20673 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
20674         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
20675         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
20676         return ret_conv;
20677 }
20678
20679 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
20680         if (!ptr_is_owned(_res)) return;
20681         void* _res_ptr = untag_ptr(_res);
20682         CHECK_ACCESS(_res_ptr);
20683         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
20684         FREE(untag_ptr(_res));
20685         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
20686 }
20687
20688 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
20689         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20690         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
20691         return tag_ptr(ret_conv, true);
20692 }
20693 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
20694         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
20695         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
20696         return ret_conv;
20697 }
20698
20699 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
20700         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
20701         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20702         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
20703         return tag_ptr(ret_conv, true);
20704 }
20705
20706 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
20707         LDKInvoice o_conv;
20708         o_conv.inner = untag_ptr(o);
20709         o_conv.is_owned = ptr_is_owned(o);
20710         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20711         o_conv = Invoice_clone(&o_conv);
20712         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
20713         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
20714         return tag_ptr(ret_conv, true);
20715 }
20716
20717 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint64_t e) {
20718         void* e_ptr = untag_ptr(e);
20719         CHECK_ACCESS(e_ptr);
20720         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
20721         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
20722         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
20723         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
20724         return tag_ptr(ret_conv, true);
20725 }
20726
20727 jboolean  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
20728         LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(o);
20729         jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
20730         return ret_conv;
20731 }
20732
20733 void  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_free"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
20734         if (!ptr_is_owned(_res)) return;
20735         void* _res_ptr = untag_ptr(_res);
20736         CHECK_ACCESS(_res_ptr);
20737         LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
20738         FREE(untag_ptr(_res));
20739         CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
20740 }
20741
20742 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
20743         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
20744         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
20745         return tag_ptr(ret_conv, true);
20746 }
20747 int64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
20748         LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
20749         int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
20750         return ret_conv;
20751 }
20752
20753 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
20754         LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
20755         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
20756         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
20757         return tag_ptr(ret_conv, true);
20758 }
20759
20760 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
20761         void* o_ptr = untag_ptr(o);
20762         CHECK_ACCESS(o_ptr);
20763         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
20764         if (o_conv.free == LDKFilter_JCalls_free) {
20765                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20766                 LDKFilter_JCalls_cloned(&o_conv);
20767         }
20768         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
20769         *ret_copy = COption_FilterZ_some(o_conv);
20770         uint64_t ret_ref = tag_ptr(ret_copy, true);
20771         return ret_ref;
20772 }
20773
20774 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
20775         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
20776         *ret_copy = COption_FilterZ_none();
20777         uint64_t ret_ref = tag_ptr(ret_copy, true);
20778         return ret_ref;
20779 }
20780
20781 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
20782         if (!ptr_is_owned(_res)) return;
20783         void* _res_ptr = untag_ptr(_res);
20784         CHECK_ACCESS(_res_ptr);
20785         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
20786         FREE(untag_ptr(_res));
20787         COption_FilterZ_free(_res_conv);
20788 }
20789
20790 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
20791         LDKLockedChannelMonitor o_conv;
20792         o_conv.inner = untag_ptr(o);
20793         o_conv.is_owned = ptr_is_owned(o);
20794         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20795         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
20796         
20797         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
20798         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
20799         return tag_ptr(ret_conv, true);
20800 }
20801
20802 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
20803         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
20804         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
20805         return tag_ptr(ret_conv, true);
20806 }
20807
20808 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
20809         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
20810         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
20811         return ret_conv;
20812 }
20813
20814 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
20815         if (!ptr_is_owned(_res)) return;
20816         void* _res_ptr = untag_ptr(_res);
20817         CHECK_ACCESS(_res_ptr);
20818         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
20819         FREE(untag_ptr(_res));
20820         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
20821 }
20822
20823 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
20824         LDKCVec_OutPointZ _res_constr;
20825         _res_constr.datalen = _res->arr_len;
20826         if (_res_constr.datalen > 0)
20827                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
20828         else
20829                 _res_constr.data = NULL;
20830         uint64_t* _res_vals = _res->elems;
20831         for (size_t k = 0; k < _res_constr.datalen; k++) {
20832                 uint64_t _res_conv_10 = _res_vals[k];
20833                 LDKOutPoint _res_conv_10_conv;
20834                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
20835                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
20836                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
20837                 _res_constr.data[k] = _res_conv_10_conv;
20838         }
20839         FREE(_res);
20840         CVec_OutPointZ_free(_res_constr);
20841 }
20842
20843 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
20844         if (!ptr_is_owned(this_ptr)) return;
20845         void* this_ptr_ptr = untag_ptr(this_ptr);
20846         CHECK_ACCESS(this_ptr_ptr);
20847         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
20848         FREE(untag_ptr(this_ptr));
20849         PaymentPurpose_free(this_ptr_conv);
20850 }
20851
20852 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
20853         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20854         *ret_copy = PaymentPurpose_clone(arg);
20855         uint64_t ret_ref = tag_ptr(ret_copy, true);
20856         return ret_ref;
20857 }
20858 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
20859         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
20860         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
20861         return ret_conv;
20862 }
20863
20864 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
20865         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
20866         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20867         *ret_copy = PaymentPurpose_clone(orig_conv);
20868         uint64_t ret_ref = tag_ptr(ret_copy, true);
20869         return ret_ref;
20870 }
20871
20872 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
20873         LDKThirtyTwoBytes payment_preimage_ref;
20874         CHECK(payment_preimage->arr_len == 32);
20875         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
20876         LDKThirtyTwoBytes payment_secret_ref;
20877         CHECK(payment_secret->arr_len == 32);
20878         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
20879         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20880         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
20881         uint64_t ret_ref = tag_ptr(ret_copy, true);
20882         return ret_ref;
20883 }
20884
20885 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
20886         LDKThirtyTwoBytes a_ref;
20887         CHECK(a->arr_len == 32);
20888         memcpy(a_ref.data, a->elems, 32); FREE(a);
20889         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20890         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
20891         uint64_t ret_ref = tag_ptr(ret_copy, true);
20892         return ret_ref;
20893 }
20894
20895 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
20896         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
20897         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
20898         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20899         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20900         CVec_u8Z_free(ret_var);
20901         return ret_arr;
20902 }
20903
20904 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
20905         LDKu8slice ser_ref;
20906         ser_ref.datalen = ser->arr_len;
20907         ser_ref.data = ser->elems;
20908         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
20909         *ret_conv = PaymentPurpose_read(ser_ref);
20910         FREE(ser);
20911         return tag_ptr(ret_conv, true);
20912 }
20913
20914 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
20915         if (!ptr_is_owned(this_ptr)) return;
20916         void* this_ptr_ptr = untag_ptr(this_ptr);
20917         CHECK_ACCESS(this_ptr_ptr);
20918         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
20919         FREE(untag_ptr(this_ptr));
20920         ClosureReason_free(this_ptr_conv);
20921 }
20922
20923 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
20924         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20925         *ret_copy = ClosureReason_clone(arg);
20926         uint64_t ret_ref = tag_ptr(ret_copy, true);
20927         return ret_ref;
20928 }
20929 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
20930         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
20931         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
20932         return ret_conv;
20933 }
20934
20935 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
20936         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
20937         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20938         *ret_copy = ClosureReason_clone(orig_conv);
20939         uint64_t ret_ref = tag_ptr(ret_copy, true);
20940         return ret_ref;
20941 }
20942
20943 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
20944         LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
20945         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20946         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
20947         uint64_t ret_ref = tag_ptr(ret_copy, true);
20948         return ret_ref;
20949 }
20950
20951 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
20952         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20953         *ret_copy = ClosureReason_holder_force_closed();
20954         uint64_t ret_ref = tag_ptr(ret_copy, true);
20955         return ret_ref;
20956 }
20957
20958 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
20959         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20960         *ret_copy = ClosureReason_cooperative_closure();
20961         uint64_t ret_ref = tag_ptr(ret_copy, true);
20962         return ret_ref;
20963 }
20964
20965 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
20966         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20967         *ret_copy = ClosureReason_commitment_tx_confirmed();
20968         uint64_t ret_ref = tag_ptr(ret_copy, true);
20969         return ret_ref;
20970 }
20971
20972 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
20973         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20974         *ret_copy = ClosureReason_funding_timed_out();
20975         uint64_t ret_ref = tag_ptr(ret_copy, true);
20976         return ret_ref;
20977 }
20978
20979 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
20980         LDKStr err_conv = str_ref_to_owned_c(err);
20981         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20982         *ret_copy = ClosureReason_processing_error(err_conv);
20983         uint64_t ret_ref = tag_ptr(ret_copy, true);
20984         return ret_ref;
20985 }
20986
20987 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
20988         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20989         *ret_copy = ClosureReason_disconnected_peer();
20990         uint64_t ret_ref = tag_ptr(ret_copy, true);
20991         return ret_ref;
20992 }
20993
20994 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
20995         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20996         *ret_copy = ClosureReason_outdated_channel_manager();
20997         uint64_t ret_ref = tag_ptr(ret_copy, true);
20998         return ret_ref;
20999 }
21000
21001 jboolean  __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
21002         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
21003         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
21004         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
21005         return ret_conv;
21006 }
21007
21008 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
21009         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
21010         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
21011         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21012         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21013         CVec_u8Z_free(ret_var);
21014         return ret_arr;
21015 }
21016
21017 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
21018         LDKu8slice ser_ref;
21019         ser_ref.datalen = ser->arr_len;
21020         ser_ref.data = ser->elems;
21021         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
21022         *ret_conv = ClosureReason_read(ser_ref);
21023         FREE(ser);
21024         return tag_ptr(ret_conv, true);
21025 }
21026
21027 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
21028         if (!ptr_is_owned(this_ptr)) return;
21029         void* this_ptr_ptr = untag_ptr(this_ptr);
21030         CHECK_ACCESS(this_ptr_ptr);
21031         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
21032         FREE(untag_ptr(this_ptr));
21033         HTLCDestination_free(this_ptr_conv);
21034 }
21035
21036 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
21037         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21038         *ret_copy = HTLCDestination_clone(arg);
21039         uint64_t ret_ref = tag_ptr(ret_copy, true);
21040         return ret_ref;
21041 }
21042 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
21043         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
21044         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
21045         return ret_conv;
21046 }
21047
21048 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
21049         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
21050         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21051         *ret_copy = HTLCDestination_clone(orig_conv);
21052         uint64_t ret_ref = tag_ptr(ret_copy, true);
21053         return ret_ref;
21054 }
21055
21056 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
21057         LDKPublicKey node_id_ref;
21058         CHECK(node_id->arr_len == 33);
21059         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21060         LDKThirtyTwoBytes channel_id_ref;
21061         CHECK(channel_id->arr_len == 32);
21062         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
21063         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21064         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
21065         uint64_t ret_ref = tag_ptr(ret_copy, true);
21066         return ret_ref;
21067 }
21068
21069 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
21070         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21071         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
21072         uint64_t ret_ref = tag_ptr(ret_copy, true);
21073         return ret_ref;
21074 }
21075
21076 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
21077         LDKThirtyTwoBytes payment_hash_ref;
21078         CHECK(payment_hash->arr_len == 32);
21079         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21080         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21081         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
21082         uint64_t ret_ref = tag_ptr(ret_copy, true);
21083         return ret_ref;
21084 }
21085
21086 jboolean  __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
21087         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
21088         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
21089         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
21090         return ret_conv;
21091 }
21092
21093 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
21094         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
21095         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
21096         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21097         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21098         CVec_u8Z_free(ret_var);
21099         return ret_arr;
21100 }
21101
21102 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
21103         LDKu8slice ser_ref;
21104         ser_ref.datalen = ser->arr_len;
21105         ser_ref.data = ser->elems;
21106         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
21107         *ret_conv = HTLCDestination_read(ser_ref);
21108         FREE(ser);
21109         return tag_ptr(ret_conv, true);
21110 }
21111
21112 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
21113         if (!ptr_is_owned(this_ptr)) return;
21114         void* this_ptr_ptr = untag_ptr(this_ptr);
21115         CHECK_ACCESS(this_ptr_ptr);
21116         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
21117         FREE(untag_ptr(this_ptr));
21118         Event_free(this_ptr_conv);
21119 }
21120
21121 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
21122         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21123         *ret_copy = Event_clone(arg);
21124         uint64_t ret_ref = tag_ptr(ret_copy, true);
21125         return ret_ref;
21126 }
21127 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
21128         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
21129         int64_t ret_conv = Event_clone_ptr(arg_conv);
21130         return ret_conv;
21131 }
21132
21133 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
21134         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
21135         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21136         *ret_copy = Event_clone(orig_conv);
21137         uint64_t ret_ref = tag_ptr(ret_copy, true);
21138         return ret_ref;
21139 }
21140
21141 uint64_t  __attribute__((export_name("TS_Event_funding_generation_ready"))) TS_Event_funding_generation_ready(int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t channel_value_satoshis, int8_tArray output_script, int64_t user_channel_id) {
21142         LDKThirtyTwoBytes temporary_channel_id_ref;
21143         CHECK(temporary_channel_id->arr_len == 32);
21144         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
21145         LDKPublicKey counterparty_node_id_ref;
21146         CHECK(counterparty_node_id->arr_len == 33);
21147         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
21148         LDKCVec_u8Z output_script_ref;
21149         output_script_ref.datalen = output_script->arr_len;
21150         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
21151         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
21152         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21153         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
21154         uint64_t ret_ref = tag_ptr(ret_copy, true);
21155         return ret_ref;
21156 }
21157
21158 uint64_t  __attribute__((export_name("TS_Event_payment_received"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose) {
21159         LDKThirtyTwoBytes payment_hash_ref;
21160         CHECK(payment_hash->arr_len == 32);
21161         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21162         void* purpose_ptr = untag_ptr(purpose);
21163         CHECK_ACCESS(purpose_ptr);
21164         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
21165         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
21166         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21167         *ret_copy = Event_payment_received(payment_hash_ref, amount_msat, purpose_conv);
21168         uint64_t ret_ref = tag_ptr(ret_copy, true);
21169         return ret_ref;
21170 }
21171
21172 uint64_t  __attribute__((export_name("TS_Event_payment_claimed"))) TS_Event_payment_claimed(int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose) {
21173         LDKThirtyTwoBytes payment_hash_ref;
21174         CHECK(payment_hash->arr_len == 32);
21175         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21176         void* purpose_ptr = untag_ptr(purpose);
21177         CHECK_ACCESS(purpose_ptr);
21178         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
21179         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
21180         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21181         *ret_copy = Event_payment_claimed(payment_hash_ref, amount_msat, purpose_conv);
21182         uint64_t ret_ref = tag_ptr(ret_copy, true);
21183         return ret_ref;
21184 }
21185
21186 uint64_t  __attribute__((export_name("TS_Event_payment_sent"))) TS_Event_payment_sent(int8_tArray payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, uint64_t fee_paid_msat) {
21187         LDKThirtyTwoBytes payment_id_ref;
21188         CHECK(payment_id->arr_len == 32);
21189         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21190         LDKThirtyTwoBytes payment_preimage_ref;
21191         CHECK(payment_preimage->arr_len == 32);
21192         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
21193         LDKThirtyTwoBytes payment_hash_ref;
21194         CHECK(payment_hash->arr_len == 32);
21195         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21196         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
21197         CHECK_ACCESS(fee_paid_msat_ptr);
21198         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
21199         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
21200         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21201         *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
21202         uint64_t ret_ref = tag_ptr(ret_copy, true);
21203         return ret_ref;
21204 }
21205
21206 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) {
21207         LDKThirtyTwoBytes payment_id_ref;
21208         CHECK(payment_id->arr_len == 32);
21209         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21210         LDKThirtyTwoBytes payment_hash_ref;
21211         CHECK(payment_hash->arr_len == 32);
21212         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21213         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21214         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
21215         uint64_t ret_ref = tag_ptr(ret_copy, true);
21216         return ret_ref;
21217 }
21218
21219 uint64_t  __attribute__((export_name("TS_Event_payment_path_successful"))) TS_Event_payment_path_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_tArray path) {
21220         LDKThirtyTwoBytes payment_id_ref;
21221         CHECK(payment_id->arr_len == 32);
21222         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21223         LDKThirtyTwoBytes payment_hash_ref;
21224         CHECK(payment_hash->arr_len == 32);
21225         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21226         LDKCVec_RouteHopZ path_constr;
21227         path_constr.datalen = path->arr_len;
21228         if (path_constr.datalen > 0)
21229                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21230         else
21231                 path_constr.data = NULL;
21232         uint64_t* path_vals = path->elems;
21233         for (size_t k = 0; k < path_constr.datalen; k++) {
21234                 uint64_t path_conv_10 = path_vals[k];
21235                 LDKRouteHop path_conv_10_conv;
21236                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
21237                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
21238                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21239                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21240                 path_constr.data[k] = path_conv_10_conv;
21241         }
21242         FREE(path);
21243         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21244         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
21245         uint64_t ret_ref = tag_ptr(ret_copy, true);
21246         return ret_ref;
21247 }
21248
21249 uint64_t  __attribute__((export_name("TS_Event_payment_path_failed"))) TS_Event_payment_path_failed(int8_tArray payment_id, int8_tArray payment_hash, jboolean payment_failed_permanently, uint64_t network_update, jboolean all_paths_failed, uint64_tArray path, uint64_t short_channel_id, uint64_t retry) {
21250         LDKThirtyTwoBytes payment_id_ref;
21251         CHECK(payment_id->arr_len == 32);
21252         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21253         LDKThirtyTwoBytes payment_hash_ref;
21254         CHECK(payment_hash->arr_len == 32);
21255         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21256         void* network_update_ptr = untag_ptr(network_update);
21257         CHECK_ACCESS(network_update_ptr);
21258         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
21259         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
21260         LDKCVec_RouteHopZ path_constr;
21261         path_constr.datalen = path->arr_len;
21262         if (path_constr.datalen > 0)
21263                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21264         else
21265                 path_constr.data = NULL;
21266         uint64_t* path_vals = path->elems;
21267         for (size_t k = 0; k < path_constr.datalen; k++) {
21268                 uint64_t path_conv_10 = path_vals[k];
21269                 LDKRouteHop path_conv_10_conv;
21270                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
21271                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
21272                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21273                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21274                 path_constr.data[k] = path_conv_10_conv;
21275         }
21276         FREE(path);
21277         void* short_channel_id_ptr = untag_ptr(short_channel_id);
21278         CHECK_ACCESS(short_channel_id_ptr);
21279         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
21280         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
21281         LDKRouteParameters retry_conv;
21282         retry_conv.inner = untag_ptr(retry);
21283         retry_conv.is_owned = ptr_is_owned(retry);
21284         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
21285         retry_conv = RouteParameters_clone(&retry_conv);
21286         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21287         *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, payment_failed_permanently, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv, retry_conv);
21288         uint64_t ret_ref = tag_ptr(ret_copy, true);
21289         return ret_ref;
21290 }
21291
21292 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_tArray path) {
21293         LDKThirtyTwoBytes payment_id_ref;
21294         CHECK(payment_id->arr_len == 32);
21295         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21296         LDKThirtyTwoBytes payment_hash_ref;
21297         CHECK(payment_hash->arr_len == 32);
21298         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21299         LDKCVec_RouteHopZ path_constr;
21300         path_constr.datalen = path->arr_len;
21301         if (path_constr.datalen > 0)
21302                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21303         else
21304                 path_constr.data = NULL;
21305         uint64_t* path_vals = path->elems;
21306         for (size_t k = 0; k < path_constr.datalen; k++) {
21307                 uint64_t path_conv_10 = path_vals[k];
21308                 LDKRouteHop path_conv_10_conv;
21309                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
21310                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
21311                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21312                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21313                 path_constr.data[k] = path_conv_10_conv;
21314         }
21315         FREE(path);
21316         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21317         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_constr);
21318         uint64_t ret_ref = tag_ptr(ret_copy, true);
21319         return ret_ref;
21320 }
21321
21322 uint64_t  __attribute__((export_name("TS_Event_probe_failed"))) TS_Event_probe_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_tArray path, uint64_t short_channel_id) {
21323         LDKThirtyTwoBytes payment_id_ref;
21324         CHECK(payment_id->arr_len == 32);
21325         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21326         LDKThirtyTwoBytes payment_hash_ref;
21327         CHECK(payment_hash->arr_len == 32);
21328         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21329         LDKCVec_RouteHopZ path_constr;
21330         path_constr.datalen = path->arr_len;
21331         if (path_constr.datalen > 0)
21332                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21333         else
21334                 path_constr.data = NULL;
21335         uint64_t* path_vals = path->elems;
21336         for (size_t k = 0; k < path_constr.datalen; k++) {
21337                 uint64_t path_conv_10 = path_vals[k];
21338                 LDKRouteHop path_conv_10_conv;
21339                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
21340                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
21341                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21342                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21343                 path_constr.data[k] = path_conv_10_conv;
21344         }
21345         FREE(path);
21346         void* short_channel_id_ptr = untag_ptr(short_channel_id);
21347         CHECK_ACCESS(short_channel_id_ptr);
21348         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
21349         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
21350         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21351         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_constr, short_channel_id_conv);
21352         uint64_t ret_ref = tag_ptr(ret_copy, true);
21353         return ret_ref;
21354 }
21355
21356 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
21357         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21358         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
21359         uint64_t ret_ref = tag_ptr(ret_copy, true);
21360         return ret_ref;
21361 }
21362
21363 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs) {
21364         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
21365         outputs_constr.datalen = outputs->arr_len;
21366         if (outputs_constr.datalen > 0)
21367                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
21368         else
21369                 outputs_constr.data = NULL;
21370         uint64_t* outputs_vals = outputs->elems;
21371         for (size_t b = 0; b < outputs_constr.datalen; b++) {
21372                 uint64_t outputs_conv_27 = outputs_vals[b];
21373                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
21374                 CHECK_ACCESS(outputs_conv_27_ptr);
21375                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
21376                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
21377                 outputs_constr.data[b] = outputs_conv_27_conv;
21378         }
21379         FREE(outputs);
21380         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21381         *ret_copy = Event_spendable_outputs(outputs_constr);
21382         uint64_t ret_ref = tag_ptr(ret_copy, true);
21383         return ret_ref;
21384 }
21385
21386 uint64_t  __attribute__((export_name("TS_Event_payment_forwarded"))) TS_Event_payment_forwarded(int8_tArray prev_channel_id, int8_tArray next_channel_id, uint64_t fee_earned_msat, jboolean claim_from_onchain_tx) {
21387         LDKThirtyTwoBytes prev_channel_id_ref;
21388         CHECK(prev_channel_id->arr_len == 32);
21389         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
21390         LDKThirtyTwoBytes next_channel_id_ref;
21391         CHECK(next_channel_id->arr_len == 32);
21392         memcpy(next_channel_id_ref.data, next_channel_id->elems, 32); FREE(next_channel_id);
21393         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
21394         CHECK_ACCESS(fee_earned_msat_ptr);
21395         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
21396         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
21397         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21398         *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
21399         uint64_t ret_ref = tag_ptr(ret_copy, true);
21400         return ret_ref;
21401 }
21402
21403 uint64_t  __attribute__((export_name("TS_Event_channel_closed"))) TS_Event_channel_closed(int8_tArray channel_id, int64_t user_channel_id, uint64_t reason) {
21404         LDKThirtyTwoBytes channel_id_ref;
21405         CHECK(channel_id->arr_len == 32);
21406         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
21407         void* reason_ptr = untag_ptr(reason);
21408         CHECK_ACCESS(reason_ptr);
21409         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
21410         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
21411         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21412         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
21413         uint64_t ret_ref = tag_ptr(ret_copy, true);
21414         return ret_ref;
21415 }
21416
21417 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
21418         LDKThirtyTwoBytes channel_id_ref;
21419         CHECK(channel_id->arr_len == 32);
21420         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
21421         LDKTransaction transaction_ref;
21422         transaction_ref.datalen = transaction->arr_len;
21423         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
21424         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
21425         transaction_ref.data_is_owned = true;
21426         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21427         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
21428         uint64_t ret_ref = tag_ptr(ret_copy, true);
21429         return ret_ref;
21430 }
21431
21432 uint64_t  __attribute__((export_name("TS_Event_open_channel_request"))) TS_Event_open_channel_request(int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat, uint64_t channel_type) {
21433         LDKThirtyTwoBytes temporary_channel_id_ref;
21434         CHECK(temporary_channel_id->arr_len == 32);
21435         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
21436         LDKPublicKey counterparty_node_id_ref;
21437         CHECK(counterparty_node_id->arr_len == 33);
21438         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
21439         LDKChannelTypeFeatures channel_type_conv;
21440         channel_type_conv.inner = untag_ptr(channel_type);
21441         channel_type_conv.is_owned = ptr_is_owned(channel_type);
21442         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
21443         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
21444         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21445         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
21446         uint64_t ret_ref = tag_ptr(ret_copy, true);
21447         return ret_ref;
21448 }
21449
21450 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
21451         LDKThirtyTwoBytes prev_channel_id_ref;
21452         CHECK(prev_channel_id->arr_len == 32);
21453         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
21454         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
21455         CHECK_ACCESS(failed_next_destination_ptr);
21456         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
21457         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
21458         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21459         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
21460         uint64_t ret_ref = tag_ptr(ret_copy, true);
21461         return ret_ref;
21462 }
21463
21464 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
21465         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
21466         LDKCVec_u8Z ret_var = Event_write(obj_conv);
21467         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21468         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21469         CVec_u8Z_free(ret_var);
21470         return ret_arr;
21471 }
21472
21473 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
21474         LDKu8slice ser_ref;
21475         ser_ref.datalen = ser->arr_len;
21476         ser_ref.data = ser->elems;
21477         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
21478         *ret_conv = Event_read(ser_ref);
21479         FREE(ser);
21480         return tag_ptr(ret_conv, true);
21481 }
21482
21483 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
21484         if (!ptr_is_owned(this_ptr)) return;
21485         void* this_ptr_ptr = untag_ptr(this_ptr);
21486         CHECK_ACCESS(this_ptr_ptr);
21487         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
21488         FREE(untag_ptr(this_ptr));
21489         MessageSendEvent_free(this_ptr_conv);
21490 }
21491
21492 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
21493         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21494         *ret_copy = MessageSendEvent_clone(arg);
21495         uint64_t ret_ref = tag_ptr(ret_copy, true);
21496         return ret_ref;
21497 }
21498 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
21499         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
21500         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
21501         return ret_conv;
21502 }
21503
21504 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
21505         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
21506         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21507         *ret_copy = MessageSendEvent_clone(orig_conv);
21508         uint64_t ret_ref = tag_ptr(ret_copy, true);
21509         return ret_ref;
21510 }
21511
21512 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
21513         LDKPublicKey node_id_ref;
21514         CHECK(node_id->arr_len == 33);
21515         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21516         LDKAcceptChannel msg_conv;
21517         msg_conv.inner = untag_ptr(msg);
21518         msg_conv.is_owned = ptr_is_owned(msg);
21519         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21520         msg_conv = AcceptChannel_clone(&msg_conv);
21521         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21522         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
21523         uint64_t ret_ref = tag_ptr(ret_copy, true);
21524         return ret_ref;
21525 }
21526
21527 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
21528         LDKPublicKey node_id_ref;
21529         CHECK(node_id->arr_len == 33);
21530         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21531         LDKOpenChannel msg_conv;
21532         msg_conv.inner = untag_ptr(msg);
21533         msg_conv.is_owned = ptr_is_owned(msg);
21534         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21535         msg_conv = OpenChannel_clone(&msg_conv);
21536         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21537         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
21538         uint64_t ret_ref = tag_ptr(ret_copy, true);
21539         return ret_ref;
21540 }
21541
21542 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
21543         LDKPublicKey node_id_ref;
21544         CHECK(node_id->arr_len == 33);
21545         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21546         LDKFundingCreated msg_conv;
21547         msg_conv.inner = untag_ptr(msg);
21548         msg_conv.is_owned = ptr_is_owned(msg);
21549         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21550         msg_conv = FundingCreated_clone(&msg_conv);
21551         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21552         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
21553         uint64_t ret_ref = tag_ptr(ret_copy, true);
21554         return ret_ref;
21555 }
21556
21557 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
21558         LDKPublicKey node_id_ref;
21559         CHECK(node_id->arr_len == 33);
21560         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21561         LDKFundingSigned msg_conv;
21562         msg_conv.inner = untag_ptr(msg);
21563         msg_conv.is_owned = ptr_is_owned(msg);
21564         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21565         msg_conv = FundingSigned_clone(&msg_conv);
21566         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21567         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
21568         uint64_t ret_ref = tag_ptr(ret_copy, true);
21569         return ret_ref;
21570 }
21571
21572 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
21573         LDKPublicKey node_id_ref;
21574         CHECK(node_id->arr_len == 33);
21575         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21576         LDKChannelReady msg_conv;
21577         msg_conv.inner = untag_ptr(msg);
21578         msg_conv.is_owned = ptr_is_owned(msg);
21579         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21580         msg_conv = ChannelReady_clone(&msg_conv);
21581         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21582         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
21583         uint64_t ret_ref = tag_ptr(ret_copy, true);
21584         return ret_ref;
21585 }
21586
21587 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
21588         LDKPublicKey node_id_ref;
21589         CHECK(node_id->arr_len == 33);
21590         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21591         LDKAnnouncementSignatures msg_conv;
21592         msg_conv.inner = untag_ptr(msg);
21593         msg_conv.is_owned = ptr_is_owned(msg);
21594         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21595         msg_conv = AnnouncementSignatures_clone(&msg_conv);
21596         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21597         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
21598         uint64_t ret_ref = tag_ptr(ret_copy, true);
21599         return ret_ref;
21600 }
21601
21602 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
21603         LDKPublicKey node_id_ref;
21604         CHECK(node_id->arr_len == 33);
21605         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21606         LDKCommitmentUpdate updates_conv;
21607         updates_conv.inner = untag_ptr(updates);
21608         updates_conv.is_owned = ptr_is_owned(updates);
21609         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
21610         updates_conv = CommitmentUpdate_clone(&updates_conv);
21611         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21612         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
21613         uint64_t ret_ref = tag_ptr(ret_copy, true);
21614         return ret_ref;
21615 }
21616
21617 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
21618         LDKPublicKey node_id_ref;
21619         CHECK(node_id->arr_len == 33);
21620         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21621         LDKRevokeAndACK msg_conv;
21622         msg_conv.inner = untag_ptr(msg);
21623         msg_conv.is_owned = ptr_is_owned(msg);
21624         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21625         msg_conv = RevokeAndACK_clone(&msg_conv);
21626         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21627         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
21628         uint64_t ret_ref = tag_ptr(ret_copy, true);
21629         return ret_ref;
21630 }
21631
21632 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
21633         LDKPublicKey node_id_ref;
21634         CHECK(node_id->arr_len == 33);
21635         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21636         LDKClosingSigned msg_conv;
21637         msg_conv.inner = untag_ptr(msg);
21638         msg_conv.is_owned = ptr_is_owned(msg);
21639         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21640         msg_conv = ClosingSigned_clone(&msg_conv);
21641         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21642         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
21643         uint64_t ret_ref = tag_ptr(ret_copy, true);
21644         return ret_ref;
21645 }
21646
21647 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
21648         LDKPublicKey node_id_ref;
21649         CHECK(node_id->arr_len == 33);
21650         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21651         LDKShutdown msg_conv;
21652         msg_conv.inner = untag_ptr(msg);
21653         msg_conv.is_owned = ptr_is_owned(msg);
21654         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21655         msg_conv = Shutdown_clone(&msg_conv);
21656         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21657         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
21658         uint64_t ret_ref = tag_ptr(ret_copy, true);
21659         return ret_ref;
21660 }
21661
21662 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
21663         LDKPublicKey node_id_ref;
21664         CHECK(node_id->arr_len == 33);
21665         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21666         LDKChannelReestablish msg_conv;
21667         msg_conv.inner = untag_ptr(msg);
21668         msg_conv.is_owned = ptr_is_owned(msg);
21669         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21670         msg_conv = ChannelReestablish_clone(&msg_conv);
21671         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21672         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
21673         uint64_t ret_ref = tag_ptr(ret_copy, true);
21674         return ret_ref;
21675 }
21676
21677 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_announcement"))) TS_MessageSendEvent_send_channel_announcement(int8_tArray node_id, uint64_t msg, uint64_t update_msg) {
21678         LDKPublicKey node_id_ref;
21679         CHECK(node_id->arr_len == 33);
21680         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21681         LDKChannelAnnouncement msg_conv;
21682         msg_conv.inner = untag_ptr(msg);
21683         msg_conv.is_owned = ptr_is_owned(msg);
21684         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21685         msg_conv = ChannelAnnouncement_clone(&msg_conv);
21686         LDKChannelUpdate update_msg_conv;
21687         update_msg_conv.inner = untag_ptr(update_msg);
21688         update_msg_conv.is_owned = ptr_is_owned(update_msg);
21689         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
21690         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
21691         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21692         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
21693         uint64_t ret_ref = tag_ptr(ret_copy, true);
21694         return ret_ref;
21695 }
21696
21697 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
21698         LDKChannelAnnouncement msg_conv;
21699         msg_conv.inner = untag_ptr(msg);
21700         msg_conv.is_owned = ptr_is_owned(msg);
21701         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21702         msg_conv = ChannelAnnouncement_clone(&msg_conv);
21703         LDKChannelUpdate update_msg_conv;
21704         update_msg_conv.inner = untag_ptr(update_msg);
21705         update_msg_conv.is_owned = ptr_is_owned(update_msg);
21706         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
21707         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
21708         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21709         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
21710         uint64_t ret_ref = tag_ptr(ret_copy, true);
21711         return ret_ref;
21712 }
21713
21714 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
21715         LDKChannelUpdate msg_conv;
21716         msg_conv.inner = untag_ptr(msg);
21717         msg_conv.is_owned = ptr_is_owned(msg);
21718         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21719         msg_conv = ChannelUpdate_clone(&msg_conv);
21720         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21721         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
21722         uint64_t ret_ref = tag_ptr(ret_copy, true);
21723         return ret_ref;
21724 }
21725
21726 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
21727         LDKPublicKey node_id_ref;
21728         CHECK(node_id->arr_len == 33);
21729         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21730         LDKChannelUpdate msg_conv;
21731         msg_conv.inner = untag_ptr(msg);
21732         msg_conv.is_owned = ptr_is_owned(msg);
21733         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21734         msg_conv = ChannelUpdate_clone(&msg_conv);
21735         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21736         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
21737         uint64_t ret_ref = tag_ptr(ret_copy, true);
21738         return ret_ref;
21739 }
21740
21741 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
21742         LDKPublicKey node_id_ref;
21743         CHECK(node_id->arr_len == 33);
21744         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21745         void* action_ptr = untag_ptr(action);
21746         CHECK_ACCESS(action_ptr);
21747         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
21748         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
21749         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21750         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
21751         uint64_t ret_ref = tag_ptr(ret_copy, true);
21752         return ret_ref;
21753 }
21754
21755 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
21756         LDKPublicKey node_id_ref;
21757         CHECK(node_id->arr_len == 33);
21758         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21759         LDKQueryChannelRange msg_conv;
21760         msg_conv.inner = untag_ptr(msg);
21761         msg_conv.is_owned = ptr_is_owned(msg);
21762         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21763         msg_conv = QueryChannelRange_clone(&msg_conv);
21764         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21765         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
21766         uint64_t ret_ref = tag_ptr(ret_copy, true);
21767         return ret_ref;
21768 }
21769
21770 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
21771         LDKPublicKey node_id_ref;
21772         CHECK(node_id->arr_len == 33);
21773         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21774         LDKQueryShortChannelIds msg_conv;
21775         msg_conv.inner = untag_ptr(msg);
21776         msg_conv.is_owned = ptr_is_owned(msg);
21777         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21778         msg_conv = QueryShortChannelIds_clone(&msg_conv);
21779         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21780         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
21781         uint64_t ret_ref = tag_ptr(ret_copy, true);
21782         return ret_ref;
21783 }
21784
21785 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
21786         LDKPublicKey node_id_ref;
21787         CHECK(node_id->arr_len == 33);
21788         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21789         LDKReplyChannelRange msg_conv;
21790         msg_conv.inner = untag_ptr(msg);
21791         msg_conv.is_owned = ptr_is_owned(msg);
21792         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21793         msg_conv = ReplyChannelRange_clone(&msg_conv);
21794         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21795         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
21796         uint64_t ret_ref = tag_ptr(ret_copy, true);
21797         return ret_ref;
21798 }
21799
21800 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
21801         LDKPublicKey node_id_ref;
21802         CHECK(node_id->arr_len == 33);
21803         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21804         LDKGossipTimestampFilter msg_conv;
21805         msg_conv.inner = untag_ptr(msg);
21806         msg_conv.is_owned = ptr_is_owned(msg);
21807         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21808         msg_conv = GossipTimestampFilter_clone(&msg_conv);
21809         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21810         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
21811         uint64_t ret_ref = tag_ptr(ret_copy, true);
21812         return ret_ref;
21813 }
21814
21815 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
21816         if (!ptr_is_owned(this_ptr)) return;
21817         void* this_ptr_ptr = untag_ptr(this_ptr);
21818         CHECK_ACCESS(this_ptr_ptr);
21819         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
21820         FREE(untag_ptr(this_ptr));
21821         MessageSendEventsProvider_free(this_ptr_conv);
21822 }
21823
21824 void  __attribute__((export_name("TS_OnionMessageProvider_free"))) TS_OnionMessageProvider_free(uint64_t this_ptr) {
21825         if (!ptr_is_owned(this_ptr)) return;
21826         void* this_ptr_ptr = untag_ptr(this_ptr);
21827         CHECK_ACCESS(this_ptr_ptr);
21828         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
21829         FREE(untag_ptr(this_ptr));
21830         OnionMessageProvider_free(this_ptr_conv);
21831 }
21832
21833 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
21834         if (!ptr_is_owned(this_ptr)) return;
21835         void* this_ptr_ptr = untag_ptr(this_ptr);
21836         CHECK_ACCESS(this_ptr_ptr);
21837         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
21838         FREE(untag_ptr(this_ptr));
21839         EventsProvider_free(this_ptr_conv);
21840 }
21841
21842 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
21843         if (!ptr_is_owned(this_ptr)) return;
21844         void* this_ptr_ptr = untag_ptr(this_ptr);
21845         CHECK_ACCESS(this_ptr_ptr);
21846         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
21847         FREE(untag_ptr(this_ptr));
21848         EventHandler_free(this_ptr_conv);
21849 }
21850
21851 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
21852         if (!ptr_is_owned(this_ptr)) return;
21853         void* this_ptr_ptr = untag_ptr(this_ptr);
21854         CHECK_ACCESS(this_ptr_ptr);
21855         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
21856         FREE(untag_ptr(this_ptr));
21857         APIError_free(this_ptr_conv);
21858 }
21859
21860 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
21861         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21862         *ret_copy = APIError_clone(arg);
21863         uint64_t ret_ref = tag_ptr(ret_copy, true);
21864         return ret_ref;
21865 }
21866 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
21867         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
21868         int64_t ret_conv = APIError_clone_ptr(arg_conv);
21869         return ret_conv;
21870 }
21871
21872 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
21873         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
21874         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21875         *ret_copy = APIError_clone(orig_conv);
21876         uint64_t ret_ref = tag_ptr(ret_copy, true);
21877         return ret_ref;
21878 }
21879
21880 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
21881         LDKStr err_conv = str_ref_to_owned_c(err);
21882         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21883         *ret_copy = APIError_apimisuse_error(err_conv);
21884         uint64_t ret_ref = tag_ptr(ret_copy, true);
21885         return ret_ref;
21886 }
21887
21888 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
21889         LDKStr err_conv = str_ref_to_owned_c(err);
21890         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21891         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
21892         uint64_t ret_ref = tag_ptr(ret_copy, true);
21893         return ret_ref;
21894 }
21895
21896 uint64_t  __attribute__((export_name("TS_APIError_route_error"))) TS_APIError_route_error(jstring err) {
21897         LDKStr err_conv = str_ref_to_owned_c(err);
21898         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21899         *ret_copy = APIError_route_error(err_conv);
21900         uint64_t ret_ref = tag_ptr(ret_copy, true);
21901         return ret_ref;
21902 }
21903
21904 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
21905         LDKStr err_conv = str_ref_to_owned_c(err);
21906         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21907         *ret_copy = APIError_channel_unavailable(err_conv);
21908         uint64_t ret_ref = tag_ptr(ret_copy, true);
21909         return ret_ref;
21910 }
21911
21912 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_in_progress"))) TS_APIError_monitor_update_in_progress() {
21913         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21914         *ret_copy = APIError_monitor_update_in_progress();
21915         uint64_t ret_ref = tag_ptr(ret_copy, true);
21916         return ret_ref;
21917 }
21918
21919 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
21920         LDKShutdownScript script_conv;
21921         script_conv.inner = untag_ptr(script);
21922         script_conv.is_owned = ptr_is_owned(script);
21923         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
21924         script_conv = ShutdownScript_clone(&script_conv);
21925         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21926         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
21927         uint64_t ret_ref = tag_ptr(ret_copy, true);
21928         return ret_ref;
21929 }
21930
21931 jboolean  __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t a, uint64_t b) {
21932         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
21933         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
21934         jboolean ret_conv = APIError_eq(a_conv, b_conv);
21935         return ret_conv;
21936 }
21937
21938 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
21939         LDKBigSize this_obj_conv;
21940         this_obj_conv.inner = untag_ptr(this_obj);
21941         this_obj_conv.is_owned = ptr_is_owned(this_obj);
21942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21943         BigSize_free(this_obj_conv);
21944 }
21945
21946 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
21947         LDKBigSize this_ptr_conv;
21948         this_ptr_conv.inner = untag_ptr(this_ptr);
21949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21951         this_ptr_conv.is_owned = false;
21952         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
21953         return ret_conv;
21954 }
21955
21956 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
21957         LDKBigSize this_ptr_conv;
21958         this_ptr_conv.inner = untag_ptr(this_ptr);
21959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21961         this_ptr_conv.is_owned = false;
21962         BigSize_set_a(&this_ptr_conv, val);
21963 }
21964
21965 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
21966         LDKBigSize ret_var = BigSize_new(a_arg);
21967         uint64_t ret_ref = 0;
21968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21970         return ret_ref;
21971 }
21972
21973 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
21974         LDKHostname this_obj_conv;
21975         this_obj_conv.inner = untag_ptr(this_obj);
21976         this_obj_conv.is_owned = ptr_is_owned(this_obj);
21977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21978         Hostname_free(this_obj_conv);
21979 }
21980
21981 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
21982         LDKHostname ret_var = Hostname_clone(arg);
21983         uint64_t ret_ref = 0;
21984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21986         return ret_ref;
21987 }
21988 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
21989         LDKHostname arg_conv;
21990         arg_conv.inner = untag_ptr(arg);
21991         arg_conv.is_owned = ptr_is_owned(arg);
21992         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21993         arg_conv.is_owned = false;
21994         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
21995         return ret_conv;
21996 }
21997
21998 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
21999         LDKHostname orig_conv;
22000         orig_conv.inner = untag_ptr(orig);
22001         orig_conv.is_owned = ptr_is_owned(orig);
22002         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22003         orig_conv.is_owned = false;
22004         LDKHostname ret_var = Hostname_clone(&orig_conv);
22005         uint64_t ret_ref = 0;
22006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22008         return ret_ref;
22009 }
22010
22011 jboolean  __attribute__((export_name("TS_Hostname_eq"))) TS_Hostname_eq(uint64_t a, uint64_t b) {
22012         LDKHostname a_conv;
22013         a_conv.inner = untag_ptr(a);
22014         a_conv.is_owned = ptr_is_owned(a);
22015         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22016         a_conv.is_owned = false;
22017         LDKHostname b_conv;
22018         b_conv.inner = untag_ptr(b);
22019         b_conv.is_owned = ptr_is_owned(b);
22020         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22021         b_conv.is_owned = false;
22022         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
22023         return ret_conv;
22024 }
22025
22026 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
22027         LDKHostname this_arg_conv;
22028         this_arg_conv.inner = untag_ptr(this_arg);
22029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22031         this_arg_conv.is_owned = false;
22032         int8_t ret_conv = Hostname_len(&this_arg_conv);
22033         return ret_conv;
22034 }
22035
22036 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
22037         LDKu8slice msg_ref;
22038         msg_ref.datalen = msg->arr_len;
22039         msg_ref.data = msg->elems;
22040         unsigned char sk_arr[32];
22041         CHECK(sk->arr_len == 32);
22042         memcpy(sk_arr, sk->elems, 32); FREE(sk);
22043         unsigned char (*sk_ref)[32] = &sk_arr;
22044         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
22045         *ret_conv = sign(msg_ref, sk_ref);
22046         FREE(msg);
22047         return tag_ptr(ret_conv, true);
22048 }
22049
22050 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
22051         LDKu8slice msg_ref;
22052         msg_ref.datalen = msg->arr_len;
22053         msg_ref.data = msg->elems;
22054         LDKStr sig_conv = str_ref_to_owned_c(sig);
22055         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22056         *ret_conv = recover_pk(msg_ref, sig_conv);
22057         FREE(msg);
22058         return tag_ptr(ret_conv, true);
22059 }
22060
22061 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
22062         LDKu8slice msg_ref;
22063         msg_ref.datalen = msg->arr_len;
22064         msg_ref.data = msg->elems;
22065         LDKStr sig_conv = str_ref_to_owned_c(sig);
22066         LDKPublicKey pk_ref;
22067         CHECK(pk->arr_len == 33);
22068         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
22069         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
22070         FREE(msg);
22071         return ret_conv;
22072 }
22073
22074 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
22075         LDKu8slice hrp_bytes_ref;
22076         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
22077         hrp_bytes_ref.data = hrp_bytes->elems;
22078         LDKCVec_u5Z data_without_signature_constr;
22079         data_without_signature_constr.datalen = data_without_signature->arr_len;
22080         if (data_without_signature_constr.datalen > 0)
22081                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
22082         else
22083                 data_without_signature_constr.data = NULL;
22084         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
22085         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
22086                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
22087                 
22088                 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
22089         }
22090         FREE(data_without_signature);
22091         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
22092         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22093         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22094         CVec_u8Z_free(ret_var);
22095         FREE(hrp_bytes);
22096         return ret_arr;
22097 }
22098
22099 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
22100         if (!ptr_is_owned(this_ptr)) return;
22101         void* this_ptr_ptr = untag_ptr(this_ptr);
22102         CHECK_ACCESS(this_ptr_ptr);
22103         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
22104         FREE(untag_ptr(this_ptr));
22105         Persister_free(this_ptr_conv);
22106 }
22107
22108 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
22109         if (!ptr_is_owned(this_ptr)) return;
22110         void* this_ptr_ptr = untag_ptr(this_ptr);
22111         CHECK_ACCESS(this_ptr_ptr);
22112         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
22113         FREE(untag_ptr(this_ptr));
22114         FutureCallback_free(this_ptr_conv);
22115 }
22116
22117 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
22118         LDKFuture this_obj_conv;
22119         this_obj_conv.inner = untag_ptr(this_obj);
22120         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22122         Future_free(this_obj_conv);
22123 }
22124
22125 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
22126         LDKFuture this_arg_conv;
22127         this_arg_conv.inner = untag_ptr(this_arg);
22128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22130         this_arg_conv.is_owned = false;
22131         void* callback_ptr = untag_ptr(callback);
22132         CHECK_ACCESS(callback_ptr);
22133         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
22134         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
22135                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22136                 LDKFutureCallback_JCalls_cloned(&callback_conv);
22137         }
22138         Future_register_callback_fn(&this_arg_conv, callback_conv);
22139 }
22140
22141 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
22142         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
22143         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
22144         return ret_conv;
22145 }
22146
22147 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
22148         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
22149         return ret_conv;
22150 }
22151
22152 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
22153         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
22154         return ret_conv;
22155 }
22156
22157 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
22158         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
22159         return ret_conv;
22160 }
22161
22162 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
22163         uint32_t ret_conv = LDKLevel_to_js(Level_info());
22164         return ret_conv;
22165 }
22166
22167 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
22168         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
22169         return ret_conv;
22170 }
22171
22172 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
22173         uint32_t ret_conv = LDKLevel_to_js(Level_error());
22174         return ret_conv;
22175 }
22176
22177 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
22178         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
22179         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
22180         jboolean ret_conv = Level_eq(a_conv, b_conv);
22181         return ret_conv;
22182 }
22183
22184 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
22185         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
22186         int64_t ret_conv = Level_hash(o_conv);
22187         return ret_conv;
22188 }
22189
22190 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
22191         uint32_t ret_conv = LDKLevel_to_js(Level_max());
22192         return ret_conv;
22193 }
22194
22195 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
22196         LDKRecord this_obj_conv;
22197         this_obj_conv.inner = untag_ptr(this_obj);
22198         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22200         Record_free(this_obj_conv);
22201 }
22202
22203 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
22204         LDKRecord this_ptr_conv;
22205         this_ptr_conv.inner = untag_ptr(this_ptr);
22206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22208         this_ptr_conv.is_owned = false;
22209         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
22210         return ret_conv;
22211 }
22212
22213 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
22214         LDKRecord this_ptr_conv;
22215         this_ptr_conv.inner = untag_ptr(this_ptr);
22216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22218         this_ptr_conv.is_owned = false;
22219         LDKLevel val_conv = LDKLevel_from_js(val);
22220         Record_set_level(&this_ptr_conv, val_conv);
22221 }
22222
22223 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
22224         LDKRecord this_ptr_conv;
22225         this_ptr_conv.inner = untag_ptr(this_ptr);
22226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22228         this_ptr_conv.is_owned = false;
22229         LDKStr ret_str = Record_get_args(&this_ptr_conv);
22230         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22231         Str_free(ret_str);
22232         return ret_conv;
22233 }
22234
22235 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
22236         LDKRecord this_ptr_conv;
22237         this_ptr_conv.inner = untag_ptr(this_ptr);
22238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22240         this_ptr_conv.is_owned = false;
22241         LDKStr val_conv = str_ref_to_owned_c(val);
22242         Record_set_args(&this_ptr_conv, val_conv);
22243 }
22244
22245 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
22246         LDKRecord this_ptr_conv;
22247         this_ptr_conv.inner = untag_ptr(this_ptr);
22248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22250         this_ptr_conv.is_owned = false;
22251         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
22252         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22253         Str_free(ret_str);
22254         return ret_conv;
22255 }
22256
22257 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
22258         LDKRecord this_ptr_conv;
22259         this_ptr_conv.inner = untag_ptr(this_ptr);
22260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22262         this_ptr_conv.is_owned = false;
22263         LDKStr val_conv = str_ref_to_owned_c(val);
22264         Record_set_module_path(&this_ptr_conv, val_conv);
22265 }
22266
22267 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
22268         LDKRecord this_ptr_conv;
22269         this_ptr_conv.inner = untag_ptr(this_ptr);
22270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22272         this_ptr_conv.is_owned = false;
22273         LDKStr ret_str = Record_get_file(&this_ptr_conv);
22274         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22275         Str_free(ret_str);
22276         return ret_conv;
22277 }
22278
22279 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
22280         LDKRecord this_ptr_conv;
22281         this_ptr_conv.inner = untag_ptr(this_ptr);
22282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22284         this_ptr_conv.is_owned = false;
22285         LDKStr val_conv = str_ref_to_owned_c(val);
22286         Record_set_file(&this_ptr_conv, val_conv);
22287 }
22288
22289 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
22290         LDKRecord this_ptr_conv;
22291         this_ptr_conv.inner = untag_ptr(this_ptr);
22292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22294         this_ptr_conv.is_owned = false;
22295         int32_t ret_conv = Record_get_line(&this_ptr_conv);
22296         return ret_conv;
22297 }
22298
22299 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
22300         LDKRecord this_ptr_conv;
22301         this_ptr_conv.inner = untag_ptr(this_ptr);
22302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22304         this_ptr_conv.is_owned = false;
22305         Record_set_line(&this_ptr_conv, val);
22306 }
22307
22308 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
22309         LDKRecord ret_var = Record_clone(arg);
22310         uint64_t ret_ref = 0;
22311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22313         return ret_ref;
22314 }
22315 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
22316         LDKRecord arg_conv;
22317         arg_conv.inner = untag_ptr(arg);
22318         arg_conv.is_owned = ptr_is_owned(arg);
22319         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22320         arg_conv.is_owned = false;
22321         int64_t ret_conv = Record_clone_ptr(&arg_conv);
22322         return ret_conv;
22323 }
22324
22325 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
22326         LDKRecord orig_conv;
22327         orig_conv.inner = untag_ptr(orig);
22328         orig_conv.is_owned = ptr_is_owned(orig);
22329         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22330         orig_conv.is_owned = false;
22331         LDKRecord ret_var = Record_clone(&orig_conv);
22332         uint64_t ret_ref = 0;
22333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22335         return ret_ref;
22336 }
22337
22338 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
22339         if (!ptr_is_owned(this_ptr)) return;
22340         void* this_ptr_ptr = untag_ptr(this_ptr);
22341         CHECK_ACCESS(this_ptr_ptr);
22342         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
22343         FREE(untag_ptr(this_ptr));
22344         Logger_free(this_ptr_conv);
22345 }
22346
22347 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
22348         LDKChannelHandshakeConfig this_obj_conv;
22349         this_obj_conv.inner = untag_ptr(this_obj);
22350         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22352         ChannelHandshakeConfig_free(this_obj_conv);
22353 }
22354
22355 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
22356         LDKChannelHandshakeConfig this_ptr_conv;
22357         this_ptr_conv.inner = untag_ptr(this_ptr);
22358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22360         this_ptr_conv.is_owned = false;
22361         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
22362         return ret_conv;
22363 }
22364
22365 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
22366         LDKChannelHandshakeConfig this_ptr_conv;
22367         this_ptr_conv.inner = untag_ptr(this_ptr);
22368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22370         this_ptr_conv.is_owned = false;
22371         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
22372 }
22373
22374 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
22375         LDKChannelHandshakeConfig this_ptr_conv;
22376         this_ptr_conv.inner = untag_ptr(this_ptr);
22377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22379         this_ptr_conv.is_owned = false;
22380         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
22381         return ret_conv;
22382 }
22383
22384 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_our_to_self_delay"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint64_t this_ptr, int16_t val) {
22385         LDKChannelHandshakeConfig this_ptr_conv;
22386         this_ptr_conv.inner = untag_ptr(this_ptr);
22387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22389         this_ptr_conv.is_owned = false;
22390         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
22391 }
22392
22393 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
22394         LDKChannelHandshakeConfig this_ptr_conv;
22395         this_ptr_conv.inner = untag_ptr(this_ptr);
22396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22398         this_ptr_conv.is_owned = false;
22399         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
22400         return ret_conv;
22401 }
22402
22403 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
22404         LDKChannelHandshakeConfig this_ptr_conv;
22405         this_ptr_conv.inner = untag_ptr(this_ptr);
22406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22408         this_ptr_conv.is_owned = false;
22409         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
22410 }
22411
22412 int8_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel"))) TS_ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(uint64_t this_ptr) {
22413         LDKChannelHandshakeConfig this_ptr_conv;
22414         this_ptr_conv.inner = untag_ptr(this_ptr);
22415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22417         this_ptr_conv.is_owned = false;
22418         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
22419         return ret_conv;
22420 }
22421
22422 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel"))) TS_ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(uint64_t this_ptr, int8_t val) {
22423         LDKChannelHandshakeConfig this_ptr_conv;
22424         this_ptr_conv.inner = untag_ptr(this_ptr);
22425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22427         this_ptr_conv.is_owned = false;
22428         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
22429 }
22430
22431 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
22432         LDKChannelHandshakeConfig this_ptr_conv;
22433         this_ptr_conv.inner = untag_ptr(this_ptr);
22434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22436         this_ptr_conv.is_owned = false;
22437         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
22438         return ret_conv;
22439 }
22440
22441 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
22442         LDKChannelHandshakeConfig this_ptr_conv;
22443         this_ptr_conv.inner = untag_ptr(this_ptr);
22444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22446         this_ptr_conv.is_owned = false;
22447         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
22448 }
22449
22450 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
22451         LDKChannelHandshakeConfig this_ptr_conv;
22452         this_ptr_conv.inner = untag_ptr(this_ptr);
22453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22455         this_ptr_conv.is_owned = false;
22456         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
22457         return ret_conv;
22458 }
22459
22460 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
22461         LDKChannelHandshakeConfig this_ptr_conv;
22462         this_ptr_conv.inner = untag_ptr(this_ptr);
22463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22465         this_ptr_conv.is_owned = false;
22466         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
22467 }
22468
22469 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
22470         LDKChannelHandshakeConfig this_ptr_conv;
22471         this_ptr_conv.inner = untag_ptr(this_ptr);
22472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22474         this_ptr_conv.is_owned = false;
22475         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
22476         return ret_conv;
22477 }
22478
22479 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
22480         LDKChannelHandshakeConfig this_ptr_conv;
22481         this_ptr_conv.inner = untag_ptr(this_ptr);
22482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22484         this_ptr_conv.is_owned = false;
22485         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
22486 }
22487
22488 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths"))) TS_ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(uint64_t this_ptr) {
22489         LDKChannelHandshakeConfig this_ptr_conv;
22490         this_ptr_conv.inner = untag_ptr(this_ptr);
22491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22493         this_ptr_conv.is_owned = false;
22494         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
22495         return ret_conv;
22496 }
22497
22498 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths"))) TS_ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(uint64_t this_ptr, int32_t val) {
22499         LDKChannelHandshakeConfig this_ptr_conv;
22500         this_ptr_conv.inner = untag_ptr(this_ptr);
22501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22503         this_ptr_conv.is_owned = false;
22504         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
22505 }
22506
22507 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_new"))) TS_ChannelHandshakeConfig_new(int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg, int8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, jboolean negotiate_scid_privacy_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int32_t their_channel_reserve_proportional_millionths_arg) {
22508         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg, max_inbound_htlc_value_in_flight_percent_of_channel_arg, negotiate_scid_privacy_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, their_channel_reserve_proportional_millionths_arg);
22509         uint64_t ret_ref = 0;
22510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22512         return ret_ref;
22513 }
22514
22515 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
22516         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
22517         uint64_t ret_ref = 0;
22518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22520         return ret_ref;
22521 }
22522 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
22523         LDKChannelHandshakeConfig arg_conv;
22524         arg_conv.inner = untag_ptr(arg);
22525         arg_conv.is_owned = ptr_is_owned(arg);
22526         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22527         arg_conv.is_owned = false;
22528         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
22529         return ret_conv;
22530 }
22531
22532 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
22533         LDKChannelHandshakeConfig orig_conv;
22534         orig_conv.inner = untag_ptr(orig);
22535         orig_conv.is_owned = ptr_is_owned(orig);
22536         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22537         orig_conv.is_owned = false;
22538         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
22539         uint64_t ret_ref = 0;
22540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22542         return ret_ref;
22543 }
22544
22545 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
22546         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
22547         uint64_t ret_ref = 0;
22548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22550         return ret_ref;
22551 }
22552
22553 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
22554         LDKChannelHandshakeLimits this_obj_conv;
22555         this_obj_conv.inner = untag_ptr(this_obj);
22556         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22558         ChannelHandshakeLimits_free(this_obj_conv);
22559 }
22560
22561 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
22562         LDKChannelHandshakeLimits this_ptr_conv;
22563         this_ptr_conv.inner = untag_ptr(this_ptr);
22564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22566         this_ptr_conv.is_owned = false;
22567         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
22568         return ret_conv;
22569 }
22570
22571 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
22572         LDKChannelHandshakeLimits this_ptr_conv;
22573         this_ptr_conv.inner = untag_ptr(this_ptr);
22574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22576         this_ptr_conv.is_owned = false;
22577         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
22578 }
22579
22580 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
22581         LDKChannelHandshakeLimits this_ptr_conv;
22582         this_ptr_conv.inner = untag_ptr(this_ptr);
22583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22585         this_ptr_conv.is_owned = false;
22586         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
22587         return ret_conv;
22588 }
22589
22590 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
22591         LDKChannelHandshakeLimits this_ptr_conv;
22592         this_ptr_conv.inner = untag_ptr(this_ptr);
22593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22595         this_ptr_conv.is_owned = false;
22596         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
22597 }
22598
22599 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
22600         LDKChannelHandshakeLimits this_ptr_conv;
22601         this_ptr_conv.inner = untag_ptr(this_ptr);
22602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22604         this_ptr_conv.is_owned = false;
22605         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
22606         return ret_conv;
22607 }
22608
22609 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
22610         LDKChannelHandshakeLimits this_ptr_conv;
22611         this_ptr_conv.inner = untag_ptr(this_ptr);
22612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22614         this_ptr_conv.is_owned = false;
22615         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
22616 }
22617
22618 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint64_t this_ptr) {
22619         LDKChannelHandshakeLimits this_ptr_conv;
22620         this_ptr_conv.inner = untag_ptr(this_ptr);
22621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22623         this_ptr_conv.is_owned = false;
22624         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
22625         return ret_conv;
22626 }
22627
22628 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint64_t this_ptr, int64_t val) {
22629         LDKChannelHandshakeLimits this_ptr_conv;
22630         this_ptr_conv.inner = untag_ptr(this_ptr);
22631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22633         this_ptr_conv.is_owned = false;
22634         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
22635 }
22636
22637 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
22638         LDKChannelHandshakeLimits this_ptr_conv;
22639         this_ptr_conv.inner = untag_ptr(this_ptr);
22640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22642         this_ptr_conv.is_owned = false;
22643         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
22644         return ret_conv;
22645 }
22646
22647 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
22648         LDKChannelHandshakeLimits this_ptr_conv;
22649         this_ptr_conv.inner = untag_ptr(this_ptr);
22650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22652         this_ptr_conv.is_owned = false;
22653         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
22654 }
22655
22656 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
22657         LDKChannelHandshakeLimits this_ptr_conv;
22658         this_ptr_conv.inner = untag_ptr(this_ptr);
22659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22661         this_ptr_conv.is_owned = false;
22662         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
22663         return ret_conv;
22664 }
22665
22666 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
22667         LDKChannelHandshakeLimits this_ptr_conv;
22668         this_ptr_conv.inner = untag_ptr(this_ptr);
22669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22671         this_ptr_conv.is_owned = false;
22672         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
22673 }
22674
22675 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
22676         LDKChannelHandshakeLimits this_ptr_conv;
22677         this_ptr_conv.inner = untag_ptr(this_ptr);
22678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22680         this_ptr_conv.is_owned = false;
22681         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
22682         return ret_conv;
22683 }
22684
22685 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
22686         LDKChannelHandshakeLimits this_ptr_conv;
22687         this_ptr_conv.inner = untag_ptr(this_ptr);
22688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22690         this_ptr_conv.is_owned = false;
22691         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
22692 }
22693
22694 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
22695         LDKChannelHandshakeLimits this_ptr_conv;
22696         this_ptr_conv.inner = untag_ptr(this_ptr);
22697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22699         this_ptr_conv.is_owned = false;
22700         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
22701         return ret_conv;
22702 }
22703
22704 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
22705         LDKChannelHandshakeLimits this_ptr_conv;
22706         this_ptr_conv.inner = untag_ptr(this_ptr);
22707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22709         this_ptr_conv.is_owned = false;
22710         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
22711 }
22712
22713 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
22714         LDKChannelHandshakeLimits this_ptr_conv;
22715         this_ptr_conv.inner = untag_ptr(this_ptr);
22716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22718         this_ptr_conv.is_owned = false;
22719         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
22720         return ret_conv;
22721 }
22722
22723 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
22724         LDKChannelHandshakeLimits this_ptr_conv;
22725         this_ptr_conv.inner = untag_ptr(this_ptr);
22726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22728         this_ptr_conv.is_owned = false;
22729         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
22730 }
22731
22732 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
22733         LDKChannelHandshakeLimits this_ptr_conv;
22734         this_ptr_conv.inner = untag_ptr(this_ptr);
22735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22737         this_ptr_conv.is_owned = false;
22738         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
22739         return ret_conv;
22740 }
22741
22742 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_their_to_self_delay"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint64_t this_ptr, int16_t val) {
22743         LDKChannelHandshakeLimits this_ptr_conv;
22744         this_ptr_conv.inner = untag_ptr(this_ptr);
22745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22747         this_ptr_conv.is_owned = false;
22748         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
22749 }
22750
22751 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_new"))) TS_ChannelHandshakeLimits_new(int64_t min_funding_satoshis_arg, int64_t max_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, int32_t max_minimum_depth_arg, jboolean trust_own_funding_0conf_arg, jboolean force_announced_channel_preference_arg, int16_t their_to_self_delay_arg) {
22752         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_new(min_funding_satoshis_arg, max_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, max_minimum_depth_arg, trust_own_funding_0conf_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
22753         uint64_t ret_ref = 0;
22754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22756         return ret_ref;
22757 }
22758
22759 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
22760         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
22761         uint64_t ret_ref = 0;
22762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22764         return ret_ref;
22765 }
22766 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
22767         LDKChannelHandshakeLimits arg_conv;
22768         arg_conv.inner = untag_ptr(arg);
22769         arg_conv.is_owned = ptr_is_owned(arg);
22770         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22771         arg_conv.is_owned = false;
22772         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
22773         return ret_conv;
22774 }
22775
22776 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
22777         LDKChannelHandshakeLimits orig_conv;
22778         orig_conv.inner = untag_ptr(orig);
22779         orig_conv.is_owned = ptr_is_owned(orig);
22780         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22781         orig_conv.is_owned = false;
22782         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
22783         uint64_t ret_ref = 0;
22784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22786         return ret_ref;
22787 }
22788
22789 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
22790         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
22791         uint64_t ret_ref = 0;
22792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22794         return ret_ref;
22795 }
22796
22797 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
22798         LDKChannelConfig this_obj_conv;
22799         this_obj_conv.inner = untag_ptr(this_obj);
22800         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22802         ChannelConfig_free(this_obj_conv);
22803 }
22804
22805 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
22806         LDKChannelConfig this_ptr_conv;
22807         this_ptr_conv.inner = untag_ptr(this_ptr);
22808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22810         this_ptr_conv.is_owned = false;
22811         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
22812         return ret_conv;
22813 }
22814
22815 void  __attribute__((export_name("TS_ChannelConfig_set_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_set_forwarding_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
22816         LDKChannelConfig this_ptr_conv;
22817         this_ptr_conv.inner = untag_ptr(this_ptr);
22818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22820         this_ptr_conv.is_owned = false;
22821         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
22822 }
22823
22824 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
22825         LDKChannelConfig this_ptr_conv;
22826         this_ptr_conv.inner = untag_ptr(this_ptr);
22827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22829         this_ptr_conv.is_owned = false;
22830         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
22831         return ret_conv;
22832 }
22833
22834 void  __attribute__((export_name("TS_ChannelConfig_set_forwarding_fee_base_msat"))) TS_ChannelConfig_set_forwarding_fee_base_msat(uint64_t this_ptr, int32_t val) {
22835         LDKChannelConfig this_ptr_conv;
22836         this_ptr_conv.inner = untag_ptr(this_ptr);
22837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22839         this_ptr_conv.is_owned = false;
22840         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
22841 }
22842
22843 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
22844         LDKChannelConfig this_ptr_conv;
22845         this_ptr_conv.inner = untag_ptr(this_ptr);
22846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22848         this_ptr_conv.is_owned = false;
22849         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
22850         return ret_conv;
22851 }
22852
22853 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
22854         LDKChannelConfig this_ptr_conv;
22855         this_ptr_conv.inner = untag_ptr(this_ptr);
22856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22858         this_ptr_conv.is_owned = false;
22859         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
22860 }
22861
22862 int64_t  __attribute__((export_name("TS_ChannelConfig_get_max_dust_htlc_exposure_msat"))) TS_ChannelConfig_get_max_dust_htlc_exposure_msat(uint64_t this_ptr) {
22863         LDKChannelConfig this_ptr_conv;
22864         this_ptr_conv.inner = untag_ptr(this_ptr);
22865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22867         this_ptr_conv.is_owned = false;
22868         int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
22869         return ret_conv;
22870 }
22871
22872 void  __attribute__((export_name("TS_ChannelConfig_set_max_dust_htlc_exposure_msat"))) TS_ChannelConfig_set_max_dust_htlc_exposure_msat(uint64_t this_ptr, int64_t val) {
22873         LDKChannelConfig this_ptr_conv;
22874         this_ptr_conv.inner = untag_ptr(this_ptr);
22875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22877         this_ptr_conv.is_owned = false;
22878         ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
22879 }
22880
22881 int64_t  __attribute__((export_name("TS_ChannelConfig_get_force_close_avoidance_max_fee_satoshis"))) TS_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(uint64_t this_ptr) {
22882         LDKChannelConfig this_ptr_conv;
22883         this_ptr_conv.inner = untag_ptr(this_ptr);
22884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22886         this_ptr_conv.is_owned = false;
22887         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
22888         return ret_conv;
22889 }
22890
22891 void  __attribute__((export_name("TS_ChannelConfig_set_force_close_avoidance_max_fee_satoshis"))) TS_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
22892         LDKChannelConfig this_ptr_conv;
22893         this_ptr_conv.inner = untag_ptr(this_ptr);
22894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22896         this_ptr_conv.is_owned = false;
22897         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
22898 }
22899
22900 uint64_t  __attribute__((export_name("TS_ChannelConfig_new"))) TS_ChannelConfig_new(int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
22901         LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
22902         uint64_t ret_ref = 0;
22903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22905         return ret_ref;
22906 }
22907
22908 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
22909         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
22910         uint64_t ret_ref = 0;
22911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22913         return ret_ref;
22914 }
22915 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
22916         LDKChannelConfig arg_conv;
22917         arg_conv.inner = untag_ptr(arg);
22918         arg_conv.is_owned = ptr_is_owned(arg);
22919         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22920         arg_conv.is_owned = false;
22921         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
22922         return ret_conv;
22923 }
22924
22925 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
22926         LDKChannelConfig orig_conv;
22927         orig_conv.inner = untag_ptr(orig);
22928         orig_conv.is_owned = ptr_is_owned(orig);
22929         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22930         orig_conv.is_owned = false;
22931         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
22932         uint64_t ret_ref = 0;
22933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22935         return ret_ref;
22936 }
22937
22938 jboolean  __attribute__((export_name("TS_ChannelConfig_eq"))) TS_ChannelConfig_eq(uint64_t a, uint64_t b) {
22939         LDKChannelConfig a_conv;
22940         a_conv.inner = untag_ptr(a);
22941         a_conv.is_owned = ptr_is_owned(a);
22942         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22943         a_conv.is_owned = false;
22944         LDKChannelConfig b_conv;
22945         b_conv.inner = untag_ptr(b);
22946         b_conv.is_owned = ptr_is_owned(b);
22947         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22948         b_conv.is_owned = false;
22949         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
22950         return ret_conv;
22951 }
22952
22953 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
22954         LDKChannelConfig ret_var = ChannelConfig_default();
22955         uint64_t ret_ref = 0;
22956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22958         return ret_ref;
22959 }
22960
22961 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
22962         LDKChannelConfig obj_conv;
22963         obj_conv.inner = untag_ptr(obj);
22964         obj_conv.is_owned = ptr_is_owned(obj);
22965         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22966         obj_conv.is_owned = false;
22967         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
22968         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22969         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22970         CVec_u8Z_free(ret_var);
22971         return ret_arr;
22972 }
22973
22974 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
22975         LDKu8slice ser_ref;
22976         ser_ref.datalen = ser->arr_len;
22977         ser_ref.data = ser->elems;
22978         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
22979         *ret_conv = ChannelConfig_read(ser_ref);
22980         FREE(ser);
22981         return tag_ptr(ret_conv, true);
22982 }
22983
22984 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
22985         LDKUserConfig this_obj_conv;
22986         this_obj_conv.inner = untag_ptr(this_obj);
22987         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22989         UserConfig_free(this_obj_conv);
22990 }
22991
22992 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
22993         LDKUserConfig this_ptr_conv;
22994         this_ptr_conv.inner = untag_ptr(this_ptr);
22995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22997         this_ptr_conv.is_owned = false;
22998         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
22999         uint64_t ret_ref = 0;
23000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23002         return ret_ref;
23003 }
23004
23005 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
23006         LDKUserConfig this_ptr_conv;
23007         this_ptr_conv.inner = untag_ptr(this_ptr);
23008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23010         this_ptr_conv.is_owned = false;
23011         LDKChannelHandshakeConfig val_conv;
23012         val_conv.inner = untag_ptr(val);
23013         val_conv.is_owned = ptr_is_owned(val);
23014         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23015         val_conv = ChannelHandshakeConfig_clone(&val_conv);
23016         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
23017 }
23018
23019 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
23020         LDKUserConfig this_ptr_conv;
23021         this_ptr_conv.inner = untag_ptr(this_ptr);
23022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23024         this_ptr_conv.is_owned = false;
23025         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
23026         uint64_t ret_ref = 0;
23027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23029         return ret_ref;
23030 }
23031
23032 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
23033         LDKUserConfig this_ptr_conv;
23034         this_ptr_conv.inner = untag_ptr(this_ptr);
23035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23037         this_ptr_conv.is_owned = false;
23038         LDKChannelHandshakeLimits val_conv;
23039         val_conv.inner = untag_ptr(val);
23040         val_conv.is_owned = ptr_is_owned(val);
23041         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23042         val_conv = ChannelHandshakeLimits_clone(&val_conv);
23043         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
23044 }
23045
23046 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
23047         LDKUserConfig this_ptr_conv;
23048         this_ptr_conv.inner = untag_ptr(this_ptr);
23049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23051         this_ptr_conv.is_owned = false;
23052         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
23053         uint64_t ret_ref = 0;
23054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23056         return ret_ref;
23057 }
23058
23059 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
23060         LDKUserConfig this_ptr_conv;
23061         this_ptr_conv.inner = untag_ptr(this_ptr);
23062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23064         this_ptr_conv.is_owned = false;
23065         LDKChannelConfig val_conv;
23066         val_conv.inner = untag_ptr(val);
23067         val_conv.is_owned = ptr_is_owned(val);
23068         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23069         val_conv = ChannelConfig_clone(&val_conv);
23070         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
23071 }
23072
23073 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
23074         LDKUserConfig this_ptr_conv;
23075         this_ptr_conv.inner = untag_ptr(this_ptr);
23076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23078         this_ptr_conv.is_owned = false;
23079         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
23080         return ret_conv;
23081 }
23082
23083 void  __attribute__((export_name("TS_UserConfig_set_accept_forwards_to_priv_channels"))) TS_UserConfig_set_accept_forwards_to_priv_channels(uint64_t this_ptr, jboolean val) {
23084         LDKUserConfig this_ptr_conv;
23085         this_ptr_conv.inner = untag_ptr(this_ptr);
23086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23088         this_ptr_conv.is_owned = false;
23089         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
23090 }
23091
23092 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
23093         LDKUserConfig this_ptr_conv;
23094         this_ptr_conv.inner = untag_ptr(this_ptr);
23095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23097         this_ptr_conv.is_owned = false;
23098         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
23099         return ret_conv;
23100 }
23101
23102 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
23103         LDKUserConfig this_ptr_conv;
23104         this_ptr_conv.inner = untag_ptr(this_ptr);
23105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23107         this_ptr_conv.is_owned = false;
23108         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
23109 }
23110
23111 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
23112         LDKUserConfig this_ptr_conv;
23113         this_ptr_conv.inner = untag_ptr(this_ptr);
23114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23116         this_ptr_conv.is_owned = false;
23117         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
23118         return ret_conv;
23119 }
23120
23121 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
23122         LDKUserConfig this_ptr_conv;
23123         this_ptr_conv.inner = untag_ptr(this_ptr);
23124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23126         this_ptr_conv.is_owned = false;
23127         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
23128 }
23129
23130 uint64_t  __attribute__((export_name("TS_UserConfig_new"))) TS_UserConfig_new(uint64_t channel_handshake_config_arg, uint64_t channel_handshake_limits_arg, uint64_t channel_config_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg, jboolean manually_accept_inbound_channels_arg) {
23131         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
23132         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
23133         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
23134         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
23135         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
23136         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
23137         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
23138         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
23139         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
23140         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
23141         LDKChannelConfig channel_config_arg_conv;
23142         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
23143         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
23144         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
23145         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
23146         LDKUserConfig ret_var = UserConfig_new(channel_handshake_config_arg_conv, channel_handshake_limits_arg_conv, channel_config_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg, manually_accept_inbound_channels_arg);
23147         uint64_t ret_ref = 0;
23148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23150         return ret_ref;
23151 }
23152
23153 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
23154         LDKUserConfig ret_var = UserConfig_clone(arg);
23155         uint64_t ret_ref = 0;
23156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23158         return ret_ref;
23159 }
23160 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
23161         LDKUserConfig arg_conv;
23162         arg_conv.inner = untag_ptr(arg);
23163         arg_conv.is_owned = ptr_is_owned(arg);
23164         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23165         arg_conv.is_owned = false;
23166         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
23167         return ret_conv;
23168 }
23169
23170 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
23171         LDKUserConfig orig_conv;
23172         orig_conv.inner = untag_ptr(orig);
23173         orig_conv.is_owned = ptr_is_owned(orig);
23174         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23175         orig_conv.is_owned = false;
23176         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
23177         uint64_t ret_ref = 0;
23178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23180         return ret_ref;
23181 }
23182
23183 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
23184         LDKUserConfig ret_var = UserConfig_default();
23185         uint64_t ret_ref = 0;
23186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23188         return ret_ref;
23189 }
23190
23191 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
23192         LDKBestBlock this_obj_conv;
23193         this_obj_conv.inner = untag_ptr(this_obj);
23194         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23196         BestBlock_free(this_obj_conv);
23197 }
23198
23199 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
23200         LDKBestBlock ret_var = BestBlock_clone(arg);
23201         uint64_t ret_ref = 0;
23202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23204         return ret_ref;
23205 }
23206 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
23207         LDKBestBlock arg_conv;
23208         arg_conv.inner = untag_ptr(arg);
23209         arg_conv.is_owned = ptr_is_owned(arg);
23210         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23211         arg_conv.is_owned = false;
23212         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
23213         return ret_conv;
23214 }
23215
23216 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
23217         LDKBestBlock orig_conv;
23218         orig_conv.inner = untag_ptr(orig);
23219         orig_conv.is_owned = ptr_is_owned(orig);
23220         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23221         orig_conv.is_owned = false;
23222         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
23223         uint64_t ret_ref = 0;
23224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23226         return ret_ref;
23227 }
23228
23229 jboolean  __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64_t a, uint64_t b) {
23230         LDKBestBlock a_conv;
23231         a_conv.inner = untag_ptr(a);
23232         a_conv.is_owned = ptr_is_owned(a);
23233         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23234         a_conv.is_owned = false;
23235         LDKBestBlock b_conv;
23236         b_conv.inner = untag_ptr(b);
23237         b_conv.is_owned = ptr_is_owned(b);
23238         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23239         b_conv.is_owned = false;
23240         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
23241         return ret_conv;
23242 }
23243
23244 uint64_t  __attribute__((export_name("TS_BestBlock_from_genesis"))) TS_BestBlock_from_genesis(uint32_t network) {
23245         LDKNetwork network_conv = LDKNetwork_from_js(network);
23246         LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
23247         uint64_t ret_ref = 0;
23248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23250         return ret_ref;
23251 }
23252
23253 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
23254         LDKThirtyTwoBytes block_hash_ref;
23255         CHECK(block_hash->arr_len == 32);
23256         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
23257         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
23258         uint64_t ret_ref = 0;
23259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23261         return ret_ref;
23262 }
23263
23264 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
23265         LDKBestBlock this_arg_conv;
23266         this_arg_conv.inner = untag_ptr(this_arg);
23267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23269         this_arg_conv.is_owned = false;
23270         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23271         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
23272         return ret_arr;
23273 }
23274
23275 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
23276         LDKBestBlock this_arg_conv;
23277         this_arg_conv.inner = untag_ptr(this_arg);
23278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23280         this_arg_conv.is_owned = false;
23281         int32_t ret_conv = BestBlock_height(&this_arg_conv);
23282         return ret_conv;
23283 }
23284
23285 uint32_t  __attribute__((export_name("TS_AccessError_clone"))) TS_AccessError_clone(uint64_t orig) {
23286         LDKAccessError* orig_conv = (LDKAccessError*)untag_ptr(orig);
23287         uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
23288         return ret_conv;
23289 }
23290
23291 uint32_t  __attribute__((export_name("TS_AccessError_unknown_chain"))) TS_AccessError_unknown_chain() {
23292         uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
23293         return ret_conv;
23294 }
23295
23296 uint32_t  __attribute__((export_name("TS_AccessError_unknown_tx"))) TS_AccessError_unknown_tx() {
23297         uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
23298         return ret_conv;
23299 }
23300
23301 void  __attribute__((export_name("TS_Access_free"))) TS_Access_free(uint64_t this_ptr) {
23302         if (!ptr_is_owned(this_ptr)) return;
23303         void* this_ptr_ptr = untag_ptr(this_ptr);
23304         CHECK_ACCESS(this_ptr_ptr);
23305         LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
23306         FREE(untag_ptr(this_ptr));
23307         Access_free(this_ptr_conv);
23308 }
23309
23310 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
23311         if (!ptr_is_owned(this_ptr)) return;
23312         void* this_ptr_ptr = untag_ptr(this_ptr);
23313         CHECK_ACCESS(this_ptr_ptr);
23314         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
23315         FREE(untag_ptr(this_ptr));
23316         Listen_free(this_ptr_conv);
23317 }
23318
23319 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
23320         if (!ptr_is_owned(this_ptr)) return;
23321         void* this_ptr_ptr = untag_ptr(this_ptr);
23322         CHECK_ACCESS(this_ptr_ptr);
23323         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
23324         FREE(untag_ptr(this_ptr));
23325         Confirm_free(this_ptr_conv);
23326 }
23327
23328 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_clone"))) TS_ChannelMonitorUpdateStatus_clone(uint64_t orig) {
23329         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
23330         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_clone(orig_conv));
23331         return ret_conv;
23332 }
23333
23334 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_completed"))) TS_ChannelMonitorUpdateStatus_completed() {
23335         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_completed());
23336         return ret_conv;
23337 }
23338
23339 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_in_progress"))) TS_ChannelMonitorUpdateStatus_in_progress() {
23340         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_in_progress());
23341         return ret_conv;
23342 }
23343
23344 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_permanent_failure"))) TS_ChannelMonitorUpdateStatus_permanent_failure() {
23345         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_permanent_failure());
23346         return ret_conv;
23347 }
23348
23349 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_eq"))) TS_ChannelMonitorUpdateStatus_eq(uint64_t a, uint64_t b) {
23350         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
23351         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
23352         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
23353         return ret_conv;
23354 }
23355
23356 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
23357         if (!ptr_is_owned(this_ptr)) return;
23358         void* this_ptr_ptr = untag_ptr(this_ptr);
23359         CHECK_ACCESS(this_ptr_ptr);
23360         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
23361         FREE(untag_ptr(this_ptr));
23362         Watch_free(this_ptr_conv);
23363 }
23364
23365 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
23366         if (!ptr_is_owned(this_ptr)) return;
23367         void* this_ptr_ptr = untag_ptr(this_ptr);
23368         CHECK_ACCESS(this_ptr_ptr);
23369         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
23370         FREE(untag_ptr(this_ptr));
23371         Filter_free(this_ptr_conv);
23372 }
23373
23374 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
23375         LDKWatchedOutput this_obj_conv;
23376         this_obj_conv.inner = untag_ptr(this_obj);
23377         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23379         WatchedOutput_free(this_obj_conv);
23380 }
23381
23382 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
23383         LDKWatchedOutput this_ptr_conv;
23384         this_ptr_conv.inner = untag_ptr(this_ptr);
23385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23387         this_ptr_conv.is_owned = false;
23388         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23389         memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
23390         return ret_arr;
23391 }
23392
23393 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, int8_tArray val) {
23394         LDKWatchedOutput this_ptr_conv;
23395         this_ptr_conv.inner = untag_ptr(this_ptr);
23396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23398         this_ptr_conv.is_owned = false;
23399         LDKThirtyTwoBytes val_ref;
23400         CHECK(val->arr_len == 32);
23401         memcpy(val_ref.data, val->elems, 32); FREE(val);
23402         WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
23403 }
23404
23405 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
23406         LDKWatchedOutput this_ptr_conv;
23407         this_ptr_conv.inner = untag_ptr(this_ptr);
23408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23410         this_ptr_conv.is_owned = false;
23411         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
23412         uint64_t ret_ref = 0;
23413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23415         return ret_ref;
23416 }
23417
23418 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
23419         LDKWatchedOutput this_ptr_conv;
23420         this_ptr_conv.inner = untag_ptr(this_ptr);
23421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23423         this_ptr_conv.is_owned = false;
23424         LDKOutPoint val_conv;
23425         val_conv.inner = untag_ptr(val);
23426         val_conv.is_owned = ptr_is_owned(val);
23427         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23428         val_conv = OutPoint_clone(&val_conv);
23429         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
23430 }
23431
23432 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
23433         LDKWatchedOutput this_ptr_conv;
23434         this_ptr_conv.inner = untag_ptr(this_ptr);
23435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23437         this_ptr_conv.is_owned = false;
23438         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
23439         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23440         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23441         return ret_arr;
23442 }
23443
23444 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
23445         LDKWatchedOutput this_ptr_conv;
23446         this_ptr_conv.inner = untag_ptr(this_ptr);
23447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23449         this_ptr_conv.is_owned = false;
23450         LDKCVec_u8Z val_ref;
23451         val_ref.datalen = val->arr_len;
23452         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
23453         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
23454         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
23455 }
23456
23457 uint64_t  __attribute__((export_name("TS_WatchedOutput_new"))) TS_WatchedOutput_new(int8_tArray block_hash_arg, uint64_t outpoint_arg, int8_tArray script_pubkey_arg) {
23458         LDKThirtyTwoBytes block_hash_arg_ref;
23459         CHECK(block_hash_arg->arr_len == 32);
23460         memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
23461         LDKOutPoint outpoint_arg_conv;
23462         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
23463         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
23464         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
23465         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
23466         LDKCVec_u8Z script_pubkey_arg_ref;
23467         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
23468         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
23469         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
23470         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
23471         uint64_t ret_ref = 0;
23472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23474         return ret_ref;
23475 }
23476
23477 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
23478         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
23479         uint64_t ret_ref = 0;
23480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23482         return ret_ref;
23483 }
23484 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
23485         LDKWatchedOutput arg_conv;
23486         arg_conv.inner = untag_ptr(arg);
23487         arg_conv.is_owned = ptr_is_owned(arg);
23488         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23489         arg_conv.is_owned = false;
23490         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
23491         return ret_conv;
23492 }
23493
23494 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
23495         LDKWatchedOutput orig_conv;
23496         orig_conv.inner = untag_ptr(orig);
23497         orig_conv.is_owned = ptr_is_owned(orig);
23498         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23499         orig_conv.is_owned = false;
23500         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
23501         uint64_t ret_ref = 0;
23502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23504         return ret_ref;
23505 }
23506
23507 jboolean  __attribute__((export_name("TS_WatchedOutput_eq"))) TS_WatchedOutput_eq(uint64_t a, uint64_t b) {
23508         LDKWatchedOutput a_conv;
23509         a_conv.inner = untag_ptr(a);
23510         a_conv.is_owned = ptr_is_owned(a);
23511         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23512         a_conv.is_owned = false;
23513         LDKWatchedOutput b_conv;
23514         b_conv.inner = untag_ptr(b);
23515         b_conv.is_owned = ptr_is_owned(b);
23516         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23517         b_conv.is_owned = false;
23518         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
23519         return ret_conv;
23520 }
23521
23522 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
23523         LDKWatchedOutput o_conv;
23524         o_conv.inner = untag_ptr(o);
23525         o_conv.is_owned = ptr_is_owned(o);
23526         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23527         o_conv.is_owned = false;
23528         int64_t ret_conv = WatchedOutput_hash(&o_conv);
23529         return ret_conv;
23530 }
23531
23532 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
23533         if (!ptr_is_owned(this_ptr)) return;
23534         void* this_ptr_ptr = untag_ptr(this_ptr);
23535         CHECK_ACCESS(this_ptr_ptr);
23536         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
23537         FREE(untag_ptr(this_ptr));
23538         BroadcasterInterface_free(this_ptr_conv);
23539 }
23540
23541 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
23542         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
23543         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
23544         return ret_conv;
23545 }
23546
23547 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
23548         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
23549         return ret_conv;
23550 }
23551
23552 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
23553         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
23554         return ret_conv;
23555 }
23556
23557 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
23558         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
23559         return ret_conv;
23560 }
23561
23562 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
23563         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
23564         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
23565         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
23566         return ret_conv;
23567 }
23568
23569 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
23570         if (!ptr_is_owned(this_ptr)) return;
23571         void* this_ptr_ptr = untag_ptr(this_ptr);
23572         CHECK_ACCESS(this_ptr_ptr);
23573         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
23574         FREE(untag_ptr(this_ptr));
23575         FeeEstimator_free(this_ptr_conv);
23576 }
23577
23578 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
23579         LDKMonitorUpdateId this_obj_conv;
23580         this_obj_conv.inner = untag_ptr(this_obj);
23581         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23583         MonitorUpdateId_free(this_obj_conv);
23584 }
23585
23586 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
23587         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
23588         uint64_t ret_ref = 0;
23589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23591         return ret_ref;
23592 }
23593 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
23594         LDKMonitorUpdateId arg_conv;
23595         arg_conv.inner = untag_ptr(arg);
23596         arg_conv.is_owned = ptr_is_owned(arg);
23597         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23598         arg_conv.is_owned = false;
23599         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
23600         return ret_conv;
23601 }
23602
23603 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
23604         LDKMonitorUpdateId orig_conv;
23605         orig_conv.inner = untag_ptr(orig);
23606         orig_conv.is_owned = ptr_is_owned(orig);
23607         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23608         orig_conv.is_owned = false;
23609         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
23610         uint64_t ret_ref = 0;
23611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23613         return ret_ref;
23614 }
23615
23616 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
23617         LDKMonitorUpdateId o_conv;
23618         o_conv.inner = untag_ptr(o);
23619         o_conv.is_owned = ptr_is_owned(o);
23620         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23621         o_conv.is_owned = false;
23622         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
23623         return ret_conv;
23624 }
23625
23626 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
23627         LDKMonitorUpdateId a_conv;
23628         a_conv.inner = untag_ptr(a);
23629         a_conv.is_owned = ptr_is_owned(a);
23630         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23631         a_conv.is_owned = false;
23632         LDKMonitorUpdateId b_conv;
23633         b_conv.inner = untag_ptr(b);
23634         b_conv.is_owned = ptr_is_owned(b);
23635         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23636         b_conv.is_owned = false;
23637         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
23638         return ret_conv;
23639 }
23640
23641 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
23642         if (!ptr_is_owned(this_ptr)) return;
23643         void* this_ptr_ptr = untag_ptr(this_ptr);
23644         CHECK_ACCESS(this_ptr_ptr);
23645         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
23646         FREE(untag_ptr(this_ptr));
23647         Persist_free(this_ptr_conv);
23648 }
23649
23650 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
23651         LDKLockedChannelMonitor this_obj_conv;
23652         this_obj_conv.inner = untag_ptr(this_obj);
23653         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23655         LockedChannelMonitor_free(this_obj_conv);
23656 }
23657
23658 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
23659         LDKChainMonitor this_obj_conv;
23660         this_obj_conv.inner = untag_ptr(this_obj);
23661         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23663         ChainMonitor_free(this_obj_conv);
23664 }
23665
23666 uint64_t  __attribute__((export_name("TS_ChainMonitor_new"))) TS_ChainMonitor_new(uint64_t chain_source, uint64_t broadcaster, uint64_t logger, uint64_t feeest, uint64_t persister) {
23667         void* chain_source_ptr = untag_ptr(chain_source);
23668         CHECK_ACCESS(chain_source_ptr);
23669         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
23670         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
23671         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
23672                 // Manually implement clone for Java trait instances
23673                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
23674                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23675                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
23676                 }
23677         }
23678         void* broadcaster_ptr = untag_ptr(broadcaster);
23679         CHECK_ACCESS(broadcaster_ptr);
23680         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23681         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23682                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23683                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23684         }
23685         void* logger_ptr = untag_ptr(logger);
23686         CHECK_ACCESS(logger_ptr);
23687         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23688         if (logger_conv.free == LDKLogger_JCalls_free) {
23689                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23690                 LDKLogger_JCalls_cloned(&logger_conv);
23691         }
23692         void* feeest_ptr = untag_ptr(feeest);
23693         CHECK_ACCESS(feeest_ptr);
23694         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
23695         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
23696                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23697                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
23698         }
23699         void* persister_ptr = untag_ptr(persister);
23700         CHECK_ACCESS(persister_ptr);
23701         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
23702         if (persister_conv.free == LDKPersist_JCalls_free) {
23703                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23704                 LDKPersist_JCalls_cloned(&persister_conv);
23705         }
23706         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
23707         uint64_t ret_ref = 0;
23708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23710         return ret_ref;
23711 }
23712
23713 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
23714         LDKChainMonitor this_arg_conv;
23715         this_arg_conv.inner = untag_ptr(this_arg);
23716         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23718         this_arg_conv.is_owned = false;
23719         LDKCVec_ChannelDetailsZ ignored_channels_constr;
23720         ignored_channels_constr.datalen = ignored_channels->arr_len;
23721         if (ignored_channels_constr.datalen > 0)
23722                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
23723         else
23724                 ignored_channels_constr.data = NULL;
23725         uint64_t* ignored_channels_vals = ignored_channels->elems;
23726         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
23727                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
23728                 LDKChannelDetails ignored_channels_conv_16_conv;
23729                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
23730                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
23731                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
23732                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
23733                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
23734         }
23735         FREE(ignored_channels);
23736         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
23737         uint64_tArray ret_arr = NULL;
23738         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
23739         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
23740         for (size_t j = 0; j < ret_var.datalen; j++) {
23741                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23742                 *ret_conv_9_copy = ret_var.data[j];
23743                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
23744                 ret_arr_ptr[j] = ret_conv_9_ref;
23745         }
23746         
23747         FREE(ret_var.data);
23748         return ret_arr;
23749 }
23750
23751 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
23752         LDKChainMonitor this_arg_conv;
23753         this_arg_conv.inner = untag_ptr(this_arg);
23754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23756         this_arg_conv.is_owned = false;
23757         LDKOutPoint funding_txo_conv;
23758         funding_txo_conv.inner = untag_ptr(funding_txo);
23759         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
23760         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
23761         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
23762         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
23763         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
23764         return tag_ptr(ret_conv, true);
23765 }
23766
23767 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
23768         LDKChainMonitor this_arg_conv;
23769         this_arg_conv.inner = untag_ptr(this_arg);
23770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23772         this_arg_conv.is_owned = false;
23773         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
23774         uint64_tArray ret_arr = NULL;
23775         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
23776         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
23777         for (size_t k = 0; k < ret_var.datalen; k++) {
23778                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
23779                 uint64_t ret_conv_10_ref = 0;
23780                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
23781                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
23782                 ret_arr_ptr[k] = ret_conv_10_ref;
23783         }
23784         
23785         FREE(ret_var.data);
23786         return ret_arr;
23787 }
23788
23789 uint64_t  __attribute__((export_name("TS_ChainMonitor_channel_monitor_updated"))) TS_ChainMonitor_channel_monitor_updated(uint64_t this_arg, uint64_t funding_txo, uint64_t completed_update_id) {
23790         LDKChainMonitor this_arg_conv;
23791         this_arg_conv.inner = untag_ptr(this_arg);
23792         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23794         this_arg_conv.is_owned = false;
23795         LDKOutPoint funding_txo_conv;
23796         funding_txo_conv.inner = untag_ptr(funding_txo);
23797         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
23798         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
23799         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
23800         LDKMonitorUpdateId completed_update_id_conv;
23801         completed_update_id_conv.inner = untag_ptr(completed_update_id);
23802         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
23803         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
23804         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
23805         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
23806         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
23807         return tag_ptr(ret_conv, true);
23808 }
23809
23810 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
23811         LDKChainMonitor this_arg_conv;
23812         this_arg_conv.inner = untag_ptr(this_arg);
23813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23815         this_arg_conv.is_owned = false;
23816         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
23817         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
23818         return tag_ptr(ret_ret, true);
23819 }
23820
23821 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
23822         LDKChainMonitor this_arg_conv;
23823         this_arg_conv.inner = untag_ptr(this_arg);
23824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23826         this_arg_conv.is_owned = false;
23827         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
23828         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
23829         return tag_ptr(ret_ret, true);
23830 }
23831
23832 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
23833         LDKChainMonitor this_arg_conv;
23834         this_arg_conv.inner = untag_ptr(this_arg);
23835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23837         this_arg_conv.is_owned = false;
23838         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
23839         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
23840         return tag_ptr(ret_ret, true);
23841 }
23842
23843 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
23844         LDKChainMonitor this_arg_conv;
23845         this_arg_conv.inner = untag_ptr(this_arg);
23846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23848         this_arg_conv.is_owned = false;
23849         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
23850         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
23851         return tag_ptr(ret_ret, true);
23852 }
23853
23854 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
23855         LDKChannelMonitorUpdate this_obj_conv;
23856         this_obj_conv.inner = untag_ptr(this_obj);
23857         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23859         ChannelMonitorUpdate_free(this_obj_conv);
23860 }
23861
23862 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
23863         LDKChannelMonitorUpdate this_ptr_conv;
23864         this_ptr_conv.inner = untag_ptr(this_ptr);
23865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23867         this_ptr_conv.is_owned = false;
23868         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
23869         return ret_conv;
23870 }
23871
23872 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
23873         LDKChannelMonitorUpdate this_ptr_conv;
23874         this_ptr_conv.inner = untag_ptr(this_ptr);
23875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23877         this_ptr_conv.is_owned = false;
23878         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
23879 }
23880
23881 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
23882         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
23883         uint64_t ret_ref = 0;
23884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23886         return ret_ref;
23887 }
23888 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
23889         LDKChannelMonitorUpdate arg_conv;
23890         arg_conv.inner = untag_ptr(arg);
23891         arg_conv.is_owned = ptr_is_owned(arg);
23892         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23893         arg_conv.is_owned = false;
23894         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
23895         return ret_conv;
23896 }
23897
23898 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
23899         LDKChannelMonitorUpdate orig_conv;
23900         orig_conv.inner = untag_ptr(orig);
23901         orig_conv.is_owned = ptr_is_owned(orig);
23902         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23903         orig_conv.is_owned = false;
23904         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
23905         uint64_t ret_ref = 0;
23906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23908         return ret_ref;
23909 }
23910
23911 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
23912         LDKChannelMonitorUpdate obj_conv;
23913         obj_conv.inner = untag_ptr(obj);
23914         obj_conv.is_owned = ptr_is_owned(obj);
23915         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23916         obj_conv.is_owned = false;
23917         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
23918         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23919         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23920         CVec_u8Z_free(ret_var);
23921         return ret_arr;
23922 }
23923
23924 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
23925         LDKu8slice ser_ref;
23926         ser_ref.datalen = ser->arr_len;
23927         ser_ref.data = ser->elems;
23928         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23929         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
23930         FREE(ser);
23931         return tag_ptr(ret_conv, true);
23932 }
23933
23934 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
23935         if (!ptr_is_owned(this_ptr)) return;
23936         void* this_ptr_ptr = untag_ptr(this_ptr);
23937         CHECK_ACCESS(this_ptr_ptr);
23938         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
23939         FREE(untag_ptr(this_ptr));
23940         MonitorEvent_free(this_ptr_conv);
23941 }
23942
23943 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
23944         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23945         *ret_copy = MonitorEvent_clone(arg);
23946         uint64_t ret_ref = tag_ptr(ret_copy, true);
23947         return ret_ref;
23948 }
23949 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
23950         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
23951         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
23952         return ret_conv;
23953 }
23954
23955 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
23956         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
23957         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23958         *ret_copy = MonitorEvent_clone(orig_conv);
23959         uint64_t ret_ref = tag_ptr(ret_copy, true);
23960         return ret_ref;
23961 }
23962
23963 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
23964         LDKHTLCUpdate a_conv;
23965         a_conv.inner = untag_ptr(a);
23966         a_conv.is_owned = ptr_is_owned(a);
23967         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23968         a_conv = HTLCUpdate_clone(&a_conv);
23969         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23970         *ret_copy = MonitorEvent_htlcevent(a_conv);
23971         uint64_t ret_ref = tag_ptr(ret_copy, true);
23972         return ret_ref;
23973 }
23974
23975 uint64_t  __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint64_t a) {
23976         LDKOutPoint a_conv;
23977         a_conv.inner = untag_ptr(a);
23978         a_conv.is_owned = ptr_is_owned(a);
23979         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23980         a_conv = OutPoint_clone(&a_conv);
23981         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23982         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
23983         uint64_t ret_ref = tag_ptr(ret_copy, true);
23984         return ret_ref;
23985 }
23986
23987 uint64_t  __attribute__((export_name("TS_MonitorEvent_completed"))) TS_MonitorEvent_completed(uint64_t funding_txo, int64_t monitor_update_id) {
23988         LDKOutPoint funding_txo_conv;
23989         funding_txo_conv.inner = untag_ptr(funding_txo);
23990         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
23991         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
23992         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
23993         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23994         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
23995         uint64_t ret_ref = tag_ptr(ret_copy, true);
23996         return ret_ref;
23997 }
23998
23999 uint64_t  __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint64_t a) {
24000         LDKOutPoint a_conv;
24001         a_conv.inner = untag_ptr(a);
24002         a_conv.is_owned = ptr_is_owned(a);
24003         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24004         a_conv = OutPoint_clone(&a_conv);
24005         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24006         *ret_copy = MonitorEvent_update_failed(a_conv);
24007         uint64_t ret_ref = tag_ptr(ret_copy, true);
24008         return ret_ref;
24009 }
24010
24011 jboolean  __attribute__((export_name("TS_MonitorEvent_eq"))) TS_MonitorEvent_eq(uint64_t a, uint64_t b) {
24012         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
24013         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
24014         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
24015         return ret_conv;
24016 }
24017
24018 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
24019         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
24020         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
24021         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24022         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24023         CVec_u8Z_free(ret_var);
24024         return ret_arr;
24025 }
24026
24027 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
24028         LDKu8slice ser_ref;
24029         ser_ref.datalen = ser->arr_len;
24030         ser_ref.data = ser->elems;
24031         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
24032         *ret_conv = MonitorEvent_read(ser_ref);
24033         FREE(ser);
24034         return tag_ptr(ret_conv, true);
24035 }
24036
24037 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
24038         LDKHTLCUpdate this_obj_conv;
24039         this_obj_conv.inner = untag_ptr(this_obj);
24040         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24042         HTLCUpdate_free(this_obj_conv);
24043 }
24044
24045 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
24046         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
24047         uint64_t ret_ref = 0;
24048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24050         return ret_ref;
24051 }
24052 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
24053         LDKHTLCUpdate arg_conv;
24054         arg_conv.inner = untag_ptr(arg);
24055         arg_conv.is_owned = ptr_is_owned(arg);
24056         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24057         arg_conv.is_owned = false;
24058         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
24059         return ret_conv;
24060 }
24061
24062 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
24063         LDKHTLCUpdate orig_conv;
24064         orig_conv.inner = untag_ptr(orig);
24065         orig_conv.is_owned = ptr_is_owned(orig);
24066         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24067         orig_conv.is_owned = false;
24068         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
24069         uint64_t ret_ref = 0;
24070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24072         return ret_ref;
24073 }
24074
24075 jboolean  __attribute__((export_name("TS_HTLCUpdate_eq"))) TS_HTLCUpdate_eq(uint64_t a, uint64_t b) {
24076         LDKHTLCUpdate a_conv;
24077         a_conv.inner = untag_ptr(a);
24078         a_conv.is_owned = ptr_is_owned(a);
24079         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24080         a_conv.is_owned = false;
24081         LDKHTLCUpdate b_conv;
24082         b_conv.inner = untag_ptr(b);
24083         b_conv.is_owned = ptr_is_owned(b);
24084         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24085         b_conv.is_owned = false;
24086         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
24087         return ret_conv;
24088 }
24089
24090 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
24091         LDKHTLCUpdate obj_conv;
24092         obj_conv.inner = untag_ptr(obj);
24093         obj_conv.is_owned = ptr_is_owned(obj);
24094         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24095         obj_conv.is_owned = false;
24096         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
24097         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24098         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24099         CVec_u8Z_free(ret_var);
24100         return ret_arr;
24101 }
24102
24103 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
24104         LDKu8slice ser_ref;
24105         ser_ref.datalen = ser->arr_len;
24106         ser_ref.data = ser->elems;
24107         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
24108         *ret_conv = HTLCUpdate_read(ser_ref);
24109         FREE(ser);
24110         return tag_ptr(ret_conv, true);
24111 }
24112
24113 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
24114         if (!ptr_is_owned(this_ptr)) return;
24115         void* this_ptr_ptr = untag_ptr(this_ptr);
24116         CHECK_ACCESS(this_ptr_ptr);
24117         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
24118         FREE(untag_ptr(this_ptr));
24119         Balance_free(this_ptr_conv);
24120 }
24121
24122 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
24123         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24124         *ret_copy = Balance_clone(arg);
24125         uint64_t ret_ref = tag_ptr(ret_copy, true);
24126         return ret_ref;
24127 }
24128 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
24129         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
24130         int64_t ret_conv = Balance_clone_ptr(arg_conv);
24131         return ret_conv;
24132 }
24133
24134 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
24135         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
24136         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24137         *ret_copy = Balance_clone(orig_conv);
24138         uint64_t ret_ref = tag_ptr(ret_copy, true);
24139         return ret_ref;
24140 }
24141
24142 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
24143         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24144         *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
24145         uint64_t ret_ref = tag_ptr(ret_copy, true);
24146         return ret_ref;
24147 }
24148
24149 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
24150         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24151         *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
24152         uint64_t ret_ref = tag_ptr(ret_copy, true);
24153         return ret_ref;
24154 }
24155
24156 uint64_t  __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
24157         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24158         *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
24159         uint64_t ret_ref = tag_ptr(ret_copy, true);
24160         return ret_ref;
24161 }
24162
24163 uint64_t  __attribute__((export_name("TS_Balance_maybe_timeout_claimable_htlc"))) TS_Balance_maybe_timeout_claimable_htlc(int64_t claimable_amount_satoshis, int32_t claimable_height) {
24164         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24165         *ret_copy = Balance_maybe_timeout_claimable_htlc(claimable_amount_satoshis, claimable_height);
24166         uint64_t ret_ref = tag_ptr(ret_copy, true);
24167         return ret_ref;
24168 }
24169
24170 uint64_t  __attribute__((export_name("TS_Balance_maybe_preimage_claimable_htlc"))) TS_Balance_maybe_preimage_claimable_htlc(int64_t claimable_amount_satoshis, int32_t expiry_height) {
24171         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24172         *ret_copy = Balance_maybe_preimage_claimable_htlc(claimable_amount_satoshis, expiry_height);
24173         uint64_t ret_ref = tag_ptr(ret_copy, true);
24174         return ret_ref;
24175 }
24176
24177 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t claimable_amount_satoshis) {
24178         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24179         *ret_copy = Balance_counterparty_revoked_output_claimable(claimable_amount_satoshis);
24180         uint64_t ret_ref = tag_ptr(ret_copy, true);
24181         return ret_ref;
24182 }
24183
24184 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
24185         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
24186         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
24187         jboolean ret_conv = Balance_eq(a_conv, b_conv);
24188         return ret_conv;
24189 }
24190
24191 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
24192         LDKChannelMonitor this_obj_conv;
24193         this_obj_conv.inner = untag_ptr(this_obj);
24194         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24196         ChannelMonitor_free(this_obj_conv);
24197 }
24198
24199 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
24200         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
24201         uint64_t ret_ref = 0;
24202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24204         return ret_ref;
24205 }
24206 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
24207         LDKChannelMonitor arg_conv;
24208         arg_conv.inner = untag_ptr(arg);
24209         arg_conv.is_owned = ptr_is_owned(arg);
24210         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24211         arg_conv.is_owned = false;
24212         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
24213         return ret_conv;
24214 }
24215
24216 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
24217         LDKChannelMonitor orig_conv;
24218         orig_conv.inner = untag_ptr(orig);
24219         orig_conv.is_owned = ptr_is_owned(orig);
24220         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24221         orig_conv.is_owned = false;
24222         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
24223         uint64_t ret_ref = 0;
24224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24226         return ret_ref;
24227 }
24228
24229 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
24230         LDKChannelMonitor obj_conv;
24231         obj_conv.inner = untag_ptr(obj);
24232         obj_conv.is_owned = ptr_is_owned(obj);
24233         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24234         obj_conv.is_owned = false;
24235         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
24236         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24237         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24238         CVec_u8Z_free(ret_var);
24239         return ret_arr;
24240 }
24241
24242 uint64_t  __attribute__((export_name("TS_ChannelMonitor_update_monitor"))) TS_ChannelMonitor_update_monitor(uint64_t this_arg, uint64_t updates, uint64_t broadcaster, uint64_t fee_estimator, uint64_t logger) {
24243         LDKChannelMonitor this_arg_conv;
24244         this_arg_conv.inner = untag_ptr(this_arg);
24245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24247         this_arg_conv.is_owned = false;
24248         LDKChannelMonitorUpdate updates_conv;
24249         updates_conv.inner = untag_ptr(updates);
24250         updates_conv.is_owned = ptr_is_owned(updates);
24251         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
24252         updates_conv.is_owned = false;
24253         void* broadcaster_ptr = untag_ptr(broadcaster);
24254         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
24255         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
24256         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24257         CHECK_ACCESS(fee_estimator_ptr);
24258         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24259         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24260                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24261                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24262         }
24263         void* logger_ptr = untag_ptr(logger);
24264         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
24265         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
24266         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
24267         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
24268         return tag_ptr(ret_conv, true);
24269 }
24270
24271 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
24272         LDKChannelMonitor this_arg_conv;
24273         this_arg_conv.inner = untag_ptr(this_arg);
24274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24276         this_arg_conv.is_owned = false;
24277         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
24278         return ret_conv;
24279 }
24280
24281 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
24282         LDKChannelMonitor this_arg_conv;
24283         this_arg_conv.inner = untag_ptr(this_arg);
24284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24286         this_arg_conv.is_owned = false;
24287         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
24288         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
24289         return tag_ptr(ret_conv, true);
24290 }
24291
24292 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
24293         LDKChannelMonitor this_arg_conv;
24294         this_arg_conv.inner = untag_ptr(this_arg);
24295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24297         this_arg_conv.is_owned = false;
24298         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
24299         uint64_tArray ret_arr = NULL;
24300         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24301         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24302         for (size_t o = 0; o < ret_var.datalen; o++) {
24303                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
24304                 *ret_conv_40_conv = ret_var.data[o];
24305                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
24306         }
24307         
24308         FREE(ret_var.data);
24309         return ret_arr;
24310 }
24311
24312 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter) {
24313         LDKChannelMonitor this_arg_conv;
24314         this_arg_conv.inner = untag_ptr(this_arg);
24315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24317         this_arg_conv.is_owned = false;
24318         void* filter_ptr = untag_ptr(filter);
24319         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
24320         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
24321         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
24322 }
24323
24324 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_monitor_events"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint64_t this_arg) {
24325         LDKChannelMonitor this_arg_conv;
24326         this_arg_conv.inner = untag_ptr(this_arg);
24327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24329         this_arg_conv.is_owned = false;
24330         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
24331         uint64_tArray ret_arr = NULL;
24332         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24333         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24334         for (size_t o = 0; o < ret_var.datalen; o++) {
24335                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24336                 *ret_conv_14_copy = ret_var.data[o];
24337                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
24338                 ret_arr_ptr[o] = ret_conv_14_ref;
24339         }
24340         
24341         FREE(ret_var.data);
24342         return ret_arr;
24343 }
24344
24345 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint64_t this_arg) {
24346         LDKChannelMonitor this_arg_conv;
24347         this_arg_conv.inner = untag_ptr(this_arg);
24348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24350         this_arg_conv.is_owned = false;
24351         LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
24352         uint64_tArray ret_arr = NULL;
24353         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24354         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24355         for (size_t h = 0; h < ret_var.datalen; h++) {
24356                 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24357                 *ret_conv_7_copy = ret_var.data[h];
24358                 uint64_t ret_conv_7_ref = tag_ptr(ret_conv_7_copy, true);
24359                 ret_arr_ptr[h] = ret_conv_7_ref;
24360         }
24361         
24362         FREE(ret_var.data);
24363         return ret_arr;
24364 }
24365
24366 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
24367         LDKChannelMonitor this_arg_conv;
24368         this_arg_conv.inner = untag_ptr(this_arg);
24369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24371         this_arg_conv.is_owned = false;
24372         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
24373         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
24374         return ret_arr;
24375 }
24376
24377 ptrArray  __attribute__((export_name("TS_ChannelMonitor_get_latest_holder_commitment_txn"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint64_t this_arg, uint64_t logger) {
24378         LDKChannelMonitor this_arg_conv;
24379         this_arg_conv.inner = untag_ptr(this_arg);
24380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24382         this_arg_conv.is_owned = false;
24383         void* logger_ptr = untag_ptr(logger);
24384         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
24385         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
24386         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
24387         ptrArray ret_arr = NULL;
24388         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
24389         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
24390         for (size_t m = 0; m < ret_var.datalen; m++) {
24391                 LDKTransaction ret_conv_12_var = ret_var.data[m];
24392                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
24393                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
24394                 Transaction_free(ret_conv_12_var);
24395                 ret_arr_ptr[m] = ret_conv_12_arr;
24396         }
24397         
24398         FREE(ret_var.data);
24399         return ret_arr;
24400 }
24401
24402 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_block_connected"))) TS_ChannelMonitor_block_connected(uint64_t this_arg, int8_tArray header, uint64_tArray txdata, int32_t height, uint64_t broadcaster, uint64_t fee_estimator, uint64_t logger) {
24403         LDKChannelMonitor this_arg_conv;
24404         this_arg_conv.inner = untag_ptr(this_arg);
24405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24407         this_arg_conv.is_owned = false;
24408         unsigned char header_arr[80];
24409         CHECK(header->arr_len == 80);
24410         memcpy(header_arr, header->elems, 80); FREE(header);
24411         unsigned char (*header_ref)[80] = &header_arr;
24412         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
24413         txdata_constr.datalen = txdata->arr_len;
24414         if (txdata_constr.datalen > 0)
24415                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
24416         else
24417                 txdata_constr.data = NULL;
24418         uint64_t* txdata_vals = txdata->elems;
24419         for (size_t c = 0; c < txdata_constr.datalen; c++) {
24420                 uint64_t txdata_conv_28 = txdata_vals[c];
24421                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
24422                 CHECK_ACCESS(txdata_conv_28_ptr);
24423                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
24424                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
24425                 txdata_constr.data[c] = txdata_conv_28_conv;
24426         }
24427         FREE(txdata);
24428         void* broadcaster_ptr = untag_ptr(broadcaster);
24429         CHECK_ACCESS(broadcaster_ptr);
24430         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24431         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24432                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24433                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24434         }
24435         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24436         CHECK_ACCESS(fee_estimator_ptr);
24437         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24438         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24439                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24440                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24441         }
24442         void* logger_ptr = untag_ptr(logger);
24443         CHECK_ACCESS(logger_ptr);
24444         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24445         if (logger_conv.free == LDKLogger_JCalls_free) {
24446                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24447                 LDKLogger_JCalls_cloned(&logger_conv);
24448         }
24449         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);
24450         uint64_tArray ret_arr = NULL;
24451         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24452         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24453         for (size_t n = 0; n < ret_var.datalen; n++) {
24454                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
24455                 *ret_conv_39_conv = ret_var.data[n];
24456                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
24457         }
24458         
24459         FREE(ret_var.data);
24460         return ret_arr;
24461 }
24462
24463 void  __attribute__((export_name("TS_ChannelMonitor_block_disconnected"))) TS_ChannelMonitor_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height, uint64_t broadcaster, uint64_t fee_estimator, uint64_t logger) {
24464         LDKChannelMonitor this_arg_conv;
24465         this_arg_conv.inner = untag_ptr(this_arg);
24466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24468         this_arg_conv.is_owned = false;
24469         unsigned char header_arr[80];
24470         CHECK(header->arr_len == 80);
24471         memcpy(header_arr, header->elems, 80); FREE(header);
24472         unsigned char (*header_ref)[80] = &header_arr;
24473         void* broadcaster_ptr = untag_ptr(broadcaster);
24474         CHECK_ACCESS(broadcaster_ptr);
24475         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24476         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24477                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24478                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24479         }
24480         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24481         CHECK_ACCESS(fee_estimator_ptr);
24482         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24483         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24484                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24485                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24486         }
24487         void* logger_ptr = untag_ptr(logger);
24488         CHECK_ACCESS(logger_ptr);
24489         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24490         if (logger_conv.free == LDKLogger_JCalls_free) {
24491                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24492                 LDKLogger_JCalls_cloned(&logger_conv);
24493         }
24494         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
24495 }
24496
24497 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_transactions_confirmed"))) TS_ChannelMonitor_transactions_confirmed(uint64_t this_arg, int8_tArray header, uint64_tArray txdata, int32_t height, uint64_t broadcaster, uint64_t fee_estimator, uint64_t logger) {
24498         LDKChannelMonitor this_arg_conv;
24499         this_arg_conv.inner = untag_ptr(this_arg);
24500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24502         this_arg_conv.is_owned = false;
24503         unsigned char header_arr[80];
24504         CHECK(header->arr_len == 80);
24505         memcpy(header_arr, header->elems, 80); FREE(header);
24506         unsigned char (*header_ref)[80] = &header_arr;
24507         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
24508         txdata_constr.datalen = txdata->arr_len;
24509         if (txdata_constr.datalen > 0)
24510                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
24511         else
24512                 txdata_constr.data = NULL;
24513         uint64_t* txdata_vals = txdata->elems;
24514         for (size_t c = 0; c < txdata_constr.datalen; c++) {
24515                 uint64_t txdata_conv_28 = txdata_vals[c];
24516                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
24517                 CHECK_ACCESS(txdata_conv_28_ptr);
24518                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
24519                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
24520                 txdata_constr.data[c] = txdata_conv_28_conv;
24521         }
24522         FREE(txdata);
24523         void* broadcaster_ptr = untag_ptr(broadcaster);
24524         CHECK_ACCESS(broadcaster_ptr);
24525         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24526         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24527                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24528                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24529         }
24530         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24531         CHECK_ACCESS(fee_estimator_ptr);
24532         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24533         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24534                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24535                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24536         }
24537         void* logger_ptr = untag_ptr(logger);
24538         CHECK_ACCESS(logger_ptr);
24539         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24540         if (logger_conv.free == LDKLogger_JCalls_free) {
24541                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24542                 LDKLogger_JCalls_cloned(&logger_conv);
24543         }
24544         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_transactions_confirmed(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
24545         uint64_tArray ret_arr = NULL;
24546         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24547         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24548         for (size_t n = 0; n < ret_var.datalen; n++) {
24549                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
24550                 *ret_conv_39_conv = ret_var.data[n];
24551                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
24552         }
24553         
24554         FREE(ret_var.data);
24555         return ret_arr;
24556 }
24557
24558 void  __attribute__((export_name("TS_ChannelMonitor_transaction_unconfirmed"))) TS_ChannelMonitor_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid, uint64_t broadcaster, uint64_t fee_estimator, uint64_t logger) {
24559         LDKChannelMonitor this_arg_conv;
24560         this_arg_conv.inner = untag_ptr(this_arg);
24561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24563         this_arg_conv.is_owned = false;
24564         unsigned char txid_arr[32];
24565         CHECK(txid->arr_len == 32);
24566         memcpy(txid_arr, txid->elems, 32); FREE(txid);
24567         unsigned char (*txid_ref)[32] = &txid_arr;
24568         void* broadcaster_ptr = untag_ptr(broadcaster);
24569         CHECK_ACCESS(broadcaster_ptr);
24570         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24571         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24572                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24573                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24574         }
24575         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24576         CHECK_ACCESS(fee_estimator_ptr);
24577         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24578         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24579                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24580                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24581         }
24582         void* logger_ptr = untag_ptr(logger);
24583         CHECK_ACCESS(logger_ptr);
24584         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24585         if (logger_conv.free == LDKLogger_JCalls_free) {
24586                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24587                 LDKLogger_JCalls_cloned(&logger_conv);
24588         }
24589         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
24590 }
24591
24592 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_best_block_updated"))) TS_ChannelMonitor_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height, uint64_t broadcaster, uint64_t fee_estimator, uint64_t logger) {
24593         LDKChannelMonitor this_arg_conv;
24594         this_arg_conv.inner = untag_ptr(this_arg);
24595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24597         this_arg_conv.is_owned = false;
24598         unsigned char header_arr[80];
24599         CHECK(header->arr_len == 80);
24600         memcpy(header_arr, header->elems, 80); FREE(header);
24601         unsigned char (*header_ref)[80] = &header_arr;
24602         void* broadcaster_ptr = untag_ptr(broadcaster);
24603         CHECK_ACCESS(broadcaster_ptr);
24604         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24605         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24606                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24607                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24608         }
24609         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24610         CHECK_ACCESS(fee_estimator_ptr);
24611         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24612         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24613                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24614                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24615         }
24616         void* logger_ptr = untag_ptr(logger);
24617         CHECK_ACCESS(logger_ptr);
24618         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24619         if (logger_conv.free == LDKLogger_JCalls_free) {
24620                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24621                 LDKLogger_JCalls_cloned(&logger_conv);
24622         }
24623         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
24624         uint64_tArray ret_arr = NULL;
24625         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24626         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24627         for (size_t n = 0; n < ret_var.datalen; n++) {
24628                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
24629                 *ret_conv_39_conv = ret_var.data[n];
24630                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
24631         }
24632         
24633         FREE(ret_var.data);
24634         return ret_arr;
24635 }
24636
24637 ptrArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
24638         LDKChannelMonitor this_arg_conv;
24639         this_arg_conv.inner = untag_ptr(this_arg);
24640         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24642         this_arg_conv.is_owned = false;
24643         LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
24644         ptrArray ret_arr = NULL;
24645         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
24646         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
24647         for (size_t m = 0; m < ret_var.datalen; m++) {
24648                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
24649                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
24650                 ret_arr_ptr[m] = ret_conv_12_arr;
24651         }
24652         
24653         FREE(ret_var.data);
24654         return ret_arr;
24655 }
24656
24657 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
24658         LDKChannelMonitor this_arg_conv;
24659         this_arg_conv.inner = untag_ptr(this_arg);
24660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24662         this_arg_conv.is_owned = false;
24663         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
24664         uint64_t ret_ref = 0;
24665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24667         return ret_ref;
24668 }
24669
24670 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
24671         LDKChannelMonitor this_arg_conv;
24672         this_arg_conv.inner = untag_ptr(this_arg);
24673         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24675         this_arg_conv.is_owned = false;
24676         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
24677         uint64_tArray ret_arr = NULL;
24678         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24679         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24680         for (size_t j = 0; j < ret_var.datalen; j++) {
24681                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24682                 *ret_conv_9_copy = ret_var.data[j];
24683                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
24684                 ret_arr_ptr[j] = ret_conv_9_ref;
24685         }
24686         
24687         FREE(ret_var.data);
24688         return ret_arr;
24689 }
24690
24691 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint64_t arg) {
24692         LDKu8slice ser_ref;
24693         ser_ref.datalen = ser->arr_len;
24694         ser_ref.data = ser->elems;
24695         void* arg_ptr = untag_ptr(arg);
24696         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
24697         LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
24698         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
24699         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
24700         FREE(ser);
24701         return tag_ptr(ret_conv, true);
24702 }
24703
24704 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
24705         LDKOutPoint this_obj_conv;
24706         this_obj_conv.inner = untag_ptr(this_obj);
24707         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24709         OutPoint_free(this_obj_conv);
24710 }
24711
24712 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
24713         LDKOutPoint this_ptr_conv;
24714         this_ptr_conv.inner = untag_ptr(this_ptr);
24715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24717         this_ptr_conv.is_owned = false;
24718         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24719         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
24720         return ret_arr;
24721 }
24722
24723 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
24724         LDKOutPoint this_ptr_conv;
24725         this_ptr_conv.inner = untag_ptr(this_ptr);
24726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24728         this_ptr_conv.is_owned = false;
24729         LDKThirtyTwoBytes val_ref;
24730         CHECK(val->arr_len == 32);
24731         memcpy(val_ref.data, val->elems, 32); FREE(val);
24732         OutPoint_set_txid(&this_ptr_conv, val_ref);
24733 }
24734
24735 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
24736         LDKOutPoint this_ptr_conv;
24737         this_ptr_conv.inner = untag_ptr(this_ptr);
24738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24740         this_ptr_conv.is_owned = false;
24741         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
24742         return ret_conv;
24743 }
24744
24745 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
24746         LDKOutPoint this_ptr_conv;
24747         this_ptr_conv.inner = untag_ptr(this_ptr);
24748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24750         this_ptr_conv.is_owned = false;
24751         OutPoint_set_index(&this_ptr_conv, val);
24752 }
24753
24754 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
24755         LDKThirtyTwoBytes txid_arg_ref;
24756         CHECK(txid_arg->arr_len == 32);
24757         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
24758         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
24759         uint64_t ret_ref = 0;
24760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24762         return ret_ref;
24763 }
24764
24765 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
24766         LDKOutPoint ret_var = OutPoint_clone(arg);
24767         uint64_t ret_ref = 0;
24768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24770         return ret_ref;
24771 }
24772 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
24773         LDKOutPoint arg_conv;
24774         arg_conv.inner = untag_ptr(arg);
24775         arg_conv.is_owned = ptr_is_owned(arg);
24776         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24777         arg_conv.is_owned = false;
24778         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
24779         return ret_conv;
24780 }
24781
24782 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
24783         LDKOutPoint orig_conv;
24784         orig_conv.inner = untag_ptr(orig);
24785         orig_conv.is_owned = ptr_is_owned(orig);
24786         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24787         orig_conv.is_owned = false;
24788         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
24789         uint64_t ret_ref = 0;
24790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24792         return ret_ref;
24793 }
24794
24795 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
24796         LDKOutPoint a_conv;
24797         a_conv.inner = untag_ptr(a);
24798         a_conv.is_owned = ptr_is_owned(a);
24799         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24800         a_conv.is_owned = false;
24801         LDKOutPoint b_conv;
24802         b_conv.inner = untag_ptr(b);
24803         b_conv.is_owned = ptr_is_owned(b);
24804         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24805         b_conv.is_owned = false;
24806         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
24807         return ret_conv;
24808 }
24809
24810 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
24811         LDKOutPoint o_conv;
24812         o_conv.inner = untag_ptr(o);
24813         o_conv.is_owned = ptr_is_owned(o);
24814         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24815         o_conv.is_owned = false;
24816         int64_t ret_conv = OutPoint_hash(&o_conv);
24817         return ret_conv;
24818 }
24819
24820 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
24821         LDKOutPoint this_arg_conv;
24822         this_arg_conv.inner = untag_ptr(this_arg);
24823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24825         this_arg_conv.is_owned = false;
24826         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24827         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
24828         return ret_arr;
24829 }
24830
24831 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
24832         LDKOutPoint obj_conv;
24833         obj_conv.inner = untag_ptr(obj);
24834         obj_conv.is_owned = ptr_is_owned(obj);
24835         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24836         obj_conv.is_owned = false;
24837         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
24838         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24839         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24840         CVec_u8Z_free(ret_var);
24841         return ret_arr;
24842 }
24843
24844 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
24845         LDKu8slice ser_ref;
24846         ser_ref.datalen = ser->arr_len;
24847         ser_ref.data = ser->elems;
24848         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
24849         *ret_conv = OutPoint_read(ser_ref);
24850         FREE(ser);
24851         return tag_ptr(ret_conv, true);
24852 }
24853
24854 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
24855         LDKDelayedPaymentOutputDescriptor this_obj_conv;
24856         this_obj_conv.inner = untag_ptr(this_obj);
24857         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24859         DelayedPaymentOutputDescriptor_free(this_obj_conv);
24860 }
24861
24862 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
24863         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24864         this_ptr_conv.inner = untag_ptr(this_ptr);
24865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24867         this_ptr_conv.is_owned = false;
24868         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
24869         uint64_t ret_ref = 0;
24870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24872         return ret_ref;
24873 }
24874
24875 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
24876         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24877         this_ptr_conv.inner = untag_ptr(this_ptr);
24878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24880         this_ptr_conv.is_owned = false;
24881         LDKOutPoint val_conv;
24882         val_conv.inner = untag_ptr(val);
24883         val_conv.is_owned = ptr_is_owned(val);
24884         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24885         val_conv = OutPoint_clone(&val_conv);
24886         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
24887 }
24888
24889 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
24890         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24891         this_ptr_conv.inner = untag_ptr(this_ptr);
24892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24894         this_ptr_conv.is_owned = false;
24895         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
24896         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
24897         return ret_arr;
24898 }
24899
24900 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
24901         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24902         this_ptr_conv.inner = untag_ptr(this_ptr);
24903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24905         this_ptr_conv.is_owned = false;
24906         LDKPublicKey val_ref;
24907         CHECK(val->arr_len == 33);
24908         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
24909         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
24910 }
24911
24912 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
24913         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24914         this_ptr_conv.inner = untag_ptr(this_ptr);
24915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24917         this_ptr_conv.is_owned = false;
24918         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
24919         return ret_conv;
24920 }
24921
24922 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
24923         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24924         this_ptr_conv.inner = untag_ptr(this_ptr);
24925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24927         this_ptr_conv.is_owned = false;
24928         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
24929 }
24930
24931 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
24932         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24933         this_ptr_conv.inner = untag_ptr(this_ptr);
24934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24936         this_ptr_conv.is_owned = false;
24937         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
24938         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
24939         return tag_ptr(ret_ref, true);
24940 }
24941
24942 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
24943         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24944         this_ptr_conv.inner = untag_ptr(this_ptr);
24945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24947         this_ptr_conv.is_owned = false;
24948         void* val_ptr = untag_ptr(val);
24949         CHECK_ACCESS(val_ptr);
24950         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
24951         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
24952         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
24953 }
24954
24955 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
24956         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24957         this_ptr_conv.inner = untag_ptr(this_ptr);
24958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24960         this_ptr_conv.is_owned = false;
24961         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
24962         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
24963         return ret_arr;
24964 }
24965
24966 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, int8_tArray val) {
24967         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24968         this_ptr_conv.inner = untag_ptr(this_ptr);
24969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24971         this_ptr_conv.is_owned = false;
24972         LDKPublicKey val_ref;
24973         CHECK(val->arr_len == 33);
24974         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
24975         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
24976 }
24977
24978 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
24979         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24980         this_ptr_conv.inner = untag_ptr(this_ptr);
24981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24983         this_ptr_conv.is_owned = false;
24984         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24985         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
24986         return ret_arr;
24987 }
24988
24989 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
24990         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24991         this_ptr_conv.inner = untag_ptr(this_ptr);
24992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24994         this_ptr_conv.is_owned = false;
24995         LDKThirtyTwoBytes val_ref;
24996         CHECK(val->arr_len == 32);
24997         memcpy(val_ref.data, val->elems, 32); FREE(val);
24998         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
24999 }
25000
25001 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
25002         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25003         this_ptr_conv.inner = untag_ptr(this_ptr);
25004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25006         this_ptr_conv.is_owned = false;
25007         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
25008         return ret_conv;
25009 }
25010
25011 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
25012         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25013         this_ptr_conv.inner = untag_ptr(this_ptr);
25014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25016         this_ptr_conv.is_owned = false;
25017         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
25018 }
25019
25020 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_new"))) TS_DelayedPaymentOutputDescriptor_new(uint64_t outpoint_arg, int8_tArray per_commitment_point_arg, int16_t to_self_delay_arg, uint64_t output_arg, int8_tArray revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
25021         LDKOutPoint outpoint_arg_conv;
25022         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
25023         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
25024         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
25025         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
25026         LDKPublicKey per_commitment_point_arg_ref;
25027         CHECK(per_commitment_point_arg->arr_len == 33);
25028         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
25029         void* output_arg_ptr = untag_ptr(output_arg);
25030         CHECK_ACCESS(output_arg_ptr);
25031         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
25032         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
25033         LDKPublicKey revocation_pubkey_arg_ref;
25034         CHECK(revocation_pubkey_arg->arr_len == 33);
25035         memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
25036         LDKThirtyTwoBytes channel_keys_id_arg_ref;
25037         CHECK(channel_keys_id_arg->arr_len == 32);
25038         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
25039         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);
25040         uint64_t ret_ref = 0;
25041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25043         return ret_ref;
25044 }
25045
25046 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
25047         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
25048         uint64_t ret_ref = 0;
25049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25051         return ret_ref;
25052 }
25053 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
25054         LDKDelayedPaymentOutputDescriptor arg_conv;
25055         arg_conv.inner = untag_ptr(arg);
25056         arg_conv.is_owned = ptr_is_owned(arg);
25057         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25058         arg_conv.is_owned = false;
25059         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
25060         return ret_conv;
25061 }
25062
25063 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
25064         LDKDelayedPaymentOutputDescriptor orig_conv;
25065         orig_conv.inner = untag_ptr(orig);
25066         orig_conv.is_owned = ptr_is_owned(orig);
25067         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25068         orig_conv.is_owned = false;
25069         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
25070         uint64_t ret_ref = 0;
25071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25073         return ret_ref;
25074 }
25075
25076 jboolean  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_eq"))) TS_DelayedPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
25077         LDKDelayedPaymentOutputDescriptor a_conv;
25078         a_conv.inner = untag_ptr(a);
25079         a_conv.is_owned = ptr_is_owned(a);
25080         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25081         a_conv.is_owned = false;
25082         LDKDelayedPaymentOutputDescriptor b_conv;
25083         b_conv.inner = untag_ptr(b);
25084         b_conv.is_owned = ptr_is_owned(b);
25085         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25086         b_conv.is_owned = false;
25087         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
25088         return ret_conv;
25089 }
25090
25091 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
25092         LDKDelayedPaymentOutputDescriptor obj_conv;
25093         obj_conv.inner = untag_ptr(obj);
25094         obj_conv.is_owned = ptr_is_owned(obj);
25095         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25096         obj_conv.is_owned = false;
25097         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
25098         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25099         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25100         CVec_u8Z_free(ret_var);
25101         return ret_arr;
25102 }
25103
25104 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
25105         LDKu8slice ser_ref;
25106         ser_ref.datalen = ser->arr_len;
25107         ser_ref.data = ser->elems;
25108         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
25109         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
25110         FREE(ser);
25111         return tag_ptr(ret_conv, true);
25112 }
25113
25114 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
25115         LDKStaticPaymentOutputDescriptor this_obj_conv;
25116         this_obj_conv.inner = untag_ptr(this_obj);
25117         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25119         StaticPaymentOutputDescriptor_free(this_obj_conv);
25120 }
25121
25122 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
25123         LDKStaticPaymentOutputDescriptor this_ptr_conv;
25124         this_ptr_conv.inner = untag_ptr(this_ptr);
25125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25127         this_ptr_conv.is_owned = false;
25128         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
25129         uint64_t ret_ref = 0;
25130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25132         return ret_ref;
25133 }
25134
25135 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
25136         LDKStaticPaymentOutputDescriptor this_ptr_conv;
25137         this_ptr_conv.inner = untag_ptr(this_ptr);
25138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25140         this_ptr_conv.is_owned = false;
25141         LDKOutPoint val_conv;
25142         val_conv.inner = untag_ptr(val);
25143         val_conv.is_owned = ptr_is_owned(val);
25144         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25145         val_conv = OutPoint_clone(&val_conv);
25146         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
25147 }
25148
25149 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
25150         LDKStaticPaymentOutputDescriptor this_ptr_conv;
25151         this_ptr_conv.inner = untag_ptr(this_ptr);
25152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25154         this_ptr_conv.is_owned = false;
25155         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
25156         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
25157         return tag_ptr(ret_ref, true);
25158 }
25159
25160 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
25161         LDKStaticPaymentOutputDescriptor this_ptr_conv;
25162         this_ptr_conv.inner = untag_ptr(this_ptr);
25163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25165         this_ptr_conv.is_owned = false;
25166         void* val_ptr = untag_ptr(val);
25167         CHECK_ACCESS(val_ptr);
25168         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
25169         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
25170         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
25171 }
25172
25173 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
25174         LDKStaticPaymentOutputDescriptor this_ptr_conv;
25175         this_ptr_conv.inner = untag_ptr(this_ptr);
25176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25178         this_ptr_conv.is_owned = false;
25179         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25180         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
25181         return ret_arr;
25182 }
25183
25184 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
25185         LDKStaticPaymentOutputDescriptor this_ptr_conv;
25186         this_ptr_conv.inner = untag_ptr(this_ptr);
25187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25189         this_ptr_conv.is_owned = false;
25190         LDKThirtyTwoBytes val_ref;
25191         CHECK(val->arr_len == 32);
25192         memcpy(val_ref.data, val->elems, 32); FREE(val);
25193         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
25194 }
25195
25196 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
25197         LDKStaticPaymentOutputDescriptor this_ptr_conv;
25198         this_ptr_conv.inner = untag_ptr(this_ptr);
25199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25201         this_ptr_conv.is_owned = false;
25202         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
25203         return ret_conv;
25204 }
25205
25206 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
25207         LDKStaticPaymentOutputDescriptor this_ptr_conv;
25208         this_ptr_conv.inner = untag_ptr(this_ptr);
25209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25211         this_ptr_conv.is_owned = false;
25212         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
25213 }
25214
25215 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_new"))) TS_StaticPaymentOutputDescriptor_new(uint64_t outpoint_arg, uint64_t output_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
25216         LDKOutPoint outpoint_arg_conv;
25217         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
25218         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
25219         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
25220         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
25221         void* output_arg_ptr = untag_ptr(output_arg);
25222         CHECK_ACCESS(output_arg_ptr);
25223         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
25224         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
25225         LDKThirtyTwoBytes channel_keys_id_arg_ref;
25226         CHECK(channel_keys_id_arg->arr_len == 32);
25227         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
25228         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
25229         uint64_t ret_ref = 0;
25230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25232         return ret_ref;
25233 }
25234
25235 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
25236         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
25237         uint64_t ret_ref = 0;
25238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25240         return ret_ref;
25241 }
25242 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
25243         LDKStaticPaymentOutputDescriptor arg_conv;
25244         arg_conv.inner = untag_ptr(arg);
25245         arg_conv.is_owned = ptr_is_owned(arg);
25246         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25247         arg_conv.is_owned = false;
25248         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
25249         return ret_conv;
25250 }
25251
25252 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
25253         LDKStaticPaymentOutputDescriptor orig_conv;
25254         orig_conv.inner = untag_ptr(orig);
25255         orig_conv.is_owned = ptr_is_owned(orig);
25256         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25257         orig_conv.is_owned = false;
25258         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
25259         uint64_t ret_ref = 0;
25260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25262         return ret_ref;
25263 }
25264
25265 jboolean  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_eq"))) TS_StaticPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
25266         LDKStaticPaymentOutputDescriptor a_conv;
25267         a_conv.inner = untag_ptr(a);
25268         a_conv.is_owned = ptr_is_owned(a);
25269         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25270         a_conv.is_owned = false;
25271         LDKStaticPaymentOutputDescriptor b_conv;
25272         b_conv.inner = untag_ptr(b);
25273         b_conv.is_owned = ptr_is_owned(b);
25274         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25275         b_conv.is_owned = false;
25276         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
25277         return ret_conv;
25278 }
25279
25280 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
25281         LDKStaticPaymentOutputDescriptor obj_conv;
25282         obj_conv.inner = untag_ptr(obj);
25283         obj_conv.is_owned = ptr_is_owned(obj);
25284         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25285         obj_conv.is_owned = false;
25286         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
25287         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25288         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25289         CVec_u8Z_free(ret_var);
25290         return ret_arr;
25291 }
25292
25293 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
25294         LDKu8slice ser_ref;
25295         ser_ref.datalen = ser->arr_len;
25296         ser_ref.data = ser->elems;
25297         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
25298         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
25299         FREE(ser);
25300         return tag_ptr(ret_conv, true);
25301 }
25302
25303 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
25304         if (!ptr_is_owned(this_ptr)) return;
25305         void* this_ptr_ptr = untag_ptr(this_ptr);
25306         CHECK_ACCESS(this_ptr_ptr);
25307         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
25308         FREE(untag_ptr(this_ptr));
25309         SpendableOutputDescriptor_free(this_ptr_conv);
25310 }
25311
25312 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
25313         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25314         *ret_copy = SpendableOutputDescriptor_clone(arg);
25315         uint64_t ret_ref = tag_ptr(ret_copy, true);
25316         return ret_ref;
25317 }
25318 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
25319         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
25320         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
25321         return ret_conv;
25322 }
25323
25324 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
25325         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
25326         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25327         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
25328         uint64_t ret_ref = tag_ptr(ret_copy, true);
25329         return ret_ref;
25330 }
25331
25332 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output) {
25333         LDKOutPoint outpoint_conv;
25334         outpoint_conv.inner = untag_ptr(outpoint);
25335         outpoint_conv.is_owned = ptr_is_owned(outpoint);
25336         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
25337         outpoint_conv = OutPoint_clone(&outpoint_conv);
25338         void* output_ptr = untag_ptr(output);
25339         CHECK_ACCESS(output_ptr);
25340         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
25341         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
25342         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25343         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
25344         uint64_t ret_ref = tag_ptr(ret_copy, true);
25345         return ret_ref;
25346 }
25347
25348 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
25349         LDKDelayedPaymentOutputDescriptor a_conv;
25350         a_conv.inner = untag_ptr(a);
25351         a_conv.is_owned = ptr_is_owned(a);
25352         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25353         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
25354         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25355         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
25356         uint64_t ret_ref = tag_ptr(ret_copy, true);
25357         return ret_ref;
25358 }
25359
25360 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
25361         LDKStaticPaymentOutputDescriptor a_conv;
25362         a_conv.inner = untag_ptr(a);
25363         a_conv.is_owned = ptr_is_owned(a);
25364         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25365         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
25366         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25367         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
25368         uint64_t ret_ref = tag_ptr(ret_copy, true);
25369         return ret_ref;
25370 }
25371
25372 jboolean  __attribute__((export_name("TS_SpendableOutputDescriptor_eq"))) TS_SpendableOutputDescriptor_eq(uint64_t a, uint64_t b) {
25373         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
25374         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
25375         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
25376         return ret_conv;
25377 }
25378
25379 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
25380         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
25381         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
25382         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25383         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25384         CVec_u8Z_free(ret_var);
25385         return ret_arr;
25386 }
25387
25388 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
25389         LDKu8slice ser_ref;
25390         ser_ref.datalen = ser->arr_len;
25391         ser_ref.data = ser->elems;
25392         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
25393         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
25394         FREE(ser);
25395         return tag_ptr(ret_conv, true);
25396 }
25397
25398 void  __attribute__((export_name("TS_BaseSign_free"))) TS_BaseSign_free(uint64_t this_ptr) {
25399         if (!ptr_is_owned(this_ptr)) return;
25400         void* this_ptr_ptr = untag_ptr(this_ptr);
25401         CHECK_ACCESS(this_ptr_ptr);
25402         LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
25403         FREE(untag_ptr(this_ptr));
25404         BaseSign_free(this_ptr_conv);
25405 }
25406
25407 static inline uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
25408         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
25409         *ret_ret = Sign_clone(arg);
25410         return tag_ptr(ret_ret, true);
25411 }
25412 int64_t  __attribute__((export_name("TS_Sign_clone_ptr"))) TS_Sign_clone_ptr(uint64_t arg) {
25413         void* arg_ptr = untag_ptr(arg);
25414         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
25415         LDKSign* arg_conv = (LDKSign*)arg_ptr;
25416         int64_t ret_conv = Sign_clone_ptr(arg_conv);
25417         return ret_conv;
25418 }
25419
25420 uint64_t  __attribute__((export_name("TS_Sign_clone"))) TS_Sign_clone(uint64_t orig) {
25421         void* orig_ptr = untag_ptr(orig);
25422         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
25423         LDKSign* orig_conv = (LDKSign*)orig_ptr;
25424         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
25425         *ret_ret = Sign_clone(orig_conv);
25426         return tag_ptr(ret_ret, true);
25427 }
25428
25429 void  __attribute__((export_name("TS_Sign_free"))) TS_Sign_free(uint64_t this_ptr) {
25430         if (!ptr_is_owned(this_ptr)) return;
25431         void* this_ptr_ptr = untag_ptr(this_ptr);
25432         CHECK_ACCESS(this_ptr_ptr);
25433         LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
25434         FREE(untag_ptr(this_ptr));
25435         Sign_free(this_ptr_conv);
25436 }
25437
25438 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
25439         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
25440         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
25441         return ret_conv;
25442 }
25443
25444 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
25445         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
25446         return ret_conv;
25447 }
25448
25449 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
25450         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
25451         return ret_conv;
25452 }
25453
25454 void  __attribute__((export_name("TS_KeysInterface_free"))) TS_KeysInterface_free(uint64_t this_ptr) {
25455         if (!ptr_is_owned(this_ptr)) return;
25456         void* this_ptr_ptr = untag_ptr(this_ptr);
25457         CHECK_ACCESS(this_ptr_ptr);
25458         LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
25459         FREE(untag_ptr(this_ptr));
25460         KeysInterface_free(this_ptr_conv);
25461 }
25462
25463 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
25464         LDKInMemorySigner this_obj_conv;
25465         this_obj_conv.inner = untag_ptr(this_obj);
25466         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25468         InMemorySigner_free(this_obj_conv);
25469 }
25470
25471 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
25472         LDKInMemorySigner this_ptr_conv;
25473         this_ptr_conv.inner = untag_ptr(this_ptr);
25474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25476         this_ptr_conv.is_owned = false;
25477         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25478         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
25479         return ret_arr;
25480 }
25481
25482 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
25483         LDKInMemorySigner this_ptr_conv;
25484         this_ptr_conv.inner = untag_ptr(this_ptr);
25485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25487         this_ptr_conv.is_owned = false;
25488         LDKSecretKey val_ref;
25489         CHECK(val->arr_len == 32);
25490         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25491         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
25492 }
25493
25494 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
25495         LDKInMemorySigner this_ptr_conv;
25496         this_ptr_conv.inner = untag_ptr(this_ptr);
25497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25499         this_ptr_conv.is_owned = false;
25500         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25501         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
25502         return ret_arr;
25503 }
25504
25505 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
25506         LDKInMemorySigner this_ptr_conv;
25507         this_ptr_conv.inner = untag_ptr(this_ptr);
25508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25510         this_ptr_conv.is_owned = false;
25511         LDKSecretKey val_ref;
25512         CHECK(val->arr_len == 32);
25513         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25514         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
25515 }
25516
25517 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
25518         LDKInMemorySigner this_ptr_conv;
25519         this_ptr_conv.inner = untag_ptr(this_ptr);
25520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25522         this_ptr_conv.is_owned = false;
25523         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25524         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
25525         return ret_arr;
25526 }
25527
25528 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
25529         LDKInMemorySigner this_ptr_conv;
25530         this_ptr_conv.inner = untag_ptr(this_ptr);
25531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25533         this_ptr_conv.is_owned = false;
25534         LDKSecretKey val_ref;
25535         CHECK(val->arr_len == 32);
25536         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25537         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
25538 }
25539
25540 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
25541         LDKInMemorySigner this_ptr_conv;
25542         this_ptr_conv.inner = untag_ptr(this_ptr);
25543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25545         this_ptr_conv.is_owned = false;
25546         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25547         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
25548         return ret_arr;
25549 }
25550
25551 void  __attribute__((export_name("TS_InMemorySigner_set_delayed_payment_base_key"))) TS_InMemorySigner_set_delayed_payment_base_key(uint64_t this_ptr, int8_tArray val) {
25552         LDKInMemorySigner this_ptr_conv;
25553         this_ptr_conv.inner = untag_ptr(this_ptr);
25554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25556         this_ptr_conv.is_owned = false;
25557         LDKSecretKey val_ref;
25558         CHECK(val->arr_len == 32);
25559         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25560         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
25561 }
25562
25563 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
25564         LDKInMemorySigner this_ptr_conv;
25565         this_ptr_conv.inner = untag_ptr(this_ptr);
25566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25568         this_ptr_conv.is_owned = false;
25569         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25570         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
25571         return ret_arr;
25572 }
25573
25574 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
25575         LDKInMemorySigner this_ptr_conv;
25576         this_ptr_conv.inner = untag_ptr(this_ptr);
25577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25579         this_ptr_conv.is_owned = false;
25580         LDKSecretKey val_ref;
25581         CHECK(val->arr_len == 32);
25582         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25583         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
25584 }
25585
25586 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
25587         LDKInMemorySigner this_ptr_conv;
25588         this_ptr_conv.inner = untag_ptr(this_ptr);
25589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25591         this_ptr_conv.is_owned = false;
25592         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25593         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
25594         return ret_arr;
25595 }
25596
25597 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
25598         LDKInMemorySigner this_ptr_conv;
25599         this_ptr_conv.inner = untag_ptr(this_ptr);
25600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25602         this_ptr_conv.is_owned = false;
25603         LDKThirtyTwoBytes val_ref;
25604         CHECK(val->arr_len == 32);
25605         memcpy(val_ref.data, val->elems, 32); FREE(val);
25606         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
25607 }
25608
25609 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
25610         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
25611         uint64_t ret_ref = 0;
25612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25614         return ret_ref;
25615 }
25616 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
25617         LDKInMemorySigner arg_conv;
25618         arg_conv.inner = untag_ptr(arg);
25619         arg_conv.is_owned = ptr_is_owned(arg);
25620         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25621         arg_conv.is_owned = false;
25622         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
25623         return ret_conv;
25624 }
25625
25626 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
25627         LDKInMemorySigner orig_conv;
25628         orig_conv.inner = untag_ptr(orig);
25629         orig_conv.is_owned = ptr_is_owned(orig);
25630         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25631         orig_conv.is_owned = false;
25632         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
25633         uint64_t ret_ref = 0;
25634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25636         return ret_ref;
25637 }
25638
25639 uint64_t  __attribute__((export_name("TS_InMemorySigner_new"))) TS_InMemorySigner_new(int8_tArray node_secret, 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) {
25640         LDKSecretKey node_secret_ref;
25641         CHECK(node_secret->arr_len == 32);
25642         memcpy(node_secret_ref.bytes, node_secret->elems, 32); FREE(node_secret);
25643         LDKSecretKey funding_key_ref;
25644         CHECK(funding_key->arr_len == 32);
25645         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
25646         LDKSecretKey revocation_base_key_ref;
25647         CHECK(revocation_base_key->arr_len == 32);
25648         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
25649         LDKSecretKey payment_key_ref;
25650         CHECK(payment_key->arr_len == 32);
25651         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
25652         LDKSecretKey delayed_payment_base_key_ref;
25653         CHECK(delayed_payment_base_key->arr_len == 32);
25654         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
25655         LDKSecretKey htlc_base_key_ref;
25656         CHECK(htlc_base_key->arr_len == 32);
25657         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
25658         LDKThirtyTwoBytes commitment_seed_ref;
25659         CHECK(commitment_seed->arr_len == 32);
25660         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
25661         LDKThirtyTwoBytes channel_keys_id_ref;
25662         CHECK(channel_keys_id->arr_len == 32);
25663         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
25664         LDKInMemorySigner ret_var = InMemorySigner_new(node_secret_ref, 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);
25665         uint64_t ret_ref = 0;
25666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25668         return ret_ref;
25669 }
25670
25671 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
25672         LDKInMemorySigner this_arg_conv;
25673         this_arg_conv.inner = untag_ptr(this_arg);
25674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25676         this_arg_conv.is_owned = false;
25677         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
25678         uint64_t ret_ref = 0;
25679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25681         return ret_ref;
25682 }
25683
25684 int16_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
25685         LDKInMemorySigner this_arg_conv;
25686         this_arg_conv.inner = untag_ptr(this_arg);
25687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25689         this_arg_conv.is_owned = false;
25690         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
25691         return ret_conv;
25692 }
25693
25694 int16_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
25695         LDKInMemorySigner this_arg_conv;
25696         this_arg_conv.inner = untag_ptr(this_arg);
25697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25699         this_arg_conv.is_owned = false;
25700         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
25701         return ret_conv;
25702 }
25703
25704 jboolean  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
25705         LDKInMemorySigner this_arg_conv;
25706         this_arg_conv.inner = untag_ptr(this_arg);
25707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25709         this_arg_conv.is_owned = false;
25710         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
25711         return ret_conv;
25712 }
25713
25714 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
25715         LDKInMemorySigner this_arg_conv;
25716         this_arg_conv.inner = untag_ptr(this_arg);
25717         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25719         this_arg_conv.is_owned = false;
25720         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
25721         uint64_t ret_ref = 0;
25722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25724         return ret_ref;
25725 }
25726
25727 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
25728         LDKInMemorySigner this_arg_conv;
25729         this_arg_conv.inner = untag_ptr(this_arg);
25730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25732         this_arg_conv.is_owned = false;
25733         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
25734         uint64_t ret_ref = 0;
25735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25737         return ret_ref;
25738 }
25739
25740 jboolean  __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint64_t this_arg) {
25741         LDKInMemorySigner this_arg_conv;
25742         this_arg_conv.inner = untag_ptr(this_arg);
25743         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25745         this_arg_conv.is_owned = false;
25746         jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
25747         return ret_conv;
25748 }
25749
25750 uint64_t  __attribute__((export_name("TS_InMemorySigner_sign_counterparty_payment_input"))) TS_InMemorySigner_sign_counterparty_payment_input(uint64_t this_arg, int8_tArray spend_tx, uint32_t input_idx, uint64_t descriptor) {
25751         LDKInMemorySigner this_arg_conv;
25752         this_arg_conv.inner = untag_ptr(this_arg);
25753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25755         this_arg_conv.is_owned = false;
25756         LDKTransaction spend_tx_ref;
25757         spend_tx_ref.datalen = spend_tx->arr_len;
25758         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
25759         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
25760         spend_tx_ref.data_is_owned = true;
25761         LDKStaticPaymentOutputDescriptor descriptor_conv;
25762         descriptor_conv.inner = untag_ptr(descriptor);
25763         descriptor_conv.is_owned = ptr_is_owned(descriptor);
25764         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
25765         descriptor_conv.is_owned = false;
25766         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
25767         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
25768         return tag_ptr(ret_conv, true);
25769 }
25770
25771 uint64_t  __attribute__((export_name("TS_InMemorySigner_sign_dynamic_p2wsh_input"))) TS_InMemorySigner_sign_dynamic_p2wsh_input(uint64_t this_arg, int8_tArray spend_tx, uint32_t input_idx, uint64_t descriptor) {
25772         LDKInMemorySigner this_arg_conv;
25773         this_arg_conv.inner = untag_ptr(this_arg);
25774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25776         this_arg_conv.is_owned = false;
25777         LDKTransaction spend_tx_ref;
25778         spend_tx_ref.datalen = spend_tx->arr_len;
25779         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
25780         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
25781         spend_tx_ref.data_is_owned = true;
25782         LDKDelayedPaymentOutputDescriptor descriptor_conv;
25783         descriptor_conv.inner = untag_ptr(descriptor);
25784         descriptor_conv.is_owned = ptr_is_owned(descriptor);
25785         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
25786         descriptor_conv.is_owned = false;
25787         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
25788         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
25789         return tag_ptr(ret_conv, true);
25790 }
25791
25792 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_BaseSign"))) TS_InMemorySigner_as_BaseSign(uint64_t this_arg) {
25793         LDKInMemorySigner this_arg_conv;
25794         this_arg_conv.inner = untag_ptr(this_arg);
25795         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25797         this_arg_conv.is_owned = false;
25798         LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
25799         *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
25800         return tag_ptr(ret_ret, true);
25801 }
25802
25803 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_Sign"))) TS_InMemorySigner_as_Sign(uint64_t this_arg) {
25804         LDKInMemorySigner this_arg_conv;
25805         this_arg_conv.inner = untag_ptr(this_arg);
25806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25808         this_arg_conv.is_owned = false;
25809         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
25810         *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
25811         return tag_ptr(ret_ret, true);
25812 }
25813
25814 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
25815         LDKInMemorySigner obj_conv;
25816         obj_conv.inner = untag_ptr(obj);
25817         obj_conv.is_owned = ptr_is_owned(obj);
25818         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25819         obj_conv.is_owned = false;
25820         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
25821         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25822         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25823         CVec_u8Z_free(ret_var);
25824         return ret_arr;
25825 }
25826
25827 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, int8_tArray arg) {
25828         LDKu8slice ser_ref;
25829         ser_ref.datalen = ser->arr_len;
25830         ser_ref.data = ser->elems;
25831         LDKSecretKey arg_ref;
25832         CHECK(arg->arr_len == 32);
25833         memcpy(arg_ref.bytes, arg->elems, 32); FREE(arg);
25834         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
25835         *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
25836         FREE(ser);
25837         return tag_ptr(ret_conv, true);
25838 }
25839
25840 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
25841         LDKKeysManager this_obj_conv;
25842         this_obj_conv.inner = untag_ptr(this_obj);
25843         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25845         KeysManager_free(this_obj_conv);
25846 }
25847
25848 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
25849         unsigned char seed_arr[32];
25850         CHECK(seed->arr_len == 32);
25851         memcpy(seed_arr, seed->elems, 32); FREE(seed);
25852         unsigned char (*seed_ref)[32] = &seed_arr;
25853         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
25854         uint64_t ret_ref = 0;
25855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25857         return ret_ref;
25858 }
25859
25860 uint64_t  __attribute__((export_name("TS_KeysManager_derive_channel_keys"))) TS_KeysManager_derive_channel_keys(uint64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
25861         LDKKeysManager this_arg_conv;
25862         this_arg_conv.inner = untag_ptr(this_arg);
25863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25865         this_arg_conv.is_owned = false;
25866         unsigned char params_arr[32];
25867         CHECK(params->arr_len == 32);
25868         memcpy(params_arr, params->elems, 32); FREE(params);
25869         unsigned char (*params_ref)[32] = &params_arr;
25870         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
25871         uint64_t ret_ref = 0;
25872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25874         return ret_ref;
25875 }
25876
25877 uint64_t  __attribute__((export_name("TS_KeysManager_spend_spendable_outputs"))) TS_KeysManager_spend_spendable_outputs(uint64_t this_arg, uint64_tArray descriptors, uint64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight) {
25878         LDKKeysManager this_arg_conv;
25879         this_arg_conv.inner = untag_ptr(this_arg);
25880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25882         this_arg_conv.is_owned = false;
25883         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
25884         descriptors_constr.datalen = descriptors->arr_len;
25885         if (descriptors_constr.datalen > 0)
25886                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
25887         else
25888                 descriptors_constr.data = NULL;
25889         uint64_t* descriptors_vals = descriptors->elems;
25890         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
25891                 uint64_t descriptors_conv_27 = descriptors_vals[b];
25892                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
25893                 CHECK_ACCESS(descriptors_conv_27_ptr);
25894                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
25895                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
25896                 descriptors_constr.data[b] = descriptors_conv_27_conv;
25897         }
25898         FREE(descriptors);
25899         LDKCVec_TxOutZ outputs_constr;
25900         outputs_constr.datalen = outputs->arr_len;
25901         if (outputs_constr.datalen > 0)
25902                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
25903         else
25904                 outputs_constr.data = NULL;
25905         uint64_t* outputs_vals = outputs->elems;
25906         for (size_t h = 0; h < outputs_constr.datalen; h++) {
25907                 uint64_t outputs_conv_7 = outputs_vals[h];
25908                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
25909                 CHECK_ACCESS(outputs_conv_7_ptr);
25910                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
25911                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
25912                 outputs_constr.data[h] = outputs_conv_7_conv;
25913         }
25914         FREE(outputs);
25915         LDKCVec_u8Z change_destination_script_ref;
25916         change_destination_script_ref.datalen = change_destination_script->arr_len;
25917         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
25918         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
25919         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
25920         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
25921         return tag_ptr(ret_conv, true);
25922 }
25923
25924 uint64_t  __attribute__((export_name("TS_KeysManager_as_KeysInterface"))) TS_KeysManager_as_KeysInterface(uint64_t this_arg) {
25925         LDKKeysManager this_arg_conv;
25926         this_arg_conv.inner = untag_ptr(this_arg);
25927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25929         this_arg_conv.is_owned = false;
25930         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
25931         *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
25932         return tag_ptr(ret_ret, true);
25933 }
25934
25935 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
25936         LDKPhantomKeysManager this_obj_conv;
25937         this_obj_conv.inner = untag_ptr(this_obj);
25938         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25940         PhantomKeysManager_free(this_obj_conv);
25941 }
25942
25943 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_KeysInterface"))) TS_PhantomKeysManager_as_KeysInterface(uint64_t this_arg) {
25944         LDKPhantomKeysManager this_arg_conv;
25945         this_arg_conv.inner = untag_ptr(this_arg);
25946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25948         this_arg_conv.is_owned = false;
25949         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
25950         *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
25951         return tag_ptr(ret_ret, true);
25952 }
25953
25954 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_new"))) TS_PhantomKeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos, int8_tArray cross_node_seed) {
25955         unsigned char seed_arr[32];
25956         CHECK(seed->arr_len == 32);
25957         memcpy(seed_arr, seed->elems, 32); FREE(seed);
25958         unsigned char (*seed_ref)[32] = &seed_arr;
25959         unsigned char cross_node_seed_arr[32];
25960         CHECK(cross_node_seed->arr_len == 32);
25961         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
25962         unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
25963         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
25964         uint64_t ret_ref = 0;
25965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25967         return ret_ref;
25968 }
25969
25970 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_spend_spendable_outputs"))) TS_PhantomKeysManager_spend_spendable_outputs(uint64_t this_arg, uint64_tArray descriptors, uint64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight) {
25971         LDKPhantomKeysManager this_arg_conv;
25972         this_arg_conv.inner = untag_ptr(this_arg);
25973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25975         this_arg_conv.is_owned = false;
25976         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
25977         descriptors_constr.datalen = descriptors->arr_len;
25978         if (descriptors_constr.datalen > 0)
25979                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
25980         else
25981                 descriptors_constr.data = NULL;
25982         uint64_t* descriptors_vals = descriptors->elems;
25983         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
25984                 uint64_t descriptors_conv_27 = descriptors_vals[b];
25985                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
25986                 CHECK_ACCESS(descriptors_conv_27_ptr);
25987                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
25988                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
25989                 descriptors_constr.data[b] = descriptors_conv_27_conv;
25990         }
25991         FREE(descriptors);
25992         LDKCVec_TxOutZ outputs_constr;
25993         outputs_constr.datalen = outputs->arr_len;
25994         if (outputs_constr.datalen > 0)
25995                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
25996         else
25997                 outputs_constr.data = NULL;
25998         uint64_t* outputs_vals = outputs->elems;
25999         for (size_t h = 0; h < outputs_constr.datalen; h++) {
26000                 uint64_t outputs_conv_7 = outputs_vals[h];
26001                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
26002                 CHECK_ACCESS(outputs_conv_7_ptr);
26003                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
26004                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
26005                 outputs_constr.data[h] = outputs_conv_7_conv;
26006         }
26007         FREE(outputs);
26008         LDKCVec_u8Z change_destination_script_ref;
26009         change_destination_script_ref.datalen = change_destination_script->arr_len;
26010         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
26011         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
26012         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
26013         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
26014         return tag_ptr(ret_conv, true);
26015 }
26016
26017 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_derive_channel_keys"))) TS_PhantomKeysManager_derive_channel_keys(uint64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
26018         LDKPhantomKeysManager this_arg_conv;
26019         this_arg_conv.inner = untag_ptr(this_arg);
26020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26022         this_arg_conv.is_owned = false;
26023         unsigned char params_arr[32];
26024         CHECK(params->arr_len == 32);
26025         memcpy(params_arr, params->elems, 32); FREE(params);
26026         unsigned char (*params_ref)[32] = &params_arr;
26027         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
26028         uint64_t ret_ref = 0;
26029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26031         return ret_ref;
26032 }
26033
26034 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
26035         LDKChannelManager this_obj_conv;
26036         this_obj_conv.inner = untag_ptr(this_obj);
26037         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26039         ChannelManager_free(this_obj_conv);
26040 }
26041
26042 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
26043         LDKChainParameters this_obj_conv;
26044         this_obj_conv.inner = untag_ptr(this_obj);
26045         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26047         ChainParameters_free(this_obj_conv);
26048 }
26049
26050 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
26051         LDKChainParameters this_ptr_conv;
26052         this_ptr_conv.inner = untag_ptr(this_ptr);
26053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26055         this_ptr_conv.is_owned = false;
26056         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
26057         return ret_conv;
26058 }
26059
26060 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
26061         LDKChainParameters this_ptr_conv;
26062         this_ptr_conv.inner = untag_ptr(this_ptr);
26063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26065         this_ptr_conv.is_owned = false;
26066         LDKNetwork val_conv = LDKNetwork_from_js(val);
26067         ChainParameters_set_network(&this_ptr_conv, val_conv);
26068 }
26069
26070 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
26071         LDKChainParameters this_ptr_conv;
26072         this_ptr_conv.inner = untag_ptr(this_ptr);
26073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26075         this_ptr_conv.is_owned = false;
26076         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
26077         uint64_t ret_ref = 0;
26078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26080         return ret_ref;
26081 }
26082
26083 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
26084         LDKChainParameters this_ptr_conv;
26085         this_ptr_conv.inner = untag_ptr(this_ptr);
26086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26088         this_ptr_conv.is_owned = false;
26089         LDKBestBlock val_conv;
26090         val_conv.inner = untag_ptr(val);
26091         val_conv.is_owned = ptr_is_owned(val);
26092         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26093         val_conv = BestBlock_clone(&val_conv);
26094         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
26095 }
26096
26097 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
26098         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
26099         LDKBestBlock best_block_arg_conv;
26100         best_block_arg_conv.inner = untag_ptr(best_block_arg);
26101         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
26102         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
26103         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
26104         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
26105         uint64_t ret_ref = 0;
26106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26108         return ret_ref;
26109 }
26110
26111 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
26112         LDKChainParameters ret_var = ChainParameters_clone(arg);
26113         uint64_t ret_ref = 0;
26114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26116         return ret_ref;
26117 }
26118 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
26119         LDKChainParameters arg_conv;
26120         arg_conv.inner = untag_ptr(arg);
26121         arg_conv.is_owned = ptr_is_owned(arg);
26122         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26123         arg_conv.is_owned = false;
26124         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
26125         return ret_conv;
26126 }
26127
26128 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
26129         LDKChainParameters orig_conv;
26130         orig_conv.inner = untag_ptr(orig);
26131         orig_conv.is_owned = ptr_is_owned(orig);
26132         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26133         orig_conv.is_owned = false;
26134         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
26135         uint64_t ret_ref = 0;
26136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26138         return ret_ref;
26139 }
26140
26141 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
26142         LDKCounterpartyForwardingInfo this_obj_conv;
26143         this_obj_conv.inner = untag_ptr(this_obj);
26144         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26146         CounterpartyForwardingInfo_free(this_obj_conv);
26147 }
26148
26149 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
26150         LDKCounterpartyForwardingInfo this_ptr_conv;
26151         this_ptr_conv.inner = untag_ptr(this_ptr);
26152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26154         this_ptr_conv.is_owned = false;
26155         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
26156         return ret_conv;
26157 }
26158
26159 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
26160         LDKCounterpartyForwardingInfo this_ptr_conv;
26161         this_ptr_conv.inner = untag_ptr(this_ptr);
26162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26164         this_ptr_conv.is_owned = false;
26165         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
26166 }
26167
26168 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
26169         LDKCounterpartyForwardingInfo this_ptr_conv;
26170         this_ptr_conv.inner = untag_ptr(this_ptr);
26171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26173         this_ptr_conv.is_owned = false;
26174         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
26175         return ret_conv;
26176 }
26177
26178 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
26179         LDKCounterpartyForwardingInfo this_ptr_conv;
26180         this_ptr_conv.inner = untag_ptr(this_ptr);
26181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26183         this_ptr_conv.is_owned = false;
26184         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
26185 }
26186
26187 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
26188         LDKCounterpartyForwardingInfo this_ptr_conv;
26189         this_ptr_conv.inner = untag_ptr(this_ptr);
26190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26192         this_ptr_conv.is_owned = false;
26193         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
26194         return ret_conv;
26195 }
26196
26197 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
26198         LDKCounterpartyForwardingInfo this_ptr_conv;
26199         this_ptr_conv.inner = untag_ptr(this_ptr);
26200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26202         this_ptr_conv.is_owned = false;
26203         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
26204 }
26205
26206 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_new"))) TS_CounterpartyForwardingInfo_new(int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) {
26207         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
26208         uint64_t ret_ref = 0;
26209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26211         return ret_ref;
26212 }
26213
26214 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
26215         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
26216         uint64_t ret_ref = 0;
26217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26219         return ret_ref;
26220 }
26221 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
26222         LDKCounterpartyForwardingInfo arg_conv;
26223         arg_conv.inner = untag_ptr(arg);
26224         arg_conv.is_owned = ptr_is_owned(arg);
26225         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26226         arg_conv.is_owned = false;
26227         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
26228         return ret_conv;
26229 }
26230
26231 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
26232         LDKCounterpartyForwardingInfo orig_conv;
26233         orig_conv.inner = untag_ptr(orig);
26234         orig_conv.is_owned = ptr_is_owned(orig);
26235         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26236         orig_conv.is_owned = false;
26237         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
26238         uint64_t ret_ref = 0;
26239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26241         return ret_ref;
26242 }
26243
26244 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
26245         LDKChannelCounterparty this_obj_conv;
26246         this_obj_conv.inner = untag_ptr(this_obj);
26247         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26249         ChannelCounterparty_free(this_obj_conv);
26250 }
26251
26252 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
26253         LDKChannelCounterparty this_ptr_conv;
26254         this_ptr_conv.inner = untag_ptr(this_ptr);
26255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26257         this_ptr_conv.is_owned = false;
26258         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26259         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
26260         return ret_arr;
26261 }
26262
26263 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
26264         LDKChannelCounterparty this_ptr_conv;
26265         this_ptr_conv.inner = untag_ptr(this_ptr);
26266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26268         this_ptr_conv.is_owned = false;
26269         LDKPublicKey val_ref;
26270         CHECK(val->arr_len == 33);
26271         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26272         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
26273 }
26274
26275 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
26276         LDKChannelCounterparty this_ptr_conv;
26277         this_ptr_conv.inner = untag_ptr(this_ptr);
26278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26280         this_ptr_conv.is_owned = false;
26281         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
26282         uint64_t ret_ref = 0;
26283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26285         return ret_ref;
26286 }
26287
26288 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
26289         LDKChannelCounterparty this_ptr_conv;
26290         this_ptr_conv.inner = untag_ptr(this_ptr);
26291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26293         this_ptr_conv.is_owned = false;
26294         LDKInitFeatures val_conv;
26295         val_conv.inner = untag_ptr(val);
26296         val_conv.is_owned = ptr_is_owned(val);
26297         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26298         val_conv = InitFeatures_clone(&val_conv);
26299         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
26300 }
26301
26302 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
26303         LDKChannelCounterparty this_ptr_conv;
26304         this_ptr_conv.inner = untag_ptr(this_ptr);
26305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26307         this_ptr_conv.is_owned = false;
26308         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
26309         return ret_conv;
26310 }
26311
26312 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
26313         LDKChannelCounterparty this_ptr_conv;
26314         this_ptr_conv.inner = untag_ptr(this_ptr);
26315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26317         this_ptr_conv.is_owned = false;
26318         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
26319 }
26320
26321 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
26322         LDKChannelCounterparty this_ptr_conv;
26323         this_ptr_conv.inner = untag_ptr(this_ptr);
26324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26326         this_ptr_conv.is_owned = false;
26327         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
26328         uint64_t ret_ref = 0;
26329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26331         return ret_ref;
26332 }
26333
26334 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
26335         LDKChannelCounterparty this_ptr_conv;
26336         this_ptr_conv.inner = untag_ptr(this_ptr);
26337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26339         this_ptr_conv.is_owned = false;
26340         LDKCounterpartyForwardingInfo val_conv;
26341         val_conv.inner = untag_ptr(val);
26342         val_conv.is_owned = ptr_is_owned(val);
26343         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26344         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
26345         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
26346 }
26347
26348 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
26349         LDKChannelCounterparty this_ptr_conv;
26350         this_ptr_conv.inner = untag_ptr(this_ptr);
26351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26353         this_ptr_conv.is_owned = false;
26354         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26355         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
26356         uint64_t ret_ref = tag_ptr(ret_copy, true);
26357         return ret_ref;
26358 }
26359
26360 void  __attribute__((export_name("TS_ChannelCounterparty_set_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_set_outbound_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
26361         LDKChannelCounterparty this_ptr_conv;
26362         this_ptr_conv.inner = untag_ptr(this_ptr);
26363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26365         this_ptr_conv.is_owned = false;
26366         void* val_ptr = untag_ptr(val);
26367         CHECK_ACCESS(val_ptr);
26368         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26369         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26370         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
26371 }
26372
26373 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
26374         LDKChannelCounterparty this_ptr_conv;
26375         this_ptr_conv.inner = untag_ptr(this_ptr);
26376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26378         this_ptr_conv.is_owned = false;
26379         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26380         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
26381         uint64_t ret_ref = tag_ptr(ret_copy, true);
26382         return ret_ref;
26383 }
26384
26385 void  __attribute__((export_name("TS_ChannelCounterparty_set_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_set_outbound_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
26386         LDKChannelCounterparty this_ptr_conv;
26387         this_ptr_conv.inner = untag_ptr(this_ptr);
26388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26390         this_ptr_conv.is_owned = false;
26391         void* val_ptr = untag_ptr(val);
26392         CHECK_ACCESS(val_ptr);
26393         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26394         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26395         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
26396 }
26397
26398 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_new"))) TS_ChannelCounterparty_new(int8_tArray node_id_arg, uint64_t features_arg, int64_t unspendable_punishment_reserve_arg, uint64_t forwarding_info_arg, uint64_t outbound_htlc_minimum_msat_arg, uint64_t outbound_htlc_maximum_msat_arg) {
26399         LDKPublicKey node_id_arg_ref;
26400         CHECK(node_id_arg->arr_len == 33);
26401         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
26402         LDKInitFeatures features_arg_conv;
26403         features_arg_conv.inner = untag_ptr(features_arg);
26404         features_arg_conv.is_owned = ptr_is_owned(features_arg);
26405         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
26406         features_arg_conv = InitFeatures_clone(&features_arg_conv);
26407         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
26408         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
26409         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
26410         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
26411         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
26412         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
26413         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
26414         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
26415         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
26416         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
26417         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
26418         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
26419         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
26420         LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv, outbound_htlc_minimum_msat_arg_conv, outbound_htlc_maximum_msat_arg_conv);
26421         uint64_t ret_ref = 0;
26422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26424         return ret_ref;
26425 }
26426
26427 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
26428         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
26429         uint64_t ret_ref = 0;
26430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26432         return ret_ref;
26433 }
26434 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
26435         LDKChannelCounterparty arg_conv;
26436         arg_conv.inner = untag_ptr(arg);
26437         arg_conv.is_owned = ptr_is_owned(arg);
26438         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26439         arg_conv.is_owned = false;
26440         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
26441         return ret_conv;
26442 }
26443
26444 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
26445         LDKChannelCounterparty orig_conv;
26446         orig_conv.inner = untag_ptr(orig);
26447         orig_conv.is_owned = ptr_is_owned(orig);
26448         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26449         orig_conv.is_owned = false;
26450         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
26451         uint64_t ret_ref = 0;
26452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26454         return ret_ref;
26455 }
26456
26457 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
26458         LDKChannelDetails this_obj_conv;
26459         this_obj_conv.inner = untag_ptr(this_obj);
26460         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26462         ChannelDetails_free(this_obj_conv);
26463 }
26464
26465 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
26466         LDKChannelDetails this_ptr_conv;
26467         this_ptr_conv.inner = untag_ptr(this_ptr);
26468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26470         this_ptr_conv.is_owned = false;
26471         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26472         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
26473         return ret_arr;
26474 }
26475
26476 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
26477         LDKChannelDetails this_ptr_conv;
26478         this_ptr_conv.inner = untag_ptr(this_ptr);
26479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26481         this_ptr_conv.is_owned = false;
26482         LDKThirtyTwoBytes val_ref;
26483         CHECK(val->arr_len == 32);
26484         memcpy(val_ref.data, val->elems, 32); FREE(val);
26485         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
26486 }
26487
26488 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
26489         LDKChannelDetails this_ptr_conv;
26490         this_ptr_conv.inner = untag_ptr(this_ptr);
26491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26493         this_ptr_conv.is_owned = false;
26494         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
26495         uint64_t ret_ref = 0;
26496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26498         return ret_ref;
26499 }
26500
26501 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
26502         LDKChannelDetails this_ptr_conv;
26503         this_ptr_conv.inner = untag_ptr(this_ptr);
26504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26506         this_ptr_conv.is_owned = false;
26507         LDKChannelCounterparty val_conv;
26508         val_conv.inner = untag_ptr(val);
26509         val_conv.is_owned = ptr_is_owned(val);
26510         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26511         val_conv = ChannelCounterparty_clone(&val_conv);
26512         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
26513 }
26514
26515 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
26516         LDKChannelDetails this_ptr_conv;
26517         this_ptr_conv.inner = untag_ptr(this_ptr);
26518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26520         this_ptr_conv.is_owned = false;
26521         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
26522         uint64_t ret_ref = 0;
26523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26525         return ret_ref;
26526 }
26527
26528 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
26529         LDKChannelDetails this_ptr_conv;
26530         this_ptr_conv.inner = untag_ptr(this_ptr);
26531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26533         this_ptr_conv.is_owned = false;
26534         LDKOutPoint val_conv;
26535         val_conv.inner = untag_ptr(val);
26536         val_conv.is_owned = ptr_is_owned(val);
26537         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26538         val_conv = OutPoint_clone(&val_conv);
26539         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
26540 }
26541
26542 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
26543         LDKChannelDetails this_ptr_conv;
26544         this_ptr_conv.inner = untag_ptr(this_ptr);
26545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26547         this_ptr_conv.is_owned = false;
26548         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
26549         uint64_t ret_ref = 0;
26550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26552         return ret_ref;
26553 }
26554
26555 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
26556         LDKChannelDetails this_ptr_conv;
26557         this_ptr_conv.inner = untag_ptr(this_ptr);
26558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26560         this_ptr_conv.is_owned = false;
26561         LDKChannelTypeFeatures val_conv;
26562         val_conv.inner = untag_ptr(val);
26563         val_conv.is_owned = ptr_is_owned(val);
26564         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26565         val_conv = ChannelTypeFeatures_clone(&val_conv);
26566         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
26567 }
26568
26569 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
26570         LDKChannelDetails this_ptr_conv;
26571         this_ptr_conv.inner = untag_ptr(this_ptr);
26572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26574         this_ptr_conv.is_owned = false;
26575         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26576         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
26577         uint64_t ret_ref = tag_ptr(ret_copy, true);
26578         return ret_ref;
26579 }
26580
26581 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
26582         LDKChannelDetails this_ptr_conv;
26583         this_ptr_conv.inner = untag_ptr(this_ptr);
26584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26586         this_ptr_conv.is_owned = false;
26587         void* val_ptr = untag_ptr(val);
26588         CHECK_ACCESS(val_ptr);
26589         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26590         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26591         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
26592 }
26593
26594 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
26595         LDKChannelDetails this_ptr_conv;
26596         this_ptr_conv.inner = untag_ptr(this_ptr);
26597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26599         this_ptr_conv.is_owned = false;
26600         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26601         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
26602         uint64_t ret_ref = tag_ptr(ret_copy, true);
26603         return ret_ref;
26604 }
26605
26606 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
26607         LDKChannelDetails this_ptr_conv;
26608         this_ptr_conv.inner = untag_ptr(this_ptr);
26609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26611         this_ptr_conv.is_owned = false;
26612         void* val_ptr = untag_ptr(val);
26613         CHECK_ACCESS(val_ptr);
26614         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26615         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26616         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
26617 }
26618
26619 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
26620         LDKChannelDetails this_ptr_conv;
26621         this_ptr_conv.inner = untag_ptr(this_ptr);
26622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26624         this_ptr_conv.is_owned = false;
26625         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26626         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
26627         uint64_t ret_ref = tag_ptr(ret_copy, true);
26628         return ret_ref;
26629 }
26630
26631 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
26632         LDKChannelDetails this_ptr_conv;
26633         this_ptr_conv.inner = untag_ptr(this_ptr);
26634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26636         this_ptr_conv.is_owned = false;
26637         void* val_ptr = untag_ptr(val);
26638         CHECK_ACCESS(val_ptr);
26639         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26640         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26641         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
26642 }
26643
26644 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
26645         LDKChannelDetails this_ptr_conv;
26646         this_ptr_conv.inner = untag_ptr(this_ptr);
26647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26649         this_ptr_conv.is_owned = false;
26650         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
26651         return ret_conv;
26652 }
26653
26654 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
26655         LDKChannelDetails this_ptr_conv;
26656         this_ptr_conv.inner = untag_ptr(this_ptr);
26657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26659         this_ptr_conv.is_owned = false;
26660         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
26661 }
26662
26663 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
26664         LDKChannelDetails this_ptr_conv;
26665         this_ptr_conv.inner = untag_ptr(this_ptr);
26666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26668         this_ptr_conv.is_owned = false;
26669         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26670         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
26671         uint64_t ret_ref = tag_ptr(ret_copy, true);
26672         return ret_ref;
26673 }
26674
26675 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
26676         LDKChannelDetails this_ptr_conv;
26677         this_ptr_conv.inner = untag_ptr(this_ptr);
26678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26680         this_ptr_conv.is_owned = false;
26681         void* val_ptr = untag_ptr(val);
26682         CHECK_ACCESS(val_ptr);
26683         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26684         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26685         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
26686 }
26687
26688 int64_t  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
26689         LDKChannelDetails this_ptr_conv;
26690         this_ptr_conv.inner = untag_ptr(this_ptr);
26691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26693         this_ptr_conv.is_owned = false;
26694         int64_t ret_conv = ChannelDetails_get_user_channel_id(&this_ptr_conv);
26695         return ret_conv;
26696 }
26697
26698 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int64_t val) {
26699         LDKChannelDetails this_ptr_conv;
26700         this_ptr_conv.inner = untag_ptr(this_ptr);
26701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26703         this_ptr_conv.is_owned = false;
26704         ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
26705 }
26706
26707 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
26708         LDKChannelDetails this_ptr_conv;
26709         this_ptr_conv.inner = untag_ptr(this_ptr);
26710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26712         this_ptr_conv.is_owned = false;
26713         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
26714         return ret_conv;
26715 }
26716
26717 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
26718         LDKChannelDetails this_ptr_conv;
26719         this_ptr_conv.inner = untag_ptr(this_ptr);
26720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26722         this_ptr_conv.is_owned = false;
26723         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
26724 }
26725
26726 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
26727         LDKChannelDetails this_ptr_conv;
26728         this_ptr_conv.inner = untag_ptr(this_ptr);
26729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26731         this_ptr_conv.is_owned = false;
26732         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
26733         return ret_conv;
26734 }
26735
26736 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
26737         LDKChannelDetails this_ptr_conv;
26738         this_ptr_conv.inner = untag_ptr(this_ptr);
26739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26741         this_ptr_conv.is_owned = false;
26742         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
26743 }
26744
26745 int64_t  __attribute__((export_name("TS_ChannelDetails_get_next_outbound_htlc_limit_msat"))) TS_ChannelDetails_get_next_outbound_htlc_limit_msat(uint64_t this_ptr) {
26746         LDKChannelDetails this_ptr_conv;
26747         this_ptr_conv.inner = untag_ptr(this_ptr);
26748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26750         this_ptr_conv.is_owned = false;
26751         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
26752         return ret_conv;
26753 }
26754
26755 void  __attribute__((export_name("TS_ChannelDetails_set_next_outbound_htlc_limit_msat"))) TS_ChannelDetails_set_next_outbound_htlc_limit_msat(uint64_t this_ptr, int64_t val) {
26756         LDKChannelDetails this_ptr_conv;
26757         this_ptr_conv.inner = untag_ptr(this_ptr);
26758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26760         this_ptr_conv.is_owned = false;
26761         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
26762 }
26763
26764 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
26765         LDKChannelDetails this_ptr_conv;
26766         this_ptr_conv.inner = untag_ptr(this_ptr);
26767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26769         this_ptr_conv.is_owned = false;
26770         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
26771         return ret_conv;
26772 }
26773
26774 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
26775         LDKChannelDetails this_ptr_conv;
26776         this_ptr_conv.inner = untag_ptr(this_ptr);
26777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26779         this_ptr_conv.is_owned = false;
26780         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
26781 }
26782
26783 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
26784         LDKChannelDetails this_ptr_conv;
26785         this_ptr_conv.inner = untag_ptr(this_ptr);
26786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26788         this_ptr_conv.is_owned = false;
26789         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
26790         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
26791         uint64_t ret_ref = tag_ptr(ret_copy, true);
26792         return ret_ref;
26793 }
26794
26795 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
26796         LDKChannelDetails this_ptr_conv;
26797         this_ptr_conv.inner = untag_ptr(this_ptr);
26798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26800         this_ptr_conv.is_owned = false;
26801         void* val_ptr = untag_ptr(val);
26802         CHECK_ACCESS(val_ptr);
26803         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
26804         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
26805         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
26806 }
26807
26808 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
26809         LDKChannelDetails this_ptr_conv;
26810         this_ptr_conv.inner = untag_ptr(this_ptr);
26811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26813         this_ptr_conv.is_owned = false;
26814         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
26815         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
26816         uint64_t ret_ref = tag_ptr(ret_copy, true);
26817         return ret_ref;
26818 }
26819
26820 void  __attribute__((export_name("TS_ChannelDetails_set_force_close_spend_delay"))) TS_ChannelDetails_set_force_close_spend_delay(uint64_t this_ptr, uint64_t val) {
26821         LDKChannelDetails this_ptr_conv;
26822         this_ptr_conv.inner = untag_ptr(this_ptr);
26823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26825         this_ptr_conv.is_owned = false;
26826         void* val_ptr = untag_ptr(val);
26827         CHECK_ACCESS(val_ptr);
26828         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
26829         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
26830         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
26831 }
26832
26833 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
26834         LDKChannelDetails this_ptr_conv;
26835         this_ptr_conv.inner = untag_ptr(this_ptr);
26836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26838         this_ptr_conv.is_owned = false;
26839         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
26840         return ret_conv;
26841 }
26842
26843 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
26844         LDKChannelDetails this_ptr_conv;
26845         this_ptr_conv.inner = untag_ptr(this_ptr);
26846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26848         this_ptr_conv.is_owned = false;
26849         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
26850 }
26851
26852 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
26853         LDKChannelDetails this_ptr_conv;
26854         this_ptr_conv.inner = untag_ptr(this_ptr);
26855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26857         this_ptr_conv.is_owned = false;
26858         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
26859         return ret_conv;
26860 }
26861
26862 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
26863         LDKChannelDetails this_ptr_conv;
26864         this_ptr_conv.inner = untag_ptr(this_ptr);
26865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26867         this_ptr_conv.is_owned = false;
26868         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
26869 }
26870
26871 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
26872         LDKChannelDetails this_ptr_conv;
26873         this_ptr_conv.inner = untag_ptr(this_ptr);
26874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26876         this_ptr_conv.is_owned = false;
26877         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
26878         return ret_conv;
26879 }
26880
26881 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
26882         LDKChannelDetails this_ptr_conv;
26883         this_ptr_conv.inner = untag_ptr(this_ptr);
26884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26886         this_ptr_conv.is_owned = false;
26887         ChannelDetails_set_is_usable(&this_ptr_conv, val);
26888 }
26889
26890 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
26891         LDKChannelDetails this_ptr_conv;
26892         this_ptr_conv.inner = untag_ptr(this_ptr);
26893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26895         this_ptr_conv.is_owned = false;
26896         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
26897         return ret_conv;
26898 }
26899
26900 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
26901         LDKChannelDetails this_ptr_conv;
26902         this_ptr_conv.inner = untag_ptr(this_ptr);
26903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26905         this_ptr_conv.is_owned = false;
26906         ChannelDetails_set_is_public(&this_ptr_conv, val);
26907 }
26908
26909 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
26910         LDKChannelDetails this_ptr_conv;
26911         this_ptr_conv.inner = untag_ptr(this_ptr);
26912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26914         this_ptr_conv.is_owned = false;
26915         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26916         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
26917         uint64_t ret_ref = tag_ptr(ret_copy, true);
26918         return ret_ref;
26919 }
26920
26921 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_htlc_minimum_msat"))) TS_ChannelDetails_set_inbound_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
26922         LDKChannelDetails this_ptr_conv;
26923         this_ptr_conv.inner = untag_ptr(this_ptr);
26924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26926         this_ptr_conv.is_owned = false;
26927         void* val_ptr = untag_ptr(val);
26928         CHECK_ACCESS(val_ptr);
26929         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26930         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26931         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
26932 }
26933
26934 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
26935         LDKChannelDetails this_ptr_conv;
26936         this_ptr_conv.inner = untag_ptr(this_ptr);
26937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26939         this_ptr_conv.is_owned = false;
26940         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26941         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
26942         uint64_t ret_ref = tag_ptr(ret_copy, true);
26943         return ret_ref;
26944 }
26945
26946 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_htlc_maximum_msat"))) TS_ChannelDetails_set_inbound_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
26947         LDKChannelDetails this_ptr_conv;
26948         this_ptr_conv.inner = untag_ptr(this_ptr);
26949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26951         this_ptr_conv.is_owned = false;
26952         void* val_ptr = untag_ptr(val);
26953         CHECK_ACCESS(val_ptr);
26954         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26955         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26956         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
26957 }
26958
26959 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
26960         LDKChannelDetails this_ptr_conv;
26961         this_ptr_conv.inner = untag_ptr(this_ptr);
26962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26964         this_ptr_conv.is_owned = false;
26965         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
26966         uint64_t ret_ref = 0;
26967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26969         return ret_ref;
26970 }
26971
26972 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
26973         LDKChannelDetails this_ptr_conv;
26974         this_ptr_conv.inner = untag_ptr(this_ptr);
26975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26977         this_ptr_conv.is_owned = false;
26978         LDKChannelConfig val_conv;
26979         val_conv.inner = untag_ptr(val);
26980         val_conv.is_owned = ptr_is_owned(val);
26981         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26982         val_conv = ChannelConfig_clone(&val_conv);
26983         ChannelDetails_set_config(&this_ptr_conv, val_conv);
26984 }
26985
26986 uint64_t  __attribute__((export_name("TS_ChannelDetails_new"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint64_t counterparty_arg, uint64_t funding_txo_arg, uint64_t channel_type_arg, uint64_t short_channel_id_arg, uint64_t outbound_scid_alias_arg, uint64_t inbound_scid_alias_arg, int64_t channel_value_satoshis_arg, uint64_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t next_outbound_htlc_limit_msat_arg, int64_t inbound_capacity_msat_arg, uint64_t confirmations_required_arg, uint64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_channel_ready_arg, jboolean is_usable_arg, jboolean is_public_arg, uint64_t inbound_htlc_minimum_msat_arg, uint64_t inbound_htlc_maximum_msat_arg, uint64_t config_arg) {
26987         LDKThirtyTwoBytes channel_id_arg_ref;
26988         CHECK(channel_id_arg->arr_len == 32);
26989         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
26990         LDKChannelCounterparty counterparty_arg_conv;
26991         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
26992         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
26993         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
26994         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
26995         LDKOutPoint funding_txo_arg_conv;
26996         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
26997         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
26998         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
26999         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
27000         LDKChannelTypeFeatures channel_type_arg_conv;
27001         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
27002         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
27003         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
27004         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
27005         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
27006         CHECK_ACCESS(short_channel_id_arg_ptr);
27007         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
27008         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
27009         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
27010         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
27011         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
27012         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
27013         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
27014         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
27015         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
27016         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
27017         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
27018         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
27019         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
27020         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
27021         CHECK_ACCESS(confirmations_required_arg_ptr);
27022         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
27023         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
27024         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
27025         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
27026         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
27027         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
27028         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
27029         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
27030         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
27031         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
27032         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
27033         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
27034         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
27035         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
27036         LDKChannelConfig config_arg_conv;
27037         config_arg_conv.inner = untag_ptr(config_arg);
27038         config_arg_conv.is_owned = ptr_is_owned(config_arg);
27039         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
27040         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
27041         LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, channel_type_arg_conv, short_channel_id_arg_conv, outbound_scid_alias_arg_conv, inbound_scid_alias_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_channel_ready_arg, is_usable_arg, is_public_arg, inbound_htlc_minimum_msat_arg_conv, inbound_htlc_maximum_msat_arg_conv, config_arg_conv);
27042         uint64_t ret_ref = 0;
27043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27045         return ret_ref;
27046 }
27047
27048 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
27049         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
27050         uint64_t ret_ref = 0;
27051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27053         return ret_ref;
27054 }
27055 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
27056         LDKChannelDetails arg_conv;
27057         arg_conv.inner = untag_ptr(arg);
27058         arg_conv.is_owned = ptr_is_owned(arg);
27059         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27060         arg_conv.is_owned = false;
27061         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
27062         return ret_conv;
27063 }
27064
27065 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
27066         LDKChannelDetails orig_conv;
27067         orig_conv.inner = untag_ptr(orig);
27068         orig_conv.is_owned = ptr_is_owned(orig);
27069         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27070         orig_conv.is_owned = false;
27071         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
27072         uint64_t ret_ref = 0;
27073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27075         return ret_ref;
27076 }
27077
27078 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
27079         LDKChannelDetails this_arg_conv;
27080         this_arg_conv.inner = untag_ptr(this_arg);
27081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27083         this_arg_conv.is_owned = false;
27084         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27085         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
27086         uint64_t ret_ref = tag_ptr(ret_copy, true);
27087         return ret_ref;
27088 }
27089
27090 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
27091         LDKChannelDetails this_arg_conv;
27092         this_arg_conv.inner = untag_ptr(this_arg);
27093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27095         this_arg_conv.is_owned = false;
27096         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27097         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
27098         uint64_t ret_ref = tag_ptr(ret_copy, true);
27099         return ret_ref;
27100 }
27101
27102 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
27103         if (!ptr_is_owned(this_ptr)) return;
27104         void* this_ptr_ptr = untag_ptr(this_ptr);
27105         CHECK_ACCESS(this_ptr_ptr);
27106         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
27107         FREE(untag_ptr(this_ptr));
27108         PaymentSendFailure_free(this_ptr_conv);
27109 }
27110
27111 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
27112         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
27113         *ret_copy = PaymentSendFailure_clone(arg);
27114         uint64_t ret_ref = tag_ptr(ret_copy, true);
27115         return ret_ref;
27116 }
27117 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
27118         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
27119         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
27120         return ret_conv;
27121 }
27122
27123 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
27124         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
27125         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
27126         *ret_copy = PaymentSendFailure_clone(orig_conv);
27127         uint64_t ret_ref = tag_ptr(ret_copy, true);
27128         return ret_ref;
27129 }
27130
27131 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
27132         void* a_ptr = untag_ptr(a);
27133         CHECK_ACCESS(a_ptr);
27134         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
27135         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
27136         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
27137         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
27138         uint64_t ret_ref = tag_ptr(ret_copy, true);
27139         return ret_ref;
27140 }
27141
27142 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
27143         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
27144         a_constr.datalen = a->arr_len;
27145         if (a_constr.datalen > 0)
27146                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
27147         else
27148                 a_constr.data = NULL;
27149         uint64_t* a_vals = a->elems;
27150         for (size_t w = 0; w < a_constr.datalen; w++) {
27151                 uint64_t a_conv_22 = a_vals[w];
27152                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
27153                 CHECK_ACCESS(a_conv_22_ptr);
27154                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
27155                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
27156                 a_constr.data[w] = a_conv_22_conv;
27157         }
27158         FREE(a);
27159         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
27160         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
27161         uint64_t ret_ref = tag_ptr(ret_copy, true);
27162         return ret_ref;
27163 }
27164
27165 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_retry_safe"))) TS_PaymentSendFailure_all_failed_retry_safe(uint64_tArray a) {
27166         LDKCVec_APIErrorZ a_constr;
27167         a_constr.datalen = a->arr_len;
27168         if (a_constr.datalen > 0)
27169                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
27170         else
27171                 a_constr.data = NULL;
27172         uint64_t* a_vals = a->elems;
27173         for (size_t k = 0; k < a_constr.datalen; k++) {
27174                 uint64_t a_conv_10 = a_vals[k];
27175                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
27176                 CHECK_ACCESS(a_conv_10_ptr);
27177                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
27178                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
27179                 a_constr.data[k] = a_conv_10_conv;
27180         }
27181         FREE(a);
27182         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
27183         *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
27184         uint64_t ret_ref = tag_ptr(ret_copy, true);
27185         return ret_ref;
27186 }
27187
27188 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_partial_failure"))) TS_PaymentSendFailure_partial_failure(uint64_tArray results, uint64_t failed_paths_retry, int8_tArray payment_id) {
27189         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
27190         results_constr.datalen = results->arr_len;
27191         if (results_constr.datalen > 0)
27192                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
27193         else
27194                 results_constr.data = NULL;
27195         uint64_t* results_vals = results->elems;
27196         for (size_t w = 0; w < results_constr.datalen; w++) {
27197                 uint64_t results_conv_22 = results_vals[w];
27198                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
27199                 CHECK_ACCESS(results_conv_22_ptr);
27200                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
27201                 results_constr.data[w] = results_conv_22_conv;
27202         }
27203         FREE(results);
27204         LDKRouteParameters failed_paths_retry_conv;
27205         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
27206         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
27207         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
27208         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
27209         LDKThirtyTwoBytes payment_id_ref;
27210         CHECK(payment_id->arr_len == 32);
27211         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
27212         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
27213         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
27214         uint64_t ret_ref = tag_ptr(ret_copy, true);
27215         return ret_ref;
27216 }
27217
27218 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
27219         LDKPhantomRouteHints this_obj_conv;
27220         this_obj_conv.inner = untag_ptr(this_obj);
27221         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27223         PhantomRouteHints_free(this_obj_conv);
27224 }
27225
27226 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
27227         LDKPhantomRouteHints this_ptr_conv;
27228         this_ptr_conv.inner = untag_ptr(this_ptr);
27229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27231         this_ptr_conv.is_owned = false;
27232         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
27233         uint64_tArray ret_arr = NULL;
27234         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
27235         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
27236         for (size_t q = 0; q < ret_var.datalen; q++) {
27237                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
27238                 uint64_t ret_conv_16_ref = 0;
27239                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
27240                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
27241                 ret_arr_ptr[q] = ret_conv_16_ref;
27242         }
27243         
27244         FREE(ret_var.data);
27245         return ret_arr;
27246 }
27247
27248 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
27249         LDKPhantomRouteHints this_ptr_conv;
27250         this_ptr_conv.inner = untag_ptr(this_ptr);
27251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27253         this_ptr_conv.is_owned = false;
27254         LDKCVec_ChannelDetailsZ val_constr;
27255         val_constr.datalen = val->arr_len;
27256         if (val_constr.datalen > 0)
27257                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
27258         else
27259                 val_constr.data = NULL;
27260         uint64_t* val_vals = val->elems;
27261         for (size_t q = 0; q < val_constr.datalen; q++) {
27262                 uint64_t val_conv_16 = val_vals[q];
27263                 LDKChannelDetails val_conv_16_conv;
27264                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
27265                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
27266                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
27267                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
27268                 val_constr.data[q] = val_conv_16_conv;
27269         }
27270         FREE(val);
27271         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
27272 }
27273
27274 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
27275         LDKPhantomRouteHints this_ptr_conv;
27276         this_ptr_conv.inner = untag_ptr(this_ptr);
27277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27279         this_ptr_conv.is_owned = false;
27280         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
27281         return ret_conv;
27282 }
27283
27284 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
27285         LDKPhantomRouteHints this_ptr_conv;
27286         this_ptr_conv.inner = untag_ptr(this_ptr);
27287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27289         this_ptr_conv.is_owned = false;
27290         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
27291 }
27292
27293 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
27294         LDKPhantomRouteHints this_ptr_conv;
27295         this_ptr_conv.inner = untag_ptr(this_ptr);
27296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27298         this_ptr_conv.is_owned = false;
27299         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27300         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
27301         return ret_arr;
27302 }
27303
27304 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
27305         LDKPhantomRouteHints this_ptr_conv;
27306         this_ptr_conv.inner = untag_ptr(this_ptr);
27307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27309         this_ptr_conv.is_owned = false;
27310         LDKPublicKey val_ref;
27311         CHECK(val->arr_len == 33);
27312         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27313         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
27314 }
27315
27316 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_new"))) TS_PhantomRouteHints_new(uint64_tArray channels_arg, int64_t phantom_scid_arg, int8_tArray real_node_pubkey_arg) {
27317         LDKCVec_ChannelDetailsZ channels_arg_constr;
27318         channels_arg_constr.datalen = channels_arg->arr_len;
27319         if (channels_arg_constr.datalen > 0)
27320                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
27321         else
27322                 channels_arg_constr.data = NULL;
27323         uint64_t* channels_arg_vals = channels_arg->elems;
27324         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
27325                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
27326                 LDKChannelDetails channels_arg_conv_16_conv;
27327                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
27328                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
27329                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
27330                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
27331                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
27332         }
27333         FREE(channels_arg);
27334         LDKPublicKey real_node_pubkey_arg_ref;
27335         CHECK(real_node_pubkey_arg->arr_len == 33);
27336         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
27337         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
27338         uint64_t ret_ref = 0;
27339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27341         return ret_ref;
27342 }
27343
27344 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
27345         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
27346         uint64_t ret_ref = 0;
27347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27349         return ret_ref;
27350 }
27351 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
27352         LDKPhantomRouteHints arg_conv;
27353         arg_conv.inner = untag_ptr(arg);
27354         arg_conv.is_owned = ptr_is_owned(arg);
27355         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27356         arg_conv.is_owned = false;
27357         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
27358         return ret_conv;
27359 }
27360
27361 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
27362         LDKPhantomRouteHints orig_conv;
27363         orig_conv.inner = untag_ptr(orig);
27364         orig_conv.is_owned = ptr_is_owned(orig);
27365         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27366         orig_conv.is_owned = false;
27367         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
27368         uint64_t ret_ref = 0;
27369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27371         return ret_ref;
27372 }
27373
27374 uint64_t  __attribute__((export_name("TS_ChannelManager_new"))) TS_ChannelManager_new(uint64_t fee_est, uint64_t chain_monitor, uint64_t tx_broadcaster, uint64_t logger, uint64_t keys_manager, uint64_t config, uint64_t params) {
27375         void* fee_est_ptr = untag_ptr(fee_est);
27376         CHECK_ACCESS(fee_est_ptr);
27377         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
27378         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
27379                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27380                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
27381         }
27382         void* chain_monitor_ptr = untag_ptr(chain_monitor);
27383         CHECK_ACCESS(chain_monitor_ptr);
27384         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
27385         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
27386                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27387                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
27388         }
27389         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
27390         CHECK_ACCESS(tx_broadcaster_ptr);
27391         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
27392         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27393                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27394                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
27395         }
27396         void* logger_ptr = untag_ptr(logger);
27397         CHECK_ACCESS(logger_ptr);
27398         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27399         if (logger_conv.free == LDKLogger_JCalls_free) {
27400                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27401                 LDKLogger_JCalls_cloned(&logger_conv);
27402         }
27403         void* keys_manager_ptr = untag_ptr(keys_manager);
27404         CHECK_ACCESS(keys_manager_ptr);
27405         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
27406         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
27407                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27408                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
27409         }
27410         LDKUserConfig config_conv;
27411         config_conv.inner = untag_ptr(config);
27412         config_conv.is_owned = ptr_is_owned(config);
27413         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
27414         config_conv = UserConfig_clone(&config_conv);
27415         LDKChainParameters params_conv;
27416         params_conv.inner = untag_ptr(params);
27417         params_conv.is_owned = ptr_is_owned(params);
27418         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
27419         params_conv = ChainParameters_clone(&params_conv);
27420         LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
27421         uint64_t ret_ref = 0;
27422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27424         return ret_ref;
27425 }
27426
27427 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
27428         LDKChannelManager this_arg_conv;
27429         this_arg_conv.inner = untag_ptr(this_arg);
27430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27432         this_arg_conv.is_owned = false;
27433         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
27434         uint64_t ret_ref = 0;
27435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27437         return ret_ref;
27438 }
27439
27440 uint64_t  __attribute__((export_name("TS_ChannelManager_create_channel"))) TS_ChannelManager_create_channel(uint64_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_channel_id, uint64_t override_config) {
27441         LDKChannelManager this_arg_conv;
27442         this_arg_conv.inner = untag_ptr(this_arg);
27443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27445         this_arg_conv.is_owned = false;
27446         LDKPublicKey their_network_key_ref;
27447         CHECK(their_network_key->arr_len == 33);
27448         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
27449         LDKUserConfig override_config_conv;
27450         override_config_conv.inner = untag_ptr(override_config);
27451         override_config_conv.is_owned = ptr_is_owned(override_config);
27452         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
27453         override_config_conv = UserConfig_clone(&override_config_conv);
27454         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
27455         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
27456         return tag_ptr(ret_conv, true);
27457 }
27458
27459 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
27460         LDKChannelManager this_arg_conv;
27461         this_arg_conv.inner = untag_ptr(this_arg);
27462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27464         this_arg_conv.is_owned = false;
27465         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
27466         uint64_tArray ret_arr = NULL;
27467         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
27468         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
27469         for (size_t q = 0; q < ret_var.datalen; q++) {
27470                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
27471                 uint64_t ret_conv_16_ref = 0;
27472                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
27473                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
27474                 ret_arr_ptr[q] = ret_conv_16_ref;
27475         }
27476         
27477         FREE(ret_var.data);
27478         return ret_arr;
27479 }
27480
27481 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
27482         LDKChannelManager this_arg_conv;
27483         this_arg_conv.inner = untag_ptr(this_arg);
27484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27486         this_arg_conv.is_owned = false;
27487         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
27488         uint64_tArray ret_arr = NULL;
27489         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
27490         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
27491         for (size_t q = 0; q < ret_var.datalen; q++) {
27492                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
27493                 uint64_t ret_conv_16_ref = 0;
27494                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
27495                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
27496                 ret_arr_ptr[q] = ret_conv_16_ref;
27497         }
27498         
27499         FREE(ret_var.data);
27500         return ret_arr;
27501 }
27502
27503 uint64_t  __attribute__((export_name("TS_ChannelManager_close_channel"))) TS_ChannelManager_close_channel(uint64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
27504         LDKChannelManager this_arg_conv;
27505         this_arg_conv.inner = untag_ptr(this_arg);
27506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27508         this_arg_conv.is_owned = false;
27509         unsigned char channel_id_arr[32];
27510         CHECK(channel_id->arr_len == 32);
27511         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
27512         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
27513         LDKPublicKey counterparty_node_id_ref;
27514         CHECK(counterparty_node_id->arr_len == 33);
27515         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27516         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27517         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
27518         return tag_ptr(ret_conv, true);
27519 }
27520
27521 uint64_t  __attribute__((export_name("TS_ChannelManager_close_channel_with_target_feerate"))) TS_ChannelManager_close_channel_with_target_feerate(uint64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id, int32_t target_feerate_sats_per_1000_weight) {
27522         LDKChannelManager this_arg_conv;
27523         this_arg_conv.inner = untag_ptr(this_arg);
27524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27526         this_arg_conv.is_owned = false;
27527         unsigned char channel_id_arr[32];
27528         CHECK(channel_id->arr_len == 32);
27529         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
27530         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
27531         LDKPublicKey counterparty_node_id_ref;
27532         CHECK(counterparty_node_id->arr_len == 33);
27533         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27534         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27535         *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
27536         return tag_ptr(ret_conv, true);
27537 }
27538
27539 uint64_t  __attribute__((export_name("TS_ChannelManager_force_close_broadcasting_latest_txn"))) TS_ChannelManager_force_close_broadcasting_latest_txn(uint64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
27540         LDKChannelManager this_arg_conv;
27541         this_arg_conv.inner = untag_ptr(this_arg);
27542         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27544         this_arg_conv.is_owned = false;
27545         unsigned char channel_id_arr[32];
27546         CHECK(channel_id->arr_len == 32);
27547         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
27548         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
27549         LDKPublicKey counterparty_node_id_ref;
27550         CHECK(counterparty_node_id->arr_len == 33);
27551         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27552         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27553         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
27554         return tag_ptr(ret_conv, true);
27555 }
27556
27557 uint64_t  __attribute__((export_name("TS_ChannelManager_force_close_without_broadcasting_txn"))) TS_ChannelManager_force_close_without_broadcasting_txn(uint64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
27558         LDKChannelManager this_arg_conv;
27559         this_arg_conv.inner = untag_ptr(this_arg);
27560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27562         this_arg_conv.is_owned = false;
27563         unsigned char channel_id_arr[32];
27564         CHECK(channel_id->arr_len == 32);
27565         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
27566         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
27567         LDKPublicKey counterparty_node_id_ref;
27568         CHECK(counterparty_node_id->arr_len == 33);
27569         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27570         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27571         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
27572         return tag_ptr(ret_conv, true);
27573 }
27574
27575 void  __attribute__((export_name("TS_ChannelManager_force_close_all_channels_broadcasting_latest_txn"))) TS_ChannelManager_force_close_all_channels_broadcasting_latest_txn(uint64_t this_arg) {
27576         LDKChannelManager this_arg_conv;
27577         this_arg_conv.inner = untag_ptr(this_arg);
27578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27580         this_arg_conv.is_owned = false;
27581         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
27582 }
27583
27584 void  __attribute__((export_name("TS_ChannelManager_force_close_all_channels_without_broadcasting_txn"))) TS_ChannelManager_force_close_all_channels_without_broadcasting_txn(uint64_t this_arg) {
27585         LDKChannelManager this_arg_conv;
27586         this_arg_conv.inner = untag_ptr(this_arg);
27587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27589         this_arg_conv.is_owned = false;
27590         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
27591 }
27592
27593 uint64_t  __attribute__((export_name("TS_ChannelManager_send_payment"))) TS_ChannelManager_send_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
27594         LDKChannelManager this_arg_conv;
27595         this_arg_conv.inner = untag_ptr(this_arg);
27596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27598         this_arg_conv.is_owned = false;
27599         LDKRoute route_conv;
27600         route_conv.inner = untag_ptr(route);
27601         route_conv.is_owned = ptr_is_owned(route);
27602         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
27603         route_conv.is_owned = false;
27604         LDKThirtyTwoBytes payment_hash_ref;
27605         CHECK(payment_hash->arr_len == 32);
27606         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27607         LDKThirtyTwoBytes payment_secret_ref;
27608         CHECK(payment_secret->arr_len == 32);
27609         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
27610         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
27611         *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
27612         return tag_ptr(ret_conv, true);
27613 }
27614
27615 uint64_t  __attribute__((export_name("TS_ChannelManager_retry_payment"))) TS_ChannelManager_retry_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_id) {
27616         LDKChannelManager this_arg_conv;
27617         this_arg_conv.inner = untag_ptr(this_arg);
27618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27620         this_arg_conv.is_owned = false;
27621         LDKRoute route_conv;
27622         route_conv.inner = untag_ptr(route);
27623         route_conv.is_owned = ptr_is_owned(route);
27624         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
27625         route_conv.is_owned = false;
27626         LDKThirtyTwoBytes payment_id_ref;
27627         CHECK(payment_id->arr_len == 32);
27628         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
27629         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
27630         *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
27631         return tag_ptr(ret_conv, true);
27632 }
27633
27634 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
27635         LDKChannelManager this_arg_conv;
27636         this_arg_conv.inner = untag_ptr(this_arg);
27637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27639         this_arg_conv.is_owned = false;
27640         LDKThirtyTwoBytes payment_id_ref;
27641         CHECK(payment_id->arr_len == 32);
27642         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
27643         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
27644 }
27645
27646 uint64_t  __attribute__((export_name("TS_ChannelManager_send_spontaneous_payment"))) TS_ChannelManager_send_spontaneous_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_preimage) {
27647         LDKChannelManager this_arg_conv;
27648         this_arg_conv.inner = untag_ptr(this_arg);
27649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27651         this_arg_conv.is_owned = false;
27652         LDKRoute route_conv;
27653         route_conv.inner = untag_ptr(route);
27654         route_conv.is_owned = ptr_is_owned(route);
27655         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
27656         route_conv.is_owned = false;
27657         LDKThirtyTwoBytes payment_preimage_ref;
27658         CHECK(payment_preimage->arr_len == 32);
27659         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
27660         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
27661         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
27662         return tag_ptr(ret_conv, true);
27663 }
27664
27665 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_tArray hops) {
27666         LDKChannelManager this_arg_conv;
27667         this_arg_conv.inner = untag_ptr(this_arg);
27668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27670         this_arg_conv.is_owned = false;
27671         LDKCVec_RouteHopZ hops_constr;
27672         hops_constr.datalen = hops->arr_len;
27673         if (hops_constr.datalen > 0)
27674                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
27675         else
27676                 hops_constr.data = NULL;
27677         uint64_t* hops_vals = hops->elems;
27678         for (size_t k = 0; k < hops_constr.datalen; k++) {
27679                 uint64_t hops_conv_10 = hops_vals[k];
27680                 LDKRouteHop hops_conv_10_conv;
27681                 hops_conv_10_conv.inner = untag_ptr(hops_conv_10);
27682                 hops_conv_10_conv.is_owned = ptr_is_owned(hops_conv_10);
27683                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv_10_conv);
27684                 hops_conv_10_conv = RouteHop_clone(&hops_conv_10_conv);
27685                 hops_constr.data[k] = hops_conv_10_conv;
27686         }
27687         FREE(hops);
27688         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
27689         *ret_conv = ChannelManager_send_probe(&this_arg_conv, hops_constr);
27690         return tag_ptr(ret_conv, true);
27691 }
27692
27693 uint64_t  __attribute__((export_name("TS_ChannelManager_funding_transaction_generated"))) TS_ChannelManager_funding_transaction_generated(uint64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray funding_transaction) {
27694         LDKChannelManager this_arg_conv;
27695         this_arg_conv.inner = untag_ptr(this_arg);
27696         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27698         this_arg_conv.is_owned = false;
27699         unsigned char temporary_channel_id_arr[32];
27700         CHECK(temporary_channel_id->arr_len == 32);
27701         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
27702         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
27703         LDKPublicKey counterparty_node_id_ref;
27704         CHECK(counterparty_node_id->arr_len == 33);
27705         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27706         LDKTransaction funding_transaction_ref;
27707         funding_transaction_ref.datalen = funding_transaction->arr_len;
27708         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
27709         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
27710         funding_transaction_ref.data_is_owned = true;
27711         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27712         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
27713         return tag_ptr(ret_conv, true);
27714 }
27715
27716 uint64_t  __attribute__((export_name("TS_ChannelManager_update_channel_config"))) TS_ChannelManager_update_channel_config(uint64_t this_arg, int8_tArray counterparty_node_id, ptrArray channel_ids, uint64_t config) {
27717         LDKChannelManager this_arg_conv;
27718         this_arg_conv.inner = untag_ptr(this_arg);
27719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27721         this_arg_conv.is_owned = false;
27722         LDKPublicKey counterparty_node_id_ref;
27723         CHECK(counterparty_node_id->arr_len == 33);
27724         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27725         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
27726         channel_ids_constr.datalen = channel_ids->arr_len;
27727         if (channel_ids_constr.datalen > 0)
27728                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
27729         else
27730                 channel_ids_constr.data = NULL;
27731         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
27732         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
27733                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
27734                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
27735                 CHECK(channel_ids_conv_12->arr_len == 32);
27736                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
27737                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
27738         }
27739         FREE(channel_ids);
27740         LDKChannelConfig config_conv;
27741         config_conv.inner = untag_ptr(config);
27742         config_conv.is_owned = ptr_is_owned(config);
27743         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
27744         config_conv.is_owned = false;
27745         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27746         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
27747         return tag_ptr(ret_conv, true);
27748 }
27749
27750 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
27751         LDKChannelManager this_arg_conv;
27752         this_arg_conv.inner = untag_ptr(this_arg);
27753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27755         this_arg_conv.is_owned = false;
27756         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
27757 }
27758
27759 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
27760         LDKChannelManager this_arg_conv;
27761         this_arg_conv.inner = untag_ptr(this_arg);
27762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27764         this_arg_conv.is_owned = false;
27765         ChannelManager_timer_tick_occurred(&this_arg_conv);
27766 }
27767
27768 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
27769         LDKChannelManager this_arg_conv;
27770         this_arg_conv.inner = untag_ptr(this_arg);
27771         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27773         this_arg_conv.is_owned = false;
27774         unsigned char payment_hash_arr[32];
27775         CHECK(payment_hash->arr_len == 32);
27776         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
27777         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
27778         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
27779 }
27780
27781 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
27782         LDKChannelManager this_arg_conv;
27783         this_arg_conv.inner = untag_ptr(this_arg);
27784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27786         this_arg_conv.is_owned = false;
27787         LDKThirtyTwoBytes payment_preimage_ref;
27788         CHECK(payment_preimage->arr_len == 32);
27789         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
27790         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
27791 }
27792
27793 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
27794         LDKChannelManager this_arg_conv;
27795         this_arg_conv.inner = untag_ptr(this_arg);
27796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27798         this_arg_conv.is_owned = false;
27799         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27800         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
27801         return ret_arr;
27802 }
27803
27804 uint64_t  __attribute__((export_name("TS_ChannelManager_accept_inbound_channel"))) TS_ChannelManager_accept_inbound_channel(uint64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t user_channel_id) {
27805         LDKChannelManager this_arg_conv;
27806         this_arg_conv.inner = untag_ptr(this_arg);
27807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27809         this_arg_conv.is_owned = false;
27810         unsigned char temporary_channel_id_arr[32];
27811         CHECK(temporary_channel_id->arr_len == 32);
27812         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
27813         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
27814         LDKPublicKey counterparty_node_id_ref;
27815         CHECK(counterparty_node_id->arr_len == 33);
27816         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27817         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27818         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
27819         return tag_ptr(ret_conv, true);
27820 }
27821
27822 uint64_t  __attribute__((export_name("TS_ChannelManager_accept_inbound_channel_from_trusted_peer_0conf"))) TS_ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(uint64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t user_channel_id) {
27823         LDKChannelManager this_arg_conv;
27824         this_arg_conv.inner = untag_ptr(this_arg);
27825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27827         this_arg_conv.is_owned = false;
27828         unsigned char temporary_channel_id_arr[32];
27829         CHECK(temporary_channel_id->arr_len == 32);
27830         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
27831         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
27832         LDKPublicKey counterparty_node_id_ref;
27833         CHECK(counterparty_node_id->arr_len == 33);
27834         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27835         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27836         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
27837         return tag_ptr(ret_conv, true);
27838 }
27839
27840 uint64_t  __attribute__((export_name("TS_ChannelManager_create_inbound_payment"))) TS_ChannelManager_create_inbound_payment(uint64_t this_arg, uint64_t min_value_msat, int32_t invoice_expiry_delta_secs) {
27841         LDKChannelManager this_arg_conv;
27842         this_arg_conv.inner = untag_ptr(this_arg);
27843         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27845         this_arg_conv.is_owned = false;
27846         void* min_value_msat_ptr = untag_ptr(min_value_msat);
27847         CHECK_ACCESS(min_value_msat_ptr);
27848         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27849         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
27850         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
27851         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
27852         return tag_ptr(ret_conv, true);
27853 }
27854
27855 uint64_t  __attribute__((export_name("TS_ChannelManager_create_inbound_payment_legacy"))) TS_ChannelManager_create_inbound_payment_legacy(uint64_t this_arg, uint64_t min_value_msat, int32_t invoice_expiry_delta_secs) {
27856         LDKChannelManager this_arg_conv;
27857         this_arg_conv.inner = untag_ptr(this_arg);
27858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27860         this_arg_conv.is_owned = false;
27861         void* min_value_msat_ptr = untag_ptr(min_value_msat);
27862         CHECK_ACCESS(min_value_msat_ptr);
27863         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27864         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
27865         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
27866         *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
27867         return tag_ptr(ret_conv, true);
27868 }
27869
27870 uint64_t  __attribute__((export_name("TS_ChannelManager_create_inbound_payment_for_hash"))) TS_ChannelManager_create_inbound_payment_for_hash(uint64_t this_arg, int8_tArray payment_hash, uint64_t min_value_msat, int32_t invoice_expiry_delta_secs) {
27871         LDKChannelManager this_arg_conv;
27872         this_arg_conv.inner = untag_ptr(this_arg);
27873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27875         this_arg_conv.is_owned = false;
27876         LDKThirtyTwoBytes payment_hash_ref;
27877         CHECK(payment_hash->arr_len == 32);
27878         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27879         void* min_value_msat_ptr = untag_ptr(min_value_msat);
27880         CHECK_ACCESS(min_value_msat_ptr);
27881         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27882         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
27883         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
27884         *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
27885         return tag_ptr(ret_conv, true);
27886 }
27887
27888 uint64_t  __attribute__((export_name("TS_ChannelManager_create_inbound_payment_for_hash_legacy"))) TS_ChannelManager_create_inbound_payment_for_hash_legacy(uint64_t this_arg, int8_tArray payment_hash, uint64_t min_value_msat, int32_t invoice_expiry_delta_secs) {
27889         LDKChannelManager this_arg_conv;
27890         this_arg_conv.inner = untag_ptr(this_arg);
27891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27893         this_arg_conv.is_owned = false;
27894         LDKThirtyTwoBytes payment_hash_ref;
27895         CHECK(payment_hash->arr_len == 32);
27896         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27897         void* min_value_msat_ptr = untag_ptr(min_value_msat);
27898         CHECK_ACCESS(min_value_msat_ptr);
27899         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27900         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
27901         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
27902         *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
27903         return tag_ptr(ret_conv, true);
27904 }
27905
27906 uint64_t  __attribute__((export_name("TS_ChannelManager_get_payment_preimage"))) TS_ChannelManager_get_payment_preimage(uint64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
27907         LDKChannelManager this_arg_conv;
27908         this_arg_conv.inner = untag_ptr(this_arg);
27909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27911         this_arg_conv.is_owned = false;
27912         LDKThirtyTwoBytes payment_hash_ref;
27913         CHECK(payment_hash->arr_len == 32);
27914         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27915         LDKThirtyTwoBytes payment_secret_ref;
27916         CHECK(payment_secret->arr_len == 32);
27917         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
27918         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
27919         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
27920         return tag_ptr(ret_conv, true);
27921 }
27922
27923 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
27924         LDKChannelManager this_arg_conv;
27925         this_arg_conv.inner = untag_ptr(this_arg);
27926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27928         this_arg_conv.is_owned = false;
27929         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
27930         return ret_conv;
27931 }
27932
27933 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
27934         LDKChannelManager this_arg_conv;
27935         this_arg_conv.inner = untag_ptr(this_arg);
27936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27938         this_arg_conv.is_owned = false;
27939         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
27940         uint64_t ret_ref = 0;
27941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27943         return ret_ref;
27944 }
27945
27946 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
27947         LDKChannelManager this_arg_conv;
27948         this_arg_conv.inner = untag_ptr(this_arg);
27949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27951         this_arg_conv.is_owned = false;
27952         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
27953         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
27954         return tag_ptr(ret_ret, true);
27955 }
27956
27957 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
27958         LDKChannelManager this_arg_conv;
27959         this_arg_conv.inner = untag_ptr(this_arg);
27960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27962         this_arg_conv.is_owned = false;
27963         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
27964         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
27965         return tag_ptr(ret_ret, true);
27966 }
27967
27968 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
27969         LDKChannelManager this_arg_conv;
27970         this_arg_conv.inner = untag_ptr(this_arg);
27971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27973         this_arg_conv.is_owned = false;
27974         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
27975         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
27976         return tag_ptr(ret_ret, true);
27977 }
27978
27979 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
27980         LDKChannelManager this_arg_conv;
27981         this_arg_conv.inner = untag_ptr(this_arg);
27982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27984         this_arg_conv.is_owned = false;
27985         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
27986         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
27987         return tag_ptr(ret_ret, true);
27988 }
27989
27990 void  __attribute__((export_name("TS_ChannelManager_await_persistable_update"))) TS_ChannelManager_await_persistable_update(uint64_t this_arg) {
27991         LDKChannelManager this_arg_conv;
27992         this_arg_conv.inner = untag_ptr(this_arg);
27993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27995         this_arg_conv.is_owned = false;
27996         ChannelManager_await_persistable_update(&this_arg_conv);
27997 }
27998
27999 uint64_t  __attribute__((export_name("TS_ChannelManager_get_persistable_update_future"))) TS_ChannelManager_get_persistable_update_future(uint64_t this_arg) {
28000         LDKChannelManager this_arg_conv;
28001         this_arg_conv.inner = untag_ptr(this_arg);
28002         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28004         this_arg_conv.is_owned = false;
28005         LDKFuture ret_var = ChannelManager_get_persistable_update_future(&this_arg_conv);
28006         uint64_t ret_ref = 0;
28007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28009         return ret_ref;
28010 }
28011
28012 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
28013         LDKChannelManager this_arg_conv;
28014         this_arg_conv.inner = untag_ptr(this_arg);
28015         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28017         this_arg_conv.is_owned = false;
28018         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
28019         uint64_t ret_ref = 0;
28020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28022         return ret_ref;
28023 }
28024
28025 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
28026         LDKChannelManager this_arg_conv;
28027         this_arg_conv.inner = untag_ptr(this_arg);
28028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28030         this_arg_conv.is_owned = false;
28031         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
28032         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
28033         return tag_ptr(ret_ret, true);
28034 }
28035
28036 uint64_t  __attribute__((export_name("TS_provided_node_features"))) TS_provided_node_features() {
28037         LDKNodeFeatures ret_var = provided_node_features();
28038         uint64_t ret_ref = 0;
28039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28041         return ret_ref;
28042 }
28043
28044 uint64_t  __attribute__((export_name("TS_provided_channel_features"))) TS_provided_channel_features() {
28045         LDKChannelFeatures ret_var = provided_channel_features();
28046         uint64_t ret_ref = 0;
28047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28049         return ret_ref;
28050 }
28051
28052 uint64_t  __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features() {
28053         LDKInitFeatures ret_var = provided_init_features();
28054         uint64_t ret_ref = 0;
28055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28057         return ret_ref;
28058 }
28059
28060 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
28061         LDKCounterpartyForwardingInfo obj_conv;
28062         obj_conv.inner = untag_ptr(obj);
28063         obj_conv.is_owned = ptr_is_owned(obj);
28064         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28065         obj_conv.is_owned = false;
28066         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
28067         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
28068         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28069         CVec_u8Z_free(ret_var);
28070         return ret_arr;
28071 }
28072
28073 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
28074         LDKu8slice ser_ref;
28075         ser_ref.datalen = ser->arr_len;
28076         ser_ref.data = ser->elems;
28077         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
28078         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
28079         FREE(ser);
28080         return tag_ptr(ret_conv, true);
28081 }
28082
28083 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
28084         LDKChannelCounterparty obj_conv;
28085         obj_conv.inner = untag_ptr(obj);
28086         obj_conv.is_owned = ptr_is_owned(obj);
28087         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28088         obj_conv.is_owned = false;
28089         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
28090         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
28091         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28092         CVec_u8Z_free(ret_var);
28093         return ret_arr;
28094 }
28095
28096 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
28097         LDKu8slice ser_ref;
28098         ser_ref.datalen = ser->arr_len;
28099         ser_ref.data = ser->elems;
28100         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
28101         *ret_conv = ChannelCounterparty_read(ser_ref);
28102         FREE(ser);
28103         return tag_ptr(ret_conv, true);
28104 }
28105
28106 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
28107         LDKChannelDetails obj_conv;
28108         obj_conv.inner = untag_ptr(obj);
28109         obj_conv.is_owned = ptr_is_owned(obj);
28110         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28111         obj_conv.is_owned = false;
28112         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
28113         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
28114         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28115         CVec_u8Z_free(ret_var);
28116         return ret_arr;
28117 }
28118
28119 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
28120         LDKu8slice ser_ref;
28121         ser_ref.datalen = ser->arr_len;
28122         ser_ref.data = ser->elems;
28123         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
28124         *ret_conv = ChannelDetails_read(ser_ref);
28125         FREE(ser);
28126         return tag_ptr(ret_conv, true);
28127 }
28128
28129 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
28130         LDKPhantomRouteHints obj_conv;
28131         obj_conv.inner = untag_ptr(obj);
28132         obj_conv.is_owned = ptr_is_owned(obj);
28133         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28134         obj_conv.is_owned = false;
28135         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
28136         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
28137         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28138         CVec_u8Z_free(ret_var);
28139         return ret_arr;
28140 }
28141
28142 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
28143         LDKu8slice ser_ref;
28144         ser_ref.datalen = ser->arr_len;
28145         ser_ref.data = ser->elems;
28146         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
28147         *ret_conv = PhantomRouteHints_read(ser_ref);
28148         FREE(ser);
28149         return tag_ptr(ret_conv, true);
28150 }
28151
28152 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
28153         LDKChannelManager obj_conv;
28154         obj_conv.inner = untag_ptr(obj);
28155         obj_conv.is_owned = ptr_is_owned(obj);
28156         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28157         obj_conv.is_owned = false;
28158         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
28159         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
28160         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28161         CVec_u8Z_free(ret_var);
28162         return ret_arr;
28163 }
28164
28165 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
28166         LDKChannelManagerReadArgs this_obj_conv;
28167         this_obj_conv.inner = untag_ptr(this_obj);
28168         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28170         ChannelManagerReadArgs_free(this_obj_conv);
28171 }
28172
28173 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_keys_manager"))) TS_ChannelManagerReadArgs_get_keys_manager(uint64_t this_ptr) {
28174         LDKChannelManagerReadArgs this_ptr_conv;
28175         this_ptr_conv.inner = untag_ptr(this_ptr);
28176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28178         this_ptr_conv.is_owned = false;
28179         // WARNING: This object doesn't live past this scope, needs clone!
28180         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv), false);
28181         return ret_ret;
28182 }
28183
28184 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_keys_manager"))) TS_ChannelManagerReadArgs_set_keys_manager(uint64_t this_ptr, uint64_t val) {
28185         LDKChannelManagerReadArgs this_ptr_conv;
28186         this_ptr_conv.inner = untag_ptr(this_ptr);
28187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28189         this_ptr_conv.is_owned = false;
28190         void* val_ptr = untag_ptr(val);
28191         CHECK_ACCESS(val_ptr);
28192         LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
28193         if (val_conv.free == LDKKeysInterface_JCalls_free) {
28194                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28195                 LDKKeysInterface_JCalls_cloned(&val_conv);
28196         }
28197         ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
28198 }
28199
28200 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
28201         LDKChannelManagerReadArgs this_ptr_conv;
28202         this_ptr_conv.inner = untag_ptr(this_ptr);
28203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28205         this_ptr_conv.is_owned = false;
28206         // WARNING: This object doesn't live past this scope, needs clone!
28207         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
28208         return ret_ret;
28209 }
28210
28211 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
28212         LDKChannelManagerReadArgs this_ptr_conv;
28213         this_ptr_conv.inner = untag_ptr(this_ptr);
28214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28216         this_ptr_conv.is_owned = false;
28217         void* val_ptr = untag_ptr(val);
28218         CHECK_ACCESS(val_ptr);
28219         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
28220         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
28221                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28222                 LDKFeeEstimator_JCalls_cloned(&val_conv);
28223         }
28224         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
28225 }
28226
28227 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
28228         LDKChannelManagerReadArgs this_ptr_conv;
28229         this_ptr_conv.inner = untag_ptr(this_ptr);
28230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28232         this_ptr_conv.is_owned = false;
28233         // WARNING: This object doesn't live past this scope, needs clone!
28234         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
28235         return ret_ret;
28236 }
28237
28238 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
28239         LDKChannelManagerReadArgs this_ptr_conv;
28240         this_ptr_conv.inner = untag_ptr(this_ptr);
28241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28243         this_ptr_conv.is_owned = false;
28244         void* val_ptr = untag_ptr(val);
28245         CHECK_ACCESS(val_ptr);
28246         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
28247         if (val_conv.free == LDKWatch_JCalls_free) {
28248                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28249                 LDKWatch_JCalls_cloned(&val_conv);
28250         }
28251         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
28252 }
28253
28254 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
28255         LDKChannelManagerReadArgs this_ptr_conv;
28256         this_ptr_conv.inner = untag_ptr(this_ptr);
28257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28259         this_ptr_conv.is_owned = false;
28260         // WARNING: This object doesn't live past this scope, needs clone!
28261         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
28262         return ret_ret;
28263 }
28264
28265 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
28266         LDKChannelManagerReadArgs this_ptr_conv;
28267         this_ptr_conv.inner = untag_ptr(this_ptr);
28268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28270         this_ptr_conv.is_owned = false;
28271         void* val_ptr = untag_ptr(val);
28272         CHECK_ACCESS(val_ptr);
28273         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
28274         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
28275                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28276                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
28277         }
28278         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
28279 }
28280
28281 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
28282         LDKChannelManagerReadArgs this_ptr_conv;
28283         this_ptr_conv.inner = untag_ptr(this_ptr);
28284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28286         this_ptr_conv.is_owned = false;
28287         // WARNING: This object doesn't live past this scope, needs clone!
28288         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
28289         return ret_ret;
28290 }
28291
28292 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
28293         LDKChannelManagerReadArgs this_ptr_conv;
28294         this_ptr_conv.inner = untag_ptr(this_ptr);
28295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28297         this_ptr_conv.is_owned = false;
28298         void* val_ptr = untag_ptr(val);
28299         CHECK_ACCESS(val_ptr);
28300         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
28301         if (val_conv.free == LDKLogger_JCalls_free) {
28302                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28303                 LDKLogger_JCalls_cloned(&val_conv);
28304         }
28305         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
28306 }
28307
28308 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
28309         LDKChannelManagerReadArgs this_ptr_conv;
28310         this_ptr_conv.inner = untag_ptr(this_ptr);
28311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28313         this_ptr_conv.is_owned = false;
28314         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
28315         uint64_t ret_ref = 0;
28316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28318         return ret_ref;
28319 }
28320
28321 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
28322         LDKChannelManagerReadArgs this_ptr_conv;
28323         this_ptr_conv.inner = untag_ptr(this_ptr);
28324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28326         this_ptr_conv.is_owned = false;
28327         LDKUserConfig val_conv;
28328         val_conv.inner = untag_ptr(val);
28329         val_conv.is_owned = ptr_is_owned(val);
28330         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28331         val_conv = UserConfig_clone(&val_conv);
28332         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
28333 }
28334
28335 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_new"))) TS_ChannelManagerReadArgs_new(uint64_t keys_manager, uint64_t fee_estimator, uint64_t chain_monitor, uint64_t tx_broadcaster, uint64_t logger, uint64_t default_config, uint64_tArray channel_monitors) {
28336         void* keys_manager_ptr = untag_ptr(keys_manager);
28337         CHECK_ACCESS(keys_manager_ptr);
28338         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
28339         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
28340                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28341                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
28342         }
28343         void* fee_estimator_ptr = untag_ptr(fee_estimator);
28344         CHECK_ACCESS(fee_estimator_ptr);
28345         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
28346         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
28347                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28348                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
28349         }
28350         void* chain_monitor_ptr = untag_ptr(chain_monitor);
28351         CHECK_ACCESS(chain_monitor_ptr);
28352         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
28353         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
28354                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28355                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
28356         }
28357         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
28358         CHECK_ACCESS(tx_broadcaster_ptr);
28359         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
28360         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28361                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28362                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
28363         }
28364         void* logger_ptr = untag_ptr(logger);
28365         CHECK_ACCESS(logger_ptr);
28366         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28367         if (logger_conv.free == LDKLogger_JCalls_free) {
28368                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28369                 LDKLogger_JCalls_cloned(&logger_conv);
28370         }
28371         LDKUserConfig default_config_conv;
28372         default_config_conv.inner = untag_ptr(default_config);
28373         default_config_conv.is_owned = ptr_is_owned(default_config);
28374         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
28375         default_config_conv = UserConfig_clone(&default_config_conv);
28376         LDKCVec_ChannelMonitorZ channel_monitors_constr;
28377         channel_monitors_constr.datalen = channel_monitors->arr_len;
28378         if (channel_monitors_constr.datalen > 0)
28379                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
28380         else
28381                 channel_monitors_constr.data = NULL;
28382         uint64_t* channel_monitors_vals = channel_monitors->elems;
28383         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
28384                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
28385                 LDKChannelMonitor channel_monitors_conv_16_conv;
28386                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
28387                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
28388                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
28389                 channel_monitors_conv_16_conv.is_owned = false;
28390                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
28391         }
28392         FREE(channel_monitors);
28393         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);
28394         uint64_t ret_ref = 0;
28395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28397         return ret_ref;
28398 }
28399
28400 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
28401         LDKu8slice ser_ref;
28402         ser_ref.datalen = ser->arr_len;
28403         ser_ref.data = ser->elems;
28404         LDKChannelManagerReadArgs arg_conv;
28405         arg_conv.inner = untag_ptr(arg);
28406         arg_conv.is_owned = ptr_is_owned(arg);
28407         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28408         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
28409         
28410         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
28411         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
28412         FREE(ser);
28413         return tag_ptr(ret_conv, true);
28414 }
28415
28416 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
28417         LDKExpandedKey this_obj_conv;
28418         this_obj_conv.inner = untag_ptr(this_obj);
28419         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28421         ExpandedKey_free(this_obj_conv);
28422 }
28423
28424 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
28425         unsigned char key_material_arr[32];
28426         CHECK(key_material->arr_len == 32);
28427         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
28428         unsigned char (*key_material_ref)[32] = &key_material_arr;
28429         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
28430         uint64_t ret_ref = 0;
28431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28433         return ret_ref;
28434 }
28435
28436 uint64_t  __attribute__((export_name("TS_create"))) TS_create(uint64_t keys, uint64_t min_value_msat, int32_t invoice_expiry_delta_secs, uint64_t keys_manager, int64_t current_time) {
28437         LDKExpandedKey keys_conv;
28438         keys_conv.inner = untag_ptr(keys);
28439         keys_conv.is_owned = ptr_is_owned(keys);
28440         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
28441         keys_conv.is_owned = false;
28442         void* min_value_msat_ptr = untag_ptr(min_value_msat);
28443         CHECK_ACCESS(min_value_msat_ptr);
28444         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28445         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
28446         void* keys_manager_ptr = untag_ptr(keys_manager);
28447         if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); }
28448         LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
28449         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
28450         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time);
28451         return tag_ptr(ret_conv, true);
28452 }
28453
28454 uint64_t  __attribute__((export_name("TS_create_from_hash"))) TS_create_from_hash(uint64_t keys, uint64_t min_value_msat, int8_tArray payment_hash, int32_t invoice_expiry_delta_secs, int64_t current_time) {
28455         LDKExpandedKey keys_conv;
28456         keys_conv.inner = untag_ptr(keys);
28457         keys_conv.is_owned = ptr_is_owned(keys);
28458         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
28459         keys_conv.is_owned = false;
28460         void* min_value_msat_ptr = untag_ptr(min_value_msat);
28461         CHECK_ACCESS(min_value_msat_ptr);
28462         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28463         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
28464         LDKThirtyTwoBytes payment_hash_ref;
28465         CHECK(payment_hash->arr_len == 32);
28466         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28467         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
28468         *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time);
28469         return tag_ptr(ret_conv, true);
28470 }
28471
28472 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_ptr) {
28473         if (!ptr_is_owned(this_ptr)) return;
28474         void* this_ptr_ptr = untag_ptr(this_ptr);
28475         CHECK_ACCESS(this_ptr_ptr);
28476         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
28477         FREE(untag_ptr(this_ptr));
28478         DecodeError_free(this_ptr_conv);
28479 }
28480
28481 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
28482         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
28483         *ret_copy = DecodeError_clone(arg);
28484         uint64_t ret_ref = tag_ptr(ret_copy, true);
28485         return ret_ref;
28486 }
28487 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
28488         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
28489         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
28490         return ret_conv;
28491 }
28492
28493 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
28494         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
28495         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
28496         *ret_copy = DecodeError_clone(orig_conv);
28497         uint64_t ret_ref = tag_ptr(ret_copy, true);
28498         return ret_ref;
28499 }
28500
28501 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_version"))) TS_DecodeError_unknown_version() {
28502         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
28503         *ret_copy = DecodeError_unknown_version();
28504         uint64_t ret_ref = tag_ptr(ret_copy, true);
28505         return ret_ref;
28506 }
28507
28508 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_required_feature"))) TS_DecodeError_unknown_required_feature() {
28509         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
28510         *ret_copy = DecodeError_unknown_required_feature();
28511         uint64_t ret_ref = tag_ptr(ret_copy, true);
28512         return ret_ref;
28513 }
28514
28515 uint64_t  __attribute__((export_name("TS_DecodeError_invalid_value"))) TS_DecodeError_invalid_value() {
28516         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
28517         *ret_copy = DecodeError_invalid_value();
28518         uint64_t ret_ref = tag_ptr(ret_copy, true);
28519         return ret_ref;
28520 }
28521
28522 uint64_t  __attribute__((export_name("TS_DecodeError_short_read"))) TS_DecodeError_short_read() {
28523         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
28524         *ret_copy = DecodeError_short_read();
28525         uint64_t ret_ref = tag_ptr(ret_copy, true);
28526         return ret_ref;
28527 }
28528
28529 uint64_t  __attribute__((export_name("TS_DecodeError_bad_length_descriptor"))) TS_DecodeError_bad_length_descriptor() {
28530         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
28531         *ret_copy = DecodeError_bad_length_descriptor();
28532         uint64_t ret_ref = tag_ptr(ret_copy, true);
28533         return ret_ref;
28534 }
28535
28536 uint64_t  __attribute__((export_name("TS_DecodeError_io"))) TS_DecodeError_io(uint32_t a) {
28537         LDKIOError a_conv = LDKIOError_from_js(a);
28538         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
28539         *ret_copy = DecodeError_io(a_conv);
28540         uint64_t ret_ref = tag_ptr(ret_copy, true);
28541         return ret_ref;
28542 }
28543
28544 uint64_t  __attribute__((export_name("TS_DecodeError_unsupported_compression"))) TS_DecodeError_unsupported_compression() {
28545         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
28546         *ret_copy = DecodeError_unsupported_compression();
28547         uint64_t ret_ref = tag_ptr(ret_copy, true);
28548         return ret_ref;
28549 }
28550
28551 jboolean  __attribute__((export_name("TS_DecodeError_eq"))) TS_DecodeError_eq(uint64_t a, uint64_t b) {
28552         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
28553         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
28554         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
28555         return ret_conv;
28556 }
28557
28558 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
28559         LDKInit this_obj_conv;
28560         this_obj_conv.inner = untag_ptr(this_obj);
28561         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28563         Init_free(this_obj_conv);
28564 }
28565
28566 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
28567         LDKInit this_ptr_conv;
28568         this_ptr_conv.inner = untag_ptr(this_ptr);
28569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28571         this_ptr_conv.is_owned = false;
28572         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
28573         uint64_t ret_ref = 0;
28574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28576         return ret_ref;
28577 }
28578
28579 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
28580         LDKInit this_ptr_conv;
28581         this_ptr_conv.inner = untag_ptr(this_ptr);
28582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28584         this_ptr_conv.is_owned = false;
28585         LDKInitFeatures val_conv;
28586         val_conv.inner = untag_ptr(val);
28587         val_conv.is_owned = ptr_is_owned(val);
28588         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28589         val_conv = InitFeatures_clone(&val_conv);
28590         Init_set_features(&this_ptr_conv, val_conv);
28591 }
28592
28593 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
28594         LDKInit this_ptr_conv;
28595         this_ptr_conv.inner = untag_ptr(this_ptr);
28596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28598         this_ptr_conv.is_owned = false;
28599         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
28600         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
28601         uint64_t ret_ref = tag_ptr(ret_copy, true);
28602         return ret_ref;
28603 }
28604
28605 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
28606         LDKInit this_ptr_conv;
28607         this_ptr_conv.inner = untag_ptr(this_ptr);
28608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28610         this_ptr_conv.is_owned = false;
28611         void* val_ptr = untag_ptr(val);
28612         CHECK_ACCESS(val_ptr);
28613         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
28614         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
28615         Init_set_remote_network_address(&this_ptr_conv, val_conv);
28616 }
28617
28618 uint64_t  __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint64_t features_arg, uint64_t remote_network_address_arg) {
28619         LDKInitFeatures features_arg_conv;
28620         features_arg_conv.inner = untag_ptr(features_arg);
28621         features_arg_conv.is_owned = ptr_is_owned(features_arg);
28622         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
28623         features_arg_conv = InitFeatures_clone(&features_arg_conv);
28624         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
28625         CHECK_ACCESS(remote_network_address_arg_ptr);
28626         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
28627         LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
28628         uint64_t ret_ref = 0;
28629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28631         return ret_ref;
28632 }
28633
28634 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
28635         LDKInit ret_var = Init_clone(arg);
28636         uint64_t ret_ref = 0;
28637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28639         return ret_ref;
28640 }
28641 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
28642         LDKInit arg_conv;
28643         arg_conv.inner = untag_ptr(arg);
28644         arg_conv.is_owned = ptr_is_owned(arg);
28645         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28646         arg_conv.is_owned = false;
28647         int64_t ret_conv = Init_clone_ptr(&arg_conv);
28648         return ret_conv;
28649 }
28650
28651 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
28652         LDKInit orig_conv;
28653         orig_conv.inner = untag_ptr(orig);
28654         orig_conv.is_owned = ptr_is_owned(orig);
28655         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28656         orig_conv.is_owned = false;
28657         LDKInit ret_var = Init_clone(&orig_conv);
28658         uint64_t ret_ref = 0;
28659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28661         return ret_ref;
28662 }
28663
28664 jboolean  __attribute__((export_name("TS_Init_eq"))) TS_Init_eq(uint64_t a, uint64_t b) {
28665         LDKInit a_conv;
28666         a_conv.inner = untag_ptr(a);
28667         a_conv.is_owned = ptr_is_owned(a);
28668         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
28669         a_conv.is_owned = false;
28670         LDKInit b_conv;
28671         b_conv.inner = untag_ptr(b);
28672         b_conv.is_owned = ptr_is_owned(b);
28673         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
28674         b_conv.is_owned = false;
28675         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
28676         return ret_conv;
28677 }
28678
28679 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
28680         LDKErrorMessage this_obj_conv;
28681         this_obj_conv.inner = untag_ptr(this_obj);
28682         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28684         ErrorMessage_free(this_obj_conv);
28685 }
28686
28687 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
28688         LDKErrorMessage this_ptr_conv;
28689         this_ptr_conv.inner = untag_ptr(this_ptr);
28690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28692         this_ptr_conv.is_owned = false;
28693         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28694         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
28695         return ret_arr;
28696 }
28697
28698 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
28699         LDKErrorMessage this_ptr_conv;
28700         this_ptr_conv.inner = untag_ptr(this_ptr);
28701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28703         this_ptr_conv.is_owned = false;
28704         LDKThirtyTwoBytes val_ref;
28705         CHECK(val->arr_len == 32);
28706         memcpy(val_ref.data, val->elems, 32); FREE(val);
28707         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
28708 }
28709
28710 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
28711         LDKErrorMessage this_ptr_conv;
28712         this_ptr_conv.inner = untag_ptr(this_ptr);
28713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28715         this_ptr_conv.is_owned = false;
28716         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
28717         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28718         Str_free(ret_str);
28719         return ret_conv;
28720 }
28721
28722 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
28723         LDKErrorMessage this_ptr_conv;
28724         this_ptr_conv.inner = untag_ptr(this_ptr);
28725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28727         this_ptr_conv.is_owned = false;
28728         LDKStr val_conv = str_ref_to_owned_c(val);
28729         ErrorMessage_set_data(&this_ptr_conv, val_conv);
28730 }
28731
28732 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
28733         LDKThirtyTwoBytes channel_id_arg_ref;
28734         CHECK(channel_id_arg->arr_len == 32);
28735         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28736         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
28737         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
28738         uint64_t ret_ref = 0;
28739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28741         return ret_ref;
28742 }
28743
28744 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
28745         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
28746         uint64_t ret_ref = 0;
28747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28749         return ret_ref;
28750 }
28751 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
28752         LDKErrorMessage arg_conv;
28753         arg_conv.inner = untag_ptr(arg);
28754         arg_conv.is_owned = ptr_is_owned(arg);
28755         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28756         arg_conv.is_owned = false;
28757         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
28758         return ret_conv;
28759 }
28760
28761 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
28762         LDKErrorMessage orig_conv;
28763         orig_conv.inner = untag_ptr(orig);
28764         orig_conv.is_owned = ptr_is_owned(orig);
28765         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28766         orig_conv.is_owned = false;
28767         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
28768         uint64_t ret_ref = 0;
28769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28771         return ret_ref;
28772 }
28773
28774 jboolean  __attribute__((export_name("TS_ErrorMessage_eq"))) TS_ErrorMessage_eq(uint64_t a, uint64_t b) {
28775         LDKErrorMessage a_conv;
28776         a_conv.inner = untag_ptr(a);
28777         a_conv.is_owned = ptr_is_owned(a);
28778         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
28779         a_conv.is_owned = false;
28780         LDKErrorMessage b_conv;
28781         b_conv.inner = untag_ptr(b);
28782         b_conv.is_owned = ptr_is_owned(b);
28783         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
28784         b_conv.is_owned = false;
28785         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
28786         return ret_conv;
28787 }
28788
28789 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
28790         LDKWarningMessage this_obj_conv;
28791         this_obj_conv.inner = untag_ptr(this_obj);
28792         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28794         WarningMessage_free(this_obj_conv);
28795 }
28796
28797 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
28798         LDKWarningMessage this_ptr_conv;
28799         this_ptr_conv.inner = untag_ptr(this_ptr);
28800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28802         this_ptr_conv.is_owned = false;
28803         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28804         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
28805         return ret_arr;
28806 }
28807
28808 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
28809         LDKWarningMessage this_ptr_conv;
28810         this_ptr_conv.inner = untag_ptr(this_ptr);
28811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28813         this_ptr_conv.is_owned = false;
28814         LDKThirtyTwoBytes val_ref;
28815         CHECK(val->arr_len == 32);
28816         memcpy(val_ref.data, val->elems, 32); FREE(val);
28817         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
28818 }
28819
28820 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
28821         LDKWarningMessage this_ptr_conv;
28822         this_ptr_conv.inner = untag_ptr(this_ptr);
28823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28825         this_ptr_conv.is_owned = false;
28826         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
28827         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28828         Str_free(ret_str);
28829         return ret_conv;
28830 }
28831
28832 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
28833         LDKWarningMessage this_ptr_conv;
28834         this_ptr_conv.inner = untag_ptr(this_ptr);
28835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28837         this_ptr_conv.is_owned = false;
28838         LDKStr val_conv = str_ref_to_owned_c(val);
28839         WarningMessage_set_data(&this_ptr_conv, val_conv);
28840 }
28841
28842 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
28843         LDKThirtyTwoBytes channel_id_arg_ref;
28844         CHECK(channel_id_arg->arr_len == 32);
28845         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28846         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
28847         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
28848         uint64_t ret_ref = 0;
28849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28851         return ret_ref;
28852 }
28853
28854 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
28855         LDKWarningMessage ret_var = WarningMessage_clone(arg);
28856         uint64_t ret_ref = 0;
28857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28859         return ret_ref;
28860 }
28861 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
28862         LDKWarningMessage arg_conv;
28863         arg_conv.inner = untag_ptr(arg);
28864         arg_conv.is_owned = ptr_is_owned(arg);
28865         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28866         arg_conv.is_owned = false;
28867         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
28868         return ret_conv;
28869 }
28870
28871 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
28872         LDKWarningMessage orig_conv;
28873         orig_conv.inner = untag_ptr(orig);
28874         orig_conv.is_owned = ptr_is_owned(orig);
28875         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28876         orig_conv.is_owned = false;
28877         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
28878         uint64_t ret_ref = 0;
28879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28881         return ret_ref;
28882 }
28883
28884 jboolean  __attribute__((export_name("TS_WarningMessage_eq"))) TS_WarningMessage_eq(uint64_t a, uint64_t b) {
28885         LDKWarningMessage a_conv;
28886         a_conv.inner = untag_ptr(a);
28887         a_conv.is_owned = ptr_is_owned(a);
28888         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
28889         a_conv.is_owned = false;
28890         LDKWarningMessage b_conv;
28891         b_conv.inner = untag_ptr(b);
28892         b_conv.is_owned = ptr_is_owned(b);
28893         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
28894         b_conv.is_owned = false;
28895         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
28896         return ret_conv;
28897 }
28898
28899 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
28900         LDKPing this_obj_conv;
28901         this_obj_conv.inner = untag_ptr(this_obj);
28902         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28904         Ping_free(this_obj_conv);
28905 }
28906
28907 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
28908         LDKPing this_ptr_conv;
28909         this_ptr_conv.inner = untag_ptr(this_ptr);
28910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28912         this_ptr_conv.is_owned = false;
28913         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
28914         return ret_conv;
28915 }
28916
28917 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
28918         LDKPing this_ptr_conv;
28919         this_ptr_conv.inner = untag_ptr(this_ptr);
28920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28922         this_ptr_conv.is_owned = false;
28923         Ping_set_ponglen(&this_ptr_conv, val);
28924 }
28925
28926 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
28927         LDKPing this_ptr_conv;
28928         this_ptr_conv.inner = untag_ptr(this_ptr);
28929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28931         this_ptr_conv.is_owned = false;
28932         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
28933         return ret_conv;
28934 }
28935
28936 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
28937         LDKPing this_ptr_conv;
28938         this_ptr_conv.inner = untag_ptr(this_ptr);
28939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28941         this_ptr_conv.is_owned = false;
28942         Ping_set_byteslen(&this_ptr_conv, val);
28943 }
28944
28945 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
28946         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
28947         uint64_t ret_ref = 0;
28948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28950         return ret_ref;
28951 }
28952
28953 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
28954         LDKPing ret_var = Ping_clone(arg);
28955         uint64_t ret_ref = 0;
28956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28958         return ret_ref;
28959 }
28960 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
28961         LDKPing arg_conv;
28962         arg_conv.inner = untag_ptr(arg);
28963         arg_conv.is_owned = ptr_is_owned(arg);
28964         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28965         arg_conv.is_owned = false;
28966         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
28967         return ret_conv;
28968 }
28969
28970 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
28971         LDKPing orig_conv;
28972         orig_conv.inner = untag_ptr(orig);
28973         orig_conv.is_owned = ptr_is_owned(orig);
28974         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28975         orig_conv.is_owned = false;
28976         LDKPing ret_var = Ping_clone(&orig_conv);
28977         uint64_t ret_ref = 0;
28978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28980         return ret_ref;
28981 }
28982
28983 jboolean  __attribute__((export_name("TS_Ping_eq"))) TS_Ping_eq(uint64_t a, uint64_t b) {
28984         LDKPing a_conv;
28985         a_conv.inner = untag_ptr(a);
28986         a_conv.is_owned = ptr_is_owned(a);
28987         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
28988         a_conv.is_owned = false;
28989         LDKPing b_conv;
28990         b_conv.inner = untag_ptr(b);
28991         b_conv.is_owned = ptr_is_owned(b);
28992         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
28993         b_conv.is_owned = false;
28994         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
28995         return ret_conv;
28996 }
28997
28998 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
28999         LDKPong this_obj_conv;
29000         this_obj_conv.inner = untag_ptr(this_obj);
29001         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29003         Pong_free(this_obj_conv);
29004 }
29005
29006 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
29007         LDKPong this_ptr_conv;
29008         this_ptr_conv.inner = untag_ptr(this_ptr);
29009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29011         this_ptr_conv.is_owned = false;
29012         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
29013         return ret_conv;
29014 }
29015
29016 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
29017         LDKPong this_ptr_conv;
29018         this_ptr_conv.inner = untag_ptr(this_ptr);
29019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29021         this_ptr_conv.is_owned = false;
29022         Pong_set_byteslen(&this_ptr_conv, val);
29023 }
29024
29025 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
29026         LDKPong ret_var = Pong_new(byteslen_arg);
29027         uint64_t ret_ref = 0;
29028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29030         return ret_ref;
29031 }
29032
29033 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
29034         LDKPong ret_var = Pong_clone(arg);
29035         uint64_t ret_ref = 0;
29036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29038         return ret_ref;
29039 }
29040 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
29041         LDKPong arg_conv;
29042         arg_conv.inner = untag_ptr(arg);
29043         arg_conv.is_owned = ptr_is_owned(arg);
29044         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29045         arg_conv.is_owned = false;
29046         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
29047         return ret_conv;
29048 }
29049
29050 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
29051         LDKPong orig_conv;
29052         orig_conv.inner = untag_ptr(orig);
29053         orig_conv.is_owned = ptr_is_owned(orig);
29054         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29055         orig_conv.is_owned = false;
29056         LDKPong ret_var = Pong_clone(&orig_conv);
29057         uint64_t ret_ref = 0;
29058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29060         return ret_ref;
29061 }
29062
29063 jboolean  __attribute__((export_name("TS_Pong_eq"))) TS_Pong_eq(uint64_t a, uint64_t b) {
29064         LDKPong a_conv;
29065         a_conv.inner = untag_ptr(a);
29066         a_conv.is_owned = ptr_is_owned(a);
29067         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29068         a_conv.is_owned = false;
29069         LDKPong b_conv;
29070         b_conv.inner = untag_ptr(b);
29071         b_conv.is_owned = ptr_is_owned(b);
29072         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29073         b_conv.is_owned = false;
29074         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
29075         return ret_conv;
29076 }
29077
29078 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
29079         LDKOpenChannel this_obj_conv;
29080         this_obj_conv.inner = untag_ptr(this_obj);
29081         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29083         OpenChannel_free(this_obj_conv);
29084 }
29085
29086 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
29087         LDKOpenChannel this_ptr_conv;
29088         this_ptr_conv.inner = untag_ptr(this_ptr);
29089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29091         this_ptr_conv.is_owned = false;
29092         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29093         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
29094         return ret_arr;
29095 }
29096
29097 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
29098         LDKOpenChannel this_ptr_conv;
29099         this_ptr_conv.inner = untag_ptr(this_ptr);
29100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29102         this_ptr_conv.is_owned = false;
29103         LDKThirtyTwoBytes val_ref;
29104         CHECK(val->arr_len == 32);
29105         memcpy(val_ref.data, val->elems, 32); FREE(val);
29106         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
29107 }
29108
29109 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
29110         LDKOpenChannel this_ptr_conv;
29111         this_ptr_conv.inner = untag_ptr(this_ptr);
29112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29114         this_ptr_conv.is_owned = false;
29115         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29116         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
29117         return ret_arr;
29118 }
29119
29120 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
29121         LDKOpenChannel this_ptr_conv;
29122         this_ptr_conv.inner = untag_ptr(this_ptr);
29123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29125         this_ptr_conv.is_owned = false;
29126         LDKThirtyTwoBytes val_ref;
29127         CHECK(val->arr_len == 32);
29128         memcpy(val_ref.data, val->elems, 32); FREE(val);
29129         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
29130 }
29131
29132 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
29133         LDKOpenChannel this_ptr_conv;
29134         this_ptr_conv.inner = untag_ptr(this_ptr);
29135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29137         this_ptr_conv.is_owned = false;
29138         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
29139         return ret_conv;
29140 }
29141
29142 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
29143         LDKOpenChannel this_ptr_conv;
29144         this_ptr_conv.inner = untag_ptr(this_ptr);
29145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29147         this_ptr_conv.is_owned = false;
29148         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
29149 }
29150
29151 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
29152         LDKOpenChannel this_ptr_conv;
29153         this_ptr_conv.inner = untag_ptr(this_ptr);
29154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29156         this_ptr_conv.is_owned = false;
29157         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
29158         return ret_conv;
29159 }
29160
29161 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
29162         LDKOpenChannel this_ptr_conv;
29163         this_ptr_conv.inner = untag_ptr(this_ptr);
29164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29166         this_ptr_conv.is_owned = false;
29167         OpenChannel_set_push_msat(&this_ptr_conv, val);
29168 }
29169
29170 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
29171         LDKOpenChannel this_ptr_conv;
29172         this_ptr_conv.inner = untag_ptr(this_ptr);
29173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29175         this_ptr_conv.is_owned = false;
29176         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
29177         return ret_conv;
29178 }
29179
29180 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
29181         LDKOpenChannel this_ptr_conv;
29182         this_ptr_conv.inner = untag_ptr(this_ptr);
29183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29185         this_ptr_conv.is_owned = false;
29186         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
29187 }
29188
29189 int64_t  __attribute__((export_name("TS_OpenChannel_get_max_htlc_value_in_flight_msat"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint64_t this_ptr) {
29190         LDKOpenChannel this_ptr_conv;
29191         this_ptr_conv.inner = untag_ptr(this_ptr);
29192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29194         this_ptr_conv.is_owned = false;
29195         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
29196         return ret_conv;
29197 }
29198
29199 void  __attribute__((export_name("TS_OpenChannel_set_max_htlc_value_in_flight_msat"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint64_t this_ptr, int64_t val) {
29200         LDKOpenChannel this_ptr_conv;
29201         this_ptr_conv.inner = untag_ptr(this_ptr);
29202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29204         this_ptr_conv.is_owned = false;
29205         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
29206 }
29207
29208 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
29209         LDKOpenChannel this_ptr_conv;
29210         this_ptr_conv.inner = untag_ptr(this_ptr);
29211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29213         this_ptr_conv.is_owned = false;
29214         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
29215         return ret_conv;
29216 }
29217
29218 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
29219         LDKOpenChannel this_ptr_conv;
29220         this_ptr_conv.inner = untag_ptr(this_ptr);
29221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29223         this_ptr_conv.is_owned = false;
29224         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
29225 }
29226
29227 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
29228         LDKOpenChannel this_ptr_conv;
29229         this_ptr_conv.inner = untag_ptr(this_ptr);
29230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29232         this_ptr_conv.is_owned = false;
29233         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
29234         return ret_conv;
29235 }
29236
29237 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
29238         LDKOpenChannel this_ptr_conv;
29239         this_ptr_conv.inner = untag_ptr(this_ptr);
29240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29242         this_ptr_conv.is_owned = false;
29243         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
29244 }
29245
29246 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
29247         LDKOpenChannel this_ptr_conv;
29248         this_ptr_conv.inner = untag_ptr(this_ptr);
29249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29251         this_ptr_conv.is_owned = false;
29252         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
29253         return ret_conv;
29254 }
29255
29256 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
29257         LDKOpenChannel this_ptr_conv;
29258         this_ptr_conv.inner = untag_ptr(this_ptr);
29259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29261         this_ptr_conv.is_owned = false;
29262         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
29263 }
29264
29265 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
29266         LDKOpenChannel this_ptr_conv;
29267         this_ptr_conv.inner = untag_ptr(this_ptr);
29268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29270         this_ptr_conv.is_owned = false;
29271         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
29272         return ret_conv;
29273 }
29274
29275 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
29276         LDKOpenChannel this_ptr_conv;
29277         this_ptr_conv.inner = untag_ptr(this_ptr);
29278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29280         this_ptr_conv.is_owned = false;
29281         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
29282 }
29283
29284 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
29285         LDKOpenChannel this_ptr_conv;
29286         this_ptr_conv.inner = untag_ptr(this_ptr);
29287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29289         this_ptr_conv.is_owned = false;
29290         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
29291         return ret_conv;
29292 }
29293
29294 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
29295         LDKOpenChannel this_ptr_conv;
29296         this_ptr_conv.inner = untag_ptr(this_ptr);
29297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29299         this_ptr_conv.is_owned = false;
29300         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
29301 }
29302
29303 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
29304         LDKOpenChannel this_ptr_conv;
29305         this_ptr_conv.inner = untag_ptr(this_ptr);
29306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29308         this_ptr_conv.is_owned = false;
29309         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29310         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
29311         return ret_arr;
29312 }
29313
29314 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
29315         LDKOpenChannel this_ptr_conv;
29316         this_ptr_conv.inner = untag_ptr(this_ptr);
29317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29319         this_ptr_conv.is_owned = false;
29320         LDKPublicKey val_ref;
29321         CHECK(val->arr_len == 33);
29322         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29323         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
29324 }
29325
29326 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
29327         LDKOpenChannel this_ptr_conv;
29328         this_ptr_conv.inner = untag_ptr(this_ptr);
29329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29331         this_ptr_conv.is_owned = false;
29332         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29333         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
29334         return ret_arr;
29335 }
29336
29337 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
29338         LDKOpenChannel this_ptr_conv;
29339         this_ptr_conv.inner = untag_ptr(this_ptr);
29340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29342         this_ptr_conv.is_owned = false;
29343         LDKPublicKey val_ref;
29344         CHECK(val->arr_len == 33);
29345         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29346         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
29347 }
29348
29349 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
29350         LDKOpenChannel this_ptr_conv;
29351         this_ptr_conv.inner = untag_ptr(this_ptr);
29352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29354         this_ptr_conv.is_owned = false;
29355         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29356         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
29357         return ret_arr;
29358 }
29359
29360 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
29361         LDKOpenChannel this_ptr_conv;
29362         this_ptr_conv.inner = untag_ptr(this_ptr);
29363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29365         this_ptr_conv.is_owned = false;
29366         LDKPublicKey val_ref;
29367         CHECK(val->arr_len == 33);
29368         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29369         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
29370 }
29371
29372 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
29373         LDKOpenChannel this_ptr_conv;
29374         this_ptr_conv.inner = untag_ptr(this_ptr);
29375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29377         this_ptr_conv.is_owned = false;
29378         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29379         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
29380         return ret_arr;
29381 }
29382
29383 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
29384         LDKOpenChannel this_ptr_conv;
29385         this_ptr_conv.inner = untag_ptr(this_ptr);
29386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29388         this_ptr_conv.is_owned = false;
29389         LDKPublicKey val_ref;
29390         CHECK(val->arr_len == 33);
29391         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29392         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
29393 }
29394
29395 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
29396         LDKOpenChannel this_ptr_conv;
29397         this_ptr_conv.inner = untag_ptr(this_ptr);
29398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29400         this_ptr_conv.is_owned = false;
29401         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29402         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
29403         return ret_arr;
29404 }
29405
29406 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
29407         LDKOpenChannel this_ptr_conv;
29408         this_ptr_conv.inner = untag_ptr(this_ptr);
29409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29411         this_ptr_conv.is_owned = false;
29412         LDKPublicKey val_ref;
29413         CHECK(val->arr_len == 33);
29414         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29415         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
29416 }
29417
29418 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
29419         LDKOpenChannel this_ptr_conv;
29420         this_ptr_conv.inner = untag_ptr(this_ptr);
29421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29423         this_ptr_conv.is_owned = false;
29424         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29425         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29426         return ret_arr;
29427 }
29428
29429 void  __attribute__((export_name("TS_OpenChannel_set_first_per_commitment_point"))) TS_OpenChannel_set_first_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
29430         LDKOpenChannel this_ptr_conv;
29431         this_ptr_conv.inner = untag_ptr(this_ptr);
29432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29434         this_ptr_conv.is_owned = false;
29435         LDKPublicKey val_ref;
29436         CHECK(val->arr_len == 33);
29437         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29438         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
29439 }
29440
29441 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
29442         LDKOpenChannel this_ptr_conv;
29443         this_ptr_conv.inner = untag_ptr(this_ptr);
29444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29446         this_ptr_conv.is_owned = false;
29447         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
29448         return ret_conv;
29449 }
29450
29451 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
29452         LDKOpenChannel this_ptr_conv;
29453         this_ptr_conv.inner = untag_ptr(this_ptr);
29454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29456         this_ptr_conv.is_owned = false;
29457         OpenChannel_set_channel_flags(&this_ptr_conv, val);
29458 }
29459
29460 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
29461         LDKOpenChannel this_ptr_conv;
29462         this_ptr_conv.inner = untag_ptr(this_ptr);
29463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29465         this_ptr_conv.is_owned = false;
29466         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
29467         uint64_t ret_ref = 0;
29468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29470         return ret_ref;
29471 }
29472
29473 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
29474         LDKOpenChannel this_ptr_conv;
29475         this_ptr_conv.inner = untag_ptr(this_ptr);
29476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29478         this_ptr_conv.is_owned = false;
29479         LDKChannelTypeFeatures val_conv;
29480         val_conv.inner = untag_ptr(val);
29481         val_conv.is_owned = ptr_is_owned(val);
29482         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29483         val_conv = ChannelTypeFeatures_clone(&val_conv);
29484         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
29485 }
29486
29487 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
29488         LDKOpenChannel ret_var = OpenChannel_clone(arg);
29489         uint64_t ret_ref = 0;
29490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29492         return ret_ref;
29493 }
29494 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
29495         LDKOpenChannel arg_conv;
29496         arg_conv.inner = untag_ptr(arg);
29497         arg_conv.is_owned = ptr_is_owned(arg);
29498         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29499         arg_conv.is_owned = false;
29500         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
29501         return ret_conv;
29502 }
29503
29504 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
29505         LDKOpenChannel orig_conv;
29506         orig_conv.inner = untag_ptr(orig);
29507         orig_conv.is_owned = ptr_is_owned(orig);
29508         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29509         orig_conv.is_owned = false;
29510         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
29511         uint64_t ret_ref = 0;
29512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29514         return ret_ref;
29515 }
29516
29517 jboolean  __attribute__((export_name("TS_OpenChannel_eq"))) TS_OpenChannel_eq(uint64_t a, uint64_t b) {
29518         LDKOpenChannel a_conv;
29519         a_conv.inner = untag_ptr(a);
29520         a_conv.is_owned = ptr_is_owned(a);
29521         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29522         a_conv.is_owned = false;
29523         LDKOpenChannel b_conv;
29524         b_conv.inner = untag_ptr(b);
29525         b_conv.is_owned = ptr_is_owned(b);
29526         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29527         b_conv.is_owned = false;
29528         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
29529         return ret_conv;
29530 }
29531
29532 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
29533         LDKAcceptChannel this_obj_conv;
29534         this_obj_conv.inner = untag_ptr(this_obj);
29535         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29537         AcceptChannel_free(this_obj_conv);
29538 }
29539
29540 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
29541         LDKAcceptChannel this_ptr_conv;
29542         this_ptr_conv.inner = untag_ptr(this_ptr);
29543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29545         this_ptr_conv.is_owned = false;
29546         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29547         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
29548         return ret_arr;
29549 }
29550
29551 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
29552         LDKAcceptChannel this_ptr_conv;
29553         this_ptr_conv.inner = untag_ptr(this_ptr);
29554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29556         this_ptr_conv.is_owned = false;
29557         LDKThirtyTwoBytes val_ref;
29558         CHECK(val->arr_len == 32);
29559         memcpy(val_ref.data, val->elems, 32); FREE(val);
29560         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
29561 }
29562
29563 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
29564         LDKAcceptChannel this_ptr_conv;
29565         this_ptr_conv.inner = untag_ptr(this_ptr);
29566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29568         this_ptr_conv.is_owned = false;
29569         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
29570         return ret_conv;
29571 }
29572
29573 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
29574         LDKAcceptChannel this_ptr_conv;
29575         this_ptr_conv.inner = untag_ptr(this_ptr);
29576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29578         this_ptr_conv.is_owned = false;
29579         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
29580 }
29581
29582 int64_t  __attribute__((export_name("TS_AcceptChannel_get_max_htlc_value_in_flight_msat"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint64_t this_ptr) {
29583         LDKAcceptChannel this_ptr_conv;
29584         this_ptr_conv.inner = untag_ptr(this_ptr);
29585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29587         this_ptr_conv.is_owned = false;
29588         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
29589         return ret_conv;
29590 }
29591
29592 void  __attribute__((export_name("TS_AcceptChannel_set_max_htlc_value_in_flight_msat"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint64_t this_ptr, int64_t val) {
29593         LDKAcceptChannel this_ptr_conv;
29594         this_ptr_conv.inner = untag_ptr(this_ptr);
29595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29597         this_ptr_conv.is_owned = false;
29598         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
29599 }
29600
29601 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
29602         LDKAcceptChannel this_ptr_conv;
29603         this_ptr_conv.inner = untag_ptr(this_ptr);
29604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29606         this_ptr_conv.is_owned = false;
29607         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
29608         return ret_conv;
29609 }
29610
29611 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
29612         LDKAcceptChannel this_ptr_conv;
29613         this_ptr_conv.inner = untag_ptr(this_ptr);
29614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29616         this_ptr_conv.is_owned = false;
29617         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
29618 }
29619
29620 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
29621         LDKAcceptChannel this_ptr_conv;
29622         this_ptr_conv.inner = untag_ptr(this_ptr);
29623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29625         this_ptr_conv.is_owned = false;
29626         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
29627         return ret_conv;
29628 }
29629
29630 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
29631         LDKAcceptChannel this_ptr_conv;
29632         this_ptr_conv.inner = untag_ptr(this_ptr);
29633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29635         this_ptr_conv.is_owned = false;
29636         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
29637 }
29638
29639 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
29640         LDKAcceptChannel this_ptr_conv;
29641         this_ptr_conv.inner = untag_ptr(this_ptr);
29642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29644         this_ptr_conv.is_owned = false;
29645         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
29646         return ret_conv;
29647 }
29648
29649 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t val) {
29650         LDKAcceptChannel this_ptr_conv;
29651         this_ptr_conv.inner = untag_ptr(this_ptr);
29652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29654         this_ptr_conv.is_owned = false;
29655         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
29656 }
29657
29658 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
29659         LDKAcceptChannel this_ptr_conv;
29660         this_ptr_conv.inner = untag_ptr(this_ptr);
29661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29663         this_ptr_conv.is_owned = false;
29664         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
29665         return ret_conv;
29666 }
29667
29668 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
29669         LDKAcceptChannel this_ptr_conv;
29670         this_ptr_conv.inner = untag_ptr(this_ptr);
29671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29673         this_ptr_conv.is_owned = false;
29674         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
29675 }
29676
29677 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
29678         LDKAcceptChannel this_ptr_conv;
29679         this_ptr_conv.inner = untag_ptr(this_ptr);
29680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29682         this_ptr_conv.is_owned = false;
29683         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
29684         return ret_conv;
29685 }
29686
29687 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
29688         LDKAcceptChannel this_ptr_conv;
29689         this_ptr_conv.inner = untag_ptr(this_ptr);
29690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29692         this_ptr_conv.is_owned = false;
29693         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
29694 }
29695
29696 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
29697         LDKAcceptChannel this_ptr_conv;
29698         this_ptr_conv.inner = untag_ptr(this_ptr);
29699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29701         this_ptr_conv.is_owned = false;
29702         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29703         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
29704         return ret_arr;
29705 }
29706
29707 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
29708         LDKAcceptChannel this_ptr_conv;
29709         this_ptr_conv.inner = untag_ptr(this_ptr);
29710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29712         this_ptr_conv.is_owned = false;
29713         LDKPublicKey val_ref;
29714         CHECK(val->arr_len == 33);
29715         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29716         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
29717 }
29718
29719 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
29720         LDKAcceptChannel this_ptr_conv;
29721         this_ptr_conv.inner = untag_ptr(this_ptr);
29722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29724         this_ptr_conv.is_owned = false;
29725         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29726         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
29727         return ret_arr;
29728 }
29729
29730 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
29731         LDKAcceptChannel this_ptr_conv;
29732         this_ptr_conv.inner = untag_ptr(this_ptr);
29733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29735         this_ptr_conv.is_owned = false;
29736         LDKPublicKey val_ref;
29737         CHECK(val->arr_len == 33);
29738         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29739         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
29740 }
29741
29742 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
29743         LDKAcceptChannel this_ptr_conv;
29744         this_ptr_conv.inner = untag_ptr(this_ptr);
29745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29747         this_ptr_conv.is_owned = false;
29748         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29749         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
29750         return ret_arr;
29751 }
29752
29753 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
29754         LDKAcceptChannel this_ptr_conv;
29755         this_ptr_conv.inner = untag_ptr(this_ptr);
29756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29758         this_ptr_conv.is_owned = false;
29759         LDKPublicKey val_ref;
29760         CHECK(val->arr_len == 33);
29761         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29762         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
29763 }
29764
29765 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
29766         LDKAcceptChannel this_ptr_conv;
29767         this_ptr_conv.inner = untag_ptr(this_ptr);
29768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29770         this_ptr_conv.is_owned = false;
29771         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29772         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
29773         return ret_arr;
29774 }
29775
29776 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
29777         LDKAcceptChannel this_ptr_conv;
29778         this_ptr_conv.inner = untag_ptr(this_ptr);
29779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29781         this_ptr_conv.is_owned = false;
29782         LDKPublicKey val_ref;
29783         CHECK(val->arr_len == 33);
29784         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29785         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
29786 }
29787
29788 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
29789         LDKAcceptChannel this_ptr_conv;
29790         this_ptr_conv.inner = untag_ptr(this_ptr);
29791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29793         this_ptr_conv.is_owned = false;
29794         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29795         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
29796         return ret_arr;
29797 }
29798
29799 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
29800         LDKAcceptChannel this_ptr_conv;
29801         this_ptr_conv.inner = untag_ptr(this_ptr);
29802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29804         this_ptr_conv.is_owned = false;
29805         LDKPublicKey val_ref;
29806         CHECK(val->arr_len == 33);
29807         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29808         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
29809 }
29810
29811 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
29812         LDKAcceptChannel this_ptr_conv;
29813         this_ptr_conv.inner = untag_ptr(this_ptr);
29814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29816         this_ptr_conv.is_owned = false;
29817         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29818         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29819         return ret_arr;
29820 }
29821
29822 void  __attribute__((export_name("TS_AcceptChannel_set_first_per_commitment_point"))) TS_AcceptChannel_set_first_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
29823         LDKAcceptChannel this_ptr_conv;
29824         this_ptr_conv.inner = untag_ptr(this_ptr);
29825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29827         this_ptr_conv.is_owned = false;
29828         LDKPublicKey val_ref;
29829         CHECK(val->arr_len == 33);
29830         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29831         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
29832 }
29833
29834 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
29835         LDKAcceptChannel this_ptr_conv;
29836         this_ptr_conv.inner = untag_ptr(this_ptr);
29837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29839         this_ptr_conv.is_owned = false;
29840         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
29841         uint64_t ret_ref = 0;
29842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29844         return ret_ref;
29845 }
29846
29847 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
29848         LDKAcceptChannel this_ptr_conv;
29849         this_ptr_conv.inner = untag_ptr(this_ptr);
29850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29852         this_ptr_conv.is_owned = false;
29853         LDKChannelTypeFeatures val_conv;
29854         val_conv.inner = untag_ptr(val);
29855         val_conv.is_owned = ptr_is_owned(val);
29856         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29857         val_conv = ChannelTypeFeatures_clone(&val_conv);
29858         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
29859 }
29860
29861 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
29862         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
29863         uint64_t ret_ref = 0;
29864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29866         return ret_ref;
29867 }
29868 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
29869         LDKAcceptChannel arg_conv;
29870         arg_conv.inner = untag_ptr(arg);
29871         arg_conv.is_owned = ptr_is_owned(arg);
29872         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29873         arg_conv.is_owned = false;
29874         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
29875         return ret_conv;
29876 }
29877
29878 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
29879         LDKAcceptChannel orig_conv;
29880         orig_conv.inner = untag_ptr(orig);
29881         orig_conv.is_owned = ptr_is_owned(orig);
29882         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29883         orig_conv.is_owned = false;
29884         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
29885         uint64_t ret_ref = 0;
29886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29888         return ret_ref;
29889 }
29890
29891 jboolean  __attribute__((export_name("TS_AcceptChannel_eq"))) TS_AcceptChannel_eq(uint64_t a, uint64_t b) {
29892         LDKAcceptChannel a_conv;
29893         a_conv.inner = untag_ptr(a);
29894         a_conv.is_owned = ptr_is_owned(a);
29895         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29896         a_conv.is_owned = false;
29897         LDKAcceptChannel b_conv;
29898         b_conv.inner = untag_ptr(b);
29899         b_conv.is_owned = ptr_is_owned(b);
29900         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29901         b_conv.is_owned = false;
29902         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
29903         return ret_conv;
29904 }
29905
29906 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
29907         LDKFundingCreated this_obj_conv;
29908         this_obj_conv.inner = untag_ptr(this_obj);
29909         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29911         FundingCreated_free(this_obj_conv);
29912 }
29913
29914 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
29915         LDKFundingCreated this_ptr_conv;
29916         this_ptr_conv.inner = untag_ptr(this_ptr);
29917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29919         this_ptr_conv.is_owned = false;
29920         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29921         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
29922         return ret_arr;
29923 }
29924
29925 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
29926         LDKFundingCreated this_ptr_conv;
29927         this_ptr_conv.inner = untag_ptr(this_ptr);
29928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29930         this_ptr_conv.is_owned = false;
29931         LDKThirtyTwoBytes val_ref;
29932         CHECK(val->arr_len == 32);
29933         memcpy(val_ref.data, val->elems, 32); FREE(val);
29934         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
29935 }
29936
29937 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
29938         LDKFundingCreated this_ptr_conv;
29939         this_ptr_conv.inner = untag_ptr(this_ptr);
29940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29942         this_ptr_conv.is_owned = false;
29943         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29944         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
29945         return ret_arr;
29946 }
29947
29948 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
29949         LDKFundingCreated this_ptr_conv;
29950         this_ptr_conv.inner = untag_ptr(this_ptr);
29951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29953         this_ptr_conv.is_owned = false;
29954         LDKThirtyTwoBytes val_ref;
29955         CHECK(val->arr_len == 32);
29956         memcpy(val_ref.data, val->elems, 32); FREE(val);
29957         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
29958 }
29959
29960 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
29961         LDKFundingCreated this_ptr_conv;
29962         this_ptr_conv.inner = untag_ptr(this_ptr);
29963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29965         this_ptr_conv.is_owned = false;
29966         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
29967         return ret_conv;
29968 }
29969
29970 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
29971         LDKFundingCreated this_ptr_conv;
29972         this_ptr_conv.inner = untag_ptr(this_ptr);
29973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29975         this_ptr_conv.is_owned = false;
29976         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
29977 }
29978
29979 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
29980         LDKFundingCreated this_ptr_conv;
29981         this_ptr_conv.inner = untag_ptr(this_ptr);
29982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29984         this_ptr_conv.is_owned = false;
29985         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29986         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
29987         return ret_arr;
29988 }
29989
29990 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
29991         LDKFundingCreated this_ptr_conv;
29992         this_ptr_conv.inner = untag_ptr(this_ptr);
29993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29995         this_ptr_conv.is_owned = false;
29996         LDKSignature val_ref;
29997         CHECK(val->arr_len == 64);
29998         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29999         FundingCreated_set_signature(&this_ptr_conv, val_ref);
30000 }
30001
30002 uint64_t  __attribute__((export_name("TS_FundingCreated_new"))) TS_FundingCreated_new(int8_tArray temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
30003         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
30004         CHECK(temporary_channel_id_arg->arr_len == 32);
30005         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
30006         LDKThirtyTwoBytes funding_txid_arg_ref;
30007         CHECK(funding_txid_arg->arr_len == 32);
30008         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
30009         LDKSignature signature_arg_ref;
30010         CHECK(signature_arg->arr_len == 64);
30011         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
30012         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
30013         uint64_t ret_ref = 0;
30014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30016         return ret_ref;
30017 }
30018
30019 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
30020         LDKFundingCreated ret_var = FundingCreated_clone(arg);
30021         uint64_t ret_ref = 0;
30022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30024         return ret_ref;
30025 }
30026 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
30027         LDKFundingCreated arg_conv;
30028         arg_conv.inner = untag_ptr(arg);
30029         arg_conv.is_owned = ptr_is_owned(arg);
30030         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30031         arg_conv.is_owned = false;
30032         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
30033         return ret_conv;
30034 }
30035
30036 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
30037         LDKFundingCreated orig_conv;
30038         orig_conv.inner = untag_ptr(orig);
30039         orig_conv.is_owned = ptr_is_owned(orig);
30040         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30041         orig_conv.is_owned = false;
30042         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
30043         uint64_t ret_ref = 0;
30044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30046         return ret_ref;
30047 }
30048
30049 jboolean  __attribute__((export_name("TS_FundingCreated_eq"))) TS_FundingCreated_eq(uint64_t a, uint64_t b) {
30050         LDKFundingCreated a_conv;
30051         a_conv.inner = untag_ptr(a);
30052         a_conv.is_owned = ptr_is_owned(a);
30053         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30054         a_conv.is_owned = false;
30055         LDKFundingCreated b_conv;
30056         b_conv.inner = untag_ptr(b);
30057         b_conv.is_owned = ptr_is_owned(b);
30058         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30059         b_conv.is_owned = false;
30060         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
30061         return ret_conv;
30062 }
30063
30064 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
30065         LDKFundingSigned this_obj_conv;
30066         this_obj_conv.inner = untag_ptr(this_obj);
30067         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30069         FundingSigned_free(this_obj_conv);
30070 }
30071
30072 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
30073         LDKFundingSigned this_ptr_conv;
30074         this_ptr_conv.inner = untag_ptr(this_ptr);
30075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30077         this_ptr_conv.is_owned = false;
30078         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30079         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
30080         return ret_arr;
30081 }
30082
30083 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30084         LDKFundingSigned this_ptr_conv;
30085         this_ptr_conv.inner = untag_ptr(this_ptr);
30086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30088         this_ptr_conv.is_owned = false;
30089         LDKThirtyTwoBytes val_ref;
30090         CHECK(val->arr_len == 32);
30091         memcpy(val_ref.data, val->elems, 32); FREE(val);
30092         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
30093 }
30094
30095 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
30096         LDKFundingSigned this_ptr_conv;
30097         this_ptr_conv.inner = untag_ptr(this_ptr);
30098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30100         this_ptr_conv.is_owned = false;
30101         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30102         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
30103         return ret_arr;
30104 }
30105
30106 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
30107         LDKFundingSigned this_ptr_conv;
30108         this_ptr_conv.inner = untag_ptr(this_ptr);
30109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30111         this_ptr_conv.is_owned = false;
30112         LDKSignature val_ref;
30113         CHECK(val->arr_len == 64);
30114         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30115         FundingSigned_set_signature(&this_ptr_conv, val_ref);
30116 }
30117
30118 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
30119         LDKThirtyTwoBytes channel_id_arg_ref;
30120         CHECK(channel_id_arg->arr_len == 32);
30121         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30122         LDKSignature signature_arg_ref;
30123         CHECK(signature_arg->arr_len == 64);
30124         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
30125         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
30126         uint64_t ret_ref = 0;
30127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30129         return ret_ref;
30130 }
30131
30132 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
30133         LDKFundingSigned ret_var = FundingSigned_clone(arg);
30134         uint64_t ret_ref = 0;
30135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30137         return ret_ref;
30138 }
30139 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
30140         LDKFundingSigned arg_conv;
30141         arg_conv.inner = untag_ptr(arg);
30142         arg_conv.is_owned = ptr_is_owned(arg);
30143         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30144         arg_conv.is_owned = false;
30145         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
30146         return ret_conv;
30147 }
30148
30149 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
30150         LDKFundingSigned orig_conv;
30151         orig_conv.inner = untag_ptr(orig);
30152         orig_conv.is_owned = ptr_is_owned(orig);
30153         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30154         orig_conv.is_owned = false;
30155         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
30156         uint64_t ret_ref = 0;
30157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30159         return ret_ref;
30160 }
30161
30162 jboolean  __attribute__((export_name("TS_FundingSigned_eq"))) TS_FundingSigned_eq(uint64_t a, uint64_t b) {
30163         LDKFundingSigned a_conv;
30164         a_conv.inner = untag_ptr(a);
30165         a_conv.is_owned = ptr_is_owned(a);
30166         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30167         a_conv.is_owned = false;
30168         LDKFundingSigned b_conv;
30169         b_conv.inner = untag_ptr(b);
30170         b_conv.is_owned = ptr_is_owned(b);
30171         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30172         b_conv.is_owned = false;
30173         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
30174         return ret_conv;
30175 }
30176
30177 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
30178         LDKChannelReady this_obj_conv;
30179         this_obj_conv.inner = untag_ptr(this_obj);
30180         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30182         ChannelReady_free(this_obj_conv);
30183 }
30184
30185 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
30186         LDKChannelReady this_ptr_conv;
30187         this_ptr_conv.inner = untag_ptr(this_ptr);
30188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30190         this_ptr_conv.is_owned = false;
30191         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30192         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
30193         return ret_arr;
30194 }
30195
30196 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30197         LDKChannelReady this_ptr_conv;
30198         this_ptr_conv.inner = untag_ptr(this_ptr);
30199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30201         this_ptr_conv.is_owned = false;
30202         LDKThirtyTwoBytes val_ref;
30203         CHECK(val->arr_len == 32);
30204         memcpy(val_ref.data, val->elems, 32); FREE(val);
30205         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
30206 }
30207
30208 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
30209         LDKChannelReady this_ptr_conv;
30210         this_ptr_conv.inner = untag_ptr(this_ptr);
30211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30213         this_ptr_conv.is_owned = false;
30214         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30215         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
30216         return ret_arr;
30217 }
30218
30219 void  __attribute__((export_name("TS_ChannelReady_set_next_per_commitment_point"))) TS_ChannelReady_set_next_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
30220         LDKChannelReady this_ptr_conv;
30221         this_ptr_conv.inner = untag_ptr(this_ptr);
30222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30224         this_ptr_conv.is_owned = false;
30225         LDKPublicKey val_ref;
30226         CHECK(val->arr_len == 33);
30227         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30228         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
30229 }
30230
30231 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
30232         LDKChannelReady this_ptr_conv;
30233         this_ptr_conv.inner = untag_ptr(this_ptr);
30234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30236         this_ptr_conv.is_owned = false;
30237         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30238         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
30239         uint64_t ret_ref = tag_ptr(ret_copy, true);
30240         return ret_ref;
30241 }
30242
30243 void  __attribute__((export_name("TS_ChannelReady_set_short_channel_id_alias"))) TS_ChannelReady_set_short_channel_id_alias(uint64_t this_ptr, uint64_t val) {
30244         LDKChannelReady this_ptr_conv;
30245         this_ptr_conv.inner = untag_ptr(this_ptr);
30246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30248         this_ptr_conv.is_owned = false;
30249         void* val_ptr = untag_ptr(val);
30250         CHECK_ACCESS(val_ptr);
30251         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
30252         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
30253         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
30254 }
30255
30256 uint64_t  __attribute__((export_name("TS_ChannelReady_new"))) TS_ChannelReady_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg, uint64_t short_channel_id_alias_arg) {
30257         LDKThirtyTwoBytes channel_id_arg_ref;
30258         CHECK(channel_id_arg->arr_len == 32);
30259         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30260         LDKPublicKey next_per_commitment_point_arg_ref;
30261         CHECK(next_per_commitment_point_arg->arr_len == 33);
30262         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
30263         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
30264         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
30265         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
30266         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
30267         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
30268         uint64_t ret_ref = 0;
30269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30271         return ret_ref;
30272 }
30273
30274 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
30275         LDKChannelReady ret_var = ChannelReady_clone(arg);
30276         uint64_t ret_ref = 0;
30277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30279         return ret_ref;
30280 }
30281 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
30282         LDKChannelReady arg_conv;
30283         arg_conv.inner = untag_ptr(arg);
30284         arg_conv.is_owned = ptr_is_owned(arg);
30285         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30286         arg_conv.is_owned = false;
30287         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
30288         return ret_conv;
30289 }
30290
30291 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
30292         LDKChannelReady orig_conv;
30293         orig_conv.inner = untag_ptr(orig);
30294         orig_conv.is_owned = ptr_is_owned(orig);
30295         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30296         orig_conv.is_owned = false;
30297         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
30298         uint64_t ret_ref = 0;
30299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30301         return ret_ref;
30302 }
30303
30304 jboolean  __attribute__((export_name("TS_ChannelReady_eq"))) TS_ChannelReady_eq(uint64_t a, uint64_t b) {
30305         LDKChannelReady a_conv;
30306         a_conv.inner = untag_ptr(a);
30307         a_conv.is_owned = ptr_is_owned(a);
30308         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30309         a_conv.is_owned = false;
30310         LDKChannelReady b_conv;
30311         b_conv.inner = untag_ptr(b);
30312         b_conv.is_owned = ptr_is_owned(b);
30313         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30314         b_conv.is_owned = false;
30315         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
30316         return ret_conv;
30317 }
30318
30319 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
30320         LDKShutdown this_obj_conv;
30321         this_obj_conv.inner = untag_ptr(this_obj);
30322         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30324         Shutdown_free(this_obj_conv);
30325 }
30326
30327 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
30328         LDKShutdown this_ptr_conv;
30329         this_ptr_conv.inner = untag_ptr(this_ptr);
30330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30332         this_ptr_conv.is_owned = false;
30333         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30334         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
30335         return ret_arr;
30336 }
30337
30338 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30339         LDKShutdown this_ptr_conv;
30340         this_ptr_conv.inner = untag_ptr(this_ptr);
30341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30343         this_ptr_conv.is_owned = false;
30344         LDKThirtyTwoBytes val_ref;
30345         CHECK(val->arr_len == 32);
30346         memcpy(val_ref.data, val->elems, 32); FREE(val);
30347         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
30348 }
30349
30350 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
30351         LDKShutdown this_ptr_conv;
30352         this_ptr_conv.inner = untag_ptr(this_ptr);
30353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30355         this_ptr_conv.is_owned = false;
30356         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
30357         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30358         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30359         return ret_arr;
30360 }
30361
30362 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
30363         LDKShutdown this_ptr_conv;
30364         this_ptr_conv.inner = untag_ptr(this_ptr);
30365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30367         this_ptr_conv.is_owned = false;
30368         LDKCVec_u8Z val_ref;
30369         val_ref.datalen = val->arr_len;
30370         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
30371         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
30372         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
30373 }
30374
30375 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
30376         LDKThirtyTwoBytes channel_id_arg_ref;
30377         CHECK(channel_id_arg->arr_len == 32);
30378         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30379         LDKCVec_u8Z scriptpubkey_arg_ref;
30380         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
30381         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
30382         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
30383         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
30384         uint64_t ret_ref = 0;
30385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30387         return ret_ref;
30388 }
30389
30390 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
30391         LDKShutdown ret_var = Shutdown_clone(arg);
30392         uint64_t ret_ref = 0;
30393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30395         return ret_ref;
30396 }
30397 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
30398         LDKShutdown arg_conv;
30399         arg_conv.inner = untag_ptr(arg);
30400         arg_conv.is_owned = ptr_is_owned(arg);
30401         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30402         arg_conv.is_owned = false;
30403         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
30404         return ret_conv;
30405 }
30406
30407 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
30408         LDKShutdown orig_conv;
30409         orig_conv.inner = untag_ptr(orig);
30410         orig_conv.is_owned = ptr_is_owned(orig);
30411         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30412         orig_conv.is_owned = false;
30413         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
30414         uint64_t ret_ref = 0;
30415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30417         return ret_ref;
30418 }
30419
30420 jboolean  __attribute__((export_name("TS_Shutdown_eq"))) TS_Shutdown_eq(uint64_t a, uint64_t b) {
30421         LDKShutdown a_conv;
30422         a_conv.inner = untag_ptr(a);
30423         a_conv.is_owned = ptr_is_owned(a);
30424         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30425         a_conv.is_owned = false;
30426         LDKShutdown b_conv;
30427         b_conv.inner = untag_ptr(b);
30428         b_conv.is_owned = ptr_is_owned(b);
30429         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30430         b_conv.is_owned = false;
30431         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
30432         return ret_conv;
30433 }
30434
30435 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
30436         LDKClosingSignedFeeRange this_obj_conv;
30437         this_obj_conv.inner = untag_ptr(this_obj);
30438         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30440         ClosingSignedFeeRange_free(this_obj_conv);
30441 }
30442
30443 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
30444         LDKClosingSignedFeeRange this_ptr_conv;
30445         this_ptr_conv.inner = untag_ptr(this_ptr);
30446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30448         this_ptr_conv.is_owned = false;
30449         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
30450         return ret_conv;
30451 }
30452
30453 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
30454         LDKClosingSignedFeeRange this_ptr_conv;
30455         this_ptr_conv.inner = untag_ptr(this_ptr);
30456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30458         this_ptr_conv.is_owned = false;
30459         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
30460 }
30461
30462 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
30463         LDKClosingSignedFeeRange this_ptr_conv;
30464         this_ptr_conv.inner = untag_ptr(this_ptr);
30465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30467         this_ptr_conv.is_owned = false;
30468         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
30469         return ret_conv;
30470 }
30471
30472 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
30473         LDKClosingSignedFeeRange this_ptr_conv;
30474         this_ptr_conv.inner = untag_ptr(this_ptr);
30475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30477         this_ptr_conv.is_owned = false;
30478         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
30479 }
30480
30481 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
30482         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
30483         uint64_t ret_ref = 0;
30484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30486         return ret_ref;
30487 }
30488
30489 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
30490         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
30491         uint64_t ret_ref = 0;
30492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30494         return ret_ref;
30495 }
30496 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
30497         LDKClosingSignedFeeRange arg_conv;
30498         arg_conv.inner = untag_ptr(arg);
30499         arg_conv.is_owned = ptr_is_owned(arg);
30500         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30501         arg_conv.is_owned = false;
30502         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
30503         return ret_conv;
30504 }
30505
30506 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
30507         LDKClosingSignedFeeRange orig_conv;
30508         orig_conv.inner = untag_ptr(orig);
30509         orig_conv.is_owned = ptr_is_owned(orig);
30510         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30511         orig_conv.is_owned = false;
30512         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
30513         uint64_t ret_ref = 0;
30514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30516         return ret_ref;
30517 }
30518
30519 jboolean  __attribute__((export_name("TS_ClosingSignedFeeRange_eq"))) TS_ClosingSignedFeeRange_eq(uint64_t a, uint64_t b) {
30520         LDKClosingSignedFeeRange a_conv;
30521         a_conv.inner = untag_ptr(a);
30522         a_conv.is_owned = ptr_is_owned(a);
30523         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30524         a_conv.is_owned = false;
30525         LDKClosingSignedFeeRange b_conv;
30526         b_conv.inner = untag_ptr(b);
30527         b_conv.is_owned = ptr_is_owned(b);
30528         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30529         b_conv.is_owned = false;
30530         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
30531         return ret_conv;
30532 }
30533
30534 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
30535         LDKClosingSigned this_obj_conv;
30536         this_obj_conv.inner = untag_ptr(this_obj);
30537         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30539         ClosingSigned_free(this_obj_conv);
30540 }
30541
30542 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
30543         LDKClosingSigned this_ptr_conv;
30544         this_ptr_conv.inner = untag_ptr(this_ptr);
30545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30547         this_ptr_conv.is_owned = false;
30548         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30549         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
30550         return ret_arr;
30551 }
30552
30553 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30554         LDKClosingSigned this_ptr_conv;
30555         this_ptr_conv.inner = untag_ptr(this_ptr);
30556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30558         this_ptr_conv.is_owned = false;
30559         LDKThirtyTwoBytes val_ref;
30560         CHECK(val->arr_len == 32);
30561         memcpy(val_ref.data, val->elems, 32); FREE(val);
30562         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
30563 }
30564
30565 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
30566         LDKClosingSigned this_ptr_conv;
30567         this_ptr_conv.inner = untag_ptr(this_ptr);
30568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30570         this_ptr_conv.is_owned = false;
30571         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
30572         return ret_conv;
30573 }
30574
30575 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
30576         LDKClosingSigned this_ptr_conv;
30577         this_ptr_conv.inner = untag_ptr(this_ptr);
30578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30580         this_ptr_conv.is_owned = false;
30581         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
30582 }
30583
30584 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
30585         LDKClosingSigned this_ptr_conv;
30586         this_ptr_conv.inner = untag_ptr(this_ptr);
30587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30589         this_ptr_conv.is_owned = false;
30590         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30591         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
30592         return ret_arr;
30593 }
30594
30595 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
30596         LDKClosingSigned this_ptr_conv;
30597         this_ptr_conv.inner = untag_ptr(this_ptr);
30598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30600         this_ptr_conv.is_owned = false;
30601         LDKSignature val_ref;
30602         CHECK(val->arr_len == 64);
30603         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30604         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
30605 }
30606
30607 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
30608         LDKClosingSigned this_ptr_conv;
30609         this_ptr_conv.inner = untag_ptr(this_ptr);
30610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30612         this_ptr_conv.is_owned = false;
30613         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
30614         uint64_t ret_ref = 0;
30615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30617         return ret_ref;
30618 }
30619
30620 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
30621         LDKClosingSigned this_ptr_conv;
30622         this_ptr_conv.inner = untag_ptr(this_ptr);
30623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30625         this_ptr_conv.is_owned = false;
30626         LDKClosingSignedFeeRange val_conv;
30627         val_conv.inner = untag_ptr(val);
30628         val_conv.is_owned = ptr_is_owned(val);
30629         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30630         val_conv = ClosingSignedFeeRange_clone(&val_conv);
30631         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
30632 }
30633
30634 uint64_t  __attribute__((export_name("TS_ClosingSigned_new"))) TS_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, uint64_t fee_range_arg) {
30635         LDKThirtyTwoBytes channel_id_arg_ref;
30636         CHECK(channel_id_arg->arr_len == 32);
30637         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30638         LDKSignature signature_arg_ref;
30639         CHECK(signature_arg->arr_len == 64);
30640         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
30641         LDKClosingSignedFeeRange fee_range_arg_conv;
30642         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
30643         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
30644         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
30645         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
30646         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
30647         uint64_t ret_ref = 0;
30648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30650         return ret_ref;
30651 }
30652
30653 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
30654         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
30655         uint64_t ret_ref = 0;
30656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30658         return ret_ref;
30659 }
30660 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
30661         LDKClosingSigned arg_conv;
30662         arg_conv.inner = untag_ptr(arg);
30663         arg_conv.is_owned = ptr_is_owned(arg);
30664         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30665         arg_conv.is_owned = false;
30666         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
30667         return ret_conv;
30668 }
30669
30670 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
30671         LDKClosingSigned orig_conv;
30672         orig_conv.inner = untag_ptr(orig);
30673         orig_conv.is_owned = ptr_is_owned(orig);
30674         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30675         orig_conv.is_owned = false;
30676         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
30677         uint64_t ret_ref = 0;
30678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30680         return ret_ref;
30681 }
30682
30683 jboolean  __attribute__((export_name("TS_ClosingSigned_eq"))) TS_ClosingSigned_eq(uint64_t a, uint64_t b) {
30684         LDKClosingSigned a_conv;
30685         a_conv.inner = untag_ptr(a);
30686         a_conv.is_owned = ptr_is_owned(a);
30687         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30688         a_conv.is_owned = false;
30689         LDKClosingSigned b_conv;
30690         b_conv.inner = untag_ptr(b);
30691         b_conv.is_owned = ptr_is_owned(b);
30692         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30693         b_conv.is_owned = false;
30694         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
30695         return ret_conv;
30696 }
30697
30698 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
30699         LDKUpdateAddHTLC this_obj_conv;
30700         this_obj_conv.inner = untag_ptr(this_obj);
30701         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30703         UpdateAddHTLC_free(this_obj_conv);
30704 }
30705
30706 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
30707         LDKUpdateAddHTLC this_ptr_conv;
30708         this_ptr_conv.inner = untag_ptr(this_ptr);
30709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30711         this_ptr_conv.is_owned = false;
30712         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30713         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
30714         return ret_arr;
30715 }
30716
30717 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30718         LDKUpdateAddHTLC this_ptr_conv;
30719         this_ptr_conv.inner = untag_ptr(this_ptr);
30720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30722         this_ptr_conv.is_owned = false;
30723         LDKThirtyTwoBytes val_ref;
30724         CHECK(val->arr_len == 32);
30725         memcpy(val_ref.data, val->elems, 32); FREE(val);
30726         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
30727 }
30728
30729 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
30730         LDKUpdateAddHTLC this_ptr_conv;
30731         this_ptr_conv.inner = untag_ptr(this_ptr);
30732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30734         this_ptr_conv.is_owned = false;
30735         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
30736         return ret_conv;
30737 }
30738
30739 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
30740         LDKUpdateAddHTLC this_ptr_conv;
30741         this_ptr_conv.inner = untag_ptr(this_ptr);
30742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30744         this_ptr_conv.is_owned = false;
30745         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
30746 }
30747
30748 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
30749         LDKUpdateAddHTLC this_ptr_conv;
30750         this_ptr_conv.inner = untag_ptr(this_ptr);
30751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30753         this_ptr_conv.is_owned = false;
30754         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
30755         return ret_conv;
30756 }
30757
30758 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
30759         LDKUpdateAddHTLC this_ptr_conv;
30760         this_ptr_conv.inner = untag_ptr(this_ptr);
30761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30763         this_ptr_conv.is_owned = false;
30764         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
30765 }
30766
30767 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
30768         LDKUpdateAddHTLC this_ptr_conv;
30769         this_ptr_conv.inner = untag_ptr(this_ptr);
30770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30772         this_ptr_conv.is_owned = false;
30773         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30774         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
30775         return ret_arr;
30776 }
30777
30778 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
30779         LDKUpdateAddHTLC this_ptr_conv;
30780         this_ptr_conv.inner = untag_ptr(this_ptr);
30781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30783         this_ptr_conv.is_owned = false;
30784         LDKThirtyTwoBytes val_ref;
30785         CHECK(val->arr_len == 32);
30786         memcpy(val_ref.data, val->elems, 32); FREE(val);
30787         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
30788 }
30789
30790 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
30791         LDKUpdateAddHTLC this_ptr_conv;
30792         this_ptr_conv.inner = untag_ptr(this_ptr);
30793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30795         this_ptr_conv.is_owned = false;
30796         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
30797         return ret_conv;
30798 }
30799
30800 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
30801         LDKUpdateAddHTLC this_ptr_conv;
30802         this_ptr_conv.inner = untag_ptr(this_ptr);
30803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30805         this_ptr_conv.is_owned = false;
30806         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
30807 }
30808
30809 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
30810         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
30811         uint64_t ret_ref = 0;
30812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30814         return ret_ref;
30815 }
30816 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
30817         LDKUpdateAddHTLC arg_conv;
30818         arg_conv.inner = untag_ptr(arg);
30819         arg_conv.is_owned = ptr_is_owned(arg);
30820         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30821         arg_conv.is_owned = false;
30822         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
30823         return ret_conv;
30824 }
30825
30826 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
30827         LDKUpdateAddHTLC orig_conv;
30828         orig_conv.inner = untag_ptr(orig);
30829         orig_conv.is_owned = ptr_is_owned(orig);
30830         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30831         orig_conv.is_owned = false;
30832         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
30833         uint64_t ret_ref = 0;
30834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30836         return ret_ref;
30837 }
30838
30839 jboolean  __attribute__((export_name("TS_UpdateAddHTLC_eq"))) TS_UpdateAddHTLC_eq(uint64_t a, uint64_t b) {
30840         LDKUpdateAddHTLC a_conv;
30841         a_conv.inner = untag_ptr(a);
30842         a_conv.is_owned = ptr_is_owned(a);
30843         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30844         a_conv.is_owned = false;
30845         LDKUpdateAddHTLC b_conv;
30846         b_conv.inner = untag_ptr(b);
30847         b_conv.is_owned = ptr_is_owned(b);
30848         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30849         b_conv.is_owned = false;
30850         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
30851         return ret_conv;
30852 }
30853
30854 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
30855         LDKOnionMessage this_obj_conv;
30856         this_obj_conv.inner = untag_ptr(this_obj);
30857         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30859         OnionMessage_free(this_obj_conv);
30860 }
30861
30862 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
30863         LDKOnionMessage this_ptr_conv;
30864         this_ptr_conv.inner = untag_ptr(this_ptr);
30865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30867         this_ptr_conv.is_owned = false;
30868         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30869         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
30870         return ret_arr;
30871 }
30872
30873 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
30874         LDKOnionMessage this_ptr_conv;
30875         this_ptr_conv.inner = untag_ptr(this_ptr);
30876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30878         this_ptr_conv.is_owned = false;
30879         LDKPublicKey val_ref;
30880         CHECK(val->arr_len == 33);
30881         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30882         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
30883 }
30884
30885 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
30886         LDKOnionMessage ret_var = OnionMessage_clone(arg);
30887         uint64_t ret_ref = 0;
30888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30890         return ret_ref;
30891 }
30892 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
30893         LDKOnionMessage arg_conv;
30894         arg_conv.inner = untag_ptr(arg);
30895         arg_conv.is_owned = ptr_is_owned(arg);
30896         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30897         arg_conv.is_owned = false;
30898         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
30899         return ret_conv;
30900 }
30901
30902 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
30903         LDKOnionMessage orig_conv;
30904         orig_conv.inner = untag_ptr(orig);
30905         orig_conv.is_owned = ptr_is_owned(orig);
30906         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30907         orig_conv.is_owned = false;
30908         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
30909         uint64_t ret_ref = 0;
30910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30912         return ret_ref;
30913 }
30914
30915 jboolean  __attribute__((export_name("TS_OnionMessage_eq"))) TS_OnionMessage_eq(uint64_t a, uint64_t b) {
30916         LDKOnionMessage a_conv;
30917         a_conv.inner = untag_ptr(a);
30918         a_conv.is_owned = ptr_is_owned(a);
30919         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30920         a_conv.is_owned = false;
30921         LDKOnionMessage b_conv;
30922         b_conv.inner = untag_ptr(b);
30923         b_conv.is_owned = ptr_is_owned(b);
30924         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30925         b_conv.is_owned = false;
30926         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
30927         return ret_conv;
30928 }
30929
30930 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
30931         LDKUpdateFulfillHTLC this_obj_conv;
30932         this_obj_conv.inner = untag_ptr(this_obj);
30933         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30935         UpdateFulfillHTLC_free(this_obj_conv);
30936 }
30937
30938 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
30939         LDKUpdateFulfillHTLC this_ptr_conv;
30940         this_ptr_conv.inner = untag_ptr(this_ptr);
30941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30943         this_ptr_conv.is_owned = false;
30944         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30945         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
30946         return ret_arr;
30947 }
30948
30949 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30950         LDKUpdateFulfillHTLC this_ptr_conv;
30951         this_ptr_conv.inner = untag_ptr(this_ptr);
30952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30954         this_ptr_conv.is_owned = false;
30955         LDKThirtyTwoBytes val_ref;
30956         CHECK(val->arr_len == 32);
30957         memcpy(val_ref.data, val->elems, 32); FREE(val);
30958         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
30959 }
30960
30961 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
30962         LDKUpdateFulfillHTLC this_ptr_conv;
30963         this_ptr_conv.inner = untag_ptr(this_ptr);
30964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30966         this_ptr_conv.is_owned = false;
30967         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
30968         return ret_conv;
30969 }
30970
30971 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
30972         LDKUpdateFulfillHTLC this_ptr_conv;
30973         this_ptr_conv.inner = untag_ptr(this_ptr);
30974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30976         this_ptr_conv.is_owned = false;
30977         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
30978 }
30979
30980 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
30981         LDKUpdateFulfillHTLC this_ptr_conv;
30982         this_ptr_conv.inner = untag_ptr(this_ptr);
30983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30985         this_ptr_conv.is_owned = false;
30986         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30987         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
30988         return ret_arr;
30989 }
30990
30991 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
30992         LDKUpdateFulfillHTLC this_ptr_conv;
30993         this_ptr_conv.inner = untag_ptr(this_ptr);
30994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30996         this_ptr_conv.is_owned = false;
30997         LDKThirtyTwoBytes val_ref;
30998         CHECK(val->arr_len == 32);
30999         memcpy(val_ref.data, val->elems, 32); FREE(val);
31000         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
31001 }
31002
31003 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_new"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
31004         LDKThirtyTwoBytes channel_id_arg_ref;
31005         CHECK(channel_id_arg->arr_len == 32);
31006         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31007         LDKThirtyTwoBytes payment_preimage_arg_ref;
31008         CHECK(payment_preimage_arg->arr_len == 32);
31009         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
31010         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
31011         uint64_t ret_ref = 0;
31012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31014         return ret_ref;
31015 }
31016
31017 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
31018         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
31019         uint64_t ret_ref = 0;
31020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31022         return ret_ref;
31023 }
31024 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
31025         LDKUpdateFulfillHTLC arg_conv;
31026         arg_conv.inner = untag_ptr(arg);
31027         arg_conv.is_owned = ptr_is_owned(arg);
31028         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31029         arg_conv.is_owned = false;
31030         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
31031         return ret_conv;
31032 }
31033
31034 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
31035         LDKUpdateFulfillHTLC orig_conv;
31036         orig_conv.inner = untag_ptr(orig);
31037         orig_conv.is_owned = ptr_is_owned(orig);
31038         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31039         orig_conv.is_owned = false;
31040         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
31041         uint64_t ret_ref = 0;
31042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31044         return ret_ref;
31045 }
31046
31047 jboolean  __attribute__((export_name("TS_UpdateFulfillHTLC_eq"))) TS_UpdateFulfillHTLC_eq(uint64_t a, uint64_t b) {
31048         LDKUpdateFulfillHTLC a_conv;
31049         a_conv.inner = untag_ptr(a);
31050         a_conv.is_owned = ptr_is_owned(a);
31051         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31052         a_conv.is_owned = false;
31053         LDKUpdateFulfillHTLC b_conv;
31054         b_conv.inner = untag_ptr(b);
31055         b_conv.is_owned = ptr_is_owned(b);
31056         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31057         b_conv.is_owned = false;
31058         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
31059         return ret_conv;
31060 }
31061
31062 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
31063         LDKUpdateFailHTLC this_obj_conv;
31064         this_obj_conv.inner = untag_ptr(this_obj);
31065         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31067         UpdateFailHTLC_free(this_obj_conv);
31068 }
31069
31070 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
31071         LDKUpdateFailHTLC this_ptr_conv;
31072         this_ptr_conv.inner = untag_ptr(this_ptr);
31073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31075         this_ptr_conv.is_owned = false;
31076         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31077         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
31078         return ret_arr;
31079 }
31080
31081 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31082         LDKUpdateFailHTLC this_ptr_conv;
31083         this_ptr_conv.inner = untag_ptr(this_ptr);
31084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31086         this_ptr_conv.is_owned = false;
31087         LDKThirtyTwoBytes val_ref;
31088         CHECK(val->arr_len == 32);
31089         memcpy(val_ref.data, val->elems, 32); FREE(val);
31090         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
31091 }
31092
31093 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
31094         LDKUpdateFailHTLC this_ptr_conv;
31095         this_ptr_conv.inner = untag_ptr(this_ptr);
31096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31098         this_ptr_conv.is_owned = false;
31099         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
31100         return ret_conv;
31101 }
31102
31103 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
31104         LDKUpdateFailHTLC this_ptr_conv;
31105         this_ptr_conv.inner = untag_ptr(this_ptr);
31106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31108         this_ptr_conv.is_owned = false;
31109         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
31110 }
31111
31112 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
31113         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
31114         uint64_t ret_ref = 0;
31115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31117         return ret_ref;
31118 }
31119 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
31120         LDKUpdateFailHTLC arg_conv;
31121         arg_conv.inner = untag_ptr(arg);
31122         arg_conv.is_owned = ptr_is_owned(arg);
31123         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31124         arg_conv.is_owned = false;
31125         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
31126         return ret_conv;
31127 }
31128
31129 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
31130         LDKUpdateFailHTLC orig_conv;
31131         orig_conv.inner = untag_ptr(orig);
31132         orig_conv.is_owned = ptr_is_owned(orig);
31133         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31134         orig_conv.is_owned = false;
31135         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
31136         uint64_t ret_ref = 0;
31137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31139         return ret_ref;
31140 }
31141
31142 jboolean  __attribute__((export_name("TS_UpdateFailHTLC_eq"))) TS_UpdateFailHTLC_eq(uint64_t a, uint64_t b) {
31143         LDKUpdateFailHTLC a_conv;
31144         a_conv.inner = untag_ptr(a);
31145         a_conv.is_owned = ptr_is_owned(a);
31146         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31147         a_conv.is_owned = false;
31148         LDKUpdateFailHTLC b_conv;
31149         b_conv.inner = untag_ptr(b);
31150         b_conv.is_owned = ptr_is_owned(b);
31151         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31152         b_conv.is_owned = false;
31153         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
31154         return ret_conv;
31155 }
31156
31157 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
31158         LDKUpdateFailMalformedHTLC this_obj_conv;
31159         this_obj_conv.inner = untag_ptr(this_obj);
31160         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31162         UpdateFailMalformedHTLC_free(this_obj_conv);
31163 }
31164
31165 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
31166         LDKUpdateFailMalformedHTLC this_ptr_conv;
31167         this_ptr_conv.inner = untag_ptr(this_ptr);
31168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31170         this_ptr_conv.is_owned = false;
31171         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31172         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
31173         return ret_arr;
31174 }
31175
31176 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31177         LDKUpdateFailMalformedHTLC this_ptr_conv;
31178         this_ptr_conv.inner = untag_ptr(this_ptr);
31179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31181         this_ptr_conv.is_owned = false;
31182         LDKThirtyTwoBytes val_ref;
31183         CHECK(val->arr_len == 32);
31184         memcpy(val_ref.data, val->elems, 32); FREE(val);
31185         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
31186 }
31187
31188 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
31189         LDKUpdateFailMalformedHTLC this_ptr_conv;
31190         this_ptr_conv.inner = untag_ptr(this_ptr);
31191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31193         this_ptr_conv.is_owned = false;
31194         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
31195         return ret_conv;
31196 }
31197
31198 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
31199         LDKUpdateFailMalformedHTLC this_ptr_conv;
31200         this_ptr_conv.inner = untag_ptr(this_ptr);
31201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31203         this_ptr_conv.is_owned = false;
31204         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
31205 }
31206
31207 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
31208         LDKUpdateFailMalformedHTLC this_ptr_conv;
31209         this_ptr_conv.inner = untag_ptr(this_ptr);
31210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31212         this_ptr_conv.is_owned = false;
31213         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
31214         return ret_conv;
31215 }
31216
31217 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
31218         LDKUpdateFailMalformedHTLC this_ptr_conv;
31219         this_ptr_conv.inner = untag_ptr(this_ptr);
31220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31222         this_ptr_conv.is_owned = false;
31223         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
31224 }
31225
31226 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
31227         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
31228         uint64_t ret_ref = 0;
31229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31231         return ret_ref;
31232 }
31233 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
31234         LDKUpdateFailMalformedHTLC arg_conv;
31235         arg_conv.inner = untag_ptr(arg);
31236         arg_conv.is_owned = ptr_is_owned(arg);
31237         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31238         arg_conv.is_owned = false;
31239         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
31240         return ret_conv;
31241 }
31242
31243 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
31244         LDKUpdateFailMalformedHTLC orig_conv;
31245         orig_conv.inner = untag_ptr(orig);
31246         orig_conv.is_owned = ptr_is_owned(orig);
31247         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31248         orig_conv.is_owned = false;
31249         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
31250         uint64_t ret_ref = 0;
31251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31253         return ret_ref;
31254 }
31255
31256 jboolean  __attribute__((export_name("TS_UpdateFailMalformedHTLC_eq"))) TS_UpdateFailMalformedHTLC_eq(uint64_t a, uint64_t b) {
31257         LDKUpdateFailMalformedHTLC a_conv;
31258         a_conv.inner = untag_ptr(a);
31259         a_conv.is_owned = ptr_is_owned(a);
31260         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31261         a_conv.is_owned = false;
31262         LDKUpdateFailMalformedHTLC b_conv;
31263         b_conv.inner = untag_ptr(b);
31264         b_conv.is_owned = ptr_is_owned(b);
31265         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31266         b_conv.is_owned = false;
31267         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
31268         return ret_conv;
31269 }
31270
31271 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
31272         LDKCommitmentSigned this_obj_conv;
31273         this_obj_conv.inner = untag_ptr(this_obj);
31274         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31276         CommitmentSigned_free(this_obj_conv);
31277 }
31278
31279 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
31280         LDKCommitmentSigned this_ptr_conv;
31281         this_ptr_conv.inner = untag_ptr(this_ptr);
31282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31284         this_ptr_conv.is_owned = false;
31285         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31286         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
31287         return ret_arr;
31288 }
31289
31290 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31291         LDKCommitmentSigned this_ptr_conv;
31292         this_ptr_conv.inner = untag_ptr(this_ptr);
31293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31295         this_ptr_conv.is_owned = false;
31296         LDKThirtyTwoBytes val_ref;
31297         CHECK(val->arr_len == 32);
31298         memcpy(val_ref.data, val->elems, 32); FREE(val);
31299         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
31300 }
31301
31302 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
31303         LDKCommitmentSigned this_ptr_conv;
31304         this_ptr_conv.inner = untag_ptr(this_ptr);
31305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31307         this_ptr_conv.is_owned = false;
31308         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31309         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
31310         return ret_arr;
31311 }
31312
31313 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
31314         LDKCommitmentSigned this_ptr_conv;
31315         this_ptr_conv.inner = untag_ptr(this_ptr);
31316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31318         this_ptr_conv.is_owned = false;
31319         LDKSignature val_ref;
31320         CHECK(val->arr_len == 64);
31321         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31322         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
31323 }
31324
31325 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
31326         LDKCommitmentSigned this_ptr_conv;
31327         this_ptr_conv.inner = untag_ptr(this_ptr);
31328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31330         this_ptr_conv.is_owned = false;
31331         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
31332         ptrArray ret_arr = NULL;
31333         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
31334         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
31335         for (size_t m = 0; m < ret_var.datalen; m++) {
31336                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
31337                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
31338                 ret_arr_ptr[m] = ret_conv_12_arr;
31339         }
31340         
31341         FREE(ret_var.data);
31342         return ret_arr;
31343 }
31344
31345 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
31346         LDKCommitmentSigned this_ptr_conv;
31347         this_ptr_conv.inner = untag_ptr(this_ptr);
31348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31350         this_ptr_conv.is_owned = false;
31351         LDKCVec_SignatureZ val_constr;
31352         val_constr.datalen = val->arr_len;
31353         if (val_constr.datalen > 0)
31354                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
31355         else
31356                 val_constr.data = NULL;
31357         int8_tArray* val_vals = (void*) val->elems;
31358         for (size_t m = 0; m < val_constr.datalen; m++) {
31359                 int8_tArray val_conv_12 = val_vals[m];
31360                 LDKSignature val_conv_12_ref;
31361                 CHECK(val_conv_12->arr_len == 64);
31362                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
31363                 val_constr.data[m] = val_conv_12_ref;
31364         }
31365         FREE(val);
31366         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
31367 }
31368
31369 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
31370         LDKThirtyTwoBytes channel_id_arg_ref;
31371         CHECK(channel_id_arg->arr_len == 32);
31372         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31373         LDKSignature signature_arg_ref;
31374         CHECK(signature_arg->arr_len == 64);
31375         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31376         LDKCVec_SignatureZ htlc_signatures_arg_constr;
31377         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
31378         if (htlc_signatures_arg_constr.datalen > 0)
31379                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
31380         else
31381                 htlc_signatures_arg_constr.data = NULL;
31382         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
31383         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
31384                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
31385                 LDKSignature htlc_signatures_arg_conv_12_ref;
31386                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
31387                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
31388                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
31389         }
31390         FREE(htlc_signatures_arg);
31391         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
31392         uint64_t ret_ref = 0;
31393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31395         return ret_ref;
31396 }
31397
31398 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
31399         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
31400         uint64_t ret_ref = 0;
31401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31403         return ret_ref;
31404 }
31405 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
31406         LDKCommitmentSigned arg_conv;
31407         arg_conv.inner = untag_ptr(arg);
31408         arg_conv.is_owned = ptr_is_owned(arg);
31409         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31410         arg_conv.is_owned = false;
31411         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
31412         return ret_conv;
31413 }
31414
31415 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
31416         LDKCommitmentSigned orig_conv;
31417         orig_conv.inner = untag_ptr(orig);
31418         orig_conv.is_owned = ptr_is_owned(orig);
31419         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31420         orig_conv.is_owned = false;
31421         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
31422         uint64_t ret_ref = 0;
31423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31425         return ret_ref;
31426 }
31427
31428 jboolean  __attribute__((export_name("TS_CommitmentSigned_eq"))) TS_CommitmentSigned_eq(uint64_t a, uint64_t b) {
31429         LDKCommitmentSigned a_conv;
31430         a_conv.inner = untag_ptr(a);
31431         a_conv.is_owned = ptr_is_owned(a);
31432         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31433         a_conv.is_owned = false;
31434         LDKCommitmentSigned b_conv;
31435         b_conv.inner = untag_ptr(b);
31436         b_conv.is_owned = ptr_is_owned(b);
31437         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31438         b_conv.is_owned = false;
31439         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
31440         return ret_conv;
31441 }
31442
31443 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
31444         LDKRevokeAndACK this_obj_conv;
31445         this_obj_conv.inner = untag_ptr(this_obj);
31446         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31448         RevokeAndACK_free(this_obj_conv);
31449 }
31450
31451 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
31452         LDKRevokeAndACK this_ptr_conv;
31453         this_ptr_conv.inner = untag_ptr(this_ptr);
31454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31456         this_ptr_conv.is_owned = false;
31457         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31458         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
31459         return ret_arr;
31460 }
31461
31462 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31463         LDKRevokeAndACK this_ptr_conv;
31464         this_ptr_conv.inner = untag_ptr(this_ptr);
31465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31467         this_ptr_conv.is_owned = false;
31468         LDKThirtyTwoBytes val_ref;
31469         CHECK(val->arr_len == 32);
31470         memcpy(val_ref.data, val->elems, 32); FREE(val);
31471         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
31472 }
31473
31474 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
31475         LDKRevokeAndACK this_ptr_conv;
31476         this_ptr_conv.inner = untag_ptr(this_ptr);
31477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31479         this_ptr_conv.is_owned = false;
31480         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31481         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
31482         return ret_arr;
31483 }
31484
31485 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
31486         LDKRevokeAndACK this_ptr_conv;
31487         this_ptr_conv.inner = untag_ptr(this_ptr);
31488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31490         this_ptr_conv.is_owned = false;
31491         LDKThirtyTwoBytes val_ref;
31492         CHECK(val->arr_len == 32);
31493         memcpy(val_ref.data, val->elems, 32); FREE(val);
31494         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
31495 }
31496
31497 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
31498         LDKRevokeAndACK this_ptr_conv;
31499         this_ptr_conv.inner = untag_ptr(this_ptr);
31500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31502         this_ptr_conv.is_owned = false;
31503         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31504         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31505         return ret_arr;
31506 }
31507
31508 void  __attribute__((export_name("TS_RevokeAndACK_set_next_per_commitment_point"))) TS_RevokeAndACK_set_next_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
31509         LDKRevokeAndACK this_ptr_conv;
31510         this_ptr_conv.inner = untag_ptr(this_ptr);
31511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31513         this_ptr_conv.is_owned = false;
31514         LDKPublicKey val_ref;
31515         CHECK(val->arr_len == 33);
31516         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31517         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
31518 }
31519
31520 uint64_t  __attribute__((export_name("TS_RevokeAndACK_new"))) TS_RevokeAndACK_new(int8_tArray channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
31521         LDKThirtyTwoBytes channel_id_arg_ref;
31522         CHECK(channel_id_arg->arr_len == 32);
31523         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31524         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
31525         CHECK(per_commitment_secret_arg->arr_len == 32);
31526         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
31527         LDKPublicKey next_per_commitment_point_arg_ref;
31528         CHECK(next_per_commitment_point_arg->arr_len == 33);
31529         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
31530         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
31531         uint64_t ret_ref = 0;
31532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31534         return ret_ref;
31535 }
31536
31537 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
31538         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
31539         uint64_t ret_ref = 0;
31540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31542         return ret_ref;
31543 }
31544 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
31545         LDKRevokeAndACK arg_conv;
31546         arg_conv.inner = untag_ptr(arg);
31547         arg_conv.is_owned = ptr_is_owned(arg);
31548         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31549         arg_conv.is_owned = false;
31550         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
31551         return ret_conv;
31552 }
31553
31554 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
31555         LDKRevokeAndACK orig_conv;
31556         orig_conv.inner = untag_ptr(orig);
31557         orig_conv.is_owned = ptr_is_owned(orig);
31558         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31559         orig_conv.is_owned = false;
31560         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
31561         uint64_t ret_ref = 0;
31562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31564         return ret_ref;
31565 }
31566
31567 jboolean  __attribute__((export_name("TS_RevokeAndACK_eq"))) TS_RevokeAndACK_eq(uint64_t a, uint64_t b) {
31568         LDKRevokeAndACK a_conv;
31569         a_conv.inner = untag_ptr(a);
31570         a_conv.is_owned = ptr_is_owned(a);
31571         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31572         a_conv.is_owned = false;
31573         LDKRevokeAndACK b_conv;
31574         b_conv.inner = untag_ptr(b);
31575         b_conv.is_owned = ptr_is_owned(b);
31576         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31577         b_conv.is_owned = false;
31578         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
31579         return ret_conv;
31580 }
31581
31582 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
31583         LDKUpdateFee this_obj_conv;
31584         this_obj_conv.inner = untag_ptr(this_obj);
31585         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31587         UpdateFee_free(this_obj_conv);
31588 }
31589
31590 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
31591         LDKUpdateFee this_ptr_conv;
31592         this_ptr_conv.inner = untag_ptr(this_ptr);
31593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31595         this_ptr_conv.is_owned = false;
31596         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31597         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
31598         return ret_arr;
31599 }
31600
31601 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31602         LDKUpdateFee this_ptr_conv;
31603         this_ptr_conv.inner = untag_ptr(this_ptr);
31604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31606         this_ptr_conv.is_owned = false;
31607         LDKThirtyTwoBytes val_ref;
31608         CHECK(val->arr_len == 32);
31609         memcpy(val_ref.data, val->elems, 32); FREE(val);
31610         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
31611 }
31612
31613 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
31614         LDKUpdateFee this_ptr_conv;
31615         this_ptr_conv.inner = untag_ptr(this_ptr);
31616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31618         this_ptr_conv.is_owned = false;
31619         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
31620         return ret_conv;
31621 }
31622
31623 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
31624         LDKUpdateFee this_ptr_conv;
31625         this_ptr_conv.inner = untag_ptr(this_ptr);
31626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31628         this_ptr_conv.is_owned = false;
31629         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
31630 }
31631
31632 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
31633         LDKThirtyTwoBytes channel_id_arg_ref;
31634         CHECK(channel_id_arg->arr_len == 32);
31635         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31636         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
31637         uint64_t ret_ref = 0;
31638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31640         return ret_ref;
31641 }
31642
31643 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
31644         LDKUpdateFee ret_var = UpdateFee_clone(arg);
31645         uint64_t ret_ref = 0;
31646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31648         return ret_ref;
31649 }
31650 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
31651         LDKUpdateFee arg_conv;
31652         arg_conv.inner = untag_ptr(arg);
31653         arg_conv.is_owned = ptr_is_owned(arg);
31654         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31655         arg_conv.is_owned = false;
31656         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
31657         return ret_conv;
31658 }
31659
31660 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
31661         LDKUpdateFee orig_conv;
31662         orig_conv.inner = untag_ptr(orig);
31663         orig_conv.is_owned = ptr_is_owned(orig);
31664         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31665         orig_conv.is_owned = false;
31666         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
31667         uint64_t ret_ref = 0;
31668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31670         return ret_ref;
31671 }
31672
31673 jboolean  __attribute__((export_name("TS_UpdateFee_eq"))) TS_UpdateFee_eq(uint64_t a, uint64_t b) {
31674         LDKUpdateFee a_conv;
31675         a_conv.inner = untag_ptr(a);
31676         a_conv.is_owned = ptr_is_owned(a);
31677         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31678         a_conv.is_owned = false;
31679         LDKUpdateFee b_conv;
31680         b_conv.inner = untag_ptr(b);
31681         b_conv.is_owned = ptr_is_owned(b);
31682         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31683         b_conv.is_owned = false;
31684         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
31685         return ret_conv;
31686 }
31687
31688 void  __attribute__((export_name("TS_DataLossProtect_free"))) TS_DataLossProtect_free(uint64_t this_obj) {
31689         LDKDataLossProtect this_obj_conv;
31690         this_obj_conv.inner = untag_ptr(this_obj);
31691         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31693         DataLossProtect_free(this_obj_conv);
31694 }
31695
31696 int8_tArray  __attribute__((export_name("TS_DataLossProtect_get_your_last_per_commitment_secret"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint64_t this_ptr) {
31697         LDKDataLossProtect this_ptr_conv;
31698         this_ptr_conv.inner = untag_ptr(this_ptr);
31699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31701         this_ptr_conv.is_owned = false;
31702         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31703         memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
31704         return ret_arr;
31705 }
31706
31707 void  __attribute__((export_name("TS_DataLossProtect_set_your_last_per_commitment_secret"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
31708         LDKDataLossProtect this_ptr_conv;
31709         this_ptr_conv.inner = untag_ptr(this_ptr);
31710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31712         this_ptr_conv.is_owned = false;
31713         LDKThirtyTwoBytes val_ref;
31714         CHECK(val->arr_len == 32);
31715         memcpy(val_ref.data, val->elems, 32); FREE(val);
31716         DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
31717 }
31718
31719 int8_tArray  __attribute__((export_name("TS_DataLossProtect_get_my_current_per_commitment_point"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint64_t this_ptr) {
31720         LDKDataLossProtect this_ptr_conv;
31721         this_ptr_conv.inner = untag_ptr(this_ptr);
31722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31724         this_ptr_conv.is_owned = false;
31725         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31726         memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31727         return ret_arr;
31728 }
31729
31730 void  __attribute__((export_name("TS_DataLossProtect_set_my_current_per_commitment_point"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
31731         LDKDataLossProtect this_ptr_conv;
31732         this_ptr_conv.inner = untag_ptr(this_ptr);
31733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31735         this_ptr_conv.is_owned = false;
31736         LDKPublicKey val_ref;
31737         CHECK(val->arr_len == 33);
31738         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31739         DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
31740 }
31741
31742 uint64_t  __attribute__((export_name("TS_DataLossProtect_new"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
31743         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
31744         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
31745         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
31746         LDKPublicKey my_current_per_commitment_point_arg_ref;
31747         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
31748         memcpy(my_current_per_commitment_point_arg_ref.compressed_form, my_current_per_commitment_point_arg->elems, 33); FREE(my_current_per_commitment_point_arg);
31749         LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
31750         uint64_t ret_ref = 0;
31751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31753         return ret_ref;
31754 }
31755
31756 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
31757         LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
31758         uint64_t ret_ref = 0;
31759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31761         return ret_ref;
31762 }
31763 int64_t  __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint64_t arg) {
31764         LDKDataLossProtect arg_conv;
31765         arg_conv.inner = untag_ptr(arg);
31766         arg_conv.is_owned = ptr_is_owned(arg);
31767         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31768         arg_conv.is_owned = false;
31769         int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
31770         return ret_conv;
31771 }
31772
31773 uint64_t  __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint64_t orig) {
31774         LDKDataLossProtect orig_conv;
31775         orig_conv.inner = untag_ptr(orig);
31776         orig_conv.is_owned = ptr_is_owned(orig);
31777         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31778         orig_conv.is_owned = false;
31779         LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
31780         uint64_t ret_ref = 0;
31781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31783         return ret_ref;
31784 }
31785
31786 jboolean  __attribute__((export_name("TS_DataLossProtect_eq"))) TS_DataLossProtect_eq(uint64_t a, uint64_t b) {
31787         LDKDataLossProtect a_conv;
31788         a_conv.inner = untag_ptr(a);
31789         a_conv.is_owned = ptr_is_owned(a);
31790         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31791         a_conv.is_owned = false;
31792         LDKDataLossProtect b_conv;
31793         b_conv.inner = untag_ptr(b);
31794         b_conv.is_owned = ptr_is_owned(b);
31795         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31796         b_conv.is_owned = false;
31797         jboolean ret_conv = DataLossProtect_eq(&a_conv, &b_conv);
31798         return ret_conv;
31799 }
31800
31801 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
31802         LDKChannelReestablish this_obj_conv;
31803         this_obj_conv.inner = untag_ptr(this_obj);
31804         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31806         ChannelReestablish_free(this_obj_conv);
31807 }
31808
31809 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
31810         LDKChannelReestablish this_ptr_conv;
31811         this_ptr_conv.inner = untag_ptr(this_ptr);
31812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31814         this_ptr_conv.is_owned = false;
31815         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31816         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
31817         return ret_arr;
31818 }
31819
31820 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31821         LDKChannelReestablish this_ptr_conv;
31822         this_ptr_conv.inner = untag_ptr(this_ptr);
31823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31825         this_ptr_conv.is_owned = false;
31826         LDKThirtyTwoBytes val_ref;
31827         CHECK(val->arr_len == 32);
31828         memcpy(val_ref.data, val->elems, 32); FREE(val);
31829         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
31830 }
31831
31832 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
31833         LDKChannelReestablish this_ptr_conv;
31834         this_ptr_conv.inner = untag_ptr(this_ptr);
31835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31837         this_ptr_conv.is_owned = false;
31838         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
31839         return ret_conv;
31840 }
31841
31842 void  __attribute__((export_name("TS_ChannelReestablish_set_next_local_commitment_number"))) TS_ChannelReestablish_set_next_local_commitment_number(uint64_t this_ptr, int64_t val) {
31843         LDKChannelReestablish this_ptr_conv;
31844         this_ptr_conv.inner = untag_ptr(this_ptr);
31845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31847         this_ptr_conv.is_owned = false;
31848         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
31849 }
31850
31851 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
31852         LDKChannelReestablish this_ptr_conv;
31853         this_ptr_conv.inner = untag_ptr(this_ptr);
31854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31856         this_ptr_conv.is_owned = false;
31857         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
31858         return ret_conv;
31859 }
31860
31861 void  __attribute__((export_name("TS_ChannelReestablish_set_next_remote_commitment_number"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint64_t this_ptr, int64_t val) {
31862         LDKChannelReestablish this_ptr_conv;
31863         this_ptr_conv.inner = untag_ptr(this_ptr);
31864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31866         this_ptr_conv.is_owned = false;
31867         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
31868 }
31869
31870 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
31871         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
31872         uint64_t ret_ref = 0;
31873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31875         return ret_ref;
31876 }
31877 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
31878         LDKChannelReestablish arg_conv;
31879         arg_conv.inner = untag_ptr(arg);
31880         arg_conv.is_owned = ptr_is_owned(arg);
31881         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31882         arg_conv.is_owned = false;
31883         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
31884         return ret_conv;
31885 }
31886
31887 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
31888         LDKChannelReestablish orig_conv;
31889         orig_conv.inner = untag_ptr(orig);
31890         orig_conv.is_owned = ptr_is_owned(orig);
31891         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31892         orig_conv.is_owned = false;
31893         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
31894         uint64_t ret_ref = 0;
31895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31897         return ret_ref;
31898 }
31899
31900 jboolean  __attribute__((export_name("TS_ChannelReestablish_eq"))) TS_ChannelReestablish_eq(uint64_t a, uint64_t b) {
31901         LDKChannelReestablish a_conv;
31902         a_conv.inner = untag_ptr(a);
31903         a_conv.is_owned = ptr_is_owned(a);
31904         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31905         a_conv.is_owned = false;
31906         LDKChannelReestablish b_conv;
31907         b_conv.inner = untag_ptr(b);
31908         b_conv.is_owned = ptr_is_owned(b);
31909         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31910         b_conv.is_owned = false;
31911         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
31912         return ret_conv;
31913 }
31914
31915 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
31916         LDKAnnouncementSignatures this_obj_conv;
31917         this_obj_conv.inner = untag_ptr(this_obj);
31918         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31920         AnnouncementSignatures_free(this_obj_conv);
31921 }
31922
31923 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
31924         LDKAnnouncementSignatures this_ptr_conv;
31925         this_ptr_conv.inner = untag_ptr(this_ptr);
31926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31928         this_ptr_conv.is_owned = false;
31929         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31930         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
31931         return ret_arr;
31932 }
31933
31934 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31935         LDKAnnouncementSignatures this_ptr_conv;
31936         this_ptr_conv.inner = untag_ptr(this_ptr);
31937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31939         this_ptr_conv.is_owned = false;
31940         LDKThirtyTwoBytes val_ref;
31941         CHECK(val->arr_len == 32);
31942         memcpy(val_ref.data, val->elems, 32); FREE(val);
31943         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
31944 }
31945
31946 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
31947         LDKAnnouncementSignatures this_ptr_conv;
31948         this_ptr_conv.inner = untag_ptr(this_ptr);
31949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31951         this_ptr_conv.is_owned = false;
31952         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
31953         return ret_conv;
31954 }
31955
31956 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
31957         LDKAnnouncementSignatures this_ptr_conv;
31958         this_ptr_conv.inner = untag_ptr(this_ptr);
31959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31961         this_ptr_conv.is_owned = false;
31962         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
31963 }
31964
31965 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
31966         LDKAnnouncementSignatures this_ptr_conv;
31967         this_ptr_conv.inner = untag_ptr(this_ptr);
31968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31970         this_ptr_conv.is_owned = false;
31971         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31972         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
31973         return ret_arr;
31974 }
31975
31976 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
31977         LDKAnnouncementSignatures this_ptr_conv;
31978         this_ptr_conv.inner = untag_ptr(this_ptr);
31979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31981         this_ptr_conv.is_owned = false;
31982         LDKSignature val_ref;
31983         CHECK(val->arr_len == 64);
31984         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31985         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
31986 }
31987
31988 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
31989         LDKAnnouncementSignatures this_ptr_conv;
31990         this_ptr_conv.inner = untag_ptr(this_ptr);
31991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31993         this_ptr_conv.is_owned = false;
31994         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31995         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
31996         return ret_arr;
31997 }
31998
31999 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
32000         LDKAnnouncementSignatures this_ptr_conv;
32001         this_ptr_conv.inner = untag_ptr(this_ptr);
32002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32004         this_ptr_conv.is_owned = false;
32005         LDKSignature val_ref;
32006         CHECK(val->arr_len == 64);
32007         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32008         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
32009 }
32010
32011 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_new"))) TS_AnnouncementSignatures_new(int8_tArray channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
32012         LDKThirtyTwoBytes channel_id_arg_ref;
32013         CHECK(channel_id_arg->arr_len == 32);
32014         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32015         LDKSignature node_signature_arg_ref;
32016         CHECK(node_signature_arg->arr_len == 64);
32017         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
32018         LDKSignature bitcoin_signature_arg_ref;
32019         CHECK(bitcoin_signature_arg->arr_len == 64);
32020         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
32021         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
32022         uint64_t ret_ref = 0;
32023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32025         return ret_ref;
32026 }
32027
32028 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
32029         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
32030         uint64_t ret_ref = 0;
32031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32033         return ret_ref;
32034 }
32035 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
32036         LDKAnnouncementSignatures arg_conv;
32037         arg_conv.inner = untag_ptr(arg);
32038         arg_conv.is_owned = ptr_is_owned(arg);
32039         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32040         arg_conv.is_owned = false;
32041         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
32042         return ret_conv;
32043 }
32044
32045 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
32046         LDKAnnouncementSignatures orig_conv;
32047         orig_conv.inner = untag_ptr(orig);
32048         orig_conv.is_owned = ptr_is_owned(orig);
32049         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32050         orig_conv.is_owned = false;
32051         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
32052         uint64_t ret_ref = 0;
32053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32055         return ret_ref;
32056 }
32057
32058 jboolean  __attribute__((export_name("TS_AnnouncementSignatures_eq"))) TS_AnnouncementSignatures_eq(uint64_t a, uint64_t b) {
32059         LDKAnnouncementSignatures a_conv;
32060         a_conv.inner = untag_ptr(a);
32061         a_conv.is_owned = ptr_is_owned(a);
32062         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32063         a_conv.is_owned = false;
32064         LDKAnnouncementSignatures b_conv;
32065         b_conv.inner = untag_ptr(b);
32066         b_conv.is_owned = ptr_is_owned(b);
32067         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32068         b_conv.is_owned = false;
32069         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
32070         return ret_conv;
32071 }
32072
32073 void  __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint64_t this_ptr) {
32074         if (!ptr_is_owned(this_ptr)) return;
32075         void* this_ptr_ptr = untag_ptr(this_ptr);
32076         CHECK_ACCESS(this_ptr_ptr);
32077         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
32078         FREE(untag_ptr(this_ptr));
32079         NetAddress_free(this_ptr_conv);
32080 }
32081
32082 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
32083         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32084         *ret_copy = NetAddress_clone(arg);
32085         uint64_t ret_ref = tag_ptr(ret_copy, true);
32086         return ret_ref;
32087 }
32088 int64_t  __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint64_t arg) {
32089         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
32090         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
32091         return ret_conv;
32092 }
32093
32094 uint64_t  __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint64_t orig) {
32095         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
32096         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32097         *ret_copy = NetAddress_clone(orig_conv);
32098         uint64_t ret_ref = tag_ptr(ret_copy, true);
32099         return ret_ref;
32100 }
32101
32102 uint64_t  __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
32103         LDKFourBytes addr_ref;
32104         CHECK(addr->arr_len == 4);
32105         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
32106         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32107         *ret_copy = NetAddress_ipv4(addr_ref, port);
32108         uint64_t ret_ref = tag_ptr(ret_copy, true);
32109         return ret_ref;
32110 }
32111
32112 uint64_t  __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
32113         LDKSixteenBytes addr_ref;
32114         CHECK(addr->arr_len == 16);
32115         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
32116         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32117         *ret_copy = NetAddress_ipv6(addr_ref, port);
32118         uint64_t ret_ref = tag_ptr(ret_copy, true);
32119         return ret_ref;
32120 }
32121
32122 uint64_t  __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
32123         LDKTwelveBytes a_ref;
32124         CHECK(a->arr_len == 12);
32125         memcpy(a_ref.data, a->elems, 12); FREE(a);
32126         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32127         *ret_copy = NetAddress_onion_v2(a_ref);
32128         uint64_t ret_ref = tag_ptr(ret_copy, true);
32129         return ret_ref;
32130 }
32131
32132 uint64_t  __attribute__((export_name("TS_NetAddress_onion_v3"))) TS_NetAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
32133         LDKThirtyTwoBytes ed25519_pubkey_ref;
32134         CHECK(ed25519_pubkey->arr_len == 32);
32135         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
32136         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32137         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
32138         uint64_t ret_ref = tag_ptr(ret_copy, true);
32139         return ret_ref;
32140 }
32141
32142 uint64_t  __attribute__((export_name("TS_NetAddress_hostname"))) TS_NetAddress_hostname(uint64_t hostname, int16_t port) {
32143         LDKHostname hostname_conv;
32144         hostname_conv.inner = untag_ptr(hostname);
32145         hostname_conv.is_owned = ptr_is_owned(hostname);
32146         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
32147         hostname_conv = Hostname_clone(&hostname_conv);
32148         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32149         *ret_copy = NetAddress_hostname(hostname_conv, port);
32150         uint64_t ret_ref = tag_ptr(ret_copy, true);
32151         return ret_ref;
32152 }
32153
32154 jboolean  __attribute__((export_name("TS_NetAddress_eq"))) TS_NetAddress_eq(uint64_t a, uint64_t b) {
32155         LDKNetAddress* a_conv = (LDKNetAddress*)untag_ptr(a);
32156         LDKNetAddress* b_conv = (LDKNetAddress*)untag_ptr(b);
32157         jboolean ret_conv = NetAddress_eq(a_conv, b_conv);
32158         return ret_conv;
32159 }
32160
32161 int8_tArray  __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint64_t obj) {
32162         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
32163         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
32164         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32165         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32166         CVec_u8Z_free(ret_var);
32167         return ret_arr;
32168 }
32169
32170 uint64_t  __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
32171         LDKu8slice ser_ref;
32172         ser_ref.datalen = ser->arr_len;
32173         ser_ref.data = ser->elems;
32174         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
32175         *ret_conv = NetAddress_read(ser_ref);
32176         FREE(ser);
32177         return tag_ptr(ret_conv, true);
32178 }
32179
32180 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
32181         LDKUnsignedNodeAnnouncement this_obj_conv;
32182         this_obj_conv.inner = untag_ptr(this_obj);
32183         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32185         UnsignedNodeAnnouncement_free(this_obj_conv);
32186 }
32187
32188 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
32189         LDKUnsignedNodeAnnouncement this_ptr_conv;
32190         this_ptr_conv.inner = untag_ptr(this_ptr);
32191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32193         this_ptr_conv.is_owned = false;
32194         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
32195         uint64_t ret_ref = 0;
32196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32198         return ret_ref;
32199 }
32200
32201 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
32202         LDKUnsignedNodeAnnouncement this_ptr_conv;
32203         this_ptr_conv.inner = untag_ptr(this_ptr);
32204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32206         this_ptr_conv.is_owned = false;
32207         LDKNodeFeatures val_conv;
32208         val_conv.inner = untag_ptr(val);
32209         val_conv.is_owned = ptr_is_owned(val);
32210         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32211         val_conv = NodeFeatures_clone(&val_conv);
32212         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
32213 }
32214
32215 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
32216         LDKUnsignedNodeAnnouncement this_ptr_conv;
32217         this_ptr_conv.inner = untag_ptr(this_ptr);
32218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32220         this_ptr_conv.is_owned = false;
32221         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
32222         return ret_conv;
32223 }
32224
32225 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
32226         LDKUnsignedNodeAnnouncement this_ptr_conv;
32227         this_ptr_conv.inner = untag_ptr(this_ptr);
32228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32230         this_ptr_conv.is_owned = false;
32231         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
32232 }
32233
32234 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
32235         LDKUnsignedNodeAnnouncement this_ptr_conv;
32236         this_ptr_conv.inner = untag_ptr(this_ptr);
32237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32239         this_ptr_conv.is_owned = false;
32240         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32241         memcpy(ret_arr->elems, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
32242         return ret_arr;
32243 }
32244
32245 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, int8_tArray val) {
32246         LDKUnsignedNodeAnnouncement this_ptr_conv;
32247         this_ptr_conv.inner = untag_ptr(this_ptr);
32248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32250         this_ptr_conv.is_owned = false;
32251         LDKPublicKey val_ref;
32252         CHECK(val->arr_len == 33);
32253         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32254         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
32255 }
32256
32257 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
32258         LDKUnsignedNodeAnnouncement this_ptr_conv;
32259         this_ptr_conv.inner = untag_ptr(this_ptr);
32260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32262         this_ptr_conv.is_owned = false;
32263         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
32264         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
32265         return ret_arr;
32266 }
32267
32268 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
32269         LDKUnsignedNodeAnnouncement this_ptr_conv;
32270         this_ptr_conv.inner = untag_ptr(this_ptr);
32271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32273         this_ptr_conv.is_owned = false;
32274         LDKThreeBytes val_ref;
32275         CHECK(val->arr_len == 3);
32276         memcpy(val_ref.data, val->elems, 3); FREE(val);
32277         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
32278 }
32279
32280 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
32281         LDKUnsignedNodeAnnouncement this_ptr_conv;
32282         this_ptr_conv.inner = untag_ptr(this_ptr);
32283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32285         this_ptr_conv.is_owned = false;
32286         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32287         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
32288         return ret_arr;
32289 }
32290
32291 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, int8_tArray val) {
32292         LDKUnsignedNodeAnnouncement this_ptr_conv;
32293         this_ptr_conv.inner = untag_ptr(this_ptr);
32294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32296         this_ptr_conv.is_owned = false;
32297         LDKThirtyTwoBytes val_ref;
32298         CHECK(val->arr_len == 32);
32299         memcpy(val_ref.data, val->elems, 32); FREE(val);
32300         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
32301 }
32302
32303 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
32304         LDKUnsignedNodeAnnouncement this_ptr_conv;
32305         this_ptr_conv.inner = untag_ptr(this_ptr);
32306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32308         this_ptr_conv.is_owned = false;
32309         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
32310         uint64_tArray ret_arr = NULL;
32311         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32312         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32313         for (size_t m = 0; m < ret_var.datalen; m++) {
32314                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32315                 *ret_conv_12_copy = ret_var.data[m];
32316                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
32317                 ret_arr_ptr[m] = ret_conv_12_ref;
32318         }
32319         
32320         FREE(ret_var.data);
32321         return ret_arr;
32322 }
32323
32324 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
32325         LDKUnsignedNodeAnnouncement this_ptr_conv;
32326         this_ptr_conv.inner = untag_ptr(this_ptr);
32327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32329         this_ptr_conv.is_owned = false;
32330         LDKCVec_NetAddressZ val_constr;
32331         val_constr.datalen = val->arr_len;
32332         if (val_constr.datalen > 0)
32333                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
32334         else
32335                 val_constr.data = NULL;
32336         uint64_t* val_vals = val->elems;
32337         for (size_t m = 0; m < val_constr.datalen; m++) {
32338                 uint64_t val_conv_12 = val_vals[m];
32339                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
32340                 CHECK_ACCESS(val_conv_12_ptr);
32341                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
32342                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
32343                 val_constr.data[m] = val_conv_12_conv;
32344         }
32345         FREE(val);
32346         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
32347 }
32348
32349 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
32350         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
32351         uint64_t ret_ref = 0;
32352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32354         return ret_ref;
32355 }
32356 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
32357         LDKUnsignedNodeAnnouncement arg_conv;
32358         arg_conv.inner = untag_ptr(arg);
32359         arg_conv.is_owned = ptr_is_owned(arg);
32360         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32361         arg_conv.is_owned = false;
32362         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
32363         return ret_conv;
32364 }
32365
32366 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
32367         LDKUnsignedNodeAnnouncement orig_conv;
32368         orig_conv.inner = untag_ptr(orig);
32369         orig_conv.is_owned = ptr_is_owned(orig);
32370         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32371         orig_conv.is_owned = false;
32372         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
32373         uint64_t ret_ref = 0;
32374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32376         return ret_ref;
32377 }
32378
32379 jboolean  __attribute__((export_name("TS_UnsignedNodeAnnouncement_eq"))) TS_UnsignedNodeAnnouncement_eq(uint64_t a, uint64_t b) {
32380         LDKUnsignedNodeAnnouncement a_conv;
32381         a_conv.inner = untag_ptr(a);
32382         a_conv.is_owned = ptr_is_owned(a);
32383         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32384         a_conv.is_owned = false;
32385         LDKUnsignedNodeAnnouncement b_conv;
32386         b_conv.inner = untag_ptr(b);
32387         b_conv.is_owned = ptr_is_owned(b);
32388         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32389         b_conv.is_owned = false;
32390         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
32391         return ret_conv;
32392 }
32393
32394 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
32395         LDKNodeAnnouncement this_obj_conv;
32396         this_obj_conv.inner = untag_ptr(this_obj);
32397         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32399         NodeAnnouncement_free(this_obj_conv);
32400 }
32401
32402 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
32403         LDKNodeAnnouncement this_ptr_conv;
32404         this_ptr_conv.inner = untag_ptr(this_ptr);
32405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32407         this_ptr_conv.is_owned = false;
32408         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32409         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
32410         return ret_arr;
32411 }
32412
32413 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
32414         LDKNodeAnnouncement this_ptr_conv;
32415         this_ptr_conv.inner = untag_ptr(this_ptr);
32416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32418         this_ptr_conv.is_owned = false;
32419         LDKSignature val_ref;
32420         CHECK(val->arr_len == 64);
32421         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32422         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
32423 }
32424
32425 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
32426         LDKNodeAnnouncement this_ptr_conv;
32427         this_ptr_conv.inner = untag_ptr(this_ptr);
32428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32430         this_ptr_conv.is_owned = false;
32431         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
32432         uint64_t ret_ref = 0;
32433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32435         return ret_ref;
32436 }
32437
32438 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
32439         LDKNodeAnnouncement this_ptr_conv;
32440         this_ptr_conv.inner = untag_ptr(this_ptr);
32441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32443         this_ptr_conv.is_owned = false;
32444         LDKUnsignedNodeAnnouncement val_conv;
32445         val_conv.inner = untag_ptr(val);
32446         val_conv.is_owned = ptr_is_owned(val);
32447         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32448         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
32449         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
32450 }
32451
32452 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
32453         LDKSignature signature_arg_ref;
32454         CHECK(signature_arg->arr_len == 64);
32455         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
32456         LDKUnsignedNodeAnnouncement contents_arg_conv;
32457         contents_arg_conv.inner = untag_ptr(contents_arg);
32458         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
32459         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
32460         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
32461         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
32462         uint64_t ret_ref = 0;
32463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32465         return ret_ref;
32466 }
32467
32468 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
32469         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
32470         uint64_t ret_ref = 0;
32471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32473         return ret_ref;
32474 }
32475 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
32476         LDKNodeAnnouncement arg_conv;
32477         arg_conv.inner = untag_ptr(arg);
32478         arg_conv.is_owned = ptr_is_owned(arg);
32479         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32480         arg_conv.is_owned = false;
32481         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
32482         return ret_conv;
32483 }
32484
32485 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
32486         LDKNodeAnnouncement orig_conv;
32487         orig_conv.inner = untag_ptr(orig);
32488         orig_conv.is_owned = ptr_is_owned(orig);
32489         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32490         orig_conv.is_owned = false;
32491         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
32492         uint64_t ret_ref = 0;
32493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32495         return ret_ref;
32496 }
32497
32498 jboolean  __attribute__((export_name("TS_NodeAnnouncement_eq"))) TS_NodeAnnouncement_eq(uint64_t a, uint64_t b) {
32499         LDKNodeAnnouncement a_conv;
32500         a_conv.inner = untag_ptr(a);
32501         a_conv.is_owned = ptr_is_owned(a);
32502         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32503         a_conv.is_owned = false;
32504         LDKNodeAnnouncement b_conv;
32505         b_conv.inner = untag_ptr(b);
32506         b_conv.is_owned = ptr_is_owned(b);
32507         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32508         b_conv.is_owned = false;
32509         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
32510         return ret_conv;
32511 }
32512
32513 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
32514         LDKUnsignedChannelAnnouncement this_obj_conv;
32515         this_obj_conv.inner = untag_ptr(this_obj);
32516         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32518         UnsignedChannelAnnouncement_free(this_obj_conv);
32519 }
32520
32521 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
32522         LDKUnsignedChannelAnnouncement this_ptr_conv;
32523         this_ptr_conv.inner = untag_ptr(this_ptr);
32524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32526         this_ptr_conv.is_owned = false;
32527         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
32528         uint64_t ret_ref = 0;
32529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32531         return ret_ref;
32532 }
32533
32534 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
32535         LDKUnsignedChannelAnnouncement this_ptr_conv;
32536         this_ptr_conv.inner = untag_ptr(this_ptr);
32537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32539         this_ptr_conv.is_owned = false;
32540         LDKChannelFeatures val_conv;
32541         val_conv.inner = untag_ptr(val);
32542         val_conv.is_owned = ptr_is_owned(val);
32543         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32544         val_conv = ChannelFeatures_clone(&val_conv);
32545         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
32546 }
32547
32548 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
32549         LDKUnsignedChannelAnnouncement this_ptr_conv;
32550         this_ptr_conv.inner = untag_ptr(this_ptr);
32551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32553         this_ptr_conv.is_owned = false;
32554         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32555         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
32556         return ret_arr;
32557 }
32558
32559 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
32560         LDKUnsignedChannelAnnouncement this_ptr_conv;
32561         this_ptr_conv.inner = untag_ptr(this_ptr);
32562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32564         this_ptr_conv.is_owned = false;
32565         LDKThirtyTwoBytes val_ref;
32566         CHECK(val->arr_len == 32);
32567         memcpy(val_ref.data, val->elems, 32); FREE(val);
32568         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
32569 }
32570
32571 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
32572         LDKUnsignedChannelAnnouncement this_ptr_conv;
32573         this_ptr_conv.inner = untag_ptr(this_ptr);
32574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32576         this_ptr_conv.is_owned = false;
32577         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
32578         return ret_conv;
32579 }
32580
32581 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
32582         LDKUnsignedChannelAnnouncement this_ptr_conv;
32583         this_ptr_conv.inner = untag_ptr(this_ptr);
32584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32586         this_ptr_conv.is_owned = false;
32587         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
32588 }
32589
32590 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
32591         LDKUnsignedChannelAnnouncement this_ptr_conv;
32592         this_ptr_conv.inner = untag_ptr(this_ptr);
32593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32595         this_ptr_conv.is_owned = false;
32596         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32597         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
32598         return ret_arr;
32599 }
32600
32601 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, int8_tArray val) {
32602         LDKUnsignedChannelAnnouncement this_ptr_conv;
32603         this_ptr_conv.inner = untag_ptr(this_ptr);
32604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32606         this_ptr_conv.is_owned = false;
32607         LDKPublicKey val_ref;
32608         CHECK(val->arr_len == 33);
32609         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32610         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
32611 }
32612
32613 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
32614         LDKUnsignedChannelAnnouncement this_ptr_conv;
32615         this_ptr_conv.inner = untag_ptr(this_ptr);
32616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32618         this_ptr_conv.is_owned = false;
32619         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32620         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
32621         return ret_arr;
32622 }
32623
32624 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, int8_tArray val) {
32625         LDKUnsignedChannelAnnouncement this_ptr_conv;
32626         this_ptr_conv.inner = untag_ptr(this_ptr);
32627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32629         this_ptr_conv.is_owned = false;
32630         LDKPublicKey val_ref;
32631         CHECK(val->arr_len == 33);
32632         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32633         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
32634 }
32635
32636 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
32637         LDKUnsignedChannelAnnouncement this_ptr_conv;
32638         this_ptr_conv.inner = untag_ptr(this_ptr);
32639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32641         this_ptr_conv.is_owned = false;
32642         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32643         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
32644         return ret_arr;
32645 }
32646
32647 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, int8_tArray val) {
32648         LDKUnsignedChannelAnnouncement this_ptr_conv;
32649         this_ptr_conv.inner = untag_ptr(this_ptr);
32650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32652         this_ptr_conv.is_owned = false;
32653         LDKPublicKey val_ref;
32654         CHECK(val->arr_len == 33);
32655         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32656         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
32657 }
32658
32659 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
32660         LDKUnsignedChannelAnnouncement this_ptr_conv;
32661         this_ptr_conv.inner = untag_ptr(this_ptr);
32662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32664         this_ptr_conv.is_owned = false;
32665         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32666         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
32667         return ret_arr;
32668 }
32669
32670 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, int8_tArray val) {
32671         LDKUnsignedChannelAnnouncement this_ptr_conv;
32672         this_ptr_conv.inner = untag_ptr(this_ptr);
32673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32675         this_ptr_conv.is_owned = false;
32676         LDKPublicKey val_ref;
32677         CHECK(val->arr_len == 33);
32678         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32679         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
32680 }
32681
32682 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
32683         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
32684         uint64_t ret_ref = 0;
32685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32687         return ret_ref;
32688 }
32689 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
32690         LDKUnsignedChannelAnnouncement arg_conv;
32691         arg_conv.inner = untag_ptr(arg);
32692         arg_conv.is_owned = ptr_is_owned(arg);
32693         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32694         arg_conv.is_owned = false;
32695         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
32696         return ret_conv;
32697 }
32698
32699 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
32700         LDKUnsignedChannelAnnouncement orig_conv;
32701         orig_conv.inner = untag_ptr(orig);
32702         orig_conv.is_owned = ptr_is_owned(orig);
32703         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32704         orig_conv.is_owned = false;
32705         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
32706         uint64_t ret_ref = 0;
32707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32709         return ret_ref;
32710 }
32711
32712 jboolean  __attribute__((export_name("TS_UnsignedChannelAnnouncement_eq"))) TS_UnsignedChannelAnnouncement_eq(uint64_t a, uint64_t b) {
32713         LDKUnsignedChannelAnnouncement a_conv;
32714         a_conv.inner = untag_ptr(a);
32715         a_conv.is_owned = ptr_is_owned(a);
32716         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32717         a_conv.is_owned = false;
32718         LDKUnsignedChannelAnnouncement b_conv;
32719         b_conv.inner = untag_ptr(b);
32720         b_conv.is_owned = ptr_is_owned(b);
32721         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32722         b_conv.is_owned = false;
32723         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
32724         return ret_conv;
32725 }
32726
32727 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
32728         LDKChannelAnnouncement this_obj_conv;
32729         this_obj_conv.inner = untag_ptr(this_obj);
32730         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32732         ChannelAnnouncement_free(this_obj_conv);
32733 }
32734
32735 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
32736         LDKChannelAnnouncement this_ptr_conv;
32737         this_ptr_conv.inner = untag_ptr(this_ptr);
32738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32740         this_ptr_conv.is_owned = false;
32741         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32742         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
32743         return ret_arr;
32744 }
32745
32746 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
32747         LDKChannelAnnouncement this_ptr_conv;
32748         this_ptr_conv.inner = untag_ptr(this_ptr);
32749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32751         this_ptr_conv.is_owned = false;
32752         LDKSignature val_ref;
32753         CHECK(val->arr_len == 64);
32754         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32755         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
32756 }
32757
32758 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
32759         LDKChannelAnnouncement this_ptr_conv;
32760         this_ptr_conv.inner = untag_ptr(this_ptr);
32761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32763         this_ptr_conv.is_owned = false;
32764         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32765         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
32766         return ret_arr;
32767 }
32768
32769 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
32770         LDKChannelAnnouncement this_ptr_conv;
32771         this_ptr_conv.inner = untag_ptr(this_ptr);
32772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32774         this_ptr_conv.is_owned = false;
32775         LDKSignature val_ref;
32776         CHECK(val->arr_len == 64);
32777         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32778         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
32779 }
32780
32781 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
32782         LDKChannelAnnouncement this_ptr_conv;
32783         this_ptr_conv.inner = untag_ptr(this_ptr);
32784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32786         this_ptr_conv.is_owned = false;
32787         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32788         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
32789         return ret_arr;
32790 }
32791
32792 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
32793         LDKChannelAnnouncement this_ptr_conv;
32794         this_ptr_conv.inner = untag_ptr(this_ptr);
32795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32797         this_ptr_conv.is_owned = false;
32798         LDKSignature val_ref;
32799         CHECK(val->arr_len == 64);
32800         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32801         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
32802 }
32803
32804 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
32805         LDKChannelAnnouncement this_ptr_conv;
32806         this_ptr_conv.inner = untag_ptr(this_ptr);
32807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32809         this_ptr_conv.is_owned = false;
32810         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32811         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
32812         return ret_arr;
32813 }
32814
32815 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
32816         LDKChannelAnnouncement this_ptr_conv;
32817         this_ptr_conv.inner = untag_ptr(this_ptr);
32818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32820         this_ptr_conv.is_owned = false;
32821         LDKSignature val_ref;
32822         CHECK(val->arr_len == 64);
32823         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32824         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
32825 }
32826
32827 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
32828         LDKChannelAnnouncement this_ptr_conv;
32829         this_ptr_conv.inner = untag_ptr(this_ptr);
32830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32832         this_ptr_conv.is_owned = false;
32833         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
32834         uint64_t ret_ref = 0;
32835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32837         return ret_ref;
32838 }
32839
32840 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
32841         LDKChannelAnnouncement this_ptr_conv;
32842         this_ptr_conv.inner = untag_ptr(this_ptr);
32843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32845         this_ptr_conv.is_owned = false;
32846         LDKUnsignedChannelAnnouncement val_conv;
32847         val_conv.inner = untag_ptr(val);
32848         val_conv.is_owned = ptr_is_owned(val);
32849         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32850         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
32851         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
32852 }
32853
32854 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_new"))) 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, uint64_t contents_arg) {
32855         LDKSignature node_signature_1_arg_ref;
32856         CHECK(node_signature_1_arg->arr_len == 64);
32857         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
32858         LDKSignature node_signature_2_arg_ref;
32859         CHECK(node_signature_2_arg->arr_len == 64);
32860         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
32861         LDKSignature bitcoin_signature_1_arg_ref;
32862         CHECK(bitcoin_signature_1_arg->arr_len == 64);
32863         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
32864         LDKSignature bitcoin_signature_2_arg_ref;
32865         CHECK(bitcoin_signature_2_arg->arr_len == 64);
32866         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
32867         LDKUnsignedChannelAnnouncement contents_arg_conv;
32868         contents_arg_conv.inner = untag_ptr(contents_arg);
32869         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
32870         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
32871         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
32872         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);
32873         uint64_t ret_ref = 0;
32874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32876         return ret_ref;
32877 }
32878
32879 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
32880         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
32881         uint64_t ret_ref = 0;
32882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32884         return ret_ref;
32885 }
32886 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
32887         LDKChannelAnnouncement arg_conv;
32888         arg_conv.inner = untag_ptr(arg);
32889         arg_conv.is_owned = ptr_is_owned(arg);
32890         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32891         arg_conv.is_owned = false;
32892         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
32893         return ret_conv;
32894 }
32895
32896 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
32897         LDKChannelAnnouncement orig_conv;
32898         orig_conv.inner = untag_ptr(orig);
32899         orig_conv.is_owned = ptr_is_owned(orig);
32900         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32901         orig_conv.is_owned = false;
32902         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
32903         uint64_t ret_ref = 0;
32904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32906         return ret_ref;
32907 }
32908
32909 jboolean  __attribute__((export_name("TS_ChannelAnnouncement_eq"))) TS_ChannelAnnouncement_eq(uint64_t a, uint64_t b) {
32910         LDKChannelAnnouncement a_conv;
32911         a_conv.inner = untag_ptr(a);
32912         a_conv.is_owned = ptr_is_owned(a);
32913         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32914         a_conv.is_owned = false;
32915         LDKChannelAnnouncement b_conv;
32916         b_conv.inner = untag_ptr(b);
32917         b_conv.is_owned = ptr_is_owned(b);
32918         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32919         b_conv.is_owned = false;
32920         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
32921         return ret_conv;
32922 }
32923
32924 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
32925         LDKUnsignedChannelUpdate this_obj_conv;
32926         this_obj_conv.inner = untag_ptr(this_obj);
32927         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32929         UnsignedChannelUpdate_free(this_obj_conv);
32930 }
32931
32932 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
32933         LDKUnsignedChannelUpdate this_ptr_conv;
32934         this_ptr_conv.inner = untag_ptr(this_ptr);
32935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32937         this_ptr_conv.is_owned = false;
32938         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32939         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
32940         return ret_arr;
32941 }
32942
32943 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
32944         LDKUnsignedChannelUpdate this_ptr_conv;
32945         this_ptr_conv.inner = untag_ptr(this_ptr);
32946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32948         this_ptr_conv.is_owned = false;
32949         LDKThirtyTwoBytes val_ref;
32950         CHECK(val->arr_len == 32);
32951         memcpy(val_ref.data, val->elems, 32); FREE(val);
32952         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
32953 }
32954
32955 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
32956         LDKUnsignedChannelUpdate this_ptr_conv;
32957         this_ptr_conv.inner = untag_ptr(this_ptr);
32958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32960         this_ptr_conv.is_owned = false;
32961         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
32962         return ret_conv;
32963 }
32964
32965 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
32966         LDKUnsignedChannelUpdate this_ptr_conv;
32967         this_ptr_conv.inner = untag_ptr(this_ptr);
32968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32970         this_ptr_conv.is_owned = false;
32971         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
32972 }
32973
32974 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
32975         LDKUnsignedChannelUpdate this_ptr_conv;
32976         this_ptr_conv.inner = untag_ptr(this_ptr);
32977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32979         this_ptr_conv.is_owned = false;
32980         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
32981         return ret_conv;
32982 }
32983
32984 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
32985         LDKUnsignedChannelUpdate this_ptr_conv;
32986         this_ptr_conv.inner = untag_ptr(this_ptr);
32987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32989         this_ptr_conv.is_owned = false;
32990         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
32991 }
32992
32993 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
32994         LDKUnsignedChannelUpdate this_ptr_conv;
32995         this_ptr_conv.inner = untag_ptr(this_ptr);
32996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32998         this_ptr_conv.is_owned = false;
32999         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
33000         return ret_conv;
33001 }
33002
33003 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
33004         LDKUnsignedChannelUpdate this_ptr_conv;
33005         this_ptr_conv.inner = untag_ptr(this_ptr);
33006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33008         this_ptr_conv.is_owned = false;
33009         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
33010 }
33011
33012 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
33013         LDKUnsignedChannelUpdate this_ptr_conv;
33014         this_ptr_conv.inner = untag_ptr(this_ptr);
33015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33017         this_ptr_conv.is_owned = false;
33018         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
33019         return ret_conv;
33020 }
33021
33022 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
33023         LDKUnsignedChannelUpdate this_ptr_conv;
33024         this_ptr_conv.inner = untag_ptr(this_ptr);
33025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33027         this_ptr_conv.is_owned = false;
33028         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
33029 }
33030
33031 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
33032         LDKUnsignedChannelUpdate this_ptr_conv;
33033         this_ptr_conv.inner = untag_ptr(this_ptr);
33034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33036         this_ptr_conv.is_owned = false;
33037         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
33038         return ret_conv;
33039 }
33040
33041 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
33042         LDKUnsignedChannelUpdate this_ptr_conv;
33043         this_ptr_conv.inner = untag_ptr(this_ptr);
33044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33046         this_ptr_conv.is_owned = false;
33047         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
33048 }
33049
33050 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
33051         LDKUnsignedChannelUpdate this_ptr_conv;
33052         this_ptr_conv.inner = untag_ptr(this_ptr);
33053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33055         this_ptr_conv.is_owned = false;
33056         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
33057         return ret_conv;
33058 }
33059
33060 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
33061         LDKUnsignedChannelUpdate this_ptr_conv;
33062         this_ptr_conv.inner = untag_ptr(this_ptr);
33063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33065         this_ptr_conv.is_owned = false;
33066         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
33067 }
33068
33069 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
33070         LDKUnsignedChannelUpdate this_ptr_conv;
33071         this_ptr_conv.inner = untag_ptr(this_ptr);
33072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33074         this_ptr_conv.is_owned = false;
33075         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
33076         return ret_conv;
33077 }
33078
33079 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
33080         LDKUnsignedChannelUpdate this_ptr_conv;
33081         this_ptr_conv.inner = untag_ptr(this_ptr);
33082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33084         this_ptr_conv.is_owned = false;
33085         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
33086 }
33087
33088 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
33089         LDKUnsignedChannelUpdate this_ptr_conv;
33090         this_ptr_conv.inner = untag_ptr(this_ptr);
33091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33093         this_ptr_conv.is_owned = false;
33094         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
33095         return ret_conv;
33096 }
33097
33098 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
33099         LDKUnsignedChannelUpdate this_ptr_conv;
33100         this_ptr_conv.inner = untag_ptr(this_ptr);
33101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33103         this_ptr_conv.is_owned = false;
33104         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
33105 }
33106
33107 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
33108         LDKUnsignedChannelUpdate this_ptr_conv;
33109         this_ptr_conv.inner = untag_ptr(this_ptr);
33110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33112         this_ptr_conv.is_owned = false;
33113         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
33114         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33115         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33116         CVec_u8Z_free(ret_var);
33117         return ret_arr;
33118 }
33119
33120 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
33121         LDKUnsignedChannelUpdate this_ptr_conv;
33122         this_ptr_conv.inner = untag_ptr(this_ptr);
33123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33125         this_ptr_conv.is_owned = false;
33126         LDKCVec_u8Z val_ref;
33127         val_ref.datalen = val->arr_len;
33128         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
33129         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
33130         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
33131 }
33132
33133 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_new"))) TS_UnsignedChannelUpdate_new(int8_tArray chain_hash_arg, int64_t short_channel_id_arg, int32_t timestamp_arg, int8_t flags_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int8_tArray excess_data_arg) {
33134         LDKThirtyTwoBytes chain_hash_arg_ref;
33135         CHECK(chain_hash_arg->arr_len == 32);
33136         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
33137         LDKCVec_u8Z excess_data_arg_ref;
33138         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
33139         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
33140         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
33141         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_new(chain_hash_arg_ref, short_channel_id_arg, timestamp_arg, flags_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fee_base_msat_arg, fee_proportional_millionths_arg, excess_data_arg_ref);
33142         uint64_t ret_ref = 0;
33143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33145         return ret_ref;
33146 }
33147
33148 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
33149         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
33150         uint64_t ret_ref = 0;
33151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33153         return ret_ref;
33154 }
33155 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
33156         LDKUnsignedChannelUpdate arg_conv;
33157         arg_conv.inner = untag_ptr(arg);
33158         arg_conv.is_owned = ptr_is_owned(arg);
33159         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33160         arg_conv.is_owned = false;
33161         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
33162         return ret_conv;
33163 }
33164
33165 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
33166         LDKUnsignedChannelUpdate orig_conv;
33167         orig_conv.inner = untag_ptr(orig);
33168         orig_conv.is_owned = ptr_is_owned(orig);
33169         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33170         orig_conv.is_owned = false;
33171         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
33172         uint64_t ret_ref = 0;
33173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33175         return ret_ref;
33176 }
33177
33178 jboolean  __attribute__((export_name("TS_UnsignedChannelUpdate_eq"))) TS_UnsignedChannelUpdate_eq(uint64_t a, uint64_t b) {
33179         LDKUnsignedChannelUpdate a_conv;
33180         a_conv.inner = untag_ptr(a);
33181         a_conv.is_owned = ptr_is_owned(a);
33182         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33183         a_conv.is_owned = false;
33184         LDKUnsignedChannelUpdate b_conv;
33185         b_conv.inner = untag_ptr(b);
33186         b_conv.is_owned = ptr_is_owned(b);
33187         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33188         b_conv.is_owned = false;
33189         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
33190         return ret_conv;
33191 }
33192
33193 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
33194         LDKChannelUpdate this_obj_conv;
33195         this_obj_conv.inner = untag_ptr(this_obj);
33196         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33198         ChannelUpdate_free(this_obj_conv);
33199 }
33200
33201 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
33202         LDKChannelUpdate this_ptr_conv;
33203         this_ptr_conv.inner = untag_ptr(this_ptr);
33204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33206         this_ptr_conv.is_owned = false;
33207         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33208         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
33209         return ret_arr;
33210 }
33211
33212 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
33213         LDKChannelUpdate this_ptr_conv;
33214         this_ptr_conv.inner = untag_ptr(this_ptr);
33215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33217         this_ptr_conv.is_owned = false;
33218         LDKSignature val_ref;
33219         CHECK(val->arr_len == 64);
33220         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33221         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
33222 }
33223
33224 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
33225         LDKChannelUpdate this_ptr_conv;
33226         this_ptr_conv.inner = untag_ptr(this_ptr);
33227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33229         this_ptr_conv.is_owned = false;
33230         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
33231         uint64_t ret_ref = 0;
33232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33234         return ret_ref;
33235 }
33236
33237 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
33238         LDKChannelUpdate this_ptr_conv;
33239         this_ptr_conv.inner = untag_ptr(this_ptr);
33240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33242         this_ptr_conv.is_owned = false;
33243         LDKUnsignedChannelUpdate val_conv;
33244         val_conv.inner = untag_ptr(val);
33245         val_conv.is_owned = ptr_is_owned(val);
33246         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33247         val_conv = UnsignedChannelUpdate_clone(&val_conv);
33248         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
33249 }
33250
33251 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
33252         LDKSignature signature_arg_ref;
33253         CHECK(signature_arg->arr_len == 64);
33254         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
33255         LDKUnsignedChannelUpdate contents_arg_conv;
33256         contents_arg_conv.inner = untag_ptr(contents_arg);
33257         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
33258         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
33259         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
33260         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
33261         uint64_t ret_ref = 0;
33262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33264         return ret_ref;
33265 }
33266
33267 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
33268         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
33269         uint64_t ret_ref = 0;
33270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33272         return ret_ref;
33273 }
33274 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
33275         LDKChannelUpdate arg_conv;
33276         arg_conv.inner = untag_ptr(arg);
33277         arg_conv.is_owned = ptr_is_owned(arg);
33278         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33279         arg_conv.is_owned = false;
33280         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
33281         return ret_conv;
33282 }
33283
33284 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
33285         LDKChannelUpdate orig_conv;
33286         orig_conv.inner = untag_ptr(orig);
33287         orig_conv.is_owned = ptr_is_owned(orig);
33288         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33289         orig_conv.is_owned = false;
33290         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
33291         uint64_t ret_ref = 0;
33292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33294         return ret_ref;
33295 }
33296
33297 jboolean  __attribute__((export_name("TS_ChannelUpdate_eq"))) TS_ChannelUpdate_eq(uint64_t a, uint64_t b) {
33298         LDKChannelUpdate a_conv;
33299         a_conv.inner = untag_ptr(a);
33300         a_conv.is_owned = ptr_is_owned(a);
33301         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33302         a_conv.is_owned = false;
33303         LDKChannelUpdate b_conv;
33304         b_conv.inner = untag_ptr(b);
33305         b_conv.is_owned = ptr_is_owned(b);
33306         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33307         b_conv.is_owned = false;
33308         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
33309         return ret_conv;
33310 }
33311
33312 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
33313         LDKQueryChannelRange this_obj_conv;
33314         this_obj_conv.inner = untag_ptr(this_obj);
33315         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33317         QueryChannelRange_free(this_obj_conv);
33318 }
33319
33320 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
33321         LDKQueryChannelRange this_ptr_conv;
33322         this_ptr_conv.inner = untag_ptr(this_ptr);
33323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33325         this_ptr_conv.is_owned = false;
33326         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33327         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
33328         return ret_arr;
33329 }
33330
33331 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
33332         LDKQueryChannelRange this_ptr_conv;
33333         this_ptr_conv.inner = untag_ptr(this_ptr);
33334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33336         this_ptr_conv.is_owned = false;
33337         LDKThirtyTwoBytes val_ref;
33338         CHECK(val->arr_len == 32);
33339         memcpy(val_ref.data, val->elems, 32); FREE(val);
33340         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
33341 }
33342
33343 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
33344         LDKQueryChannelRange this_ptr_conv;
33345         this_ptr_conv.inner = untag_ptr(this_ptr);
33346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33348         this_ptr_conv.is_owned = false;
33349         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
33350         return ret_conv;
33351 }
33352
33353 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
33354         LDKQueryChannelRange this_ptr_conv;
33355         this_ptr_conv.inner = untag_ptr(this_ptr);
33356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33358         this_ptr_conv.is_owned = false;
33359         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
33360 }
33361
33362 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
33363         LDKQueryChannelRange this_ptr_conv;
33364         this_ptr_conv.inner = untag_ptr(this_ptr);
33365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33367         this_ptr_conv.is_owned = false;
33368         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
33369         return ret_conv;
33370 }
33371
33372 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
33373         LDKQueryChannelRange this_ptr_conv;
33374         this_ptr_conv.inner = untag_ptr(this_ptr);
33375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33377         this_ptr_conv.is_owned = false;
33378         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
33379 }
33380
33381 uint64_t  __attribute__((export_name("TS_QueryChannelRange_new"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
33382         LDKThirtyTwoBytes chain_hash_arg_ref;
33383         CHECK(chain_hash_arg->arr_len == 32);
33384         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
33385         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
33386         uint64_t ret_ref = 0;
33387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33389         return ret_ref;
33390 }
33391
33392 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
33393         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
33394         uint64_t ret_ref = 0;
33395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33397         return ret_ref;
33398 }
33399 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
33400         LDKQueryChannelRange arg_conv;
33401         arg_conv.inner = untag_ptr(arg);
33402         arg_conv.is_owned = ptr_is_owned(arg);
33403         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33404         arg_conv.is_owned = false;
33405         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
33406         return ret_conv;
33407 }
33408
33409 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
33410         LDKQueryChannelRange orig_conv;
33411         orig_conv.inner = untag_ptr(orig);
33412         orig_conv.is_owned = ptr_is_owned(orig);
33413         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33414         orig_conv.is_owned = false;
33415         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
33416         uint64_t ret_ref = 0;
33417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33419         return ret_ref;
33420 }
33421
33422 jboolean  __attribute__((export_name("TS_QueryChannelRange_eq"))) TS_QueryChannelRange_eq(uint64_t a, uint64_t b) {
33423         LDKQueryChannelRange a_conv;
33424         a_conv.inner = untag_ptr(a);
33425         a_conv.is_owned = ptr_is_owned(a);
33426         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33427         a_conv.is_owned = false;
33428         LDKQueryChannelRange b_conv;
33429         b_conv.inner = untag_ptr(b);
33430         b_conv.is_owned = ptr_is_owned(b);
33431         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33432         b_conv.is_owned = false;
33433         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
33434         return ret_conv;
33435 }
33436
33437 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
33438         LDKReplyChannelRange this_obj_conv;
33439         this_obj_conv.inner = untag_ptr(this_obj);
33440         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33442         ReplyChannelRange_free(this_obj_conv);
33443 }
33444
33445 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
33446         LDKReplyChannelRange this_ptr_conv;
33447         this_ptr_conv.inner = untag_ptr(this_ptr);
33448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33450         this_ptr_conv.is_owned = false;
33451         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33452         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
33453         return ret_arr;
33454 }
33455
33456 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
33457         LDKReplyChannelRange this_ptr_conv;
33458         this_ptr_conv.inner = untag_ptr(this_ptr);
33459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33461         this_ptr_conv.is_owned = false;
33462         LDKThirtyTwoBytes val_ref;
33463         CHECK(val->arr_len == 32);
33464         memcpy(val_ref.data, val->elems, 32); FREE(val);
33465         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
33466 }
33467
33468 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
33469         LDKReplyChannelRange this_ptr_conv;
33470         this_ptr_conv.inner = untag_ptr(this_ptr);
33471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33473         this_ptr_conv.is_owned = false;
33474         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
33475         return ret_conv;
33476 }
33477
33478 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
33479         LDKReplyChannelRange this_ptr_conv;
33480         this_ptr_conv.inner = untag_ptr(this_ptr);
33481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33483         this_ptr_conv.is_owned = false;
33484         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
33485 }
33486
33487 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
33488         LDKReplyChannelRange this_ptr_conv;
33489         this_ptr_conv.inner = untag_ptr(this_ptr);
33490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33492         this_ptr_conv.is_owned = false;
33493         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
33494         return ret_conv;
33495 }
33496
33497 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
33498         LDKReplyChannelRange this_ptr_conv;
33499         this_ptr_conv.inner = untag_ptr(this_ptr);
33500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33502         this_ptr_conv.is_owned = false;
33503         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
33504 }
33505
33506 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
33507         LDKReplyChannelRange this_ptr_conv;
33508         this_ptr_conv.inner = untag_ptr(this_ptr);
33509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33511         this_ptr_conv.is_owned = false;
33512         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
33513         return ret_conv;
33514 }
33515
33516 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
33517         LDKReplyChannelRange this_ptr_conv;
33518         this_ptr_conv.inner = untag_ptr(this_ptr);
33519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33521         this_ptr_conv.is_owned = false;
33522         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
33523 }
33524
33525 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
33526         LDKReplyChannelRange this_ptr_conv;
33527         this_ptr_conv.inner = untag_ptr(this_ptr);
33528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33530         this_ptr_conv.is_owned = false;
33531         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
33532         int64_tArray ret_arr = NULL;
33533         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
33534         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
33535         for (size_t i = 0; i < ret_var.datalen; i++) {
33536                 int64_t ret_conv_8_conv = ret_var.data[i];
33537                 ret_arr_ptr[i] = ret_conv_8_conv;
33538         }
33539         
33540         FREE(ret_var.data);
33541         return ret_arr;
33542 }
33543
33544 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
33545         LDKReplyChannelRange this_ptr_conv;
33546         this_ptr_conv.inner = untag_ptr(this_ptr);
33547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33549         this_ptr_conv.is_owned = false;
33550         LDKCVec_u64Z val_constr;
33551         val_constr.datalen = val->arr_len;
33552         if (val_constr.datalen > 0)
33553                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
33554         else
33555                 val_constr.data = NULL;
33556         int64_t* val_vals = val->elems;
33557         for (size_t i = 0; i < val_constr.datalen; i++) {
33558                 int64_t val_conv_8 = val_vals[i];
33559                 val_constr.data[i] = val_conv_8;
33560         }
33561         FREE(val);
33562         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
33563 }
33564
33565 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_new"))) 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) {
33566         LDKThirtyTwoBytes chain_hash_arg_ref;
33567         CHECK(chain_hash_arg->arr_len == 32);
33568         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
33569         LDKCVec_u64Z short_channel_ids_arg_constr;
33570         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
33571         if (short_channel_ids_arg_constr.datalen > 0)
33572                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
33573         else
33574                 short_channel_ids_arg_constr.data = NULL;
33575         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
33576         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
33577                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
33578                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
33579         }
33580         FREE(short_channel_ids_arg);
33581         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
33582         uint64_t ret_ref = 0;
33583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33585         return ret_ref;
33586 }
33587
33588 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
33589         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
33590         uint64_t ret_ref = 0;
33591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33593         return ret_ref;
33594 }
33595 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
33596         LDKReplyChannelRange arg_conv;
33597         arg_conv.inner = untag_ptr(arg);
33598         arg_conv.is_owned = ptr_is_owned(arg);
33599         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33600         arg_conv.is_owned = false;
33601         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
33602         return ret_conv;
33603 }
33604
33605 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
33606         LDKReplyChannelRange orig_conv;
33607         orig_conv.inner = untag_ptr(orig);
33608         orig_conv.is_owned = ptr_is_owned(orig);
33609         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33610         orig_conv.is_owned = false;
33611         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
33612         uint64_t ret_ref = 0;
33613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33615         return ret_ref;
33616 }
33617
33618 jboolean  __attribute__((export_name("TS_ReplyChannelRange_eq"))) TS_ReplyChannelRange_eq(uint64_t a, uint64_t b) {
33619         LDKReplyChannelRange a_conv;
33620         a_conv.inner = untag_ptr(a);
33621         a_conv.is_owned = ptr_is_owned(a);
33622         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33623         a_conv.is_owned = false;
33624         LDKReplyChannelRange b_conv;
33625         b_conv.inner = untag_ptr(b);
33626         b_conv.is_owned = ptr_is_owned(b);
33627         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33628         b_conv.is_owned = false;
33629         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
33630         return ret_conv;
33631 }
33632
33633 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
33634         LDKQueryShortChannelIds this_obj_conv;
33635         this_obj_conv.inner = untag_ptr(this_obj);
33636         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33638         QueryShortChannelIds_free(this_obj_conv);
33639 }
33640
33641 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
33642         LDKQueryShortChannelIds this_ptr_conv;
33643         this_ptr_conv.inner = untag_ptr(this_ptr);
33644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33646         this_ptr_conv.is_owned = false;
33647         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33648         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
33649         return ret_arr;
33650 }
33651
33652 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
33653         LDKQueryShortChannelIds this_ptr_conv;
33654         this_ptr_conv.inner = untag_ptr(this_ptr);
33655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33657         this_ptr_conv.is_owned = false;
33658         LDKThirtyTwoBytes val_ref;
33659         CHECK(val->arr_len == 32);
33660         memcpy(val_ref.data, val->elems, 32); FREE(val);
33661         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
33662 }
33663
33664 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
33665         LDKQueryShortChannelIds this_ptr_conv;
33666         this_ptr_conv.inner = untag_ptr(this_ptr);
33667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33669         this_ptr_conv.is_owned = false;
33670         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
33671         int64_tArray ret_arr = NULL;
33672         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
33673         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
33674         for (size_t i = 0; i < ret_var.datalen; i++) {
33675                 int64_t ret_conv_8_conv = ret_var.data[i];
33676                 ret_arr_ptr[i] = ret_conv_8_conv;
33677         }
33678         
33679         FREE(ret_var.data);
33680         return ret_arr;
33681 }
33682
33683 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
33684         LDKQueryShortChannelIds this_ptr_conv;
33685         this_ptr_conv.inner = untag_ptr(this_ptr);
33686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33688         this_ptr_conv.is_owned = false;
33689         LDKCVec_u64Z val_constr;
33690         val_constr.datalen = val->arr_len;
33691         if (val_constr.datalen > 0)
33692                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
33693         else
33694                 val_constr.data = NULL;
33695         int64_t* val_vals = val->elems;
33696         for (size_t i = 0; i < val_constr.datalen; i++) {
33697                 int64_t val_conv_8 = val_vals[i];
33698                 val_constr.data[i] = val_conv_8;
33699         }
33700         FREE(val);
33701         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
33702 }
33703
33704 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
33705         LDKThirtyTwoBytes chain_hash_arg_ref;
33706         CHECK(chain_hash_arg->arr_len == 32);
33707         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
33708         LDKCVec_u64Z short_channel_ids_arg_constr;
33709         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
33710         if (short_channel_ids_arg_constr.datalen > 0)
33711                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
33712         else
33713                 short_channel_ids_arg_constr.data = NULL;
33714         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
33715         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
33716                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
33717                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
33718         }
33719         FREE(short_channel_ids_arg);
33720         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
33721         uint64_t ret_ref = 0;
33722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33724         return ret_ref;
33725 }
33726
33727 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
33728         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
33729         uint64_t ret_ref = 0;
33730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33732         return ret_ref;
33733 }
33734 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
33735         LDKQueryShortChannelIds arg_conv;
33736         arg_conv.inner = untag_ptr(arg);
33737         arg_conv.is_owned = ptr_is_owned(arg);
33738         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33739         arg_conv.is_owned = false;
33740         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
33741         return ret_conv;
33742 }
33743
33744 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
33745         LDKQueryShortChannelIds orig_conv;
33746         orig_conv.inner = untag_ptr(orig);
33747         orig_conv.is_owned = ptr_is_owned(orig);
33748         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33749         orig_conv.is_owned = false;
33750         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
33751         uint64_t ret_ref = 0;
33752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33754         return ret_ref;
33755 }
33756
33757 jboolean  __attribute__((export_name("TS_QueryShortChannelIds_eq"))) TS_QueryShortChannelIds_eq(uint64_t a, uint64_t b) {
33758         LDKQueryShortChannelIds a_conv;
33759         a_conv.inner = untag_ptr(a);
33760         a_conv.is_owned = ptr_is_owned(a);
33761         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33762         a_conv.is_owned = false;
33763         LDKQueryShortChannelIds b_conv;
33764         b_conv.inner = untag_ptr(b);
33765         b_conv.is_owned = ptr_is_owned(b);
33766         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33767         b_conv.is_owned = false;
33768         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
33769         return ret_conv;
33770 }
33771
33772 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
33773         LDKReplyShortChannelIdsEnd this_obj_conv;
33774         this_obj_conv.inner = untag_ptr(this_obj);
33775         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33777         ReplyShortChannelIdsEnd_free(this_obj_conv);
33778 }
33779
33780 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
33781         LDKReplyShortChannelIdsEnd this_ptr_conv;
33782         this_ptr_conv.inner = untag_ptr(this_ptr);
33783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33785         this_ptr_conv.is_owned = false;
33786         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33787         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
33788         return ret_arr;
33789 }
33790
33791 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
33792         LDKReplyShortChannelIdsEnd this_ptr_conv;
33793         this_ptr_conv.inner = untag_ptr(this_ptr);
33794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33796         this_ptr_conv.is_owned = false;
33797         LDKThirtyTwoBytes val_ref;
33798         CHECK(val->arr_len == 32);
33799         memcpy(val_ref.data, val->elems, 32); FREE(val);
33800         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
33801 }
33802
33803 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
33804         LDKReplyShortChannelIdsEnd this_ptr_conv;
33805         this_ptr_conv.inner = untag_ptr(this_ptr);
33806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33808         this_ptr_conv.is_owned = false;
33809         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
33810         return ret_conv;
33811 }
33812
33813 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
33814         LDKReplyShortChannelIdsEnd this_ptr_conv;
33815         this_ptr_conv.inner = untag_ptr(this_ptr);
33816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33818         this_ptr_conv.is_owned = false;
33819         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
33820 }
33821
33822 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
33823         LDKThirtyTwoBytes chain_hash_arg_ref;
33824         CHECK(chain_hash_arg->arr_len == 32);
33825         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
33826         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
33827         uint64_t ret_ref = 0;
33828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33830         return ret_ref;
33831 }
33832
33833 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
33834         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
33835         uint64_t ret_ref = 0;
33836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33838         return ret_ref;
33839 }
33840 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
33841         LDKReplyShortChannelIdsEnd arg_conv;
33842         arg_conv.inner = untag_ptr(arg);
33843         arg_conv.is_owned = ptr_is_owned(arg);
33844         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33845         arg_conv.is_owned = false;
33846         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
33847         return ret_conv;
33848 }
33849
33850 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
33851         LDKReplyShortChannelIdsEnd orig_conv;
33852         orig_conv.inner = untag_ptr(orig);
33853         orig_conv.is_owned = ptr_is_owned(orig);
33854         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33855         orig_conv.is_owned = false;
33856         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
33857         uint64_t ret_ref = 0;
33858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33860         return ret_ref;
33861 }
33862
33863 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_eq"))) TS_ReplyShortChannelIdsEnd_eq(uint64_t a, uint64_t b) {
33864         LDKReplyShortChannelIdsEnd a_conv;
33865         a_conv.inner = untag_ptr(a);
33866         a_conv.is_owned = ptr_is_owned(a);
33867         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33868         a_conv.is_owned = false;
33869         LDKReplyShortChannelIdsEnd b_conv;
33870         b_conv.inner = untag_ptr(b);
33871         b_conv.is_owned = ptr_is_owned(b);
33872         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33873         b_conv.is_owned = false;
33874         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
33875         return ret_conv;
33876 }
33877
33878 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
33879         LDKGossipTimestampFilter this_obj_conv;
33880         this_obj_conv.inner = untag_ptr(this_obj);
33881         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33883         GossipTimestampFilter_free(this_obj_conv);
33884 }
33885
33886 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
33887         LDKGossipTimestampFilter this_ptr_conv;
33888         this_ptr_conv.inner = untag_ptr(this_ptr);
33889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33891         this_ptr_conv.is_owned = false;
33892         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33893         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
33894         return ret_arr;
33895 }
33896
33897 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
33898         LDKGossipTimestampFilter this_ptr_conv;
33899         this_ptr_conv.inner = untag_ptr(this_ptr);
33900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33902         this_ptr_conv.is_owned = false;
33903         LDKThirtyTwoBytes val_ref;
33904         CHECK(val->arr_len == 32);
33905         memcpy(val_ref.data, val->elems, 32); FREE(val);
33906         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
33907 }
33908
33909 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
33910         LDKGossipTimestampFilter this_ptr_conv;
33911         this_ptr_conv.inner = untag_ptr(this_ptr);
33912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33914         this_ptr_conv.is_owned = false;
33915         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
33916         return ret_conv;
33917 }
33918
33919 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
33920         LDKGossipTimestampFilter this_ptr_conv;
33921         this_ptr_conv.inner = untag_ptr(this_ptr);
33922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33924         this_ptr_conv.is_owned = false;
33925         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
33926 }
33927
33928 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
33929         LDKGossipTimestampFilter this_ptr_conv;
33930         this_ptr_conv.inner = untag_ptr(this_ptr);
33931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33933         this_ptr_conv.is_owned = false;
33934         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
33935         return ret_conv;
33936 }
33937
33938 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
33939         LDKGossipTimestampFilter this_ptr_conv;
33940         this_ptr_conv.inner = untag_ptr(this_ptr);
33941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33943         this_ptr_conv.is_owned = false;
33944         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
33945 }
33946
33947 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_new"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
33948         LDKThirtyTwoBytes chain_hash_arg_ref;
33949         CHECK(chain_hash_arg->arr_len == 32);
33950         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
33951         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
33952         uint64_t ret_ref = 0;
33953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33955         return ret_ref;
33956 }
33957
33958 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
33959         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
33960         uint64_t ret_ref = 0;
33961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33963         return ret_ref;
33964 }
33965 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
33966         LDKGossipTimestampFilter arg_conv;
33967         arg_conv.inner = untag_ptr(arg);
33968         arg_conv.is_owned = ptr_is_owned(arg);
33969         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33970         arg_conv.is_owned = false;
33971         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
33972         return ret_conv;
33973 }
33974
33975 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
33976         LDKGossipTimestampFilter orig_conv;
33977         orig_conv.inner = untag_ptr(orig);
33978         orig_conv.is_owned = ptr_is_owned(orig);
33979         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33980         orig_conv.is_owned = false;
33981         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
33982         uint64_t ret_ref = 0;
33983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33985         return ret_ref;
33986 }
33987
33988 jboolean  __attribute__((export_name("TS_GossipTimestampFilter_eq"))) TS_GossipTimestampFilter_eq(uint64_t a, uint64_t b) {
33989         LDKGossipTimestampFilter a_conv;
33990         a_conv.inner = untag_ptr(a);
33991         a_conv.is_owned = ptr_is_owned(a);
33992         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33993         a_conv.is_owned = false;
33994         LDKGossipTimestampFilter b_conv;
33995         b_conv.inner = untag_ptr(b);
33996         b_conv.is_owned = ptr_is_owned(b);
33997         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33998         b_conv.is_owned = false;
33999         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
34000         return ret_conv;
34001 }
34002
34003 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
34004         if (!ptr_is_owned(this_ptr)) return;
34005         void* this_ptr_ptr = untag_ptr(this_ptr);
34006         CHECK_ACCESS(this_ptr_ptr);
34007         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
34008         FREE(untag_ptr(this_ptr));
34009         ErrorAction_free(this_ptr_conv);
34010 }
34011
34012 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
34013         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34014         *ret_copy = ErrorAction_clone(arg);
34015         uint64_t ret_ref = tag_ptr(ret_copy, true);
34016         return ret_ref;
34017 }
34018 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
34019         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
34020         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
34021         return ret_conv;
34022 }
34023
34024 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
34025         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
34026         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34027         *ret_copy = ErrorAction_clone(orig_conv);
34028         uint64_t ret_ref = tag_ptr(ret_copy, true);
34029         return ret_ref;
34030 }
34031
34032 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
34033         LDKErrorMessage msg_conv;
34034         msg_conv.inner = untag_ptr(msg);
34035         msg_conv.is_owned = ptr_is_owned(msg);
34036         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
34037         msg_conv = ErrorMessage_clone(&msg_conv);
34038         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34039         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
34040         uint64_t ret_ref = tag_ptr(ret_copy, true);
34041         return ret_ref;
34042 }
34043
34044 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
34045         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34046         *ret_copy = ErrorAction_ignore_error();
34047         uint64_t ret_ref = tag_ptr(ret_copy, true);
34048         return ret_ref;
34049 }
34050
34051 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
34052         LDKLevel a_conv = LDKLevel_from_js(a);
34053         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34054         *ret_copy = ErrorAction_ignore_and_log(a_conv);
34055         uint64_t ret_ref = tag_ptr(ret_copy, true);
34056         return ret_ref;
34057 }
34058
34059 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
34060         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34061         *ret_copy = ErrorAction_ignore_duplicate_gossip();
34062         uint64_t ret_ref = tag_ptr(ret_copy, true);
34063         return ret_ref;
34064 }
34065
34066 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
34067         LDKErrorMessage msg_conv;
34068         msg_conv.inner = untag_ptr(msg);
34069         msg_conv.is_owned = ptr_is_owned(msg);
34070         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
34071         msg_conv = ErrorMessage_clone(&msg_conv);
34072         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34073         *ret_copy = ErrorAction_send_error_message(msg_conv);
34074         uint64_t ret_ref = tag_ptr(ret_copy, true);
34075         return ret_ref;
34076 }
34077
34078 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
34079         LDKWarningMessage msg_conv;
34080         msg_conv.inner = untag_ptr(msg);
34081         msg_conv.is_owned = ptr_is_owned(msg);
34082         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
34083         msg_conv = WarningMessage_clone(&msg_conv);
34084         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
34085         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34086         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
34087         uint64_t ret_ref = tag_ptr(ret_copy, true);
34088         return ret_ref;
34089 }
34090
34091 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
34092         LDKLightningError this_obj_conv;
34093         this_obj_conv.inner = untag_ptr(this_obj);
34094         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34096         LightningError_free(this_obj_conv);
34097 }
34098
34099 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
34100         LDKLightningError this_ptr_conv;
34101         this_ptr_conv.inner = untag_ptr(this_ptr);
34102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34104         this_ptr_conv.is_owned = false;
34105         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
34106         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
34107         Str_free(ret_str);
34108         return ret_conv;
34109 }
34110
34111 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
34112         LDKLightningError this_ptr_conv;
34113         this_ptr_conv.inner = untag_ptr(this_ptr);
34114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34116         this_ptr_conv.is_owned = false;
34117         LDKStr val_conv = str_ref_to_owned_c(val);
34118         LightningError_set_err(&this_ptr_conv, val_conv);
34119 }
34120
34121 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
34122         LDKLightningError this_ptr_conv;
34123         this_ptr_conv.inner = untag_ptr(this_ptr);
34124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34126         this_ptr_conv.is_owned = false;
34127         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34128         *ret_copy = LightningError_get_action(&this_ptr_conv);
34129         uint64_t ret_ref = tag_ptr(ret_copy, true);
34130         return ret_ref;
34131 }
34132
34133 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
34134         LDKLightningError this_ptr_conv;
34135         this_ptr_conv.inner = untag_ptr(this_ptr);
34136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34138         this_ptr_conv.is_owned = false;
34139         void* val_ptr = untag_ptr(val);
34140         CHECK_ACCESS(val_ptr);
34141         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
34142         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
34143         LightningError_set_action(&this_ptr_conv, val_conv);
34144 }
34145
34146 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
34147         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
34148         void* action_arg_ptr = untag_ptr(action_arg);
34149         CHECK_ACCESS(action_arg_ptr);
34150         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
34151         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
34152         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
34153         uint64_t ret_ref = 0;
34154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34156         return ret_ref;
34157 }
34158
34159 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
34160         LDKLightningError ret_var = LightningError_clone(arg);
34161         uint64_t ret_ref = 0;
34162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34164         return ret_ref;
34165 }
34166 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
34167         LDKLightningError arg_conv;
34168         arg_conv.inner = untag_ptr(arg);
34169         arg_conv.is_owned = ptr_is_owned(arg);
34170         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34171         arg_conv.is_owned = false;
34172         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
34173         return ret_conv;
34174 }
34175
34176 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
34177         LDKLightningError orig_conv;
34178         orig_conv.inner = untag_ptr(orig);
34179         orig_conv.is_owned = ptr_is_owned(orig);
34180         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34181         orig_conv.is_owned = false;
34182         LDKLightningError ret_var = LightningError_clone(&orig_conv);
34183         uint64_t ret_ref = 0;
34184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34186         return ret_ref;
34187 }
34188
34189 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
34190         LDKCommitmentUpdate this_obj_conv;
34191         this_obj_conv.inner = untag_ptr(this_obj);
34192         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34194         CommitmentUpdate_free(this_obj_conv);
34195 }
34196
34197 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
34198         LDKCommitmentUpdate this_ptr_conv;
34199         this_ptr_conv.inner = untag_ptr(this_ptr);
34200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34202         this_ptr_conv.is_owned = false;
34203         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
34204         uint64_tArray ret_arr = NULL;
34205         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34206         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34207         for (size_t p = 0; p < ret_var.datalen; p++) {
34208                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
34209                 uint64_t ret_conv_15_ref = 0;
34210                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
34211                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
34212                 ret_arr_ptr[p] = ret_conv_15_ref;
34213         }
34214         
34215         FREE(ret_var.data);
34216         return ret_arr;
34217 }
34218
34219 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
34220         LDKCommitmentUpdate this_ptr_conv;
34221         this_ptr_conv.inner = untag_ptr(this_ptr);
34222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34224         this_ptr_conv.is_owned = false;
34225         LDKCVec_UpdateAddHTLCZ val_constr;
34226         val_constr.datalen = val->arr_len;
34227         if (val_constr.datalen > 0)
34228                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
34229         else
34230                 val_constr.data = NULL;
34231         uint64_t* val_vals = val->elems;
34232         for (size_t p = 0; p < val_constr.datalen; p++) {
34233                 uint64_t val_conv_15 = val_vals[p];
34234                 LDKUpdateAddHTLC val_conv_15_conv;
34235                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
34236                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
34237                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
34238                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
34239                 val_constr.data[p] = val_conv_15_conv;
34240         }
34241         FREE(val);
34242         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
34243 }
34244
34245 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
34246         LDKCommitmentUpdate this_ptr_conv;
34247         this_ptr_conv.inner = untag_ptr(this_ptr);
34248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34250         this_ptr_conv.is_owned = false;
34251         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
34252         uint64_tArray ret_arr = NULL;
34253         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34254         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34255         for (size_t t = 0; t < ret_var.datalen; t++) {
34256                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
34257                 uint64_t ret_conv_19_ref = 0;
34258                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
34259                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
34260                 ret_arr_ptr[t] = ret_conv_19_ref;
34261         }
34262         
34263         FREE(ret_var.data);
34264         return ret_arr;
34265 }
34266
34267 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
34268         LDKCommitmentUpdate this_ptr_conv;
34269         this_ptr_conv.inner = untag_ptr(this_ptr);
34270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34272         this_ptr_conv.is_owned = false;
34273         LDKCVec_UpdateFulfillHTLCZ val_constr;
34274         val_constr.datalen = val->arr_len;
34275         if (val_constr.datalen > 0)
34276                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
34277         else
34278                 val_constr.data = NULL;
34279         uint64_t* val_vals = val->elems;
34280         for (size_t t = 0; t < val_constr.datalen; t++) {
34281                 uint64_t val_conv_19 = val_vals[t];
34282                 LDKUpdateFulfillHTLC val_conv_19_conv;
34283                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
34284                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
34285                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
34286                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
34287                 val_constr.data[t] = val_conv_19_conv;
34288         }
34289         FREE(val);
34290         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
34291 }
34292
34293 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
34294         LDKCommitmentUpdate this_ptr_conv;
34295         this_ptr_conv.inner = untag_ptr(this_ptr);
34296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34298         this_ptr_conv.is_owned = false;
34299         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
34300         uint64_tArray ret_arr = NULL;
34301         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34302         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34303         for (size_t q = 0; q < ret_var.datalen; q++) {
34304                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
34305                 uint64_t ret_conv_16_ref = 0;
34306                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
34307                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
34308                 ret_arr_ptr[q] = ret_conv_16_ref;
34309         }
34310         
34311         FREE(ret_var.data);
34312         return ret_arr;
34313 }
34314
34315 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
34316         LDKCommitmentUpdate this_ptr_conv;
34317         this_ptr_conv.inner = untag_ptr(this_ptr);
34318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34320         this_ptr_conv.is_owned = false;
34321         LDKCVec_UpdateFailHTLCZ val_constr;
34322         val_constr.datalen = val->arr_len;
34323         if (val_constr.datalen > 0)
34324                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
34325         else
34326                 val_constr.data = NULL;
34327         uint64_t* val_vals = val->elems;
34328         for (size_t q = 0; q < val_constr.datalen; q++) {
34329                 uint64_t val_conv_16 = val_vals[q];
34330                 LDKUpdateFailHTLC val_conv_16_conv;
34331                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
34332                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
34333                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
34334                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
34335                 val_constr.data[q] = val_conv_16_conv;
34336         }
34337         FREE(val);
34338         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
34339 }
34340
34341 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
34342         LDKCommitmentUpdate this_ptr_conv;
34343         this_ptr_conv.inner = untag_ptr(this_ptr);
34344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34346         this_ptr_conv.is_owned = false;
34347         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
34348         uint64_tArray ret_arr = NULL;
34349         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34350         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34351         for (size_t z = 0; z < ret_var.datalen; z++) {
34352                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
34353                 uint64_t ret_conv_25_ref = 0;
34354                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
34355                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
34356                 ret_arr_ptr[z] = ret_conv_25_ref;
34357         }
34358         
34359         FREE(ret_var.data);
34360         return ret_arr;
34361 }
34362
34363 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint64_t this_ptr, uint64_tArray val) {
34364         LDKCommitmentUpdate this_ptr_conv;
34365         this_ptr_conv.inner = untag_ptr(this_ptr);
34366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34368         this_ptr_conv.is_owned = false;
34369         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
34370         val_constr.datalen = val->arr_len;
34371         if (val_constr.datalen > 0)
34372                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
34373         else
34374                 val_constr.data = NULL;
34375         uint64_t* val_vals = val->elems;
34376         for (size_t z = 0; z < val_constr.datalen; z++) {
34377                 uint64_t val_conv_25 = val_vals[z];
34378                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
34379                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
34380                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
34381                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
34382                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
34383                 val_constr.data[z] = val_conv_25_conv;
34384         }
34385         FREE(val);
34386         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
34387 }
34388
34389 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
34390         LDKCommitmentUpdate this_ptr_conv;
34391         this_ptr_conv.inner = untag_ptr(this_ptr);
34392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34394         this_ptr_conv.is_owned = false;
34395         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
34396         uint64_t ret_ref = 0;
34397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34399         return ret_ref;
34400 }
34401
34402 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
34403         LDKCommitmentUpdate this_ptr_conv;
34404         this_ptr_conv.inner = untag_ptr(this_ptr);
34405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34407         this_ptr_conv.is_owned = false;
34408         LDKUpdateFee val_conv;
34409         val_conv.inner = untag_ptr(val);
34410         val_conv.is_owned = ptr_is_owned(val);
34411         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34412         val_conv = UpdateFee_clone(&val_conv);
34413         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
34414 }
34415
34416 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
34417         LDKCommitmentUpdate this_ptr_conv;
34418         this_ptr_conv.inner = untag_ptr(this_ptr);
34419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34421         this_ptr_conv.is_owned = false;
34422         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
34423         uint64_t ret_ref = 0;
34424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34426         return ret_ref;
34427 }
34428
34429 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
34430         LDKCommitmentUpdate this_ptr_conv;
34431         this_ptr_conv.inner = untag_ptr(this_ptr);
34432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34434         this_ptr_conv.is_owned = false;
34435         LDKCommitmentSigned val_conv;
34436         val_conv.inner = untag_ptr(val);
34437         val_conv.is_owned = ptr_is_owned(val);
34438         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34439         val_conv = CommitmentSigned_clone(&val_conv);
34440         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
34441 }
34442
34443 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_new"))) TS_CommitmentUpdate_new(uint64_tArray update_add_htlcs_arg, uint64_tArray update_fulfill_htlcs_arg, uint64_tArray update_fail_htlcs_arg, uint64_tArray update_fail_malformed_htlcs_arg, uint64_t update_fee_arg, uint64_t commitment_signed_arg) {
34444         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
34445         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
34446         if (update_add_htlcs_arg_constr.datalen > 0)
34447                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
34448         else
34449                 update_add_htlcs_arg_constr.data = NULL;
34450         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
34451         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
34452                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
34453                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
34454                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
34455                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
34456                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
34457                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
34458                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
34459         }
34460         FREE(update_add_htlcs_arg);
34461         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
34462         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
34463         if (update_fulfill_htlcs_arg_constr.datalen > 0)
34464                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
34465         else
34466                 update_fulfill_htlcs_arg_constr.data = NULL;
34467         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
34468         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
34469                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
34470                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
34471                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
34472                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
34473                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
34474                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
34475                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
34476         }
34477         FREE(update_fulfill_htlcs_arg);
34478         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
34479         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
34480         if (update_fail_htlcs_arg_constr.datalen > 0)
34481                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
34482         else
34483                 update_fail_htlcs_arg_constr.data = NULL;
34484         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
34485         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
34486                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
34487                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
34488                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
34489                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
34490                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
34491                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
34492                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
34493         }
34494         FREE(update_fail_htlcs_arg);
34495         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
34496         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
34497         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
34498                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
34499         else
34500                 update_fail_malformed_htlcs_arg_constr.data = NULL;
34501         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
34502         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
34503                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
34504                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
34505                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
34506                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
34507                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
34508                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
34509                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
34510         }
34511         FREE(update_fail_malformed_htlcs_arg);
34512         LDKUpdateFee update_fee_arg_conv;
34513         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
34514         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
34515         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
34516         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
34517         LDKCommitmentSigned commitment_signed_arg_conv;
34518         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
34519         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
34520         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
34521         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
34522         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);
34523         uint64_t ret_ref = 0;
34524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34526         return ret_ref;
34527 }
34528
34529 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
34530         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
34531         uint64_t ret_ref = 0;
34532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34534         return ret_ref;
34535 }
34536 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
34537         LDKCommitmentUpdate arg_conv;
34538         arg_conv.inner = untag_ptr(arg);
34539         arg_conv.is_owned = ptr_is_owned(arg);
34540         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34541         arg_conv.is_owned = false;
34542         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
34543         return ret_conv;
34544 }
34545
34546 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
34547         LDKCommitmentUpdate orig_conv;
34548         orig_conv.inner = untag_ptr(orig);
34549         orig_conv.is_owned = ptr_is_owned(orig);
34550         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34551         orig_conv.is_owned = false;
34552         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
34553         uint64_t ret_ref = 0;
34554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34556         return ret_ref;
34557 }
34558
34559 jboolean  __attribute__((export_name("TS_CommitmentUpdate_eq"))) TS_CommitmentUpdate_eq(uint64_t a, uint64_t b) {
34560         LDKCommitmentUpdate a_conv;
34561         a_conv.inner = untag_ptr(a);
34562         a_conv.is_owned = ptr_is_owned(a);
34563         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34564         a_conv.is_owned = false;
34565         LDKCommitmentUpdate b_conv;
34566         b_conv.inner = untag_ptr(b);
34567         b_conv.is_owned = ptr_is_owned(b);
34568         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34569         b_conv.is_owned = false;
34570         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
34571         return ret_conv;
34572 }
34573
34574 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
34575         if (!ptr_is_owned(this_ptr)) return;
34576         void* this_ptr_ptr = untag_ptr(this_ptr);
34577         CHECK_ACCESS(this_ptr_ptr);
34578         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
34579         FREE(untag_ptr(this_ptr));
34580         ChannelMessageHandler_free(this_ptr_conv);
34581 }
34582
34583 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
34584         if (!ptr_is_owned(this_ptr)) return;
34585         void* this_ptr_ptr = untag_ptr(this_ptr);
34586         CHECK_ACCESS(this_ptr_ptr);
34587         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
34588         FREE(untag_ptr(this_ptr));
34589         RoutingMessageHandler_free(this_ptr_conv);
34590 }
34591
34592 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
34593         if (!ptr_is_owned(this_ptr)) return;
34594         void* this_ptr_ptr = untag_ptr(this_ptr);
34595         CHECK_ACCESS(this_ptr_ptr);
34596         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
34597         FREE(untag_ptr(this_ptr));
34598         OnionMessageHandler_free(this_ptr_conv);
34599 }
34600
34601 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
34602         LDKAcceptChannel obj_conv;
34603         obj_conv.inner = untag_ptr(obj);
34604         obj_conv.is_owned = ptr_is_owned(obj);
34605         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34606         obj_conv.is_owned = false;
34607         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
34608         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34609         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34610         CVec_u8Z_free(ret_var);
34611         return ret_arr;
34612 }
34613
34614 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
34615         LDKu8slice ser_ref;
34616         ser_ref.datalen = ser->arr_len;
34617         ser_ref.data = ser->elems;
34618         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
34619         *ret_conv = AcceptChannel_read(ser_ref);
34620         FREE(ser);
34621         return tag_ptr(ret_conv, true);
34622 }
34623
34624 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
34625         LDKAnnouncementSignatures obj_conv;
34626         obj_conv.inner = untag_ptr(obj);
34627         obj_conv.is_owned = ptr_is_owned(obj);
34628         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34629         obj_conv.is_owned = false;
34630         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
34631         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34632         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34633         CVec_u8Z_free(ret_var);
34634         return ret_arr;
34635 }
34636
34637 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
34638         LDKu8slice ser_ref;
34639         ser_ref.datalen = ser->arr_len;
34640         ser_ref.data = ser->elems;
34641         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
34642         *ret_conv = AnnouncementSignatures_read(ser_ref);
34643         FREE(ser);
34644         return tag_ptr(ret_conv, true);
34645 }
34646
34647 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
34648         LDKChannelReestablish obj_conv;
34649         obj_conv.inner = untag_ptr(obj);
34650         obj_conv.is_owned = ptr_is_owned(obj);
34651         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34652         obj_conv.is_owned = false;
34653         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
34654         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34655         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34656         CVec_u8Z_free(ret_var);
34657         return ret_arr;
34658 }
34659
34660 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
34661         LDKu8slice ser_ref;
34662         ser_ref.datalen = ser->arr_len;
34663         ser_ref.data = ser->elems;
34664         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
34665         *ret_conv = ChannelReestablish_read(ser_ref);
34666         FREE(ser);
34667         return tag_ptr(ret_conv, true);
34668 }
34669
34670 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
34671         LDKClosingSigned obj_conv;
34672         obj_conv.inner = untag_ptr(obj);
34673         obj_conv.is_owned = ptr_is_owned(obj);
34674         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34675         obj_conv.is_owned = false;
34676         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
34677         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34678         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34679         CVec_u8Z_free(ret_var);
34680         return ret_arr;
34681 }
34682
34683 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
34684         LDKu8slice ser_ref;
34685         ser_ref.datalen = ser->arr_len;
34686         ser_ref.data = ser->elems;
34687         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
34688         *ret_conv = ClosingSigned_read(ser_ref);
34689         FREE(ser);
34690         return tag_ptr(ret_conv, true);
34691 }
34692
34693 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
34694         LDKClosingSignedFeeRange obj_conv;
34695         obj_conv.inner = untag_ptr(obj);
34696         obj_conv.is_owned = ptr_is_owned(obj);
34697         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34698         obj_conv.is_owned = false;
34699         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
34700         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34701         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34702         CVec_u8Z_free(ret_var);
34703         return ret_arr;
34704 }
34705
34706 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
34707         LDKu8slice ser_ref;
34708         ser_ref.datalen = ser->arr_len;
34709         ser_ref.data = ser->elems;
34710         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
34711         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
34712         FREE(ser);
34713         return tag_ptr(ret_conv, true);
34714 }
34715
34716 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
34717         LDKCommitmentSigned obj_conv;
34718         obj_conv.inner = untag_ptr(obj);
34719         obj_conv.is_owned = ptr_is_owned(obj);
34720         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34721         obj_conv.is_owned = false;
34722         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
34723         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34724         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34725         CVec_u8Z_free(ret_var);
34726         return ret_arr;
34727 }
34728
34729 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
34730         LDKu8slice ser_ref;
34731         ser_ref.datalen = ser->arr_len;
34732         ser_ref.data = ser->elems;
34733         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
34734         *ret_conv = CommitmentSigned_read(ser_ref);
34735         FREE(ser);
34736         return tag_ptr(ret_conv, true);
34737 }
34738
34739 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
34740         LDKFundingCreated obj_conv;
34741         obj_conv.inner = untag_ptr(obj);
34742         obj_conv.is_owned = ptr_is_owned(obj);
34743         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34744         obj_conv.is_owned = false;
34745         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
34746         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34747         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34748         CVec_u8Z_free(ret_var);
34749         return ret_arr;
34750 }
34751
34752 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
34753         LDKu8slice ser_ref;
34754         ser_ref.datalen = ser->arr_len;
34755         ser_ref.data = ser->elems;
34756         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
34757         *ret_conv = FundingCreated_read(ser_ref);
34758         FREE(ser);
34759         return tag_ptr(ret_conv, true);
34760 }
34761
34762 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
34763         LDKFundingSigned obj_conv;
34764         obj_conv.inner = untag_ptr(obj);
34765         obj_conv.is_owned = ptr_is_owned(obj);
34766         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34767         obj_conv.is_owned = false;
34768         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
34769         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34770         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34771         CVec_u8Z_free(ret_var);
34772         return ret_arr;
34773 }
34774
34775 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
34776         LDKu8slice ser_ref;
34777         ser_ref.datalen = ser->arr_len;
34778         ser_ref.data = ser->elems;
34779         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
34780         *ret_conv = FundingSigned_read(ser_ref);
34781         FREE(ser);
34782         return tag_ptr(ret_conv, true);
34783 }
34784
34785 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
34786         LDKChannelReady obj_conv;
34787         obj_conv.inner = untag_ptr(obj);
34788         obj_conv.is_owned = ptr_is_owned(obj);
34789         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34790         obj_conv.is_owned = false;
34791         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
34792         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34793         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34794         CVec_u8Z_free(ret_var);
34795         return ret_arr;
34796 }
34797
34798 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
34799         LDKu8slice ser_ref;
34800         ser_ref.datalen = ser->arr_len;
34801         ser_ref.data = ser->elems;
34802         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
34803         *ret_conv = ChannelReady_read(ser_ref);
34804         FREE(ser);
34805         return tag_ptr(ret_conv, true);
34806 }
34807
34808 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
34809         LDKInit obj_conv;
34810         obj_conv.inner = untag_ptr(obj);
34811         obj_conv.is_owned = ptr_is_owned(obj);
34812         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34813         obj_conv.is_owned = false;
34814         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
34815         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34816         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34817         CVec_u8Z_free(ret_var);
34818         return ret_arr;
34819 }
34820
34821 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
34822         LDKu8slice ser_ref;
34823         ser_ref.datalen = ser->arr_len;
34824         ser_ref.data = ser->elems;
34825         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
34826         *ret_conv = Init_read(ser_ref);
34827         FREE(ser);
34828         return tag_ptr(ret_conv, true);
34829 }
34830
34831 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
34832         LDKOpenChannel obj_conv;
34833         obj_conv.inner = untag_ptr(obj);
34834         obj_conv.is_owned = ptr_is_owned(obj);
34835         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34836         obj_conv.is_owned = false;
34837         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
34838         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34839         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34840         CVec_u8Z_free(ret_var);
34841         return ret_arr;
34842 }
34843
34844 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
34845         LDKu8slice ser_ref;
34846         ser_ref.datalen = ser->arr_len;
34847         ser_ref.data = ser->elems;
34848         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
34849         *ret_conv = OpenChannel_read(ser_ref);
34850         FREE(ser);
34851         return tag_ptr(ret_conv, true);
34852 }
34853
34854 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
34855         LDKRevokeAndACK obj_conv;
34856         obj_conv.inner = untag_ptr(obj);
34857         obj_conv.is_owned = ptr_is_owned(obj);
34858         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34859         obj_conv.is_owned = false;
34860         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
34861         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34862         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34863         CVec_u8Z_free(ret_var);
34864         return ret_arr;
34865 }
34866
34867 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
34868         LDKu8slice ser_ref;
34869         ser_ref.datalen = ser->arr_len;
34870         ser_ref.data = ser->elems;
34871         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
34872         *ret_conv = RevokeAndACK_read(ser_ref);
34873         FREE(ser);
34874         return tag_ptr(ret_conv, true);
34875 }
34876
34877 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
34878         LDKShutdown obj_conv;
34879         obj_conv.inner = untag_ptr(obj);
34880         obj_conv.is_owned = ptr_is_owned(obj);
34881         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34882         obj_conv.is_owned = false;
34883         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
34884         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34885         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34886         CVec_u8Z_free(ret_var);
34887         return ret_arr;
34888 }
34889
34890 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
34891         LDKu8slice ser_ref;
34892         ser_ref.datalen = ser->arr_len;
34893         ser_ref.data = ser->elems;
34894         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
34895         *ret_conv = Shutdown_read(ser_ref);
34896         FREE(ser);
34897         return tag_ptr(ret_conv, true);
34898 }
34899
34900 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
34901         LDKUpdateFailHTLC obj_conv;
34902         obj_conv.inner = untag_ptr(obj);
34903         obj_conv.is_owned = ptr_is_owned(obj);
34904         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34905         obj_conv.is_owned = false;
34906         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
34907         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34908         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34909         CVec_u8Z_free(ret_var);
34910         return ret_arr;
34911 }
34912
34913 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
34914         LDKu8slice ser_ref;
34915         ser_ref.datalen = ser->arr_len;
34916         ser_ref.data = ser->elems;
34917         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
34918         *ret_conv = UpdateFailHTLC_read(ser_ref);
34919         FREE(ser);
34920         return tag_ptr(ret_conv, true);
34921 }
34922
34923 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
34924         LDKUpdateFailMalformedHTLC obj_conv;
34925         obj_conv.inner = untag_ptr(obj);
34926         obj_conv.is_owned = ptr_is_owned(obj);
34927         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34928         obj_conv.is_owned = false;
34929         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
34930         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34931         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34932         CVec_u8Z_free(ret_var);
34933         return ret_arr;
34934 }
34935
34936 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
34937         LDKu8slice ser_ref;
34938         ser_ref.datalen = ser->arr_len;
34939         ser_ref.data = ser->elems;
34940         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
34941         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
34942         FREE(ser);
34943         return tag_ptr(ret_conv, true);
34944 }
34945
34946 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
34947         LDKUpdateFee obj_conv;
34948         obj_conv.inner = untag_ptr(obj);
34949         obj_conv.is_owned = ptr_is_owned(obj);
34950         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34951         obj_conv.is_owned = false;
34952         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
34953         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34954         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34955         CVec_u8Z_free(ret_var);
34956         return ret_arr;
34957 }
34958
34959 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
34960         LDKu8slice ser_ref;
34961         ser_ref.datalen = ser->arr_len;
34962         ser_ref.data = ser->elems;
34963         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
34964         *ret_conv = UpdateFee_read(ser_ref);
34965         FREE(ser);
34966         return tag_ptr(ret_conv, true);
34967 }
34968
34969 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
34970         LDKUpdateFulfillHTLC obj_conv;
34971         obj_conv.inner = untag_ptr(obj);
34972         obj_conv.is_owned = ptr_is_owned(obj);
34973         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34974         obj_conv.is_owned = false;
34975         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
34976         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34977         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34978         CVec_u8Z_free(ret_var);
34979         return ret_arr;
34980 }
34981
34982 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
34983         LDKu8slice ser_ref;
34984         ser_ref.datalen = ser->arr_len;
34985         ser_ref.data = ser->elems;
34986         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
34987         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
34988         FREE(ser);
34989         return tag_ptr(ret_conv, true);
34990 }
34991
34992 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
34993         LDKUpdateAddHTLC obj_conv;
34994         obj_conv.inner = untag_ptr(obj);
34995         obj_conv.is_owned = ptr_is_owned(obj);
34996         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34997         obj_conv.is_owned = false;
34998         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
34999         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35000         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35001         CVec_u8Z_free(ret_var);
35002         return ret_arr;
35003 }
35004
35005 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
35006         LDKu8slice ser_ref;
35007         ser_ref.datalen = ser->arr_len;
35008         ser_ref.data = ser->elems;
35009         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
35010         *ret_conv = UpdateAddHTLC_read(ser_ref);
35011         FREE(ser);
35012         return tag_ptr(ret_conv, true);
35013 }
35014
35015 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
35016         LDKu8slice ser_ref;
35017         ser_ref.datalen = ser->arr_len;
35018         ser_ref.data = ser->elems;
35019         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
35020         *ret_conv = OnionMessage_read(ser_ref);
35021         FREE(ser);
35022         return tag_ptr(ret_conv, true);
35023 }
35024
35025 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
35026         LDKOnionMessage obj_conv;
35027         obj_conv.inner = untag_ptr(obj);
35028         obj_conv.is_owned = ptr_is_owned(obj);
35029         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35030         obj_conv.is_owned = false;
35031         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
35032         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35033         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35034         CVec_u8Z_free(ret_var);
35035         return ret_arr;
35036 }
35037
35038 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
35039         LDKPing obj_conv;
35040         obj_conv.inner = untag_ptr(obj);
35041         obj_conv.is_owned = ptr_is_owned(obj);
35042         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35043         obj_conv.is_owned = false;
35044         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
35045         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35046         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35047         CVec_u8Z_free(ret_var);
35048         return ret_arr;
35049 }
35050
35051 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
35052         LDKu8slice ser_ref;
35053         ser_ref.datalen = ser->arr_len;
35054         ser_ref.data = ser->elems;
35055         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
35056         *ret_conv = Ping_read(ser_ref);
35057         FREE(ser);
35058         return tag_ptr(ret_conv, true);
35059 }
35060
35061 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
35062         LDKPong obj_conv;
35063         obj_conv.inner = untag_ptr(obj);
35064         obj_conv.is_owned = ptr_is_owned(obj);
35065         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35066         obj_conv.is_owned = false;
35067         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
35068         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35069         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35070         CVec_u8Z_free(ret_var);
35071         return ret_arr;
35072 }
35073
35074 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
35075         LDKu8slice ser_ref;
35076         ser_ref.datalen = ser->arr_len;
35077         ser_ref.data = ser->elems;
35078         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
35079         *ret_conv = Pong_read(ser_ref);
35080         FREE(ser);
35081         return tag_ptr(ret_conv, true);
35082 }
35083
35084 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
35085         LDKUnsignedChannelAnnouncement obj_conv;
35086         obj_conv.inner = untag_ptr(obj);
35087         obj_conv.is_owned = ptr_is_owned(obj);
35088         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35089         obj_conv.is_owned = false;
35090         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
35091         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35092         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35093         CVec_u8Z_free(ret_var);
35094         return ret_arr;
35095 }
35096
35097 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
35098         LDKu8slice ser_ref;
35099         ser_ref.datalen = ser->arr_len;
35100         ser_ref.data = ser->elems;
35101         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
35102         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
35103         FREE(ser);
35104         return tag_ptr(ret_conv, true);
35105 }
35106
35107 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
35108         LDKChannelAnnouncement obj_conv;
35109         obj_conv.inner = untag_ptr(obj);
35110         obj_conv.is_owned = ptr_is_owned(obj);
35111         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35112         obj_conv.is_owned = false;
35113         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
35114         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35115         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35116         CVec_u8Z_free(ret_var);
35117         return ret_arr;
35118 }
35119
35120 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
35121         LDKu8slice ser_ref;
35122         ser_ref.datalen = ser->arr_len;
35123         ser_ref.data = ser->elems;
35124         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
35125         *ret_conv = ChannelAnnouncement_read(ser_ref);
35126         FREE(ser);
35127         return tag_ptr(ret_conv, true);
35128 }
35129
35130 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
35131         LDKUnsignedChannelUpdate obj_conv;
35132         obj_conv.inner = untag_ptr(obj);
35133         obj_conv.is_owned = ptr_is_owned(obj);
35134         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35135         obj_conv.is_owned = false;
35136         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
35137         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35138         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35139         CVec_u8Z_free(ret_var);
35140         return ret_arr;
35141 }
35142
35143 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
35144         LDKu8slice ser_ref;
35145         ser_ref.datalen = ser->arr_len;
35146         ser_ref.data = ser->elems;
35147         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
35148         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
35149         FREE(ser);
35150         return tag_ptr(ret_conv, true);
35151 }
35152
35153 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
35154         LDKChannelUpdate obj_conv;
35155         obj_conv.inner = untag_ptr(obj);
35156         obj_conv.is_owned = ptr_is_owned(obj);
35157         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35158         obj_conv.is_owned = false;
35159         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
35160         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35161         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35162         CVec_u8Z_free(ret_var);
35163         return ret_arr;
35164 }
35165
35166 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
35167         LDKu8slice ser_ref;
35168         ser_ref.datalen = ser->arr_len;
35169         ser_ref.data = ser->elems;
35170         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
35171         *ret_conv = ChannelUpdate_read(ser_ref);
35172         FREE(ser);
35173         return tag_ptr(ret_conv, true);
35174 }
35175
35176 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
35177         LDKErrorMessage obj_conv;
35178         obj_conv.inner = untag_ptr(obj);
35179         obj_conv.is_owned = ptr_is_owned(obj);
35180         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35181         obj_conv.is_owned = false;
35182         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
35183         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35184         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35185         CVec_u8Z_free(ret_var);
35186         return ret_arr;
35187 }
35188
35189 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
35190         LDKu8slice ser_ref;
35191         ser_ref.datalen = ser->arr_len;
35192         ser_ref.data = ser->elems;
35193         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
35194         *ret_conv = ErrorMessage_read(ser_ref);
35195         FREE(ser);
35196         return tag_ptr(ret_conv, true);
35197 }
35198
35199 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
35200         LDKWarningMessage obj_conv;
35201         obj_conv.inner = untag_ptr(obj);
35202         obj_conv.is_owned = ptr_is_owned(obj);
35203         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35204         obj_conv.is_owned = false;
35205         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
35206         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35207         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35208         CVec_u8Z_free(ret_var);
35209         return ret_arr;
35210 }
35211
35212 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
35213         LDKu8slice ser_ref;
35214         ser_ref.datalen = ser->arr_len;
35215         ser_ref.data = ser->elems;
35216         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
35217         *ret_conv = WarningMessage_read(ser_ref);
35218         FREE(ser);
35219         return tag_ptr(ret_conv, true);
35220 }
35221
35222 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
35223         LDKUnsignedNodeAnnouncement obj_conv;
35224         obj_conv.inner = untag_ptr(obj);
35225         obj_conv.is_owned = ptr_is_owned(obj);
35226         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35227         obj_conv.is_owned = false;
35228         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
35229         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35230         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35231         CVec_u8Z_free(ret_var);
35232         return ret_arr;
35233 }
35234
35235 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
35236         LDKu8slice ser_ref;
35237         ser_ref.datalen = ser->arr_len;
35238         ser_ref.data = ser->elems;
35239         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
35240         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
35241         FREE(ser);
35242         return tag_ptr(ret_conv, true);
35243 }
35244
35245 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
35246         LDKNodeAnnouncement obj_conv;
35247         obj_conv.inner = untag_ptr(obj);
35248         obj_conv.is_owned = ptr_is_owned(obj);
35249         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35250         obj_conv.is_owned = false;
35251         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
35252         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35253         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35254         CVec_u8Z_free(ret_var);
35255         return ret_arr;
35256 }
35257
35258 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
35259         LDKu8slice ser_ref;
35260         ser_ref.datalen = ser->arr_len;
35261         ser_ref.data = ser->elems;
35262         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
35263         *ret_conv = NodeAnnouncement_read(ser_ref);
35264         FREE(ser);
35265         return tag_ptr(ret_conv, true);
35266 }
35267
35268 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
35269         LDKu8slice ser_ref;
35270         ser_ref.datalen = ser->arr_len;
35271         ser_ref.data = ser->elems;
35272         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
35273         *ret_conv = QueryShortChannelIds_read(ser_ref);
35274         FREE(ser);
35275         return tag_ptr(ret_conv, true);
35276 }
35277
35278 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
35279         LDKQueryShortChannelIds obj_conv;
35280         obj_conv.inner = untag_ptr(obj);
35281         obj_conv.is_owned = ptr_is_owned(obj);
35282         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35283         obj_conv.is_owned = false;
35284         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
35285         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35286         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35287         CVec_u8Z_free(ret_var);
35288         return ret_arr;
35289 }
35290
35291 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
35292         LDKReplyShortChannelIdsEnd obj_conv;
35293         obj_conv.inner = untag_ptr(obj);
35294         obj_conv.is_owned = ptr_is_owned(obj);
35295         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35296         obj_conv.is_owned = false;
35297         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
35298         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35299         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35300         CVec_u8Z_free(ret_var);
35301         return ret_arr;
35302 }
35303
35304 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
35305         LDKu8slice ser_ref;
35306         ser_ref.datalen = ser->arr_len;
35307         ser_ref.data = ser->elems;
35308         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
35309         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
35310         FREE(ser);
35311         return tag_ptr(ret_conv, true);
35312 }
35313
35314 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
35315         LDKQueryChannelRange this_arg_conv;
35316         this_arg_conv.inner = untag_ptr(this_arg);
35317         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35319         this_arg_conv.is_owned = false;
35320         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
35321         return ret_conv;
35322 }
35323
35324 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
35325         LDKQueryChannelRange obj_conv;
35326         obj_conv.inner = untag_ptr(obj);
35327         obj_conv.is_owned = ptr_is_owned(obj);
35328         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35329         obj_conv.is_owned = false;
35330         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
35331         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35332         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35333         CVec_u8Z_free(ret_var);
35334         return ret_arr;
35335 }
35336
35337 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
35338         LDKu8slice ser_ref;
35339         ser_ref.datalen = ser->arr_len;
35340         ser_ref.data = ser->elems;
35341         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
35342         *ret_conv = QueryChannelRange_read(ser_ref);
35343         FREE(ser);
35344         return tag_ptr(ret_conv, true);
35345 }
35346
35347 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
35348         LDKu8slice ser_ref;
35349         ser_ref.datalen = ser->arr_len;
35350         ser_ref.data = ser->elems;
35351         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
35352         *ret_conv = ReplyChannelRange_read(ser_ref);
35353         FREE(ser);
35354         return tag_ptr(ret_conv, true);
35355 }
35356
35357 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
35358         LDKReplyChannelRange obj_conv;
35359         obj_conv.inner = untag_ptr(obj);
35360         obj_conv.is_owned = ptr_is_owned(obj);
35361         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35362         obj_conv.is_owned = false;
35363         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
35364         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35365         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35366         CVec_u8Z_free(ret_var);
35367         return ret_arr;
35368 }
35369
35370 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
35371         LDKGossipTimestampFilter obj_conv;
35372         obj_conv.inner = untag_ptr(obj);
35373         obj_conv.is_owned = ptr_is_owned(obj);
35374         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35375         obj_conv.is_owned = false;
35376         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
35377         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35378         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35379         CVec_u8Z_free(ret_var);
35380         return ret_arr;
35381 }
35382
35383 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
35384         LDKu8slice ser_ref;
35385         ser_ref.datalen = ser->arr_len;
35386         ser_ref.data = ser->elems;
35387         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
35388         *ret_conv = GossipTimestampFilter_read(ser_ref);
35389         FREE(ser);
35390         return tag_ptr(ret_conv, true);
35391 }
35392
35393 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
35394         if (!ptr_is_owned(this_ptr)) return;
35395         void* this_ptr_ptr = untag_ptr(this_ptr);
35396         CHECK_ACCESS(this_ptr_ptr);
35397         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
35398         FREE(untag_ptr(this_ptr));
35399         CustomMessageHandler_free(this_ptr_conv);
35400 }
35401
35402 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
35403         LDKIgnoringMessageHandler this_obj_conv;
35404         this_obj_conv.inner = untag_ptr(this_obj);
35405         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35407         IgnoringMessageHandler_free(this_obj_conv);
35408 }
35409
35410 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
35411         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
35412         uint64_t ret_ref = 0;
35413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35415         return ret_ref;
35416 }
35417
35418 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
35419         LDKIgnoringMessageHandler this_arg_conv;
35420         this_arg_conv.inner = untag_ptr(this_arg);
35421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35423         this_arg_conv.is_owned = false;
35424         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
35425         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
35426         return tag_ptr(ret_ret, true);
35427 }
35428
35429 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
35430         LDKIgnoringMessageHandler this_arg_conv;
35431         this_arg_conv.inner = untag_ptr(this_arg);
35432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35434         this_arg_conv.is_owned = false;
35435         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
35436         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
35437         return tag_ptr(ret_ret, true);
35438 }
35439
35440 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageProvider"))) TS_IgnoringMessageHandler_as_OnionMessageProvider(uint64_t this_arg) {
35441         LDKIgnoringMessageHandler this_arg_conv;
35442         this_arg_conv.inner = untag_ptr(this_arg);
35443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35445         this_arg_conv.is_owned = false;
35446         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
35447         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
35448         return tag_ptr(ret_ret, true);
35449 }
35450
35451 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
35452         LDKIgnoringMessageHandler this_arg_conv;
35453         this_arg_conv.inner = untag_ptr(this_arg);
35454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35456         this_arg_conv.is_owned = false;
35457         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
35458         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
35459         return tag_ptr(ret_ret, true);
35460 }
35461
35462 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomOnionMessageHandler"))) TS_IgnoringMessageHandler_as_CustomOnionMessageHandler(uint64_t this_arg) {
35463         LDKIgnoringMessageHandler this_arg_conv;
35464         this_arg_conv.inner = untag_ptr(this_arg);
35465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35467         this_arg_conv.is_owned = false;
35468         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
35469         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
35470         return tag_ptr(ret_ret, true);
35471 }
35472
35473 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
35474         LDKIgnoringMessageHandler this_arg_conv;
35475         this_arg_conv.inner = untag_ptr(this_arg);
35476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35478         this_arg_conv.is_owned = false;
35479         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
35480         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
35481         return tag_ptr(ret_ret, true);
35482 }
35483
35484 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
35485         LDKIgnoringMessageHandler this_arg_conv;
35486         this_arg_conv.inner = untag_ptr(this_arg);
35487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35489         this_arg_conv.is_owned = false;
35490         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
35491         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
35492         return tag_ptr(ret_ret, true);
35493 }
35494
35495 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
35496         LDKErroringMessageHandler this_obj_conv;
35497         this_obj_conv.inner = untag_ptr(this_obj);
35498         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35500         ErroringMessageHandler_free(this_obj_conv);
35501 }
35502
35503 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
35504         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
35505         uint64_t ret_ref = 0;
35506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35508         return ret_ref;
35509 }
35510
35511 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
35512         LDKErroringMessageHandler this_arg_conv;
35513         this_arg_conv.inner = untag_ptr(this_arg);
35514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35516         this_arg_conv.is_owned = false;
35517         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
35518         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
35519         return tag_ptr(ret_ret, true);
35520 }
35521
35522 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
35523         LDKErroringMessageHandler this_arg_conv;
35524         this_arg_conv.inner = untag_ptr(this_arg);
35525         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35527         this_arg_conv.is_owned = false;
35528         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
35529         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
35530         return tag_ptr(ret_ret, true);
35531 }
35532
35533 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
35534         LDKMessageHandler this_obj_conv;
35535         this_obj_conv.inner = untag_ptr(this_obj);
35536         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35538         MessageHandler_free(this_obj_conv);
35539 }
35540
35541 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
35542         LDKMessageHandler this_ptr_conv;
35543         this_ptr_conv.inner = untag_ptr(this_ptr);
35544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35546         this_ptr_conv.is_owned = false;
35547         // WARNING: This object doesn't live past this scope, needs clone!
35548         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
35549         return ret_ret;
35550 }
35551
35552 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
35553         LDKMessageHandler this_ptr_conv;
35554         this_ptr_conv.inner = untag_ptr(this_ptr);
35555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35557         this_ptr_conv.is_owned = false;
35558         void* val_ptr = untag_ptr(val);
35559         CHECK_ACCESS(val_ptr);
35560         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
35561         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
35562                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35563                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
35564         }
35565         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
35566 }
35567
35568 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
35569         LDKMessageHandler this_ptr_conv;
35570         this_ptr_conv.inner = untag_ptr(this_ptr);
35571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35573         this_ptr_conv.is_owned = false;
35574         // WARNING: This object doesn't live past this scope, needs clone!
35575         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
35576         return ret_ret;
35577 }
35578
35579 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
35580         LDKMessageHandler this_ptr_conv;
35581         this_ptr_conv.inner = untag_ptr(this_ptr);
35582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35584         this_ptr_conv.is_owned = false;
35585         void* val_ptr = untag_ptr(val);
35586         CHECK_ACCESS(val_ptr);
35587         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
35588         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
35589                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35590                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
35591         }
35592         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
35593 }
35594
35595 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
35596         LDKMessageHandler this_ptr_conv;
35597         this_ptr_conv.inner = untag_ptr(this_ptr);
35598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35600         this_ptr_conv.is_owned = false;
35601         // WARNING: This object doesn't live past this scope, needs clone!
35602         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
35603         return ret_ret;
35604 }
35605
35606 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
35607         LDKMessageHandler this_ptr_conv;
35608         this_ptr_conv.inner = untag_ptr(this_ptr);
35609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35611         this_ptr_conv.is_owned = false;
35612         void* val_ptr = untag_ptr(val);
35613         CHECK_ACCESS(val_ptr);
35614         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
35615         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
35616                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35617                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
35618         }
35619         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
35620 }
35621
35622 uint64_t  __attribute__((export_name("TS_MessageHandler_new"))) TS_MessageHandler_new(uint64_t chan_handler_arg, uint64_t route_handler_arg, uint64_t onion_message_handler_arg) {
35623         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
35624         CHECK_ACCESS(chan_handler_arg_ptr);
35625         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
35626         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
35627                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35628                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
35629         }
35630         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
35631         CHECK_ACCESS(route_handler_arg_ptr);
35632         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
35633         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
35634                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35635                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
35636         }
35637         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
35638         CHECK_ACCESS(onion_message_handler_arg_ptr);
35639         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
35640         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
35641                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35642                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
35643         }
35644         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv);
35645         uint64_t ret_ref = 0;
35646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35648         return ret_ref;
35649 }
35650
35651 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
35652         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
35653         *ret_ret = SocketDescriptor_clone(arg);
35654         return tag_ptr(ret_ret, true);
35655 }
35656 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
35657         void* arg_ptr = untag_ptr(arg);
35658         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
35659         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
35660         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
35661         return ret_conv;
35662 }
35663
35664 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
35665         void* orig_ptr = untag_ptr(orig);
35666         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
35667         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
35668         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
35669         *ret_ret = SocketDescriptor_clone(orig_conv);
35670         return tag_ptr(ret_ret, true);
35671 }
35672
35673 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
35674         if (!ptr_is_owned(this_ptr)) return;
35675         void* this_ptr_ptr = untag_ptr(this_ptr);
35676         CHECK_ACCESS(this_ptr_ptr);
35677         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
35678         FREE(untag_ptr(this_ptr));
35679         SocketDescriptor_free(this_ptr_conv);
35680 }
35681
35682 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
35683         LDKPeerHandleError this_obj_conv;
35684         this_obj_conv.inner = untag_ptr(this_obj);
35685         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35687         PeerHandleError_free(this_obj_conv);
35688 }
35689
35690 jboolean  __attribute__((export_name("TS_PeerHandleError_get_no_connection_possible"))) TS_PeerHandleError_get_no_connection_possible(uint64_t this_ptr) {
35691         LDKPeerHandleError this_ptr_conv;
35692         this_ptr_conv.inner = untag_ptr(this_ptr);
35693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35695         this_ptr_conv.is_owned = false;
35696         jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
35697         return ret_conv;
35698 }
35699
35700 void  __attribute__((export_name("TS_PeerHandleError_set_no_connection_possible"))) TS_PeerHandleError_set_no_connection_possible(uint64_t this_ptr, jboolean val) {
35701         LDKPeerHandleError this_ptr_conv;
35702         this_ptr_conv.inner = untag_ptr(this_ptr);
35703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35705         this_ptr_conv.is_owned = false;
35706         PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
35707 }
35708
35709 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
35710         LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
35711         uint64_t ret_ref = 0;
35712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35714         return ret_ref;
35715 }
35716
35717 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
35718         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
35719         uint64_t ret_ref = 0;
35720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35722         return ret_ref;
35723 }
35724 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
35725         LDKPeerHandleError arg_conv;
35726         arg_conv.inner = untag_ptr(arg);
35727         arg_conv.is_owned = ptr_is_owned(arg);
35728         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35729         arg_conv.is_owned = false;
35730         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
35731         return ret_conv;
35732 }
35733
35734 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
35735         LDKPeerHandleError orig_conv;
35736         orig_conv.inner = untag_ptr(orig);
35737         orig_conv.is_owned = ptr_is_owned(orig);
35738         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35739         orig_conv.is_owned = false;
35740         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
35741         uint64_t ret_ref = 0;
35742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35744         return ret_ref;
35745 }
35746
35747 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
35748         LDKPeerManager this_obj_conv;
35749         this_obj_conv.inner = untag_ptr(this_obj);
35750         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35752         PeerManager_free(this_obj_conv);
35753 }
35754
35755 uint64_t  __attribute__((export_name("TS_PeerManager_new"))) TS_PeerManager_new(uint64_t message_handler, int8_tArray our_node_secret, int32_t current_time, int8_tArray ephemeral_random_data, uint64_t logger, uint64_t custom_message_handler) {
35756         LDKMessageHandler message_handler_conv;
35757         message_handler_conv.inner = untag_ptr(message_handler);
35758         message_handler_conv.is_owned = ptr_is_owned(message_handler);
35759         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
35760         // WARNING: we need a move here but no clone is available for LDKMessageHandler
35761         
35762         LDKSecretKey our_node_secret_ref;
35763         CHECK(our_node_secret->arr_len == 32);
35764         memcpy(our_node_secret_ref.bytes, our_node_secret->elems, 32); FREE(our_node_secret);
35765         unsigned char ephemeral_random_data_arr[32];
35766         CHECK(ephemeral_random_data->arr_len == 32);
35767         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
35768         unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
35769         void* logger_ptr = untag_ptr(logger);
35770         CHECK_ACCESS(logger_ptr);
35771         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
35772         if (logger_conv.free == LDKLogger_JCalls_free) {
35773                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35774                 LDKLogger_JCalls_cloned(&logger_conv);
35775         }
35776         void* custom_message_handler_ptr = untag_ptr(custom_message_handler);
35777         CHECK_ACCESS(custom_message_handler_ptr);
35778         LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
35779         if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
35780                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35781                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
35782         }
35783         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, current_time, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
35784         uint64_t ret_ref = 0;
35785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35787         return ret_ref;
35788 }
35789
35790 ptrArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
35791         LDKPeerManager this_arg_conv;
35792         this_arg_conv.inner = untag_ptr(this_arg);
35793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35795         this_arg_conv.is_owned = false;
35796         LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
35797         ptrArray ret_arr = NULL;
35798         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
35799         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
35800         for (size_t m = 0; m < ret_var.datalen; m++) {
35801                 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
35802                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
35803                 ret_arr_ptr[m] = ret_conv_12_arr;
35804         }
35805         
35806         FREE(ret_var.data);
35807         return ret_arr;
35808 }
35809
35810 uint64_t  __attribute__((export_name("TS_PeerManager_new_outbound_connection"))) TS_PeerManager_new_outbound_connection(uint64_t this_arg, int8_tArray their_node_id, uint64_t descriptor, uint64_t remote_network_address) {
35811         LDKPeerManager this_arg_conv;
35812         this_arg_conv.inner = untag_ptr(this_arg);
35813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35815         this_arg_conv.is_owned = false;
35816         LDKPublicKey their_node_id_ref;
35817         CHECK(their_node_id->arr_len == 33);
35818         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
35819         void* descriptor_ptr = untag_ptr(descriptor);
35820         CHECK_ACCESS(descriptor_ptr);
35821         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
35822         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
35823                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35824                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
35825         }
35826         void* remote_network_address_ptr = untag_ptr(remote_network_address);
35827         CHECK_ACCESS(remote_network_address_ptr);
35828         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
35829         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
35830         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
35831         return tag_ptr(ret_conv, true);
35832 }
35833
35834 uint64_t  __attribute__((export_name("TS_PeerManager_new_inbound_connection"))) TS_PeerManager_new_inbound_connection(uint64_t this_arg, uint64_t descriptor, uint64_t remote_network_address) {
35835         LDKPeerManager this_arg_conv;
35836         this_arg_conv.inner = untag_ptr(this_arg);
35837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35839         this_arg_conv.is_owned = false;
35840         void* descriptor_ptr = untag_ptr(descriptor);
35841         CHECK_ACCESS(descriptor_ptr);
35842         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
35843         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
35844                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35845                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
35846         }
35847         void* remote_network_address_ptr = untag_ptr(remote_network_address);
35848         CHECK_ACCESS(remote_network_address_ptr);
35849         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
35850         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
35851         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
35852         return tag_ptr(ret_conv, true);
35853 }
35854
35855 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
35856         LDKPeerManager this_arg_conv;
35857         this_arg_conv.inner = untag_ptr(this_arg);
35858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35860         this_arg_conv.is_owned = false;
35861         void* descriptor_ptr = untag_ptr(descriptor);
35862         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
35863         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
35864         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
35865         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
35866         return tag_ptr(ret_conv, true);
35867 }
35868
35869 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
35870         LDKPeerManager this_arg_conv;
35871         this_arg_conv.inner = untag_ptr(this_arg);
35872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35874         this_arg_conv.is_owned = false;
35875         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
35876         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
35877         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
35878         LDKu8slice data_ref;
35879         data_ref.datalen = data->arr_len;
35880         data_ref.data = data->elems;
35881         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
35882         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
35883         FREE(data);
35884         return tag_ptr(ret_conv, true);
35885 }
35886
35887 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
35888         LDKPeerManager this_arg_conv;
35889         this_arg_conv.inner = untag_ptr(this_arg);
35890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35892         this_arg_conv.is_owned = false;
35893         PeerManager_process_events(&this_arg_conv);
35894 }
35895
35896 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
35897         LDKPeerManager this_arg_conv;
35898         this_arg_conv.inner = untag_ptr(this_arg);
35899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35901         this_arg_conv.is_owned = false;
35902         void* descriptor_ptr = untag_ptr(descriptor);
35903         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
35904         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
35905         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
35906 }
35907
35908 void  __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint64_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
35909         LDKPeerManager this_arg_conv;
35910         this_arg_conv.inner = untag_ptr(this_arg);
35911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35913         this_arg_conv.is_owned = false;
35914         LDKPublicKey node_id_ref;
35915         CHECK(node_id->arr_len == 33);
35916         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
35917         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
35918 }
35919
35920 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
35921         LDKPeerManager this_arg_conv;
35922         this_arg_conv.inner = untag_ptr(this_arg);
35923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35925         this_arg_conv.is_owned = false;
35926         PeerManager_disconnect_all_peers(&this_arg_conv);
35927 }
35928
35929 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
35930         LDKPeerManager this_arg_conv;
35931         this_arg_conv.inner = untag_ptr(this_arg);
35932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35934         this_arg_conv.is_owned = false;
35935         PeerManager_timer_tick_occurred(&this_arg_conv);
35936 }
35937
35938 void  __attribute__((export_name("TS_PeerManager_broadcast_node_announcement"))) TS_PeerManager_broadcast_node_announcement(uint64_t this_arg, int8_tArray rgb, int8_tArray alias, uint64_tArray addresses) {
35939         LDKPeerManager this_arg_conv;
35940         this_arg_conv.inner = untag_ptr(this_arg);
35941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35943         this_arg_conv.is_owned = false;
35944         LDKThreeBytes rgb_ref;
35945         CHECK(rgb->arr_len == 3);
35946         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
35947         LDKThirtyTwoBytes alias_ref;
35948         CHECK(alias->arr_len == 32);
35949         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
35950         LDKCVec_NetAddressZ addresses_constr;
35951         addresses_constr.datalen = addresses->arr_len;
35952         if (addresses_constr.datalen > 0)
35953                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
35954         else
35955                 addresses_constr.data = NULL;
35956         uint64_t* addresses_vals = addresses->elems;
35957         for (size_t m = 0; m < addresses_constr.datalen; m++) {
35958                 uint64_t addresses_conv_12 = addresses_vals[m];
35959                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
35960                 CHECK_ACCESS(addresses_conv_12_ptr);
35961                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
35962                 addresses_constr.data[m] = addresses_conv_12_conv;
35963         }
35964         FREE(addresses);
35965         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
35966 }
35967
35968 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
35969         int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
35970         return ret_conv;
35971 }
35972
35973 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
35974         int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
35975         return ret_conv;
35976 }
35977
35978 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
35979         unsigned char commitment_seed_arr[32];
35980         CHECK(commitment_seed->arr_len == 32);
35981         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
35982         unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
35983         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35984         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
35985         return ret_arr;
35986 }
35987
35988 int8_tArray  __attribute__((export_name("TS_build_closing_transaction"))) TS_build_closing_transaction(int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, uint64_t funding_outpoint) {
35989         LDKCVec_u8Z to_holder_script_ref;
35990         to_holder_script_ref.datalen = to_holder_script->arr_len;
35991         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
35992         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
35993         LDKCVec_u8Z to_counterparty_script_ref;
35994         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
35995         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
35996         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
35997         LDKOutPoint funding_outpoint_conv;
35998         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
35999         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
36000         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
36001         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
36002         LDKTransaction ret_var = build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
36003         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36004         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36005         Transaction_free(ret_var);
36006         return ret_arr;
36007 }
36008
36009 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
36010         LDKCounterpartyCommitmentSecrets this_obj_conv;
36011         this_obj_conv.inner = untag_ptr(this_obj);
36012         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36014         CounterpartyCommitmentSecrets_free(this_obj_conv);
36015 }
36016
36017 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
36018         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
36019         uint64_t ret_ref = 0;
36020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36022         return ret_ref;
36023 }
36024 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
36025         LDKCounterpartyCommitmentSecrets arg_conv;
36026         arg_conv.inner = untag_ptr(arg);
36027         arg_conv.is_owned = ptr_is_owned(arg);
36028         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36029         arg_conv.is_owned = false;
36030         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
36031         return ret_conv;
36032 }
36033
36034 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
36035         LDKCounterpartyCommitmentSecrets orig_conv;
36036         orig_conv.inner = untag_ptr(orig);
36037         orig_conv.is_owned = ptr_is_owned(orig);
36038         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36039         orig_conv.is_owned = false;
36040         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
36041         uint64_t ret_ref = 0;
36042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36044         return ret_ref;
36045 }
36046
36047 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
36048         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
36049         uint64_t ret_ref = 0;
36050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36052         return ret_ref;
36053 }
36054
36055 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
36056         LDKCounterpartyCommitmentSecrets this_arg_conv;
36057         this_arg_conv.inner = untag_ptr(this_arg);
36058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36060         this_arg_conv.is_owned = false;
36061         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
36062         return ret_conv;
36063 }
36064
36065 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
36066         LDKCounterpartyCommitmentSecrets this_arg_conv;
36067         this_arg_conv.inner = untag_ptr(this_arg);
36068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36070         this_arg_conv.is_owned = false;
36071         LDKThirtyTwoBytes secret_ref;
36072         CHECK(secret->arr_len == 32);
36073         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
36074         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
36075         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
36076         return tag_ptr(ret_conv, true);
36077 }
36078
36079 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
36080         LDKCounterpartyCommitmentSecrets this_arg_conv;
36081         this_arg_conv.inner = untag_ptr(this_arg);
36082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36084         this_arg_conv.is_owned = false;
36085         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36086         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
36087         return ret_arr;
36088 }
36089
36090 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
36091         LDKCounterpartyCommitmentSecrets obj_conv;
36092         obj_conv.inner = untag_ptr(obj);
36093         obj_conv.is_owned = ptr_is_owned(obj);
36094         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36095         obj_conv.is_owned = false;
36096         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
36097         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36098         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36099         CVec_u8Z_free(ret_var);
36100         return ret_arr;
36101 }
36102
36103 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
36104         LDKu8slice ser_ref;
36105         ser_ref.datalen = ser->arr_len;
36106         ser_ref.data = ser->elems;
36107         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
36108         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
36109         FREE(ser);
36110         return tag_ptr(ret_conv, true);
36111 }
36112
36113 uint64_t  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
36114         LDKPublicKey per_commitment_point_ref;
36115         CHECK(per_commitment_point->arr_len == 33);
36116         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
36117         unsigned char base_secret_arr[32];
36118         CHECK(base_secret->arr_len == 32);
36119         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
36120         unsigned char (*base_secret_ref)[32] = &base_secret_arr;
36121         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
36122         *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
36123         return tag_ptr(ret_conv, true);
36124 }
36125
36126 uint64_t  __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
36127         LDKPublicKey per_commitment_point_ref;
36128         CHECK(per_commitment_point->arr_len == 33);
36129         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
36130         LDKPublicKey base_point_ref;
36131         CHECK(base_point->arr_len == 33);
36132         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
36133         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
36134         *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
36135         return tag_ptr(ret_conv, true);
36136 }
36137
36138 uint64_t  __attribute__((export_name("TS_derive_private_revocation_key"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
36139         unsigned char per_commitment_secret_arr[32];
36140         CHECK(per_commitment_secret->arr_len == 32);
36141         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
36142         unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
36143         unsigned char countersignatory_revocation_base_secret_arr[32];
36144         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
36145         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
36146         unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
36147         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
36148         *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
36149         return tag_ptr(ret_conv, true);
36150 }
36151
36152 uint64_t  __attribute__((export_name("TS_derive_public_revocation_key"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
36153         LDKPublicKey per_commitment_point_ref;
36154         CHECK(per_commitment_point->arr_len == 33);
36155         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
36156         LDKPublicKey countersignatory_revocation_base_point_ref;
36157         CHECK(countersignatory_revocation_base_point->arr_len == 33);
36158         memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
36159         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
36160         *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
36161         return tag_ptr(ret_conv, true);
36162 }
36163
36164 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
36165         LDKTxCreationKeys this_obj_conv;
36166         this_obj_conv.inner = untag_ptr(this_obj);
36167         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36169         TxCreationKeys_free(this_obj_conv);
36170 }
36171
36172 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
36173         LDKTxCreationKeys this_ptr_conv;
36174         this_ptr_conv.inner = untag_ptr(this_ptr);
36175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36177         this_ptr_conv.is_owned = false;
36178         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36179         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
36180         return ret_arr;
36181 }
36182
36183 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
36184         LDKTxCreationKeys this_ptr_conv;
36185         this_ptr_conv.inner = untag_ptr(this_ptr);
36186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36188         this_ptr_conv.is_owned = false;
36189         LDKPublicKey val_ref;
36190         CHECK(val->arr_len == 33);
36191         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36192         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
36193 }
36194
36195 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
36196         LDKTxCreationKeys this_ptr_conv;
36197         this_ptr_conv.inner = untag_ptr(this_ptr);
36198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36200         this_ptr_conv.is_owned = false;
36201         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36202         memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
36203         return ret_arr;
36204 }
36205
36206 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, int8_tArray val) {
36207         LDKTxCreationKeys this_ptr_conv;
36208         this_ptr_conv.inner = untag_ptr(this_ptr);
36209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36211         this_ptr_conv.is_owned = false;
36212         LDKPublicKey val_ref;
36213         CHECK(val->arr_len == 33);
36214         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36215         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
36216 }
36217
36218 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
36219         LDKTxCreationKeys this_ptr_conv;
36220         this_ptr_conv.inner = untag_ptr(this_ptr);
36221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36223         this_ptr_conv.is_owned = false;
36224         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36225         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
36226         return ret_arr;
36227 }
36228
36229 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, int8_tArray val) {
36230         LDKTxCreationKeys this_ptr_conv;
36231         this_ptr_conv.inner = untag_ptr(this_ptr);
36232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36234         this_ptr_conv.is_owned = false;
36235         LDKPublicKey val_ref;
36236         CHECK(val->arr_len == 33);
36237         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36238         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
36239 }
36240
36241 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
36242         LDKTxCreationKeys this_ptr_conv;
36243         this_ptr_conv.inner = untag_ptr(this_ptr);
36244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36246         this_ptr_conv.is_owned = false;
36247         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36248         memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
36249         return ret_arr;
36250 }
36251
36252 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, int8_tArray val) {
36253         LDKTxCreationKeys this_ptr_conv;
36254         this_ptr_conv.inner = untag_ptr(this_ptr);
36255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36257         this_ptr_conv.is_owned = false;
36258         LDKPublicKey val_ref;
36259         CHECK(val->arr_len == 33);
36260         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36261         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
36262 }
36263
36264 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
36265         LDKTxCreationKeys this_ptr_conv;
36266         this_ptr_conv.inner = untag_ptr(this_ptr);
36267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36269         this_ptr_conv.is_owned = false;
36270         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36271         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
36272         return ret_arr;
36273 }
36274
36275 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint64_t this_ptr, int8_tArray val) {
36276         LDKTxCreationKeys this_ptr_conv;
36277         this_ptr_conv.inner = untag_ptr(this_ptr);
36278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36280         this_ptr_conv.is_owned = false;
36281         LDKPublicKey val_ref;
36282         CHECK(val->arr_len == 33);
36283         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36284         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
36285 }
36286
36287 uint64_t  __attribute__((export_name("TS_TxCreationKeys_new"))) 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) {
36288         LDKPublicKey per_commitment_point_arg_ref;
36289         CHECK(per_commitment_point_arg->arr_len == 33);
36290         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
36291         LDKPublicKey revocation_key_arg_ref;
36292         CHECK(revocation_key_arg->arr_len == 33);
36293         memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
36294         LDKPublicKey broadcaster_htlc_key_arg_ref;
36295         CHECK(broadcaster_htlc_key_arg->arr_len == 33);
36296         memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
36297         LDKPublicKey countersignatory_htlc_key_arg_ref;
36298         CHECK(countersignatory_htlc_key_arg->arr_len == 33);
36299         memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
36300         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
36301         CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
36302         memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
36303         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);
36304         uint64_t ret_ref = 0;
36305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36307         return ret_ref;
36308 }
36309
36310 jboolean  __attribute__((export_name("TS_TxCreationKeys_eq"))) TS_TxCreationKeys_eq(uint64_t a, uint64_t b) {
36311         LDKTxCreationKeys a_conv;
36312         a_conv.inner = untag_ptr(a);
36313         a_conv.is_owned = ptr_is_owned(a);
36314         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36315         a_conv.is_owned = false;
36316         LDKTxCreationKeys b_conv;
36317         b_conv.inner = untag_ptr(b);
36318         b_conv.is_owned = ptr_is_owned(b);
36319         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36320         b_conv.is_owned = false;
36321         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
36322         return ret_conv;
36323 }
36324
36325 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
36326         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
36327         uint64_t ret_ref = 0;
36328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36330         return ret_ref;
36331 }
36332 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
36333         LDKTxCreationKeys arg_conv;
36334         arg_conv.inner = untag_ptr(arg);
36335         arg_conv.is_owned = ptr_is_owned(arg);
36336         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36337         arg_conv.is_owned = false;
36338         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
36339         return ret_conv;
36340 }
36341
36342 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
36343         LDKTxCreationKeys orig_conv;
36344         orig_conv.inner = untag_ptr(orig);
36345         orig_conv.is_owned = ptr_is_owned(orig);
36346         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36347         orig_conv.is_owned = false;
36348         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
36349         uint64_t ret_ref = 0;
36350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36352         return ret_ref;
36353 }
36354
36355 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
36356         LDKTxCreationKeys obj_conv;
36357         obj_conv.inner = untag_ptr(obj);
36358         obj_conv.is_owned = ptr_is_owned(obj);
36359         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36360         obj_conv.is_owned = false;
36361         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
36362         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36363         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36364         CVec_u8Z_free(ret_var);
36365         return ret_arr;
36366 }
36367
36368 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
36369         LDKu8slice ser_ref;
36370         ser_ref.datalen = ser->arr_len;
36371         ser_ref.data = ser->elems;
36372         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
36373         *ret_conv = TxCreationKeys_read(ser_ref);
36374         FREE(ser);
36375         return tag_ptr(ret_conv, true);
36376 }
36377
36378 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
36379         LDKChannelPublicKeys this_obj_conv;
36380         this_obj_conv.inner = untag_ptr(this_obj);
36381         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36383         ChannelPublicKeys_free(this_obj_conv);
36384 }
36385
36386 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
36387         LDKChannelPublicKeys this_ptr_conv;
36388         this_ptr_conv.inner = untag_ptr(this_ptr);
36389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36391         this_ptr_conv.is_owned = false;
36392         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36393         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
36394         return ret_arr;
36395 }
36396
36397 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
36398         LDKChannelPublicKeys this_ptr_conv;
36399         this_ptr_conv.inner = untag_ptr(this_ptr);
36400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36402         this_ptr_conv.is_owned = false;
36403         LDKPublicKey val_ref;
36404         CHECK(val->arr_len == 33);
36405         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36406         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
36407 }
36408
36409 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
36410         LDKChannelPublicKeys this_ptr_conv;
36411         this_ptr_conv.inner = untag_ptr(this_ptr);
36412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36414         this_ptr_conv.is_owned = false;
36415         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36416         memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
36417         return ret_arr;
36418 }
36419
36420 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
36421         LDKChannelPublicKeys this_ptr_conv;
36422         this_ptr_conv.inner = untag_ptr(this_ptr);
36423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36425         this_ptr_conv.is_owned = false;
36426         LDKPublicKey val_ref;
36427         CHECK(val->arr_len == 33);
36428         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36429         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
36430 }
36431
36432 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
36433         LDKChannelPublicKeys this_ptr_conv;
36434         this_ptr_conv.inner = untag_ptr(this_ptr);
36435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36437         this_ptr_conv.is_owned = false;
36438         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36439         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
36440         return ret_arr;
36441 }
36442
36443 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
36444         LDKChannelPublicKeys this_ptr_conv;
36445         this_ptr_conv.inner = untag_ptr(this_ptr);
36446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36448         this_ptr_conv.is_owned = false;
36449         LDKPublicKey val_ref;
36450         CHECK(val->arr_len == 33);
36451         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36452         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
36453 }
36454
36455 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
36456         LDKChannelPublicKeys this_ptr_conv;
36457         this_ptr_conv.inner = untag_ptr(this_ptr);
36458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36460         this_ptr_conv.is_owned = false;
36461         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36462         memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
36463         return ret_arr;
36464 }
36465
36466 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
36467         LDKChannelPublicKeys this_ptr_conv;
36468         this_ptr_conv.inner = untag_ptr(this_ptr);
36469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36471         this_ptr_conv.is_owned = false;
36472         LDKPublicKey val_ref;
36473         CHECK(val->arr_len == 33);
36474         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36475         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
36476 }
36477
36478 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
36479         LDKChannelPublicKeys this_ptr_conv;
36480         this_ptr_conv.inner = untag_ptr(this_ptr);
36481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36483         this_ptr_conv.is_owned = false;
36484         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36485         memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
36486         return ret_arr;
36487 }
36488
36489 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
36490         LDKChannelPublicKeys this_ptr_conv;
36491         this_ptr_conv.inner = untag_ptr(this_ptr);
36492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36494         this_ptr_conv.is_owned = false;
36495         LDKPublicKey val_ref;
36496         CHECK(val->arr_len == 33);
36497         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36498         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
36499 }
36500
36501 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_new"))) 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) {
36502         LDKPublicKey funding_pubkey_arg_ref;
36503         CHECK(funding_pubkey_arg->arr_len == 33);
36504         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
36505         LDKPublicKey revocation_basepoint_arg_ref;
36506         CHECK(revocation_basepoint_arg->arr_len == 33);
36507         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
36508         LDKPublicKey payment_point_arg_ref;
36509         CHECK(payment_point_arg->arr_len == 33);
36510         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
36511         LDKPublicKey delayed_payment_basepoint_arg_ref;
36512         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
36513         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
36514         LDKPublicKey htlc_basepoint_arg_ref;
36515         CHECK(htlc_basepoint_arg->arr_len == 33);
36516         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
36517         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);
36518         uint64_t ret_ref = 0;
36519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36521         return ret_ref;
36522 }
36523
36524 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
36525         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
36526         uint64_t ret_ref = 0;
36527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36529         return ret_ref;
36530 }
36531 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
36532         LDKChannelPublicKeys arg_conv;
36533         arg_conv.inner = untag_ptr(arg);
36534         arg_conv.is_owned = ptr_is_owned(arg);
36535         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36536         arg_conv.is_owned = false;
36537         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
36538         return ret_conv;
36539 }
36540
36541 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
36542         LDKChannelPublicKeys orig_conv;
36543         orig_conv.inner = untag_ptr(orig);
36544         orig_conv.is_owned = ptr_is_owned(orig);
36545         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36546         orig_conv.is_owned = false;
36547         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
36548         uint64_t ret_ref = 0;
36549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36551         return ret_ref;
36552 }
36553
36554 jboolean  __attribute__((export_name("TS_ChannelPublicKeys_eq"))) TS_ChannelPublicKeys_eq(uint64_t a, uint64_t b) {
36555         LDKChannelPublicKeys a_conv;
36556         a_conv.inner = untag_ptr(a);
36557         a_conv.is_owned = ptr_is_owned(a);
36558         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36559         a_conv.is_owned = false;
36560         LDKChannelPublicKeys b_conv;
36561         b_conv.inner = untag_ptr(b);
36562         b_conv.is_owned = ptr_is_owned(b);
36563         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36564         b_conv.is_owned = false;
36565         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
36566         return ret_conv;
36567 }
36568
36569 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
36570         LDKChannelPublicKeys obj_conv;
36571         obj_conv.inner = untag_ptr(obj);
36572         obj_conv.is_owned = ptr_is_owned(obj);
36573         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36574         obj_conv.is_owned = false;
36575         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
36576         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36577         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36578         CVec_u8Z_free(ret_var);
36579         return ret_arr;
36580 }
36581
36582 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
36583         LDKu8slice ser_ref;
36584         ser_ref.datalen = ser->arr_len;
36585         ser_ref.data = ser->elems;
36586         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
36587         *ret_conv = ChannelPublicKeys_read(ser_ref);
36588         FREE(ser);
36589         return tag_ptr(ret_conv, true);
36590 }
36591
36592 uint64_t  __attribute__((export_name("TS_TxCreationKeys_derive_new"))) 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) {
36593         LDKPublicKey per_commitment_point_ref;
36594         CHECK(per_commitment_point->arr_len == 33);
36595         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
36596         LDKPublicKey broadcaster_delayed_payment_base_ref;
36597         CHECK(broadcaster_delayed_payment_base->arr_len == 33);
36598         memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
36599         LDKPublicKey broadcaster_htlc_base_ref;
36600         CHECK(broadcaster_htlc_base->arr_len == 33);
36601         memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
36602         LDKPublicKey countersignatory_revocation_base_ref;
36603         CHECK(countersignatory_revocation_base->arr_len == 33);
36604         memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
36605         LDKPublicKey countersignatory_htlc_base_ref;
36606         CHECK(countersignatory_htlc_base->arr_len == 33);
36607         memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
36608         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
36609         *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);
36610         return tag_ptr(ret_conv, true);
36611 }
36612
36613 uint64_t  __attribute__((export_name("TS_TxCreationKeys_from_channel_static_keys"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint64_t broadcaster_keys, uint64_t countersignatory_keys) {
36614         LDKPublicKey per_commitment_point_ref;
36615         CHECK(per_commitment_point->arr_len == 33);
36616         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
36617         LDKChannelPublicKeys broadcaster_keys_conv;
36618         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
36619         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
36620         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
36621         broadcaster_keys_conv.is_owned = false;
36622         LDKChannelPublicKeys countersignatory_keys_conv;
36623         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
36624         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
36625         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
36626         countersignatory_keys_conv.is_owned = false;
36627         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
36628         *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
36629         return tag_ptr(ret_conv, true);
36630 }
36631
36632 int8_tArray  __attribute__((export_name("TS_get_revokeable_redeemscript"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
36633         LDKPublicKey revocation_key_ref;
36634         CHECK(revocation_key->arr_len == 33);
36635         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
36636         LDKPublicKey broadcaster_delayed_payment_key_ref;
36637         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
36638         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
36639         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
36640         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36641         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36642         CVec_u8Z_free(ret_var);
36643         return ret_arr;
36644 }
36645
36646 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
36647         LDKHTLCOutputInCommitment this_obj_conv;
36648         this_obj_conv.inner = untag_ptr(this_obj);
36649         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36651         HTLCOutputInCommitment_free(this_obj_conv);
36652 }
36653
36654 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
36655         LDKHTLCOutputInCommitment this_ptr_conv;
36656         this_ptr_conv.inner = untag_ptr(this_ptr);
36657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36659         this_ptr_conv.is_owned = false;
36660         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
36661         return ret_conv;
36662 }
36663
36664 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
36665         LDKHTLCOutputInCommitment this_ptr_conv;
36666         this_ptr_conv.inner = untag_ptr(this_ptr);
36667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36669         this_ptr_conv.is_owned = false;
36670         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
36671 }
36672
36673 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
36674         LDKHTLCOutputInCommitment this_ptr_conv;
36675         this_ptr_conv.inner = untag_ptr(this_ptr);
36676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36678         this_ptr_conv.is_owned = false;
36679         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
36680         return ret_conv;
36681 }
36682
36683 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
36684         LDKHTLCOutputInCommitment this_ptr_conv;
36685         this_ptr_conv.inner = untag_ptr(this_ptr);
36686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36688         this_ptr_conv.is_owned = false;
36689         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
36690 }
36691
36692 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
36693         LDKHTLCOutputInCommitment this_ptr_conv;
36694         this_ptr_conv.inner = untag_ptr(this_ptr);
36695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36697         this_ptr_conv.is_owned = false;
36698         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
36699         return ret_conv;
36700 }
36701
36702 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
36703         LDKHTLCOutputInCommitment this_ptr_conv;
36704         this_ptr_conv.inner = untag_ptr(this_ptr);
36705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36707         this_ptr_conv.is_owned = false;
36708         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
36709 }
36710
36711 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
36712         LDKHTLCOutputInCommitment this_ptr_conv;
36713         this_ptr_conv.inner = untag_ptr(this_ptr);
36714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36716         this_ptr_conv.is_owned = false;
36717         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36718         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
36719         return ret_arr;
36720 }
36721
36722 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
36723         LDKHTLCOutputInCommitment this_ptr_conv;
36724         this_ptr_conv.inner = untag_ptr(this_ptr);
36725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36727         this_ptr_conv.is_owned = false;
36728         LDKThirtyTwoBytes val_ref;
36729         CHECK(val->arr_len == 32);
36730         memcpy(val_ref.data, val->elems, 32); FREE(val);
36731         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
36732 }
36733
36734 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
36735         LDKHTLCOutputInCommitment this_ptr_conv;
36736         this_ptr_conv.inner = untag_ptr(this_ptr);
36737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36739         this_ptr_conv.is_owned = false;
36740         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
36741         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
36742         uint64_t ret_ref = tag_ptr(ret_copy, true);
36743         return ret_ref;
36744 }
36745
36746 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
36747         LDKHTLCOutputInCommitment this_ptr_conv;
36748         this_ptr_conv.inner = untag_ptr(this_ptr);
36749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36751         this_ptr_conv.is_owned = false;
36752         void* val_ptr = untag_ptr(val);
36753         CHECK_ACCESS(val_ptr);
36754         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
36755         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
36756         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
36757 }
36758
36759 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_new"))) TS_HTLCOutputInCommitment_new(jboolean offered_arg, int64_t amount_msat_arg, int32_t cltv_expiry_arg, int8_tArray payment_hash_arg, uint64_t transaction_output_index_arg) {
36760         LDKThirtyTwoBytes payment_hash_arg_ref;
36761         CHECK(payment_hash_arg->arr_len == 32);
36762         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
36763         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
36764         CHECK_ACCESS(transaction_output_index_arg_ptr);
36765         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
36766         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
36767         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
36768         uint64_t ret_ref = 0;
36769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36771         return ret_ref;
36772 }
36773
36774 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
36775         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
36776         uint64_t ret_ref = 0;
36777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36779         return ret_ref;
36780 }
36781 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
36782         LDKHTLCOutputInCommitment arg_conv;
36783         arg_conv.inner = untag_ptr(arg);
36784         arg_conv.is_owned = ptr_is_owned(arg);
36785         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36786         arg_conv.is_owned = false;
36787         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
36788         return ret_conv;
36789 }
36790
36791 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
36792         LDKHTLCOutputInCommitment orig_conv;
36793         orig_conv.inner = untag_ptr(orig);
36794         orig_conv.is_owned = ptr_is_owned(orig);
36795         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36796         orig_conv.is_owned = false;
36797         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
36798         uint64_t ret_ref = 0;
36799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36801         return ret_ref;
36802 }
36803
36804 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_eq"))) TS_HTLCOutputInCommitment_eq(uint64_t a, uint64_t b) {
36805         LDKHTLCOutputInCommitment a_conv;
36806         a_conv.inner = untag_ptr(a);
36807         a_conv.is_owned = ptr_is_owned(a);
36808         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36809         a_conv.is_owned = false;
36810         LDKHTLCOutputInCommitment b_conv;
36811         b_conv.inner = untag_ptr(b);
36812         b_conv.is_owned = ptr_is_owned(b);
36813         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36814         b_conv.is_owned = false;
36815         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
36816         return ret_conv;
36817 }
36818
36819 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
36820         LDKHTLCOutputInCommitment obj_conv;
36821         obj_conv.inner = untag_ptr(obj);
36822         obj_conv.is_owned = ptr_is_owned(obj);
36823         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36824         obj_conv.is_owned = false;
36825         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
36826         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36827         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36828         CVec_u8Z_free(ret_var);
36829         return ret_arr;
36830 }
36831
36832 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
36833         LDKu8slice ser_ref;
36834         ser_ref.datalen = ser->arr_len;
36835         ser_ref.data = ser->elems;
36836         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
36837         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
36838         FREE(ser);
36839         return tag_ptr(ret_conv, true);
36840 }
36841
36842 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, jboolean opt_anchors, uint64_t keys) {
36843         LDKHTLCOutputInCommitment htlc_conv;
36844         htlc_conv.inner = untag_ptr(htlc);
36845         htlc_conv.is_owned = ptr_is_owned(htlc);
36846         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
36847         htlc_conv.is_owned = false;
36848         LDKTxCreationKeys keys_conv;
36849         keys_conv.inner = untag_ptr(keys);
36850         keys_conv.is_owned = ptr_is_owned(keys);
36851         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
36852         keys_conv.is_owned = false;
36853         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
36854         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36855         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36856         CVec_u8Z_free(ret_var);
36857         return ret_arr;
36858 }
36859
36860 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
36861         LDKPublicKey broadcaster_ref;
36862         CHECK(broadcaster->arr_len == 33);
36863         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
36864         LDKPublicKey countersignatory_ref;
36865         CHECK(countersignatory->arr_len == 33);
36866         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
36867         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
36868         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36869         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36870         CVec_u8Z_free(ret_var);
36871         return ret_arr;
36872 }
36873
36874 int8_tArray  __attribute__((export_name("TS_build_htlc_transaction"))) TS_build_htlc_transaction(int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, uint64_t htlc, jboolean opt_anchors, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
36875         unsigned char commitment_txid_arr[32];
36876         CHECK(commitment_txid->arr_len == 32);
36877         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
36878         unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
36879         LDKHTLCOutputInCommitment htlc_conv;
36880         htlc_conv.inner = untag_ptr(htlc);
36881         htlc_conv.is_owned = ptr_is_owned(htlc);
36882         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
36883         htlc_conv.is_owned = false;
36884         LDKPublicKey broadcaster_delayed_payment_key_ref;
36885         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
36886         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
36887         LDKPublicKey revocation_key_ref;
36888         CHECK(revocation_key->arr_len == 33);
36889         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
36890         LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, opt_anchors, broadcaster_delayed_payment_key_ref, revocation_key_ref);
36891         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36892         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36893         Transaction_free(ret_var);
36894         return ret_arr;
36895 }
36896
36897 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
36898         LDKPublicKey funding_pubkey_ref;
36899         CHECK(funding_pubkey->arr_len == 33);
36900         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
36901         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
36902         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36903         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36904         CVec_u8Z_free(ret_var);
36905         return ret_arr;
36906 }
36907
36908 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
36909         LDKChannelTransactionParameters this_obj_conv;
36910         this_obj_conv.inner = untag_ptr(this_obj);
36911         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36913         ChannelTransactionParameters_free(this_obj_conv);
36914 }
36915
36916 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
36917         LDKChannelTransactionParameters this_ptr_conv;
36918         this_ptr_conv.inner = untag_ptr(this_ptr);
36919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36921         this_ptr_conv.is_owned = false;
36922         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
36923         uint64_t ret_ref = 0;
36924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36926         return ret_ref;
36927 }
36928
36929 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
36930         LDKChannelTransactionParameters this_ptr_conv;
36931         this_ptr_conv.inner = untag_ptr(this_ptr);
36932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36934         this_ptr_conv.is_owned = false;
36935         LDKChannelPublicKeys val_conv;
36936         val_conv.inner = untag_ptr(val);
36937         val_conv.is_owned = ptr_is_owned(val);
36938         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36939         val_conv = ChannelPublicKeys_clone(&val_conv);
36940         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
36941 }
36942
36943 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
36944         LDKChannelTransactionParameters this_ptr_conv;
36945         this_ptr_conv.inner = untag_ptr(this_ptr);
36946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36948         this_ptr_conv.is_owned = false;
36949         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
36950         return ret_conv;
36951 }
36952
36953 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint64_t this_ptr, int16_t val) {
36954         LDKChannelTransactionParameters this_ptr_conv;
36955         this_ptr_conv.inner = untag_ptr(this_ptr);
36956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36958         this_ptr_conv.is_owned = false;
36959         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
36960 }
36961
36962 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
36963         LDKChannelTransactionParameters this_ptr_conv;
36964         this_ptr_conv.inner = untag_ptr(this_ptr);
36965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36967         this_ptr_conv.is_owned = false;
36968         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
36969         return ret_conv;
36970 }
36971
36972 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
36973         LDKChannelTransactionParameters this_ptr_conv;
36974         this_ptr_conv.inner = untag_ptr(this_ptr);
36975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36977         this_ptr_conv.is_owned = false;
36978         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
36979 }
36980
36981 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
36982         LDKChannelTransactionParameters this_ptr_conv;
36983         this_ptr_conv.inner = untag_ptr(this_ptr);
36984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36986         this_ptr_conv.is_owned = false;
36987         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
36988         uint64_t ret_ref = 0;
36989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36991         return ret_ref;
36992 }
36993
36994 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
36995         LDKChannelTransactionParameters this_ptr_conv;
36996         this_ptr_conv.inner = untag_ptr(this_ptr);
36997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36999         this_ptr_conv.is_owned = false;
37000         LDKCounterpartyChannelTransactionParameters val_conv;
37001         val_conv.inner = untag_ptr(val);
37002         val_conv.is_owned = ptr_is_owned(val);
37003         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37004         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
37005         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
37006 }
37007
37008 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
37009         LDKChannelTransactionParameters this_ptr_conv;
37010         this_ptr_conv.inner = untag_ptr(this_ptr);
37011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37013         this_ptr_conv.is_owned = false;
37014         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
37015         uint64_t ret_ref = 0;
37016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37018         return ret_ref;
37019 }
37020
37021 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
37022         LDKChannelTransactionParameters this_ptr_conv;
37023         this_ptr_conv.inner = untag_ptr(this_ptr);
37024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37026         this_ptr_conv.is_owned = false;
37027         LDKOutPoint val_conv;
37028         val_conv.inner = untag_ptr(val);
37029         val_conv.is_owned = ptr_is_owned(val);
37030         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37031         val_conv = OutPoint_clone(&val_conv);
37032         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
37033 }
37034
37035 uint32_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_anchors(uint64_t this_ptr) {
37036         LDKChannelTransactionParameters this_ptr_conv;
37037         this_ptr_conv.inner = untag_ptr(this_ptr);
37038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37040         this_ptr_conv.is_owned = false;
37041         uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
37042         return ret_conv;
37043 }
37044
37045 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_anchors(uint64_t this_ptr, uint32_t val) {
37046         LDKChannelTransactionParameters this_ptr_conv;
37047         this_ptr_conv.inner = untag_ptr(this_ptr);
37048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37050         this_ptr_conv.is_owned = false;
37051         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
37052         ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
37053 }
37054
37055 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_new"))) TS_ChannelTransactionParameters_new(uint64_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, uint64_t counterparty_parameters_arg, uint64_t funding_outpoint_arg, uint32_t opt_anchors_arg) {
37056         LDKChannelPublicKeys holder_pubkeys_arg_conv;
37057         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
37058         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
37059         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
37060         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
37061         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
37062         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
37063         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
37064         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
37065         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
37066         LDKOutPoint funding_outpoint_arg_conv;
37067         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
37068         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
37069         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
37070         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
37071         LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
37072         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, opt_anchors_arg_conv);
37073         uint64_t ret_ref = 0;
37074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37076         return ret_ref;
37077 }
37078
37079 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
37080         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
37081         uint64_t ret_ref = 0;
37082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37084         return ret_ref;
37085 }
37086 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
37087         LDKChannelTransactionParameters arg_conv;
37088         arg_conv.inner = untag_ptr(arg);
37089         arg_conv.is_owned = ptr_is_owned(arg);
37090         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37091         arg_conv.is_owned = false;
37092         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
37093         return ret_conv;
37094 }
37095
37096 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
37097         LDKChannelTransactionParameters orig_conv;
37098         orig_conv.inner = untag_ptr(orig);
37099         orig_conv.is_owned = ptr_is_owned(orig);
37100         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37101         orig_conv.is_owned = false;
37102         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
37103         uint64_t ret_ref = 0;
37104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37106         return ret_ref;
37107 }
37108
37109 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
37110         LDKCounterpartyChannelTransactionParameters this_obj_conv;
37111         this_obj_conv.inner = untag_ptr(this_obj);
37112         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37114         CounterpartyChannelTransactionParameters_free(this_obj_conv);
37115 }
37116
37117 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
37118         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37119         this_ptr_conv.inner = untag_ptr(this_ptr);
37120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37122         this_ptr_conv.is_owned = false;
37123         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
37124         uint64_t ret_ref = 0;
37125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37127         return ret_ref;
37128 }
37129
37130 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
37131         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37132         this_ptr_conv.inner = untag_ptr(this_ptr);
37133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37135         this_ptr_conv.is_owned = false;
37136         LDKChannelPublicKeys val_conv;
37137         val_conv.inner = untag_ptr(val);
37138         val_conv.is_owned = ptr_is_owned(val);
37139         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37140         val_conv = ChannelPublicKeys_clone(&val_conv);
37141         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
37142 }
37143
37144 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
37145         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37146         this_ptr_conv.inner = untag_ptr(this_ptr);
37147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37149         this_ptr_conv.is_owned = false;
37150         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
37151         return ret_conv;
37152 }
37153
37154 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
37155         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37156         this_ptr_conv.inner = untag_ptr(this_ptr);
37157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37159         this_ptr_conv.is_owned = false;
37160         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
37161 }
37162
37163 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
37164         LDKChannelPublicKeys pubkeys_arg_conv;
37165         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
37166         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
37167         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
37168         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
37169         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
37170         uint64_t ret_ref = 0;
37171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37173         return ret_ref;
37174 }
37175
37176 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
37177         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
37178         uint64_t ret_ref = 0;
37179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37181         return ret_ref;
37182 }
37183 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
37184         LDKCounterpartyChannelTransactionParameters arg_conv;
37185         arg_conv.inner = untag_ptr(arg);
37186         arg_conv.is_owned = ptr_is_owned(arg);
37187         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37188         arg_conv.is_owned = false;
37189         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
37190         return ret_conv;
37191 }
37192
37193 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
37194         LDKCounterpartyChannelTransactionParameters orig_conv;
37195         orig_conv.inner = untag_ptr(orig);
37196         orig_conv.is_owned = ptr_is_owned(orig);
37197         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37198         orig_conv.is_owned = false;
37199         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
37200         uint64_t ret_ref = 0;
37201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37203         return ret_ref;
37204 }
37205
37206 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
37207         LDKChannelTransactionParameters this_arg_conv;
37208         this_arg_conv.inner = untag_ptr(this_arg);
37209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37211         this_arg_conv.is_owned = false;
37212         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
37213         return ret_conv;
37214 }
37215
37216 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
37217         LDKChannelTransactionParameters this_arg_conv;
37218         this_arg_conv.inner = untag_ptr(this_arg);
37219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37221         this_arg_conv.is_owned = false;
37222         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
37223         uint64_t ret_ref = 0;
37224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37226         return ret_ref;
37227 }
37228
37229 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
37230         LDKChannelTransactionParameters this_arg_conv;
37231         this_arg_conv.inner = untag_ptr(this_arg);
37232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37234         this_arg_conv.is_owned = false;
37235         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
37236         uint64_t ret_ref = 0;
37237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37239         return ret_ref;
37240 }
37241
37242 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
37243         LDKCounterpartyChannelTransactionParameters obj_conv;
37244         obj_conv.inner = untag_ptr(obj);
37245         obj_conv.is_owned = ptr_is_owned(obj);
37246         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37247         obj_conv.is_owned = false;
37248         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
37249         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37250         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37251         CVec_u8Z_free(ret_var);
37252         return ret_arr;
37253 }
37254
37255 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
37256         LDKu8slice ser_ref;
37257         ser_ref.datalen = ser->arr_len;
37258         ser_ref.data = ser->elems;
37259         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
37260         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
37261         FREE(ser);
37262         return tag_ptr(ret_conv, true);
37263 }
37264
37265 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
37266         LDKChannelTransactionParameters obj_conv;
37267         obj_conv.inner = untag_ptr(obj);
37268         obj_conv.is_owned = ptr_is_owned(obj);
37269         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37270         obj_conv.is_owned = false;
37271         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
37272         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37273         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37274         CVec_u8Z_free(ret_var);
37275         return ret_arr;
37276 }
37277
37278 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
37279         LDKu8slice ser_ref;
37280         ser_ref.datalen = ser->arr_len;
37281         ser_ref.data = ser->elems;
37282         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
37283         *ret_conv = ChannelTransactionParameters_read(ser_ref);
37284         FREE(ser);
37285         return tag_ptr(ret_conv, true);
37286 }
37287
37288 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
37289         LDKDirectedChannelTransactionParameters this_obj_conv;
37290         this_obj_conv.inner = untag_ptr(this_obj);
37291         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37293         DirectedChannelTransactionParameters_free(this_obj_conv);
37294 }
37295
37296 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
37297         LDKDirectedChannelTransactionParameters this_arg_conv;
37298         this_arg_conv.inner = untag_ptr(this_arg);
37299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37301         this_arg_conv.is_owned = false;
37302         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
37303         uint64_t ret_ref = 0;
37304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37306         return ret_ref;
37307 }
37308
37309 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
37310         LDKDirectedChannelTransactionParameters this_arg_conv;
37311         this_arg_conv.inner = untag_ptr(this_arg);
37312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37314         this_arg_conv.is_owned = false;
37315         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
37316         uint64_t ret_ref = 0;
37317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37319         return ret_ref;
37320 }
37321
37322 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
37323         LDKDirectedChannelTransactionParameters this_arg_conv;
37324         this_arg_conv.inner = untag_ptr(this_arg);
37325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37327         this_arg_conv.is_owned = false;
37328         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
37329         return ret_conv;
37330 }
37331
37332 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
37333         LDKDirectedChannelTransactionParameters this_arg_conv;
37334         this_arg_conv.inner = untag_ptr(this_arg);
37335         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37337         this_arg_conv.is_owned = false;
37338         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
37339         return ret_conv;
37340 }
37341
37342 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
37343         LDKDirectedChannelTransactionParameters this_arg_conv;
37344         this_arg_conv.inner = untag_ptr(this_arg);
37345         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37347         this_arg_conv.is_owned = false;
37348         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
37349         uint64_t ret_ref = 0;
37350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37352         return ret_ref;
37353 }
37354
37355 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint64_t this_arg) {
37356         LDKDirectedChannelTransactionParameters this_arg_conv;
37357         this_arg_conv.inner = untag_ptr(this_arg);
37358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37360         this_arg_conv.is_owned = false;
37361         jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
37362         return ret_conv;
37363 }
37364
37365 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
37366         LDKHolderCommitmentTransaction this_obj_conv;
37367         this_obj_conv.inner = untag_ptr(this_obj);
37368         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37370         HolderCommitmentTransaction_free(this_obj_conv);
37371 }
37372
37373 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
37374         LDKHolderCommitmentTransaction this_ptr_conv;
37375         this_ptr_conv.inner = untag_ptr(this_ptr);
37376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37378         this_ptr_conv.is_owned = false;
37379         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
37380         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
37381         return ret_arr;
37382 }
37383
37384 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
37385         LDKHolderCommitmentTransaction this_ptr_conv;
37386         this_ptr_conv.inner = untag_ptr(this_ptr);
37387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37389         this_ptr_conv.is_owned = false;
37390         LDKSignature val_ref;
37391         CHECK(val->arr_len == 64);
37392         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
37393         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
37394 }
37395
37396 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
37397         LDKHolderCommitmentTransaction this_ptr_conv;
37398         this_ptr_conv.inner = untag_ptr(this_ptr);
37399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37401         this_ptr_conv.is_owned = false;
37402         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
37403         ptrArray ret_arr = NULL;
37404         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
37405         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
37406         for (size_t m = 0; m < ret_var.datalen; m++) {
37407                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
37408                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
37409                 ret_arr_ptr[m] = ret_conv_12_arr;
37410         }
37411         
37412         FREE(ret_var.data);
37413         return ret_arr;
37414 }
37415
37416 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
37417         LDKHolderCommitmentTransaction this_ptr_conv;
37418         this_ptr_conv.inner = untag_ptr(this_ptr);
37419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37421         this_ptr_conv.is_owned = false;
37422         LDKCVec_SignatureZ val_constr;
37423         val_constr.datalen = val->arr_len;
37424         if (val_constr.datalen > 0)
37425                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
37426         else
37427                 val_constr.data = NULL;
37428         int8_tArray* val_vals = (void*) val->elems;
37429         for (size_t m = 0; m < val_constr.datalen; m++) {
37430                 int8_tArray val_conv_12 = val_vals[m];
37431                 LDKSignature val_conv_12_ref;
37432                 CHECK(val_conv_12->arr_len == 64);
37433                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
37434                 val_constr.data[m] = val_conv_12_ref;
37435         }
37436         FREE(val);
37437         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
37438 }
37439
37440 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
37441         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
37442         uint64_t ret_ref = 0;
37443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37445         return ret_ref;
37446 }
37447 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
37448         LDKHolderCommitmentTransaction arg_conv;
37449         arg_conv.inner = untag_ptr(arg);
37450         arg_conv.is_owned = ptr_is_owned(arg);
37451         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37452         arg_conv.is_owned = false;
37453         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
37454         return ret_conv;
37455 }
37456
37457 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
37458         LDKHolderCommitmentTransaction orig_conv;
37459         orig_conv.inner = untag_ptr(orig);
37460         orig_conv.is_owned = ptr_is_owned(orig);
37461         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37462         orig_conv.is_owned = false;
37463         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
37464         uint64_t ret_ref = 0;
37465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37467         return ret_ref;
37468 }
37469
37470 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
37471         LDKHolderCommitmentTransaction obj_conv;
37472         obj_conv.inner = untag_ptr(obj);
37473         obj_conv.is_owned = ptr_is_owned(obj);
37474         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37475         obj_conv.is_owned = false;
37476         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
37477         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37478         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37479         CVec_u8Z_free(ret_var);
37480         return ret_arr;
37481 }
37482
37483 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
37484         LDKu8slice ser_ref;
37485         ser_ref.datalen = ser->arr_len;
37486         ser_ref.data = ser->elems;
37487         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
37488         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
37489         FREE(ser);
37490         return tag_ptr(ret_conv, true);
37491 }
37492
37493 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_new"))) TS_HolderCommitmentTransaction_new(uint64_t commitment_tx, int8_tArray counterparty_sig, ptrArray counterparty_htlc_sigs, int8_tArray holder_funding_key, int8_tArray counterparty_funding_key) {
37494         LDKCommitmentTransaction commitment_tx_conv;
37495         commitment_tx_conv.inner = untag_ptr(commitment_tx);
37496         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
37497         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
37498         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
37499         LDKSignature counterparty_sig_ref;
37500         CHECK(counterparty_sig->arr_len == 64);
37501         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
37502         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
37503         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
37504         if (counterparty_htlc_sigs_constr.datalen > 0)
37505                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
37506         else
37507                 counterparty_htlc_sigs_constr.data = NULL;
37508         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
37509         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
37510                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
37511                 LDKSignature counterparty_htlc_sigs_conv_12_ref;
37512                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
37513                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
37514                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
37515         }
37516         FREE(counterparty_htlc_sigs);
37517         LDKPublicKey holder_funding_key_ref;
37518         CHECK(holder_funding_key->arr_len == 33);
37519         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
37520         LDKPublicKey counterparty_funding_key_ref;
37521         CHECK(counterparty_funding_key->arr_len == 33);
37522         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
37523         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
37524         uint64_t ret_ref = 0;
37525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37527         return ret_ref;
37528 }
37529
37530 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
37531         LDKBuiltCommitmentTransaction this_obj_conv;
37532         this_obj_conv.inner = untag_ptr(this_obj);
37533         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37535         BuiltCommitmentTransaction_free(this_obj_conv);
37536 }
37537
37538 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
37539         LDKBuiltCommitmentTransaction this_ptr_conv;
37540         this_ptr_conv.inner = untag_ptr(this_ptr);
37541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37543         this_ptr_conv.is_owned = false;
37544         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
37545         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37546         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37547         Transaction_free(ret_var);
37548         return ret_arr;
37549 }
37550
37551 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
37552         LDKBuiltCommitmentTransaction this_ptr_conv;
37553         this_ptr_conv.inner = untag_ptr(this_ptr);
37554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37556         this_ptr_conv.is_owned = false;
37557         LDKTransaction val_ref;
37558         val_ref.datalen = val->arr_len;
37559         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
37560         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
37561         val_ref.data_is_owned = true;
37562         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
37563 }
37564
37565 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
37566         LDKBuiltCommitmentTransaction this_ptr_conv;
37567         this_ptr_conv.inner = untag_ptr(this_ptr);
37568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37570         this_ptr_conv.is_owned = false;
37571         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37572         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
37573         return ret_arr;
37574 }
37575
37576 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
37577         LDKBuiltCommitmentTransaction this_ptr_conv;
37578         this_ptr_conv.inner = untag_ptr(this_ptr);
37579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37581         this_ptr_conv.is_owned = false;
37582         LDKThirtyTwoBytes val_ref;
37583         CHECK(val->arr_len == 32);
37584         memcpy(val_ref.data, val->elems, 32); FREE(val);
37585         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
37586 }
37587
37588 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
37589         LDKTransaction transaction_arg_ref;
37590         transaction_arg_ref.datalen = transaction_arg->arr_len;
37591         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
37592         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
37593         transaction_arg_ref.data_is_owned = true;
37594         LDKThirtyTwoBytes txid_arg_ref;
37595         CHECK(txid_arg->arr_len == 32);
37596         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
37597         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
37598         uint64_t ret_ref = 0;
37599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37601         return ret_ref;
37602 }
37603
37604 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
37605         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
37606         uint64_t ret_ref = 0;
37607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37609         return ret_ref;
37610 }
37611 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
37612         LDKBuiltCommitmentTransaction arg_conv;
37613         arg_conv.inner = untag_ptr(arg);
37614         arg_conv.is_owned = ptr_is_owned(arg);
37615         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37616         arg_conv.is_owned = false;
37617         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
37618         return ret_conv;
37619 }
37620
37621 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
37622         LDKBuiltCommitmentTransaction orig_conv;
37623         orig_conv.inner = untag_ptr(orig);
37624         orig_conv.is_owned = ptr_is_owned(orig);
37625         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37626         orig_conv.is_owned = false;
37627         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
37628         uint64_t ret_ref = 0;
37629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37631         return ret_ref;
37632 }
37633
37634 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
37635         LDKBuiltCommitmentTransaction obj_conv;
37636         obj_conv.inner = untag_ptr(obj);
37637         obj_conv.is_owned = ptr_is_owned(obj);
37638         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37639         obj_conv.is_owned = false;
37640         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
37641         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37642         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37643         CVec_u8Z_free(ret_var);
37644         return ret_arr;
37645 }
37646
37647 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
37648         LDKu8slice ser_ref;
37649         ser_ref.datalen = ser->arr_len;
37650         ser_ref.data = ser->elems;
37651         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
37652         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
37653         FREE(ser);
37654         return tag_ptr(ret_conv, true);
37655 }
37656
37657 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_sighash_all"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
37658         LDKBuiltCommitmentTransaction this_arg_conv;
37659         this_arg_conv.inner = untag_ptr(this_arg);
37660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37662         this_arg_conv.is_owned = false;
37663         LDKu8slice funding_redeemscript_ref;
37664         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
37665         funding_redeemscript_ref.data = funding_redeemscript->elems;
37666         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37667         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
37668         FREE(funding_redeemscript);
37669         return ret_arr;
37670 }
37671
37672 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_sign"))) TS_BuiltCommitmentTransaction_sign(uint64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
37673         LDKBuiltCommitmentTransaction this_arg_conv;
37674         this_arg_conv.inner = untag_ptr(this_arg);
37675         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37677         this_arg_conv.is_owned = false;
37678         unsigned char funding_key_arr[32];
37679         CHECK(funding_key->arr_len == 32);
37680         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
37681         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
37682         LDKu8slice funding_redeemscript_ref;
37683         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
37684         funding_redeemscript_ref.data = funding_redeemscript->elems;
37685         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
37686         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
37687         FREE(funding_redeemscript);
37688         return ret_arr;
37689 }
37690
37691 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
37692         LDKClosingTransaction this_obj_conv;
37693         this_obj_conv.inner = untag_ptr(this_obj);
37694         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37696         ClosingTransaction_free(this_obj_conv);
37697 }
37698
37699 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
37700         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
37701         uint64_t ret_ref = 0;
37702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37704         return ret_ref;
37705 }
37706 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
37707         LDKClosingTransaction arg_conv;
37708         arg_conv.inner = untag_ptr(arg);
37709         arg_conv.is_owned = ptr_is_owned(arg);
37710         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37711         arg_conv.is_owned = false;
37712         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
37713         return ret_conv;
37714 }
37715
37716 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
37717         LDKClosingTransaction orig_conv;
37718         orig_conv.inner = untag_ptr(orig);
37719         orig_conv.is_owned = ptr_is_owned(orig);
37720         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37721         orig_conv.is_owned = false;
37722         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
37723         uint64_t ret_ref = 0;
37724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37726         return ret_ref;
37727 }
37728
37729 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
37730         LDKClosingTransaction o_conv;
37731         o_conv.inner = untag_ptr(o);
37732         o_conv.is_owned = ptr_is_owned(o);
37733         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37734         o_conv.is_owned = false;
37735         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
37736         return ret_conv;
37737 }
37738
37739 jboolean  __attribute__((export_name("TS_ClosingTransaction_eq"))) TS_ClosingTransaction_eq(uint64_t a, uint64_t b) {
37740         LDKClosingTransaction a_conv;
37741         a_conv.inner = untag_ptr(a);
37742         a_conv.is_owned = ptr_is_owned(a);
37743         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37744         a_conv.is_owned = false;
37745         LDKClosingTransaction b_conv;
37746         b_conv.inner = untag_ptr(b);
37747         b_conv.is_owned = ptr_is_owned(b);
37748         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37749         b_conv.is_owned = false;
37750         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
37751         return ret_conv;
37752 }
37753
37754 uint64_t  __attribute__((export_name("TS_ClosingTransaction_new"))) TS_ClosingTransaction_new(int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, uint64_t funding_outpoint) {
37755         LDKCVec_u8Z to_holder_script_ref;
37756         to_holder_script_ref.datalen = to_holder_script->arr_len;
37757         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
37758         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
37759         LDKCVec_u8Z to_counterparty_script_ref;
37760         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
37761         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
37762         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
37763         LDKOutPoint funding_outpoint_conv;
37764         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
37765         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
37766         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
37767         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
37768         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
37769         uint64_t ret_ref = 0;
37770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37772         return ret_ref;
37773 }
37774
37775 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
37776         LDKClosingTransaction this_arg_conv;
37777         this_arg_conv.inner = untag_ptr(this_arg);
37778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37780         this_arg_conv.is_owned = false;
37781         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
37782         uint64_t ret_ref = 0;
37783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37785         return ret_ref;
37786 }
37787
37788 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
37789         LDKClosingTransaction this_arg_conv;
37790         this_arg_conv.inner = untag_ptr(this_arg);
37791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37793         this_arg_conv.is_owned = false;
37794         LDKOutPoint funding_outpoint_conv;
37795         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
37796         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
37797         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
37798         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
37799         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
37800         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
37801         return tag_ptr(ret_conv, true);
37802 }
37803
37804 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
37805         LDKClosingTransaction this_arg_conv;
37806         this_arg_conv.inner = untag_ptr(this_arg);
37807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37809         this_arg_conv.is_owned = false;
37810         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
37811         return ret_conv;
37812 }
37813
37814 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
37815         LDKClosingTransaction this_arg_conv;
37816         this_arg_conv.inner = untag_ptr(this_arg);
37817         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37819         this_arg_conv.is_owned = false;
37820         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
37821         return ret_conv;
37822 }
37823
37824 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
37825         LDKClosingTransaction this_arg_conv;
37826         this_arg_conv.inner = untag_ptr(this_arg);
37827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37829         this_arg_conv.is_owned = false;
37830         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
37831         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37832         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37833         return ret_arr;
37834 }
37835
37836 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
37837         LDKClosingTransaction this_arg_conv;
37838         this_arg_conv.inner = untag_ptr(this_arg);
37839         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37841         this_arg_conv.is_owned = false;
37842         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
37843         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37844         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37845         return ret_arr;
37846 }
37847
37848 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
37849         LDKTrustedClosingTransaction this_obj_conv;
37850         this_obj_conv.inner = untag_ptr(this_obj);
37851         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37853         TrustedClosingTransaction_free(this_obj_conv);
37854 }
37855
37856 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
37857         LDKTrustedClosingTransaction this_arg_conv;
37858         this_arg_conv.inner = untag_ptr(this_arg);
37859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37861         this_arg_conv.is_owned = false;
37862         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
37863         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37864         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37865         Transaction_free(ret_var);
37866         return ret_arr;
37867 }
37868
37869 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_get_sighash_all"))) TS_TrustedClosingTransaction_get_sighash_all(uint64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
37870         LDKTrustedClosingTransaction this_arg_conv;
37871         this_arg_conv.inner = untag_ptr(this_arg);
37872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37874         this_arg_conv.is_owned = false;
37875         LDKu8slice funding_redeemscript_ref;
37876         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
37877         funding_redeemscript_ref.data = funding_redeemscript->elems;
37878         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37879         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
37880         FREE(funding_redeemscript);
37881         return ret_arr;
37882 }
37883
37884 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_sign"))) TS_TrustedClosingTransaction_sign(uint64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
37885         LDKTrustedClosingTransaction this_arg_conv;
37886         this_arg_conv.inner = untag_ptr(this_arg);
37887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37889         this_arg_conv.is_owned = false;
37890         unsigned char funding_key_arr[32];
37891         CHECK(funding_key->arr_len == 32);
37892         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
37893         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
37894         LDKu8slice funding_redeemscript_ref;
37895         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
37896         funding_redeemscript_ref.data = funding_redeemscript->elems;
37897         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
37898         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
37899         FREE(funding_redeemscript);
37900         return ret_arr;
37901 }
37902
37903 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
37904         LDKCommitmentTransaction this_obj_conv;
37905         this_obj_conv.inner = untag_ptr(this_obj);
37906         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37908         CommitmentTransaction_free(this_obj_conv);
37909 }
37910
37911 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
37912         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
37913         uint64_t ret_ref = 0;
37914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37916         return ret_ref;
37917 }
37918 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
37919         LDKCommitmentTransaction arg_conv;
37920         arg_conv.inner = untag_ptr(arg);
37921         arg_conv.is_owned = ptr_is_owned(arg);
37922         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37923         arg_conv.is_owned = false;
37924         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
37925         return ret_conv;
37926 }
37927
37928 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
37929         LDKCommitmentTransaction orig_conv;
37930         orig_conv.inner = untag_ptr(orig);
37931         orig_conv.is_owned = ptr_is_owned(orig);
37932         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37933         orig_conv.is_owned = false;
37934         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
37935         uint64_t ret_ref = 0;
37936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37938         return ret_ref;
37939 }
37940
37941 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
37942         LDKCommitmentTransaction obj_conv;
37943         obj_conv.inner = untag_ptr(obj);
37944         obj_conv.is_owned = ptr_is_owned(obj);
37945         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37946         obj_conv.is_owned = false;
37947         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
37948         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37949         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37950         CVec_u8Z_free(ret_var);
37951         return ret_arr;
37952 }
37953
37954 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
37955         LDKu8slice ser_ref;
37956         ser_ref.datalen = ser->arr_len;
37957         ser_ref.data = ser->elems;
37958         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
37959         *ret_conv = CommitmentTransaction_read(ser_ref);
37960         FREE(ser);
37961         return tag_ptr(ret_conv, true);
37962 }
37963
37964 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
37965         LDKCommitmentTransaction this_arg_conv;
37966         this_arg_conv.inner = untag_ptr(this_arg);
37967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37969         this_arg_conv.is_owned = false;
37970         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
37971         return ret_conv;
37972 }
37973
37974 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
37975         LDKCommitmentTransaction this_arg_conv;
37976         this_arg_conv.inner = untag_ptr(this_arg);
37977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37979         this_arg_conv.is_owned = false;
37980         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
37981         return ret_conv;
37982 }
37983
37984 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
37985         LDKCommitmentTransaction this_arg_conv;
37986         this_arg_conv.inner = untag_ptr(this_arg);
37987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37989         this_arg_conv.is_owned = false;
37990         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
37991         return ret_conv;
37992 }
37993
37994 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
37995         LDKCommitmentTransaction this_arg_conv;
37996         this_arg_conv.inner = untag_ptr(this_arg);
37997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37999         this_arg_conv.is_owned = false;
38000         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
38001         return ret_conv;
38002 }
38003
38004 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
38005         LDKCommitmentTransaction this_arg_conv;
38006         this_arg_conv.inner = untag_ptr(this_arg);
38007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38009         this_arg_conv.is_owned = false;
38010         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
38011         uint64_t ret_ref = 0;
38012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38014         return ret_ref;
38015 }
38016
38017 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_verify"))) TS_CommitmentTransaction_verify(uint64_t this_arg, uint64_t channel_parameters, uint64_t broadcaster_keys, uint64_t countersignatory_keys) {
38018         LDKCommitmentTransaction this_arg_conv;
38019         this_arg_conv.inner = untag_ptr(this_arg);
38020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38022         this_arg_conv.is_owned = false;
38023         LDKDirectedChannelTransactionParameters channel_parameters_conv;
38024         channel_parameters_conv.inner = untag_ptr(channel_parameters);
38025         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
38026         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
38027         channel_parameters_conv.is_owned = false;
38028         LDKChannelPublicKeys broadcaster_keys_conv;
38029         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
38030         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
38031         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
38032         broadcaster_keys_conv.is_owned = false;
38033         LDKChannelPublicKeys countersignatory_keys_conv;
38034         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
38035         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
38036         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
38037         countersignatory_keys_conv.is_owned = false;
38038         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
38039         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
38040         return tag_ptr(ret_conv, true);
38041 }
38042
38043 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
38044         LDKTrustedCommitmentTransaction this_obj_conv;
38045         this_obj_conv.inner = untag_ptr(this_obj);
38046         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38048         TrustedCommitmentTransaction_free(this_obj_conv);
38049 }
38050
38051 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
38052         LDKTrustedCommitmentTransaction this_arg_conv;
38053         this_arg_conv.inner = untag_ptr(this_arg);
38054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38056         this_arg_conv.is_owned = false;
38057         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38058         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
38059         return ret_arr;
38060 }
38061
38062 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
38063         LDKTrustedCommitmentTransaction this_arg_conv;
38064         this_arg_conv.inner = untag_ptr(this_arg);
38065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38067         this_arg_conv.is_owned = false;
38068         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
38069         uint64_t ret_ref = 0;
38070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38072         return ret_ref;
38073 }
38074
38075 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
38076         LDKTrustedCommitmentTransaction this_arg_conv;
38077         this_arg_conv.inner = untag_ptr(this_arg);
38078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38080         this_arg_conv.is_owned = false;
38081         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
38082         uint64_t ret_ref = 0;
38083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38085         return ret_ref;
38086 }
38087
38088 jboolean  __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint64_t this_arg) {
38089         LDKTrustedCommitmentTransaction this_arg_conv;
38090         this_arg_conv.inner = untag_ptr(this_arg);
38091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38093         this_arg_conv.is_owned = false;
38094         jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
38095         return ret_conv;
38096 }
38097
38098 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_get_htlc_sigs"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint64_t this_arg, int8_tArray htlc_base_key, uint64_t channel_parameters) {
38099         LDKTrustedCommitmentTransaction this_arg_conv;
38100         this_arg_conv.inner = untag_ptr(this_arg);
38101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38103         this_arg_conv.is_owned = false;
38104         unsigned char htlc_base_key_arr[32];
38105         CHECK(htlc_base_key->arr_len == 32);
38106         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
38107         unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
38108         LDKDirectedChannelTransactionParameters channel_parameters_conv;
38109         channel_parameters_conv.inner = untag_ptr(channel_parameters);
38110         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
38111         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
38112         channel_parameters_conv.is_owned = false;
38113         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
38114         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
38115         return tag_ptr(ret_conv, true);
38116 }
38117
38118 int64_t  __attribute__((export_name("TS_get_commitment_transaction_number_obscure_factor"))) TS_get_commitment_transaction_number_obscure_factor(int8_tArray broadcaster_payment_basepoint, int8_tArray countersignatory_payment_basepoint, jboolean outbound_from_broadcaster) {
38119         LDKPublicKey broadcaster_payment_basepoint_ref;
38120         CHECK(broadcaster_payment_basepoint->arr_len == 33);
38121         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
38122         LDKPublicKey countersignatory_payment_basepoint_ref;
38123         CHECK(countersignatory_payment_basepoint->arr_len == 33);
38124         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
38125         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
38126         return ret_conv;
38127 }
38128
38129 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
38130         LDKInitFeatures a_conv;
38131         a_conv.inner = untag_ptr(a);
38132         a_conv.is_owned = ptr_is_owned(a);
38133         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38134         a_conv.is_owned = false;
38135         LDKInitFeatures b_conv;
38136         b_conv.inner = untag_ptr(b);
38137         b_conv.is_owned = ptr_is_owned(b);
38138         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38139         b_conv.is_owned = false;
38140         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
38141         return ret_conv;
38142 }
38143
38144 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
38145         LDKNodeFeatures a_conv;
38146         a_conv.inner = untag_ptr(a);
38147         a_conv.is_owned = ptr_is_owned(a);
38148         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38149         a_conv.is_owned = false;
38150         LDKNodeFeatures b_conv;
38151         b_conv.inner = untag_ptr(b);
38152         b_conv.is_owned = ptr_is_owned(b);
38153         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38154         b_conv.is_owned = false;
38155         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
38156         return ret_conv;
38157 }
38158
38159 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
38160         LDKChannelFeatures a_conv;
38161         a_conv.inner = untag_ptr(a);
38162         a_conv.is_owned = ptr_is_owned(a);
38163         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38164         a_conv.is_owned = false;
38165         LDKChannelFeatures b_conv;
38166         b_conv.inner = untag_ptr(b);
38167         b_conv.is_owned = ptr_is_owned(b);
38168         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38169         b_conv.is_owned = false;
38170         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
38171         return ret_conv;
38172 }
38173
38174 jboolean  __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint64_t a, uint64_t b) {
38175         LDKInvoiceFeatures a_conv;
38176         a_conv.inner = untag_ptr(a);
38177         a_conv.is_owned = ptr_is_owned(a);
38178         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38179         a_conv.is_owned = false;
38180         LDKInvoiceFeatures b_conv;
38181         b_conv.inner = untag_ptr(b);
38182         b_conv.is_owned = ptr_is_owned(b);
38183         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38184         b_conv.is_owned = false;
38185         jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
38186         return ret_conv;
38187 }
38188
38189 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
38190         LDKChannelTypeFeatures a_conv;
38191         a_conv.inner = untag_ptr(a);
38192         a_conv.is_owned = ptr_is_owned(a);
38193         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38194         a_conv.is_owned = false;
38195         LDKChannelTypeFeatures b_conv;
38196         b_conv.inner = untag_ptr(b);
38197         b_conv.is_owned = ptr_is_owned(b);
38198         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38199         b_conv.is_owned = false;
38200         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
38201         return ret_conv;
38202 }
38203
38204 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
38205         LDKInitFeatures ret_var = InitFeatures_clone(arg);
38206         uint64_t ret_ref = 0;
38207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38209         return ret_ref;
38210 }
38211 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
38212         LDKInitFeatures arg_conv;
38213         arg_conv.inner = untag_ptr(arg);
38214         arg_conv.is_owned = ptr_is_owned(arg);
38215         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38216         arg_conv.is_owned = false;
38217         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
38218         return ret_conv;
38219 }
38220
38221 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
38222         LDKInitFeatures orig_conv;
38223         orig_conv.inner = untag_ptr(orig);
38224         orig_conv.is_owned = ptr_is_owned(orig);
38225         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38226         orig_conv.is_owned = false;
38227         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
38228         uint64_t ret_ref = 0;
38229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38231         return ret_ref;
38232 }
38233
38234 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
38235         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
38236         uint64_t ret_ref = 0;
38237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38239         return ret_ref;
38240 }
38241 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
38242         LDKNodeFeatures arg_conv;
38243         arg_conv.inner = untag_ptr(arg);
38244         arg_conv.is_owned = ptr_is_owned(arg);
38245         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38246         arg_conv.is_owned = false;
38247         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
38248         return ret_conv;
38249 }
38250
38251 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
38252         LDKNodeFeatures orig_conv;
38253         orig_conv.inner = untag_ptr(orig);
38254         orig_conv.is_owned = ptr_is_owned(orig);
38255         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38256         orig_conv.is_owned = false;
38257         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
38258         uint64_t ret_ref = 0;
38259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38261         return ret_ref;
38262 }
38263
38264 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
38265         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
38266         uint64_t ret_ref = 0;
38267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38269         return ret_ref;
38270 }
38271 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
38272         LDKChannelFeatures arg_conv;
38273         arg_conv.inner = untag_ptr(arg);
38274         arg_conv.is_owned = ptr_is_owned(arg);
38275         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38276         arg_conv.is_owned = false;
38277         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
38278         return ret_conv;
38279 }
38280
38281 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
38282         LDKChannelFeatures orig_conv;
38283         orig_conv.inner = untag_ptr(orig);
38284         orig_conv.is_owned = ptr_is_owned(orig);
38285         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38286         orig_conv.is_owned = false;
38287         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
38288         uint64_t ret_ref = 0;
38289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38291         return ret_ref;
38292 }
38293
38294 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
38295         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
38296         uint64_t ret_ref = 0;
38297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38299         return ret_ref;
38300 }
38301 int64_t  __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint64_t arg) {
38302         LDKInvoiceFeatures arg_conv;
38303         arg_conv.inner = untag_ptr(arg);
38304         arg_conv.is_owned = ptr_is_owned(arg);
38305         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38306         arg_conv.is_owned = false;
38307         int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
38308         return ret_conv;
38309 }
38310
38311 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint64_t orig) {
38312         LDKInvoiceFeatures orig_conv;
38313         orig_conv.inner = untag_ptr(orig);
38314         orig_conv.is_owned = ptr_is_owned(orig);
38315         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38316         orig_conv.is_owned = false;
38317         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
38318         uint64_t ret_ref = 0;
38319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38321         return ret_ref;
38322 }
38323
38324 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
38325         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
38326         uint64_t ret_ref = 0;
38327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38329         return ret_ref;
38330 }
38331 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
38332         LDKChannelTypeFeatures arg_conv;
38333         arg_conv.inner = untag_ptr(arg);
38334         arg_conv.is_owned = ptr_is_owned(arg);
38335         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38336         arg_conv.is_owned = false;
38337         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
38338         return ret_conv;
38339 }
38340
38341 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
38342         LDKChannelTypeFeatures orig_conv;
38343         orig_conv.inner = untag_ptr(orig);
38344         orig_conv.is_owned = ptr_is_owned(orig);
38345         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38346         orig_conv.is_owned = false;
38347         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
38348         uint64_t ret_ref = 0;
38349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38351         return ret_ref;
38352 }
38353
38354 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
38355         LDKInitFeatures this_obj_conv;
38356         this_obj_conv.inner = untag_ptr(this_obj);
38357         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38359         InitFeatures_free(this_obj_conv);
38360 }
38361
38362 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
38363         LDKNodeFeatures this_obj_conv;
38364         this_obj_conv.inner = untag_ptr(this_obj);
38365         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38367         NodeFeatures_free(this_obj_conv);
38368 }
38369
38370 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
38371         LDKChannelFeatures this_obj_conv;
38372         this_obj_conv.inner = untag_ptr(this_obj);
38373         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38375         ChannelFeatures_free(this_obj_conv);
38376 }
38377
38378 void  __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint64_t this_obj) {
38379         LDKInvoiceFeatures this_obj_conv;
38380         this_obj_conv.inner = untag_ptr(this_obj);
38381         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38383         InvoiceFeatures_free(this_obj_conv);
38384 }
38385
38386 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
38387         LDKChannelTypeFeatures this_obj_conv;
38388         this_obj_conv.inner = untag_ptr(this_obj);
38389         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38391         ChannelTypeFeatures_free(this_obj_conv);
38392 }
38393
38394 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
38395         LDKInitFeatures ret_var = InitFeatures_empty();
38396         uint64_t ret_ref = 0;
38397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38399         return ret_ref;
38400 }
38401
38402 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
38403         LDKInitFeatures this_arg_conv;
38404         this_arg_conv.inner = untag_ptr(this_arg);
38405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38407         this_arg_conv.is_owned = false;
38408         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
38409         return ret_conv;
38410 }
38411
38412 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
38413         LDKNodeFeatures ret_var = NodeFeatures_empty();
38414         uint64_t ret_ref = 0;
38415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38417         return ret_ref;
38418 }
38419
38420 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
38421         LDKNodeFeatures this_arg_conv;
38422         this_arg_conv.inner = untag_ptr(this_arg);
38423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38425         this_arg_conv.is_owned = false;
38426         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
38427         return ret_conv;
38428 }
38429
38430 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
38431         LDKChannelFeatures ret_var = ChannelFeatures_empty();
38432         uint64_t ret_ref = 0;
38433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38435         return ret_ref;
38436 }
38437
38438 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
38439         LDKChannelFeatures this_arg_conv;
38440         this_arg_conv.inner = untag_ptr(this_arg);
38441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38443         this_arg_conv.is_owned = false;
38444         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
38445         return ret_conv;
38446 }
38447
38448 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
38449         LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
38450         uint64_t ret_ref = 0;
38451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38453         return ret_ref;
38454 }
38455
38456 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
38457         LDKInvoiceFeatures this_arg_conv;
38458         this_arg_conv.inner = untag_ptr(this_arg);
38459         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38461         this_arg_conv.is_owned = false;
38462         jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
38463         return ret_conv;
38464 }
38465
38466 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
38467         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
38468         uint64_t ret_ref = 0;
38469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38471         return ret_ref;
38472 }
38473
38474 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
38475         LDKChannelTypeFeatures this_arg_conv;
38476         this_arg_conv.inner = untag_ptr(this_arg);
38477         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38479         this_arg_conv.is_owned = false;
38480         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
38481         return ret_conv;
38482 }
38483
38484 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
38485         LDKInitFeatures obj_conv;
38486         obj_conv.inner = untag_ptr(obj);
38487         obj_conv.is_owned = ptr_is_owned(obj);
38488         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38489         obj_conv.is_owned = false;
38490         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
38491         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38492         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38493         CVec_u8Z_free(ret_var);
38494         return ret_arr;
38495 }
38496
38497 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
38498         LDKu8slice ser_ref;
38499         ser_ref.datalen = ser->arr_len;
38500         ser_ref.data = ser->elems;
38501         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
38502         *ret_conv = InitFeatures_read(ser_ref);
38503         FREE(ser);
38504         return tag_ptr(ret_conv, true);
38505 }
38506
38507 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
38508         LDKChannelFeatures obj_conv;
38509         obj_conv.inner = untag_ptr(obj);
38510         obj_conv.is_owned = ptr_is_owned(obj);
38511         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38512         obj_conv.is_owned = false;
38513         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
38514         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38515         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38516         CVec_u8Z_free(ret_var);
38517         return ret_arr;
38518 }
38519
38520 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
38521         LDKu8slice ser_ref;
38522         ser_ref.datalen = ser->arr_len;
38523         ser_ref.data = ser->elems;
38524         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
38525         *ret_conv = ChannelFeatures_read(ser_ref);
38526         FREE(ser);
38527         return tag_ptr(ret_conv, true);
38528 }
38529
38530 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
38531         LDKNodeFeatures obj_conv;
38532         obj_conv.inner = untag_ptr(obj);
38533         obj_conv.is_owned = ptr_is_owned(obj);
38534         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38535         obj_conv.is_owned = false;
38536         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
38537         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38538         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38539         CVec_u8Z_free(ret_var);
38540         return ret_arr;
38541 }
38542
38543 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
38544         LDKu8slice ser_ref;
38545         ser_ref.datalen = ser->arr_len;
38546         ser_ref.data = ser->elems;
38547         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
38548         *ret_conv = NodeFeatures_read(ser_ref);
38549         FREE(ser);
38550         return tag_ptr(ret_conv, true);
38551 }
38552
38553 int8_tArray  __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint64_t obj) {
38554         LDKInvoiceFeatures obj_conv;
38555         obj_conv.inner = untag_ptr(obj);
38556         obj_conv.is_owned = ptr_is_owned(obj);
38557         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38558         obj_conv.is_owned = false;
38559         LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
38560         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38561         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38562         CVec_u8Z_free(ret_var);
38563         return ret_arr;
38564 }
38565
38566 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
38567         LDKu8slice ser_ref;
38568         ser_ref.datalen = ser->arr_len;
38569         ser_ref.data = ser->elems;
38570         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
38571         *ret_conv = InvoiceFeatures_read(ser_ref);
38572         FREE(ser);
38573         return tag_ptr(ret_conv, true);
38574 }
38575
38576 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
38577         LDKChannelTypeFeatures obj_conv;
38578         obj_conv.inner = untag_ptr(obj);
38579         obj_conv.is_owned = ptr_is_owned(obj);
38580         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38581         obj_conv.is_owned = false;
38582         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
38583         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38584         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38585         CVec_u8Z_free(ret_var);
38586         return ret_arr;
38587 }
38588
38589 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
38590         LDKu8slice ser_ref;
38591         ser_ref.datalen = ser->arr_len;
38592         ser_ref.data = ser->elems;
38593         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
38594         *ret_conv = ChannelTypeFeatures_read(ser_ref);
38595         FREE(ser);
38596         return tag_ptr(ret_conv, true);
38597 }
38598
38599 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
38600         LDKInitFeatures this_arg_conv;
38601         this_arg_conv.inner = untag_ptr(this_arg);
38602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38604         this_arg_conv.is_owned = false;
38605         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
38606 }
38607
38608 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
38609         LDKInitFeatures this_arg_conv;
38610         this_arg_conv.inner = untag_ptr(this_arg);
38611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38613         this_arg_conv.is_owned = false;
38614         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
38615 }
38616
38617 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
38618         LDKInitFeatures this_arg_conv;
38619         this_arg_conv.inner = untag_ptr(this_arg);
38620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38622         this_arg_conv.is_owned = false;
38623         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
38624         return ret_conv;
38625 }
38626
38627 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
38628         LDKNodeFeatures this_arg_conv;
38629         this_arg_conv.inner = untag_ptr(this_arg);
38630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38632         this_arg_conv.is_owned = false;
38633         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
38634 }
38635
38636 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
38637         LDKNodeFeatures this_arg_conv;
38638         this_arg_conv.inner = untag_ptr(this_arg);
38639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38641         this_arg_conv.is_owned = false;
38642         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
38643 }
38644
38645 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
38646         LDKNodeFeatures this_arg_conv;
38647         this_arg_conv.inner = untag_ptr(this_arg);
38648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38650         this_arg_conv.is_owned = false;
38651         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
38652         return ret_conv;
38653 }
38654
38655 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
38656         LDKInitFeatures this_arg_conv;
38657         this_arg_conv.inner = untag_ptr(this_arg);
38658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38660         this_arg_conv.is_owned = false;
38661         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
38662         return ret_conv;
38663 }
38664
38665 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
38666         LDKNodeFeatures this_arg_conv;
38667         this_arg_conv.inner = untag_ptr(this_arg);
38668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38670         this_arg_conv.is_owned = false;
38671         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
38672         return ret_conv;
38673 }
38674
38675 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
38676         LDKInitFeatures this_arg_conv;
38677         this_arg_conv.inner = untag_ptr(this_arg);
38678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38680         this_arg_conv.is_owned = false;
38681         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
38682 }
38683
38684 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
38685         LDKInitFeatures this_arg_conv;
38686         this_arg_conv.inner = untag_ptr(this_arg);
38687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38689         this_arg_conv.is_owned = false;
38690         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
38691 }
38692
38693 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
38694         LDKInitFeatures this_arg_conv;
38695         this_arg_conv.inner = untag_ptr(this_arg);
38696         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38698         this_arg_conv.is_owned = false;
38699         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
38700         return ret_conv;
38701 }
38702
38703 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
38704         LDKInitFeatures this_arg_conv;
38705         this_arg_conv.inner = untag_ptr(this_arg);
38706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38708         this_arg_conv.is_owned = false;
38709         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
38710 }
38711
38712 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
38713         LDKInitFeatures this_arg_conv;
38714         this_arg_conv.inner = untag_ptr(this_arg);
38715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38717         this_arg_conv.is_owned = false;
38718         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
38719 }
38720
38721 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
38722         LDKInitFeatures this_arg_conv;
38723         this_arg_conv.inner = untag_ptr(this_arg);
38724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38726         this_arg_conv.is_owned = false;
38727         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
38728         return ret_conv;
38729 }
38730
38731 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
38732         LDKNodeFeatures this_arg_conv;
38733         this_arg_conv.inner = untag_ptr(this_arg);
38734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38736         this_arg_conv.is_owned = false;
38737         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
38738 }
38739
38740 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
38741         LDKNodeFeatures this_arg_conv;
38742         this_arg_conv.inner = untag_ptr(this_arg);
38743         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38745         this_arg_conv.is_owned = false;
38746         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
38747 }
38748
38749 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
38750         LDKNodeFeatures this_arg_conv;
38751         this_arg_conv.inner = untag_ptr(this_arg);
38752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38754         this_arg_conv.is_owned = false;
38755         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
38756         return ret_conv;
38757 }
38758
38759 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
38760         LDKInitFeatures this_arg_conv;
38761         this_arg_conv.inner = untag_ptr(this_arg);
38762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38764         this_arg_conv.is_owned = false;
38765         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
38766         return ret_conv;
38767 }
38768
38769 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
38770         LDKNodeFeatures this_arg_conv;
38771         this_arg_conv.inner = untag_ptr(this_arg);
38772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38774         this_arg_conv.is_owned = false;
38775         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
38776         return ret_conv;
38777 }
38778
38779 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
38780         LDKInitFeatures this_arg_conv;
38781         this_arg_conv.inner = untag_ptr(this_arg);
38782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38784         this_arg_conv.is_owned = false;
38785         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
38786 }
38787
38788 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
38789         LDKInitFeatures this_arg_conv;
38790         this_arg_conv.inner = untag_ptr(this_arg);
38791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38793         this_arg_conv.is_owned = false;
38794         InitFeatures_set_gossip_queries_required(&this_arg_conv);
38795 }
38796
38797 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
38798         LDKInitFeatures this_arg_conv;
38799         this_arg_conv.inner = untag_ptr(this_arg);
38800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38802         this_arg_conv.is_owned = false;
38803         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
38804         return ret_conv;
38805 }
38806
38807 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
38808         LDKNodeFeatures this_arg_conv;
38809         this_arg_conv.inner = untag_ptr(this_arg);
38810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38812         this_arg_conv.is_owned = false;
38813         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
38814 }
38815
38816 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
38817         LDKNodeFeatures this_arg_conv;
38818         this_arg_conv.inner = untag_ptr(this_arg);
38819         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38821         this_arg_conv.is_owned = false;
38822         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
38823 }
38824
38825 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
38826         LDKNodeFeatures this_arg_conv;
38827         this_arg_conv.inner = untag_ptr(this_arg);
38828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38830         this_arg_conv.is_owned = false;
38831         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
38832         return ret_conv;
38833 }
38834
38835 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
38836         LDKInitFeatures this_arg_conv;
38837         this_arg_conv.inner = untag_ptr(this_arg);
38838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38840         this_arg_conv.is_owned = false;
38841         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
38842         return ret_conv;
38843 }
38844
38845 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
38846         LDKNodeFeatures this_arg_conv;
38847         this_arg_conv.inner = untag_ptr(this_arg);
38848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38850         this_arg_conv.is_owned = false;
38851         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
38852         return ret_conv;
38853 }
38854
38855 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
38856         LDKInitFeatures this_arg_conv;
38857         this_arg_conv.inner = untag_ptr(this_arg);
38858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38860         this_arg_conv.is_owned = false;
38861         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
38862 }
38863
38864 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
38865         LDKInitFeatures this_arg_conv;
38866         this_arg_conv.inner = untag_ptr(this_arg);
38867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38869         this_arg_conv.is_owned = false;
38870         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
38871 }
38872
38873 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
38874         LDKInitFeatures this_arg_conv;
38875         this_arg_conv.inner = untag_ptr(this_arg);
38876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38878         this_arg_conv.is_owned = false;
38879         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
38880         return ret_conv;
38881 }
38882
38883 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
38884         LDKNodeFeatures this_arg_conv;
38885         this_arg_conv.inner = untag_ptr(this_arg);
38886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38888         this_arg_conv.is_owned = false;
38889         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
38890 }
38891
38892 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
38893         LDKNodeFeatures this_arg_conv;
38894         this_arg_conv.inner = untag_ptr(this_arg);
38895         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38897         this_arg_conv.is_owned = false;
38898         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
38899 }
38900
38901 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
38902         LDKNodeFeatures this_arg_conv;
38903         this_arg_conv.inner = untag_ptr(this_arg);
38904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38906         this_arg_conv.is_owned = false;
38907         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
38908         return ret_conv;
38909 }
38910
38911 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_optional"))) TS_InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
38912         LDKInvoiceFeatures this_arg_conv;
38913         this_arg_conv.inner = untag_ptr(this_arg);
38914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38916         this_arg_conv.is_owned = false;
38917         InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
38918 }
38919
38920 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_required"))) TS_InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
38921         LDKInvoiceFeatures this_arg_conv;
38922         this_arg_conv.inner = untag_ptr(this_arg);
38923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38925         this_arg_conv.is_owned = false;
38926         InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
38927 }
38928
38929 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_variable_length_onion"))) TS_InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
38930         LDKInvoiceFeatures this_arg_conv;
38931         this_arg_conv.inner = untag_ptr(this_arg);
38932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38934         this_arg_conv.is_owned = false;
38935         jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
38936         return ret_conv;
38937 }
38938
38939 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
38940         LDKInitFeatures this_arg_conv;
38941         this_arg_conv.inner = untag_ptr(this_arg);
38942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38944         this_arg_conv.is_owned = false;
38945         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
38946         return ret_conv;
38947 }
38948
38949 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
38950         LDKNodeFeatures this_arg_conv;
38951         this_arg_conv.inner = untag_ptr(this_arg);
38952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38954         this_arg_conv.is_owned = false;
38955         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
38956         return ret_conv;
38957 }
38958
38959 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_variable_length_onion"))) TS_InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
38960         LDKInvoiceFeatures this_arg_conv;
38961         this_arg_conv.inner = untag_ptr(this_arg);
38962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38964         this_arg_conv.is_owned = false;
38965         jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
38966         return ret_conv;
38967 }
38968
38969 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
38970         LDKInitFeatures this_arg_conv;
38971         this_arg_conv.inner = untag_ptr(this_arg);
38972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38974         this_arg_conv.is_owned = false;
38975         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
38976 }
38977
38978 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
38979         LDKInitFeatures this_arg_conv;
38980         this_arg_conv.inner = untag_ptr(this_arg);
38981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38983         this_arg_conv.is_owned = false;
38984         InitFeatures_set_static_remote_key_required(&this_arg_conv);
38985 }
38986
38987 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
38988         LDKInitFeatures this_arg_conv;
38989         this_arg_conv.inner = untag_ptr(this_arg);
38990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38992         this_arg_conv.is_owned = false;
38993         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
38994         return ret_conv;
38995 }
38996
38997 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
38998         LDKNodeFeatures this_arg_conv;
38999         this_arg_conv.inner = untag_ptr(this_arg);
39000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39002         this_arg_conv.is_owned = false;
39003         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
39004 }
39005
39006 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
39007         LDKNodeFeatures this_arg_conv;
39008         this_arg_conv.inner = untag_ptr(this_arg);
39009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39011         this_arg_conv.is_owned = false;
39012         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
39013 }
39014
39015 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
39016         LDKNodeFeatures this_arg_conv;
39017         this_arg_conv.inner = untag_ptr(this_arg);
39018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39020         this_arg_conv.is_owned = false;
39021         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
39022         return ret_conv;
39023 }
39024
39025 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
39026         LDKChannelTypeFeatures this_arg_conv;
39027         this_arg_conv.inner = untag_ptr(this_arg);
39028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39030         this_arg_conv.is_owned = false;
39031         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
39032 }
39033
39034 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
39035         LDKChannelTypeFeatures this_arg_conv;
39036         this_arg_conv.inner = untag_ptr(this_arg);
39037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39039         this_arg_conv.is_owned = false;
39040         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
39041 }
39042
39043 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
39044         LDKChannelTypeFeatures this_arg_conv;
39045         this_arg_conv.inner = untag_ptr(this_arg);
39046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39048         this_arg_conv.is_owned = false;
39049         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
39050         return ret_conv;
39051 }
39052
39053 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
39054         LDKInitFeatures this_arg_conv;
39055         this_arg_conv.inner = untag_ptr(this_arg);
39056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39058         this_arg_conv.is_owned = false;
39059         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
39060         return ret_conv;
39061 }
39062
39063 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
39064         LDKNodeFeatures this_arg_conv;
39065         this_arg_conv.inner = untag_ptr(this_arg);
39066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39068         this_arg_conv.is_owned = false;
39069         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
39070         return ret_conv;
39071 }
39072
39073 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
39074         LDKChannelTypeFeatures this_arg_conv;
39075         this_arg_conv.inner = untag_ptr(this_arg);
39076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39078         this_arg_conv.is_owned = false;
39079         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
39080         return ret_conv;
39081 }
39082
39083 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
39084         LDKInitFeatures this_arg_conv;
39085         this_arg_conv.inner = untag_ptr(this_arg);
39086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39088         this_arg_conv.is_owned = false;
39089         InitFeatures_set_payment_secret_optional(&this_arg_conv);
39090 }
39091
39092 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
39093         LDKInitFeatures this_arg_conv;
39094         this_arg_conv.inner = untag_ptr(this_arg);
39095         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39097         this_arg_conv.is_owned = false;
39098         InitFeatures_set_payment_secret_required(&this_arg_conv);
39099 }
39100
39101 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
39102         LDKInitFeatures this_arg_conv;
39103         this_arg_conv.inner = untag_ptr(this_arg);
39104         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39106         this_arg_conv.is_owned = false;
39107         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
39108         return ret_conv;
39109 }
39110
39111 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
39112         LDKNodeFeatures this_arg_conv;
39113         this_arg_conv.inner = untag_ptr(this_arg);
39114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39116         this_arg_conv.is_owned = false;
39117         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
39118 }
39119
39120 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
39121         LDKNodeFeatures this_arg_conv;
39122         this_arg_conv.inner = untag_ptr(this_arg);
39123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39125         this_arg_conv.is_owned = false;
39126         NodeFeatures_set_payment_secret_required(&this_arg_conv);
39127 }
39128
39129 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
39130         LDKNodeFeatures this_arg_conv;
39131         this_arg_conv.inner = untag_ptr(this_arg);
39132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39134         this_arg_conv.is_owned = false;
39135         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
39136         return ret_conv;
39137 }
39138
39139 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_optional"))) TS_InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
39140         LDKInvoiceFeatures this_arg_conv;
39141         this_arg_conv.inner = untag_ptr(this_arg);
39142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39144         this_arg_conv.is_owned = false;
39145         InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
39146 }
39147
39148 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_required"))) TS_InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
39149         LDKInvoiceFeatures this_arg_conv;
39150         this_arg_conv.inner = untag_ptr(this_arg);
39151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39153         this_arg_conv.is_owned = false;
39154         InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
39155 }
39156
39157 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_payment_secret"))) TS_InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
39158         LDKInvoiceFeatures this_arg_conv;
39159         this_arg_conv.inner = untag_ptr(this_arg);
39160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39162         this_arg_conv.is_owned = false;
39163         jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
39164         return ret_conv;
39165 }
39166
39167 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
39168         LDKInitFeatures this_arg_conv;
39169         this_arg_conv.inner = untag_ptr(this_arg);
39170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39172         this_arg_conv.is_owned = false;
39173         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
39174         return ret_conv;
39175 }
39176
39177 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
39178         LDKNodeFeatures this_arg_conv;
39179         this_arg_conv.inner = untag_ptr(this_arg);
39180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39182         this_arg_conv.is_owned = false;
39183         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
39184         return ret_conv;
39185 }
39186
39187 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_payment_secret"))) TS_InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
39188         LDKInvoiceFeatures this_arg_conv;
39189         this_arg_conv.inner = untag_ptr(this_arg);
39190         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39192         this_arg_conv.is_owned = false;
39193         jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
39194         return ret_conv;
39195 }
39196
39197 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
39198         LDKInitFeatures this_arg_conv;
39199         this_arg_conv.inner = untag_ptr(this_arg);
39200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39202         this_arg_conv.is_owned = false;
39203         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
39204 }
39205
39206 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
39207         LDKInitFeatures this_arg_conv;
39208         this_arg_conv.inner = untag_ptr(this_arg);
39209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39211         this_arg_conv.is_owned = false;
39212         InitFeatures_set_basic_mpp_required(&this_arg_conv);
39213 }
39214
39215 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
39216         LDKInitFeatures this_arg_conv;
39217         this_arg_conv.inner = untag_ptr(this_arg);
39218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39220         this_arg_conv.is_owned = false;
39221         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
39222         return ret_conv;
39223 }
39224
39225 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
39226         LDKNodeFeatures this_arg_conv;
39227         this_arg_conv.inner = untag_ptr(this_arg);
39228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39230         this_arg_conv.is_owned = false;
39231         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
39232 }
39233
39234 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
39235         LDKNodeFeatures this_arg_conv;
39236         this_arg_conv.inner = untag_ptr(this_arg);
39237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39239         this_arg_conv.is_owned = false;
39240         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
39241 }
39242
39243 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
39244         LDKNodeFeatures this_arg_conv;
39245         this_arg_conv.inner = untag_ptr(this_arg);
39246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39248         this_arg_conv.is_owned = false;
39249         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
39250         return ret_conv;
39251 }
39252
39253 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_optional"))) TS_InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
39254         LDKInvoiceFeatures this_arg_conv;
39255         this_arg_conv.inner = untag_ptr(this_arg);
39256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39258         this_arg_conv.is_owned = false;
39259         InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
39260 }
39261
39262 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_required"))) TS_InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
39263         LDKInvoiceFeatures this_arg_conv;
39264         this_arg_conv.inner = untag_ptr(this_arg);
39265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39267         this_arg_conv.is_owned = false;
39268         InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
39269 }
39270
39271 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_basic_mpp"))) TS_InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
39272         LDKInvoiceFeatures this_arg_conv;
39273         this_arg_conv.inner = untag_ptr(this_arg);
39274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39276         this_arg_conv.is_owned = false;
39277         jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
39278         return ret_conv;
39279 }
39280
39281 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
39282         LDKInitFeatures this_arg_conv;
39283         this_arg_conv.inner = untag_ptr(this_arg);
39284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39286         this_arg_conv.is_owned = false;
39287         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
39288         return ret_conv;
39289 }
39290
39291 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
39292         LDKNodeFeatures this_arg_conv;
39293         this_arg_conv.inner = untag_ptr(this_arg);
39294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39296         this_arg_conv.is_owned = false;
39297         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
39298         return ret_conv;
39299 }
39300
39301 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_basic_mpp"))) TS_InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
39302         LDKInvoiceFeatures this_arg_conv;
39303         this_arg_conv.inner = untag_ptr(this_arg);
39304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39306         this_arg_conv.is_owned = false;
39307         jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
39308         return ret_conv;
39309 }
39310
39311 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
39312         LDKInitFeatures this_arg_conv;
39313         this_arg_conv.inner = untag_ptr(this_arg);
39314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39316         this_arg_conv.is_owned = false;
39317         InitFeatures_set_wumbo_optional(&this_arg_conv);
39318 }
39319
39320 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
39321         LDKInitFeatures this_arg_conv;
39322         this_arg_conv.inner = untag_ptr(this_arg);
39323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39325         this_arg_conv.is_owned = false;
39326         InitFeatures_set_wumbo_required(&this_arg_conv);
39327 }
39328
39329 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
39330         LDKInitFeatures this_arg_conv;
39331         this_arg_conv.inner = untag_ptr(this_arg);
39332         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39334         this_arg_conv.is_owned = false;
39335         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
39336         return ret_conv;
39337 }
39338
39339 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
39340         LDKNodeFeatures this_arg_conv;
39341         this_arg_conv.inner = untag_ptr(this_arg);
39342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39344         this_arg_conv.is_owned = false;
39345         NodeFeatures_set_wumbo_optional(&this_arg_conv);
39346 }
39347
39348 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
39349         LDKNodeFeatures this_arg_conv;
39350         this_arg_conv.inner = untag_ptr(this_arg);
39351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39353         this_arg_conv.is_owned = false;
39354         NodeFeatures_set_wumbo_required(&this_arg_conv);
39355 }
39356
39357 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
39358         LDKNodeFeatures this_arg_conv;
39359         this_arg_conv.inner = untag_ptr(this_arg);
39360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39362         this_arg_conv.is_owned = false;
39363         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
39364         return ret_conv;
39365 }
39366
39367 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
39368         LDKInitFeatures this_arg_conv;
39369         this_arg_conv.inner = untag_ptr(this_arg);
39370         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39372         this_arg_conv.is_owned = false;
39373         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
39374         return ret_conv;
39375 }
39376
39377 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
39378         LDKNodeFeatures this_arg_conv;
39379         this_arg_conv.inner = untag_ptr(this_arg);
39380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39382         this_arg_conv.is_owned = false;
39383         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
39384         return ret_conv;
39385 }
39386
39387 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
39388         LDKInitFeatures this_arg_conv;
39389         this_arg_conv.inner = untag_ptr(this_arg);
39390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39392         this_arg_conv.is_owned = false;
39393         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
39394 }
39395
39396 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
39397         LDKInitFeatures this_arg_conv;
39398         this_arg_conv.inner = untag_ptr(this_arg);
39399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39401         this_arg_conv.is_owned = false;
39402         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
39403 }
39404
39405 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
39406         LDKInitFeatures this_arg_conv;
39407         this_arg_conv.inner = untag_ptr(this_arg);
39408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39410         this_arg_conv.is_owned = false;
39411         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
39412         return ret_conv;
39413 }
39414
39415 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
39416         LDKNodeFeatures this_arg_conv;
39417         this_arg_conv.inner = untag_ptr(this_arg);
39418         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39420         this_arg_conv.is_owned = false;
39421         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
39422 }
39423
39424 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
39425         LDKNodeFeatures this_arg_conv;
39426         this_arg_conv.inner = untag_ptr(this_arg);
39427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39429         this_arg_conv.is_owned = false;
39430         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
39431 }
39432
39433 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
39434         LDKNodeFeatures this_arg_conv;
39435         this_arg_conv.inner = untag_ptr(this_arg);
39436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39438         this_arg_conv.is_owned = false;
39439         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
39440         return ret_conv;
39441 }
39442
39443 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
39444         LDKInitFeatures this_arg_conv;
39445         this_arg_conv.inner = untag_ptr(this_arg);
39446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39448         this_arg_conv.is_owned = false;
39449         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
39450         return ret_conv;
39451 }
39452
39453 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
39454         LDKNodeFeatures this_arg_conv;
39455         this_arg_conv.inner = untag_ptr(this_arg);
39456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39458         this_arg_conv.is_owned = false;
39459         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
39460         return ret_conv;
39461 }
39462
39463 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
39464         LDKInitFeatures this_arg_conv;
39465         this_arg_conv.inner = untag_ptr(this_arg);
39466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39468         this_arg_conv.is_owned = false;
39469         InitFeatures_set_onion_messages_optional(&this_arg_conv);
39470 }
39471
39472 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
39473         LDKInitFeatures this_arg_conv;
39474         this_arg_conv.inner = untag_ptr(this_arg);
39475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39477         this_arg_conv.is_owned = false;
39478         InitFeatures_set_onion_messages_required(&this_arg_conv);
39479 }
39480
39481 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
39482         LDKInitFeatures this_arg_conv;
39483         this_arg_conv.inner = untag_ptr(this_arg);
39484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39486         this_arg_conv.is_owned = false;
39487         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
39488         return ret_conv;
39489 }
39490
39491 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
39492         LDKNodeFeatures this_arg_conv;
39493         this_arg_conv.inner = untag_ptr(this_arg);
39494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39496         this_arg_conv.is_owned = false;
39497         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
39498 }
39499
39500 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
39501         LDKNodeFeatures this_arg_conv;
39502         this_arg_conv.inner = untag_ptr(this_arg);
39503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39505         this_arg_conv.is_owned = false;
39506         NodeFeatures_set_onion_messages_required(&this_arg_conv);
39507 }
39508
39509 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
39510         LDKNodeFeatures this_arg_conv;
39511         this_arg_conv.inner = untag_ptr(this_arg);
39512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39514         this_arg_conv.is_owned = false;
39515         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
39516         return ret_conv;
39517 }
39518
39519 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
39520         LDKInitFeatures this_arg_conv;
39521         this_arg_conv.inner = untag_ptr(this_arg);
39522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39524         this_arg_conv.is_owned = false;
39525         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
39526         return ret_conv;
39527 }
39528
39529 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
39530         LDKNodeFeatures this_arg_conv;
39531         this_arg_conv.inner = untag_ptr(this_arg);
39532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39534         this_arg_conv.is_owned = false;
39535         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
39536         return ret_conv;
39537 }
39538
39539 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
39540         LDKInitFeatures this_arg_conv;
39541         this_arg_conv.inner = untag_ptr(this_arg);
39542         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39544         this_arg_conv.is_owned = false;
39545         InitFeatures_set_channel_type_optional(&this_arg_conv);
39546 }
39547
39548 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
39549         LDKInitFeatures this_arg_conv;
39550         this_arg_conv.inner = untag_ptr(this_arg);
39551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39553         this_arg_conv.is_owned = false;
39554         InitFeatures_set_channel_type_required(&this_arg_conv);
39555 }
39556
39557 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
39558         LDKInitFeatures this_arg_conv;
39559         this_arg_conv.inner = untag_ptr(this_arg);
39560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39562         this_arg_conv.is_owned = false;
39563         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
39564         return ret_conv;
39565 }
39566
39567 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
39568         LDKNodeFeatures this_arg_conv;
39569         this_arg_conv.inner = untag_ptr(this_arg);
39570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39572         this_arg_conv.is_owned = false;
39573         NodeFeatures_set_channel_type_optional(&this_arg_conv);
39574 }
39575
39576 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
39577         LDKNodeFeatures this_arg_conv;
39578         this_arg_conv.inner = untag_ptr(this_arg);
39579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39581         this_arg_conv.is_owned = false;
39582         NodeFeatures_set_channel_type_required(&this_arg_conv);
39583 }
39584
39585 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
39586         LDKNodeFeatures this_arg_conv;
39587         this_arg_conv.inner = untag_ptr(this_arg);
39588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39590         this_arg_conv.is_owned = false;
39591         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
39592         return ret_conv;
39593 }
39594
39595 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
39596         LDKInitFeatures this_arg_conv;
39597         this_arg_conv.inner = untag_ptr(this_arg);
39598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39600         this_arg_conv.is_owned = false;
39601         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
39602         return ret_conv;
39603 }
39604
39605 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
39606         LDKNodeFeatures this_arg_conv;
39607         this_arg_conv.inner = untag_ptr(this_arg);
39608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39610         this_arg_conv.is_owned = false;
39611         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
39612         return ret_conv;
39613 }
39614
39615 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
39616         LDKInitFeatures this_arg_conv;
39617         this_arg_conv.inner = untag_ptr(this_arg);
39618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39620         this_arg_conv.is_owned = false;
39621         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
39622 }
39623
39624 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
39625         LDKInitFeatures this_arg_conv;
39626         this_arg_conv.inner = untag_ptr(this_arg);
39627         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39629         this_arg_conv.is_owned = false;
39630         InitFeatures_set_scid_privacy_required(&this_arg_conv);
39631 }
39632
39633 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
39634         LDKInitFeatures this_arg_conv;
39635         this_arg_conv.inner = untag_ptr(this_arg);
39636         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39638         this_arg_conv.is_owned = false;
39639         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
39640         return ret_conv;
39641 }
39642
39643 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
39644         LDKNodeFeatures this_arg_conv;
39645         this_arg_conv.inner = untag_ptr(this_arg);
39646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39648         this_arg_conv.is_owned = false;
39649         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
39650 }
39651
39652 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
39653         LDKNodeFeatures this_arg_conv;
39654         this_arg_conv.inner = untag_ptr(this_arg);
39655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39657         this_arg_conv.is_owned = false;
39658         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
39659 }
39660
39661 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
39662         LDKNodeFeatures this_arg_conv;
39663         this_arg_conv.inner = untag_ptr(this_arg);
39664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39666         this_arg_conv.is_owned = false;
39667         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
39668         return ret_conv;
39669 }
39670
39671 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
39672         LDKChannelTypeFeatures this_arg_conv;
39673         this_arg_conv.inner = untag_ptr(this_arg);
39674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39676         this_arg_conv.is_owned = false;
39677         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
39678 }
39679
39680 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
39681         LDKChannelTypeFeatures this_arg_conv;
39682         this_arg_conv.inner = untag_ptr(this_arg);
39683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39685         this_arg_conv.is_owned = false;
39686         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
39687 }
39688
39689 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
39690         LDKChannelTypeFeatures this_arg_conv;
39691         this_arg_conv.inner = untag_ptr(this_arg);
39692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39694         this_arg_conv.is_owned = false;
39695         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
39696         return ret_conv;
39697 }
39698
39699 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
39700         LDKInitFeatures this_arg_conv;
39701         this_arg_conv.inner = untag_ptr(this_arg);
39702         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39704         this_arg_conv.is_owned = false;
39705         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
39706         return ret_conv;
39707 }
39708
39709 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
39710         LDKNodeFeatures this_arg_conv;
39711         this_arg_conv.inner = untag_ptr(this_arg);
39712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39714         this_arg_conv.is_owned = false;
39715         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
39716         return ret_conv;
39717 }
39718
39719 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
39720         LDKChannelTypeFeatures this_arg_conv;
39721         this_arg_conv.inner = untag_ptr(this_arg);
39722         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39724         this_arg_conv.is_owned = false;
39725         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
39726         return ret_conv;
39727 }
39728
39729 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
39730         LDKInitFeatures this_arg_conv;
39731         this_arg_conv.inner = untag_ptr(this_arg);
39732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39734         this_arg_conv.is_owned = false;
39735         InitFeatures_set_zero_conf_optional(&this_arg_conv);
39736 }
39737
39738 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
39739         LDKInitFeatures this_arg_conv;
39740         this_arg_conv.inner = untag_ptr(this_arg);
39741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39743         this_arg_conv.is_owned = false;
39744         InitFeatures_set_zero_conf_required(&this_arg_conv);
39745 }
39746
39747 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
39748         LDKInitFeatures this_arg_conv;
39749         this_arg_conv.inner = untag_ptr(this_arg);
39750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39752         this_arg_conv.is_owned = false;
39753         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
39754         return ret_conv;
39755 }
39756
39757 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
39758         LDKNodeFeatures this_arg_conv;
39759         this_arg_conv.inner = untag_ptr(this_arg);
39760         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39762         this_arg_conv.is_owned = false;
39763         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
39764 }
39765
39766 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
39767         LDKNodeFeatures this_arg_conv;
39768         this_arg_conv.inner = untag_ptr(this_arg);
39769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39771         this_arg_conv.is_owned = false;
39772         NodeFeatures_set_zero_conf_required(&this_arg_conv);
39773 }
39774
39775 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
39776         LDKNodeFeatures this_arg_conv;
39777         this_arg_conv.inner = untag_ptr(this_arg);
39778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39780         this_arg_conv.is_owned = false;
39781         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
39782         return ret_conv;
39783 }
39784
39785 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
39786         LDKChannelTypeFeatures this_arg_conv;
39787         this_arg_conv.inner = untag_ptr(this_arg);
39788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39790         this_arg_conv.is_owned = false;
39791         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
39792 }
39793
39794 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
39795         LDKChannelTypeFeatures this_arg_conv;
39796         this_arg_conv.inner = untag_ptr(this_arg);
39797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39799         this_arg_conv.is_owned = false;
39800         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
39801 }
39802
39803 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
39804         LDKChannelTypeFeatures this_arg_conv;
39805         this_arg_conv.inner = untag_ptr(this_arg);
39806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39808         this_arg_conv.is_owned = false;
39809         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
39810         return ret_conv;
39811 }
39812
39813 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
39814         LDKInitFeatures this_arg_conv;
39815         this_arg_conv.inner = untag_ptr(this_arg);
39816         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39818         this_arg_conv.is_owned = false;
39819         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
39820         return ret_conv;
39821 }
39822
39823 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
39824         LDKNodeFeatures this_arg_conv;
39825         this_arg_conv.inner = untag_ptr(this_arg);
39826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39828         this_arg_conv.is_owned = false;
39829         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
39830         return ret_conv;
39831 }
39832
39833 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
39834         LDKChannelTypeFeatures this_arg_conv;
39835         this_arg_conv.inner = untag_ptr(this_arg);
39836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39838         this_arg_conv.is_owned = false;
39839         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
39840         return ret_conv;
39841 }
39842
39843 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
39844         LDKNodeFeatures this_arg_conv;
39845         this_arg_conv.inner = untag_ptr(this_arg);
39846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39848         this_arg_conv.is_owned = false;
39849         NodeFeatures_set_keysend_optional(&this_arg_conv);
39850 }
39851
39852 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
39853         LDKNodeFeatures this_arg_conv;
39854         this_arg_conv.inner = untag_ptr(this_arg);
39855         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39857         this_arg_conv.is_owned = false;
39858         NodeFeatures_set_keysend_required(&this_arg_conv);
39859 }
39860
39861 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
39862         LDKNodeFeatures this_arg_conv;
39863         this_arg_conv.inner = untag_ptr(this_arg);
39864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39866         this_arg_conv.is_owned = false;
39867         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
39868         return ret_conv;
39869 }
39870
39871 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
39872         LDKNodeFeatures this_arg_conv;
39873         this_arg_conv.inner = untag_ptr(this_arg);
39874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39876         this_arg_conv.is_owned = false;
39877         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
39878         return ret_conv;
39879 }
39880
39881 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
39882         LDKShutdownScript this_obj_conv;
39883         this_obj_conv.inner = untag_ptr(this_obj);
39884         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39886         ShutdownScript_free(this_obj_conv);
39887 }
39888
39889 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
39890         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
39891         uint64_t ret_ref = 0;
39892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39894         return ret_ref;
39895 }
39896 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
39897         LDKShutdownScript arg_conv;
39898         arg_conv.inner = untag_ptr(arg);
39899         arg_conv.is_owned = ptr_is_owned(arg);
39900         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39901         arg_conv.is_owned = false;
39902         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
39903         return ret_conv;
39904 }
39905
39906 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
39907         LDKShutdownScript orig_conv;
39908         orig_conv.inner = untag_ptr(orig);
39909         orig_conv.is_owned = ptr_is_owned(orig);
39910         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39911         orig_conv.is_owned = false;
39912         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
39913         uint64_t ret_ref = 0;
39914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39916         return ret_ref;
39917 }
39918
39919 jboolean  __attribute__((export_name("TS_ShutdownScript_eq"))) TS_ShutdownScript_eq(uint64_t a, uint64_t b) {
39920         LDKShutdownScript a_conv;
39921         a_conv.inner = untag_ptr(a);
39922         a_conv.is_owned = ptr_is_owned(a);
39923         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39924         a_conv.is_owned = false;
39925         LDKShutdownScript b_conv;
39926         b_conv.inner = untag_ptr(b);
39927         b_conv.is_owned = ptr_is_owned(b);
39928         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39929         b_conv.is_owned = false;
39930         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
39931         return ret_conv;
39932 }
39933
39934 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
39935         LDKInvalidShutdownScript this_obj_conv;
39936         this_obj_conv.inner = untag_ptr(this_obj);
39937         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39939         InvalidShutdownScript_free(this_obj_conv);
39940 }
39941
39942 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
39943         LDKInvalidShutdownScript this_ptr_conv;
39944         this_ptr_conv.inner = untag_ptr(this_ptr);
39945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39947         this_ptr_conv.is_owned = false;
39948         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
39949         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39950         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39951         return ret_arr;
39952 }
39953
39954 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
39955         LDKInvalidShutdownScript this_ptr_conv;
39956         this_ptr_conv.inner = untag_ptr(this_ptr);
39957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39959         this_ptr_conv.is_owned = false;
39960         LDKCVec_u8Z val_ref;
39961         val_ref.datalen = val->arr_len;
39962         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
39963         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
39964         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
39965 }
39966
39967 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
39968         LDKCVec_u8Z script_arg_ref;
39969         script_arg_ref.datalen = script_arg->arr_len;
39970         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
39971         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
39972         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
39973         uint64_t ret_ref = 0;
39974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39976         return ret_ref;
39977 }
39978
39979 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
39980         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
39981         uint64_t ret_ref = 0;
39982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39984         return ret_ref;
39985 }
39986 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
39987         LDKInvalidShutdownScript arg_conv;
39988         arg_conv.inner = untag_ptr(arg);
39989         arg_conv.is_owned = ptr_is_owned(arg);
39990         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39991         arg_conv.is_owned = false;
39992         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
39993         return ret_conv;
39994 }
39995
39996 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
39997         LDKInvalidShutdownScript orig_conv;
39998         orig_conv.inner = untag_ptr(orig);
39999         orig_conv.is_owned = ptr_is_owned(orig);
40000         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40001         orig_conv.is_owned = false;
40002         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
40003         uint64_t ret_ref = 0;
40004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40006         return ret_ref;
40007 }
40008
40009 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
40010         LDKShutdownScript obj_conv;
40011         obj_conv.inner = untag_ptr(obj);
40012         obj_conv.is_owned = ptr_is_owned(obj);
40013         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40014         obj_conv.is_owned = false;
40015         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
40016         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40017         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40018         CVec_u8Z_free(ret_var);
40019         return ret_arr;
40020 }
40021
40022 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
40023         LDKu8slice ser_ref;
40024         ser_ref.datalen = ser->arr_len;
40025         ser_ref.data = ser->elems;
40026         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
40027         *ret_conv = ShutdownScript_read(ser_ref);
40028         FREE(ser);
40029         return tag_ptr(ret_conv, true);
40030 }
40031
40032 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
40033         unsigned char pubkey_hash_arr[20];
40034         CHECK(pubkey_hash->arr_len == 20);
40035         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
40036         unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
40037         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
40038         uint64_t ret_ref = 0;
40039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40041         return ret_ref;
40042 }
40043
40044 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
40045         unsigned char script_hash_arr[32];
40046         CHECK(script_hash->arr_len == 32);
40047         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
40048         unsigned char (*script_hash_ref)[32] = &script_hash_arr;
40049         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
40050         uint64_t ret_ref = 0;
40051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40053         return ret_ref;
40054 }
40055
40056 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
40057         
40058         LDKu8slice program_ref;
40059         program_ref.datalen = program->arr_len;
40060         program_ref.data = program->elems;
40061         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
40062         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
40063         FREE(program);
40064         return tag_ptr(ret_conv, true);
40065 }
40066
40067 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
40068         LDKShutdownScript this_arg_conv;
40069         this_arg_conv.inner = untag_ptr(this_arg);
40070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40072         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
40073         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
40074         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40075         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40076         CVec_u8Z_free(ret_var);
40077         return ret_arr;
40078 }
40079
40080 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
40081         LDKShutdownScript this_arg_conv;
40082         this_arg_conv.inner = untag_ptr(this_arg);
40083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40085         this_arg_conv.is_owned = false;
40086         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40087         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
40088         return ret_arr;
40089 }
40090
40091 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
40092         LDKShutdownScript this_arg_conv;
40093         this_arg_conv.inner = untag_ptr(this_arg);
40094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40096         this_arg_conv.is_owned = false;
40097         LDKInitFeatures features_conv;
40098         features_conv.inner = untag_ptr(features);
40099         features_conv.is_owned = ptr_is_owned(features);
40100         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
40101         features_conv.is_owned = false;
40102         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
40103         return ret_conv;
40104 }
40105
40106 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
40107         if (!ptr_is_owned(this_ptr)) return;
40108         void* this_ptr_ptr = untag_ptr(this_ptr);
40109         CHECK_ACCESS(this_ptr_ptr);
40110         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
40111         FREE(untag_ptr(this_ptr));
40112         CustomMessageReader_free(this_ptr_conv);
40113 }
40114
40115 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
40116         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
40117         *ret_ret = Type_clone(arg);
40118         return tag_ptr(ret_ret, true);
40119 }
40120 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
40121         void* arg_ptr = untag_ptr(arg);
40122         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
40123         LDKType* arg_conv = (LDKType*)arg_ptr;
40124         int64_t ret_conv = Type_clone_ptr(arg_conv);
40125         return ret_conv;
40126 }
40127
40128 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
40129         void* orig_ptr = untag_ptr(orig);
40130         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
40131         LDKType* orig_conv = (LDKType*)orig_ptr;
40132         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
40133         *ret_ret = Type_clone(orig_conv);
40134         return tag_ptr(ret_ret, true);
40135 }
40136
40137 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
40138         if (!ptr_is_owned(this_ptr)) return;
40139         void* this_ptr_ptr = untag_ptr(this_ptr);
40140         CHECK_ACCESS(this_ptr_ptr);
40141         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
40142         FREE(untag_ptr(this_ptr));
40143         Type_free(this_ptr_conv);
40144 }
40145
40146 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
40147         LDKNodeId this_obj_conv;
40148         this_obj_conv.inner = untag_ptr(this_obj);
40149         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40151         NodeId_free(this_obj_conv);
40152 }
40153
40154 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
40155         LDKNodeId ret_var = NodeId_clone(arg);
40156         uint64_t ret_ref = 0;
40157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40159         return ret_ref;
40160 }
40161 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
40162         LDKNodeId arg_conv;
40163         arg_conv.inner = untag_ptr(arg);
40164         arg_conv.is_owned = ptr_is_owned(arg);
40165         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40166         arg_conv.is_owned = false;
40167         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
40168         return ret_conv;
40169 }
40170
40171 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
40172         LDKNodeId orig_conv;
40173         orig_conv.inner = untag_ptr(orig);
40174         orig_conv.is_owned = ptr_is_owned(orig);
40175         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40176         orig_conv.is_owned = false;
40177         LDKNodeId ret_var = NodeId_clone(&orig_conv);
40178         uint64_t ret_ref = 0;
40179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40181         return ret_ref;
40182 }
40183
40184 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
40185         LDKPublicKey pubkey_ref;
40186         CHECK(pubkey->arr_len == 33);
40187         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
40188         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
40189         uint64_t ret_ref = 0;
40190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40192         return ret_ref;
40193 }
40194
40195 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
40196         LDKNodeId this_arg_conv;
40197         this_arg_conv.inner = untag_ptr(this_arg);
40198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40200         this_arg_conv.is_owned = false;
40201         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
40202         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40203         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40204         return ret_arr;
40205 }
40206
40207 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
40208         LDKNodeId o_conv;
40209         o_conv.inner = untag_ptr(o);
40210         o_conv.is_owned = ptr_is_owned(o);
40211         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40212         o_conv.is_owned = false;
40213         int64_t ret_conv = NodeId_hash(&o_conv);
40214         return ret_conv;
40215 }
40216
40217 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
40218         LDKNodeId obj_conv;
40219         obj_conv.inner = untag_ptr(obj);
40220         obj_conv.is_owned = ptr_is_owned(obj);
40221         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40222         obj_conv.is_owned = false;
40223         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
40224         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40225         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40226         CVec_u8Z_free(ret_var);
40227         return ret_arr;
40228 }
40229
40230 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
40231         LDKu8slice ser_ref;
40232         ser_ref.datalen = ser->arr_len;
40233         ser_ref.data = ser->elems;
40234         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
40235         *ret_conv = NodeId_read(ser_ref);
40236         FREE(ser);
40237         return tag_ptr(ret_conv, true);
40238 }
40239
40240 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
40241         LDKNetworkGraph this_obj_conv;
40242         this_obj_conv.inner = untag_ptr(this_obj);
40243         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40245         NetworkGraph_free(this_obj_conv);
40246 }
40247
40248 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
40249         LDKReadOnlyNetworkGraph this_obj_conv;
40250         this_obj_conv.inner = untag_ptr(this_obj);
40251         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40253         ReadOnlyNetworkGraph_free(this_obj_conv);
40254 }
40255
40256 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
40257         if (!ptr_is_owned(this_ptr)) return;
40258         void* this_ptr_ptr = untag_ptr(this_ptr);
40259         CHECK_ACCESS(this_ptr_ptr);
40260         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
40261         FREE(untag_ptr(this_ptr));
40262         NetworkUpdate_free(this_ptr_conv);
40263 }
40264
40265 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
40266         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
40267         *ret_copy = NetworkUpdate_clone(arg);
40268         uint64_t ret_ref = tag_ptr(ret_copy, true);
40269         return ret_ref;
40270 }
40271 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
40272         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
40273         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
40274         return ret_conv;
40275 }
40276
40277 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
40278         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
40279         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
40280         *ret_copy = NetworkUpdate_clone(orig_conv);
40281         uint64_t ret_ref = tag_ptr(ret_copy, true);
40282         return ret_ref;
40283 }
40284
40285 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
40286         LDKChannelUpdate msg_conv;
40287         msg_conv.inner = untag_ptr(msg);
40288         msg_conv.is_owned = ptr_is_owned(msg);
40289         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40290         msg_conv = ChannelUpdate_clone(&msg_conv);
40291         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
40292         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
40293         uint64_t ret_ref = tag_ptr(ret_copy, true);
40294         return ret_ref;
40295 }
40296
40297 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
40298         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
40299         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
40300         uint64_t ret_ref = tag_ptr(ret_copy, true);
40301         return ret_ref;
40302 }
40303
40304 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
40305         LDKPublicKey node_id_ref;
40306         CHECK(node_id->arr_len == 33);
40307         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
40308         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
40309         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
40310         uint64_t ret_ref = tag_ptr(ret_copy, true);
40311         return ret_ref;
40312 }
40313
40314 jboolean  __attribute__((export_name("TS_NetworkUpdate_eq"))) TS_NetworkUpdate_eq(uint64_t a, uint64_t b) {
40315         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
40316         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
40317         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
40318         return ret_conv;
40319 }
40320
40321 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
40322         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
40323         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
40324         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40325         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40326         CVec_u8Z_free(ret_var);
40327         return ret_arr;
40328 }
40329
40330 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
40331         LDKu8slice ser_ref;
40332         ser_ref.datalen = ser->arr_len;
40333         ser_ref.data = ser->elems;
40334         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
40335         *ret_conv = NetworkUpdate_read(ser_ref);
40336         FREE(ser);
40337         return tag_ptr(ret_conv, true);
40338 }
40339
40340 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
40341         LDKP2PGossipSync this_obj_conv;
40342         this_obj_conv.inner = untag_ptr(this_obj);
40343         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40345         P2PGossipSync_free(this_obj_conv);
40346 }
40347
40348 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t chain_access, uint64_t logger) {
40349         LDKNetworkGraph network_graph_conv;
40350         network_graph_conv.inner = untag_ptr(network_graph);
40351         network_graph_conv.is_owned = ptr_is_owned(network_graph);
40352         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
40353         network_graph_conv.is_owned = false;
40354         void* chain_access_ptr = untag_ptr(chain_access);
40355         CHECK_ACCESS(chain_access_ptr);
40356         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
40357         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
40358         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
40359                 // Manually implement clone for Java trait instances
40360                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
40361                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40362                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
40363                 }
40364         }
40365         void* logger_ptr = untag_ptr(logger);
40366         CHECK_ACCESS(logger_ptr);
40367         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
40368         if (logger_conv.free == LDKLogger_JCalls_free) {
40369                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40370                 LDKLogger_JCalls_cloned(&logger_conv);
40371         }
40372         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv);
40373         uint64_t ret_ref = 0;
40374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40376         return ret_ref;
40377 }
40378
40379 void  __attribute__((export_name("TS_P2PGossipSync_add_chain_access"))) TS_P2PGossipSync_add_chain_access(uint64_t this_arg, uint64_t chain_access) {
40380         LDKP2PGossipSync this_arg_conv;
40381         this_arg_conv.inner = untag_ptr(this_arg);
40382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40384         this_arg_conv.is_owned = false;
40385         void* chain_access_ptr = untag_ptr(chain_access);
40386         CHECK_ACCESS(chain_access_ptr);
40387         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
40388         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
40389         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
40390                 // Manually implement clone for Java trait instances
40391                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
40392                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40393                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
40394                 }
40395         }
40396         P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv);
40397 }
40398
40399 uint64_t  __attribute__((export_name("TS_NetworkGraph_as_EventHandler"))) TS_NetworkGraph_as_EventHandler(uint64_t this_arg) {
40400         LDKNetworkGraph this_arg_conv;
40401         this_arg_conv.inner = untag_ptr(this_arg);
40402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40404         this_arg_conv.is_owned = false;
40405         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
40406         *ret_ret = NetworkGraph_as_EventHandler(&this_arg_conv);
40407         return tag_ptr(ret_ret, true);
40408 }
40409
40410 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
40411         LDKP2PGossipSync this_arg_conv;
40412         this_arg_conv.inner = untag_ptr(this_arg);
40413         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40415         this_arg_conv.is_owned = false;
40416         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
40417         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
40418         return tag_ptr(ret_ret, true);
40419 }
40420
40421 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
40422         LDKP2PGossipSync this_arg_conv;
40423         this_arg_conv.inner = untag_ptr(this_arg);
40424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40426         this_arg_conv.is_owned = false;
40427         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
40428         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
40429         return tag_ptr(ret_ret, true);
40430 }
40431
40432 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
40433         LDKChannelUpdateInfo this_obj_conv;
40434         this_obj_conv.inner = untag_ptr(this_obj);
40435         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40437         ChannelUpdateInfo_free(this_obj_conv);
40438 }
40439
40440 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
40441         LDKChannelUpdateInfo this_ptr_conv;
40442         this_ptr_conv.inner = untag_ptr(this_ptr);
40443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40445         this_ptr_conv.is_owned = false;
40446         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
40447         return ret_conv;
40448 }
40449
40450 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
40451         LDKChannelUpdateInfo this_ptr_conv;
40452         this_ptr_conv.inner = untag_ptr(this_ptr);
40453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40455         this_ptr_conv.is_owned = false;
40456         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
40457 }
40458
40459 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
40460         LDKChannelUpdateInfo this_ptr_conv;
40461         this_ptr_conv.inner = untag_ptr(this_ptr);
40462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40464         this_ptr_conv.is_owned = false;
40465         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
40466         return ret_conv;
40467 }
40468
40469 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
40470         LDKChannelUpdateInfo this_ptr_conv;
40471         this_ptr_conv.inner = untag_ptr(this_ptr);
40472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40474         this_ptr_conv.is_owned = false;
40475         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
40476 }
40477
40478 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
40479         LDKChannelUpdateInfo this_ptr_conv;
40480         this_ptr_conv.inner = untag_ptr(this_ptr);
40481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40483         this_ptr_conv.is_owned = false;
40484         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
40485         return ret_conv;
40486 }
40487
40488 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
40489         LDKChannelUpdateInfo this_ptr_conv;
40490         this_ptr_conv.inner = untag_ptr(this_ptr);
40491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40493         this_ptr_conv.is_owned = false;
40494         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
40495 }
40496
40497 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
40498         LDKChannelUpdateInfo this_ptr_conv;
40499         this_ptr_conv.inner = untag_ptr(this_ptr);
40500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40502         this_ptr_conv.is_owned = false;
40503         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
40504         return ret_conv;
40505 }
40506
40507 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
40508         LDKChannelUpdateInfo this_ptr_conv;
40509         this_ptr_conv.inner = untag_ptr(this_ptr);
40510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40512         this_ptr_conv.is_owned = false;
40513         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
40514 }
40515
40516 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
40517         LDKChannelUpdateInfo this_ptr_conv;
40518         this_ptr_conv.inner = untag_ptr(this_ptr);
40519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40521         this_ptr_conv.is_owned = false;
40522         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
40523         return ret_conv;
40524 }
40525
40526 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
40527         LDKChannelUpdateInfo this_ptr_conv;
40528         this_ptr_conv.inner = untag_ptr(this_ptr);
40529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40531         this_ptr_conv.is_owned = false;
40532         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
40533 }
40534
40535 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
40536         LDKChannelUpdateInfo this_ptr_conv;
40537         this_ptr_conv.inner = untag_ptr(this_ptr);
40538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40540         this_ptr_conv.is_owned = false;
40541         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
40542         uint64_t ret_ref = 0;
40543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40545         return ret_ref;
40546 }
40547
40548 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
40549         LDKChannelUpdateInfo this_ptr_conv;
40550         this_ptr_conv.inner = untag_ptr(this_ptr);
40551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40553         this_ptr_conv.is_owned = false;
40554         LDKRoutingFees val_conv;
40555         val_conv.inner = untag_ptr(val);
40556         val_conv.is_owned = ptr_is_owned(val);
40557         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40558         val_conv = RoutingFees_clone(&val_conv);
40559         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
40560 }
40561
40562 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
40563         LDKChannelUpdateInfo this_ptr_conv;
40564         this_ptr_conv.inner = untag_ptr(this_ptr);
40565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40567         this_ptr_conv.is_owned = false;
40568         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
40569         uint64_t ret_ref = 0;
40570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40572         return ret_ref;
40573 }
40574
40575 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
40576         LDKChannelUpdateInfo this_ptr_conv;
40577         this_ptr_conv.inner = untag_ptr(this_ptr);
40578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40580         this_ptr_conv.is_owned = false;
40581         LDKChannelUpdate val_conv;
40582         val_conv.inner = untag_ptr(val);
40583         val_conv.is_owned = ptr_is_owned(val);
40584         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40585         val_conv = ChannelUpdate_clone(&val_conv);
40586         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
40587 }
40588
40589 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_new"))) TS_ChannelUpdateInfo_new(int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, uint64_t fees_arg, uint64_t last_update_message_arg) {
40590         LDKRoutingFees fees_arg_conv;
40591         fees_arg_conv.inner = untag_ptr(fees_arg);
40592         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
40593         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
40594         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
40595         LDKChannelUpdate last_update_message_arg_conv;
40596         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
40597         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
40598         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
40599         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
40600         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fees_arg_conv, last_update_message_arg_conv);
40601         uint64_t ret_ref = 0;
40602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40604         return ret_ref;
40605 }
40606
40607 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
40608         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
40609         uint64_t ret_ref = 0;
40610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40612         return ret_ref;
40613 }
40614 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
40615         LDKChannelUpdateInfo arg_conv;
40616         arg_conv.inner = untag_ptr(arg);
40617         arg_conv.is_owned = ptr_is_owned(arg);
40618         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40619         arg_conv.is_owned = false;
40620         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
40621         return ret_conv;
40622 }
40623
40624 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
40625         LDKChannelUpdateInfo orig_conv;
40626         orig_conv.inner = untag_ptr(orig);
40627         orig_conv.is_owned = ptr_is_owned(orig);
40628         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40629         orig_conv.is_owned = false;
40630         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
40631         uint64_t ret_ref = 0;
40632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40634         return ret_ref;
40635 }
40636
40637 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_eq"))) TS_ChannelUpdateInfo_eq(uint64_t a, uint64_t b) {
40638         LDKChannelUpdateInfo a_conv;
40639         a_conv.inner = untag_ptr(a);
40640         a_conv.is_owned = ptr_is_owned(a);
40641         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40642         a_conv.is_owned = false;
40643         LDKChannelUpdateInfo b_conv;
40644         b_conv.inner = untag_ptr(b);
40645         b_conv.is_owned = ptr_is_owned(b);
40646         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40647         b_conv.is_owned = false;
40648         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
40649         return ret_conv;
40650 }
40651
40652 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
40653         LDKChannelUpdateInfo obj_conv;
40654         obj_conv.inner = untag_ptr(obj);
40655         obj_conv.is_owned = ptr_is_owned(obj);
40656         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40657         obj_conv.is_owned = false;
40658         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
40659         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40660         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40661         CVec_u8Z_free(ret_var);
40662         return ret_arr;
40663 }
40664
40665 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
40666         LDKu8slice ser_ref;
40667         ser_ref.datalen = ser->arr_len;
40668         ser_ref.data = ser->elems;
40669         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
40670         *ret_conv = ChannelUpdateInfo_read(ser_ref);
40671         FREE(ser);
40672         return tag_ptr(ret_conv, true);
40673 }
40674
40675 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
40676         LDKChannelInfo this_obj_conv;
40677         this_obj_conv.inner = untag_ptr(this_obj);
40678         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40680         ChannelInfo_free(this_obj_conv);
40681 }
40682
40683 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
40684         LDKChannelInfo this_ptr_conv;
40685         this_ptr_conv.inner = untag_ptr(this_ptr);
40686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40688         this_ptr_conv.is_owned = false;
40689         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
40690         uint64_t ret_ref = 0;
40691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40693         return ret_ref;
40694 }
40695
40696 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
40697         LDKChannelInfo this_ptr_conv;
40698         this_ptr_conv.inner = untag_ptr(this_ptr);
40699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40701         this_ptr_conv.is_owned = false;
40702         LDKChannelFeatures val_conv;
40703         val_conv.inner = untag_ptr(val);
40704         val_conv.is_owned = ptr_is_owned(val);
40705         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40706         val_conv = ChannelFeatures_clone(&val_conv);
40707         ChannelInfo_set_features(&this_ptr_conv, val_conv);
40708 }
40709
40710 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
40711         LDKChannelInfo this_ptr_conv;
40712         this_ptr_conv.inner = untag_ptr(this_ptr);
40713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40715         this_ptr_conv.is_owned = false;
40716         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
40717         uint64_t ret_ref = 0;
40718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40720         return ret_ref;
40721 }
40722
40723 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
40724         LDKChannelInfo this_ptr_conv;
40725         this_ptr_conv.inner = untag_ptr(this_ptr);
40726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40728         this_ptr_conv.is_owned = false;
40729         LDKNodeId val_conv;
40730         val_conv.inner = untag_ptr(val);
40731         val_conv.is_owned = ptr_is_owned(val);
40732         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40733         val_conv = NodeId_clone(&val_conv);
40734         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
40735 }
40736
40737 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
40738         LDKChannelInfo this_ptr_conv;
40739         this_ptr_conv.inner = untag_ptr(this_ptr);
40740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40742         this_ptr_conv.is_owned = false;
40743         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
40744         uint64_t ret_ref = 0;
40745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40747         return ret_ref;
40748 }
40749
40750 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
40751         LDKChannelInfo this_ptr_conv;
40752         this_ptr_conv.inner = untag_ptr(this_ptr);
40753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40755         this_ptr_conv.is_owned = false;
40756         LDKChannelUpdateInfo val_conv;
40757         val_conv.inner = untag_ptr(val);
40758         val_conv.is_owned = ptr_is_owned(val);
40759         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40760         val_conv = ChannelUpdateInfo_clone(&val_conv);
40761         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
40762 }
40763
40764 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
40765         LDKChannelInfo this_ptr_conv;
40766         this_ptr_conv.inner = untag_ptr(this_ptr);
40767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40769         this_ptr_conv.is_owned = false;
40770         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
40771         uint64_t ret_ref = 0;
40772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40774         return ret_ref;
40775 }
40776
40777 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
40778         LDKChannelInfo this_ptr_conv;
40779         this_ptr_conv.inner = untag_ptr(this_ptr);
40780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40782         this_ptr_conv.is_owned = false;
40783         LDKNodeId val_conv;
40784         val_conv.inner = untag_ptr(val);
40785         val_conv.is_owned = ptr_is_owned(val);
40786         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40787         val_conv = NodeId_clone(&val_conv);
40788         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
40789 }
40790
40791 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
40792         LDKChannelInfo this_ptr_conv;
40793         this_ptr_conv.inner = untag_ptr(this_ptr);
40794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40796         this_ptr_conv.is_owned = false;
40797         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
40798         uint64_t ret_ref = 0;
40799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40801         return ret_ref;
40802 }
40803
40804 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
40805         LDKChannelInfo this_ptr_conv;
40806         this_ptr_conv.inner = untag_ptr(this_ptr);
40807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40809         this_ptr_conv.is_owned = false;
40810         LDKChannelUpdateInfo val_conv;
40811         val_conv.inner = untag_ptr(val);
40812         val_conv.is_owned = ptr_is_owned(val);
40813         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40814         val_conv = ChannelUpdateInfo_clone(&val_conv);
40815         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
40816 }
40817
40818 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
40819         LDKChannelInfo this_ptr_conv;
40820         this_ptr_conv.inner = untag_ptr(this_ptr);
40821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40823         this_ptr_conv.is_owned = false;
40824         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40825         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
40826         uint64_t ret_ref = tag_ptr(ret_copy, true);
40827         return ret_ref;
40828 }
40829
40830 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
40831         LDKChannelInfo this_ptr_conv;
40832         this_ptr_conv.inner = untag_ptr(this_ptr);
40833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40835         this_ptr_conv.is_owned = false;
40836         void* val_ptr = untag_ptr(val);
40837         CHECK_ACCESS(val_ptr);
40838         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40839         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40840         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
40841 }
40842
40843 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
40844         LDKChannelInfo this_ptr_conv;
40845         this_ptr_conv.inner = untag_ptr(this_ptr);
40846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40848         this_ptr_conv.is_owned = false;
40849         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
40850         uint64_t ret_ref = 0;
40851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40853         return ret_ref;
40854 }
40855
40856 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
40857         LDKChannelInfo this_ptr_conv;
40858         this_ptr_conv.inner = untag_ptr(this_ptr);
40859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40861         this_ptr_conv.is_owned = false;
40862         LDKChannelAnnouncement val_conv;
40863         val_conv.inner = untag_ptr(val);
40864         val_conv.is_owned = ptr_is_owned(val);
40865         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40866         val_conv = ChannelAnnouncement_clone(&val_conv);
40867         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
40868 }
40869
40870 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
40871         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
40872         uint64_t ret_ref = 0;
40873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40875         return ret_ref;
40876 }
40877 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
40878         LDKChannelInfo arg_conv;
40879         arg_conv.inner = untag_ptr(arg);
40880         arg_conv.is_owned = ptr_is_owned(arg);
40881         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40882         arg_conv.is_owned = false;
40883         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
40884         return ret_conv;
40885 }
40886
40887 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
40888         LDKChannelInfo orig_conv;
40889         orig_conv.inner = untag_ptr(orig);
40890         orig_conv.is_owned = ptr_is_owned(orig);
40891         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40892         orig_conv.is_owned = false;
40893         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
40894         uint64_t ret_ref = 0;
40895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40897         return ret_ref;
40898 }
40899
40900 jboolean  __attribute__((export_name("TS_ChannelInfo_eq"))) TS_ChannelInfo_eq(uint64_t a, uint64_t b) {
40901         LDKChannelInfo a_conv;
40902         a_conv.inner = untag_ptr(a);
40903         a_conv.is_owned = ptr_is_owned(a);
40904         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40905         a_conv.is_owned = false;
40906         LDKChannelInfo b_conv;
40907         b_conv.inner = untag_ptr(b);
40908         b_conv.is_owned = ptr_is_owned(b);
40909         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40910         b_conv.is_owned = false;
40911         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
40912         return ret_conv;
40913 }
40914
40915 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
40916         LDKChannelInfo this_arg_conv;
40917         this_arg_conv.inner = untag_ptr(this_arg);
40918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40920         this_arg_conv.is_owned = false;
40921         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
40922         uint64_t ret_ref = 0;
40923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40925         return ret_ref;
40926 }
40927
40928 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
40929         LDKChannelInfo obj_conv;
40930         obj_conv.inner = untag_ptr(obj);
40931         obj_conv.is_owned = ptr_is_owned(obj);
40932         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40933         obj_conv.is_owned = false;
40934         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
40935         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40936         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40937         CVec_u8Z_free(ret_var);
40938         return ret_arr;
40939 }
40940
40941 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
40942         LDKu8slice ser_ref;
40943         ser_ref.datalen = ser->arr_len;
40944         ser_ref.data = ser->elems;
40945         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
40946         *ret_conv = ChannelInfo_read(ser_ref);
40947         FREE(ser);
40948         return tag_ptr(ret_conv, true);
40949 }
40950
40951 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
40952         LDKDirectedChannelInfo this_obj_conv;
40953         this_obj_conv.inner = untag_ptr(this_obj);
40954         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40956         DirectedChannelInfo_free(this_obj_conv);
40957 }
40958
40959 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
40960         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
40961         uint64_t ret_ref = 0;
40962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40964         return ret_ref;
40965 }
40966 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
40967         LDKDirectedChannelInfo arg_conv;
40968         arg_conv.inner = untag_ptr(arg);
40969         arg_conv.is_owned = ptr_is_owned(arg);
40970         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40971         arg_conv.is_owned = false;
40972         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
40973         return ret_conv;
40974 }
40975
40976 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
40977         LDKDirectedChannelInfo orig_conv;
40978         orig_conv.inner = untag_ptr(orig);
40979         orig_conv.is_owned = ptr_is_owned(orig);
40980         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40981         orig_conv.is_owned = false;
40982         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
40983         uint64_t ret_ref = 0;
40984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40986         return ret_ref;
40987 }
40988
40989 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
40990         LDKDirectedChannelInfo this_arg_conv;
40991         this_arg_conv.inner = untag_ptr(this_arg);
40992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40994         this_arg_conv.is_owned = false;
40995         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
40996         uint64_t ret_ref = 0;
40997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40999         return ret_ref;
41000 }
41001
41002 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_direction"))) TS_DirectedChannelInfo_direction(uint64_t this_arg) {
41003         LDKDirectedChannelInfo this_arg_conv;
41004         this_arg_conv.inner = untag_ptr(this_arg);
41005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41007         this_arg_conv.is_owned = false;
41008         LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
41009         uint64_t ret_ref = 0;
41010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41012         return ret_ref;
41013 }
41014
41015 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint64_t this_arg) {
41016         LDKDirectedChannelInfo this_arg_conv;
41017         this_arg_conv.inner = untag_ptr(this_arg);
41018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41020         this_arg_conv.is_owned = false;
41021         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
41022         return ret_conv;
41023 }
41024
41025 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
41026         LDKDirectedChannelInfo this_arg_conv;
41027         this_arg_conv.inner = untag_ptr(this_arg);
41028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41030         this_arg_conv.is_owned = false;
41031         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
41032         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
41033         uint64_t ret_ref = tag_ptr(ret_copy, true);
41034         return ret_ref;
41035 }
41036
41037 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
41038         if (!ptr_is_owned(this_ptr)) return;
41039         void* this_ptr_ptr = untag_ptr(this_ptr);
41040         CHECK_ACCESS(this_ptr_ptr);
41041         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
41042         FREE(untag_ptr(this_ptr));
41043         EffectiveCapacity_free(this_ptr_conv);
41044 }
41045
41046 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
41047         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
41048         *ret_copy = EffectiveCapacity_clone(arg);
41049         uint64_t ret_ref = tag_ptr(ret_copy, true);
41050         return ret_ref;
41051 }
41052 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
41053         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
41054         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
41055         return ret_conv;
41056 }
41057
41058 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
41059         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
41060         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
41061         *ret_copy = EffectiveCapacity_clone(orig_conv);
41062         uint64_t ret_ref = tag_ptr(ret_copy, true);
41063         return ret_ref;
41064 }
41065
41066 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
41067         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
41068         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
41069         uint64_t ret_ref = tag_ptr(ret_copy, true);
41070         return ret_ref;
41071 }
41072
41073 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_maximum_htlc"))) TS_EffectiveCapacity_maximum_htlc(int64_t amount_msat) {
41074         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
41075         *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
41076         uint64_t ret_ref = tag_ptr(ret_copy, true);
41077         return ret_ref;
41078 }
41079
41080 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, uint64_t htlc_maximum_msat) {
41081         void* htlc_maximum_msat_ptr = untag_ptr(htlc_maximum_msat);
41082         CHECK_ACCESS(htlc_maximum_msat_ptr);
41083         LDKCOption_u64Z htlc_maximum_msat_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_ptr);
41084         htlc_maximum_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat));
41085         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
41086         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat_conv);
41087         uint64_t ret_ref = tag_ptr(ret_copy, true);
41088         return ret_ref;
41089 }
41090
41091 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
41092         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
41093         *ret_copy = EffectiveCapacity_infinite();
41094         uint64_t ret_ref = tag_ptr(ret_copy, true);
41095         return ret_ref;
41096 }
41097
41098 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
41099         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
41100         *ret_copy = EffectiveCapacity_unknown();
41101         uint64_t ret_ref = tag_ptr(ret_copy, true);
41102         return ret_ref;
41103 }
41104
41105 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
41106         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
41107         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
41108         return ret_conv;
41109 }
41110
41111 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
41112         LDKRoutingFees this_obj_conv;
41113         this_obj_conv.inner = untag_ptr(this_obj);
41114         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41116         RoutingFees_free(this_obj_conv);
41117 }
41118
41119 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
41120         LDKRoutingFees this_ptr_conv;
41121         this_ptr_conv.inner = untag_ptr(this_ptr);
41122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41124         this_ptr_conv.is_owned = false;
41125         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
41126         return ret_conv;
41127 }
41128
41129 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
41130         LDKRoutingFees this_ptr_conv;
41131         this_ptr_conv.inner = untag_ptr(this_ptr);
41132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41134         this_ptr_conv.is_owned = false;
41135         RoutingFees_set_base_msat(&this_ptr_conv, val);
41136 }
41137
41138 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
41139         LDKRoutingFees this_ptr_conv;
41140         this_ptr_conv.inner = untag_ptr(this_ptr);
41141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41143         this_ptr_conv.is_owned = false;
41144         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
41145         return ret_conv;
41146 }
41147
41148 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
41149         LDKRoutingFees this_ptr_conv;
41150         this_ptr_conv.inner = untag_ptr(this_ptr);
41151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41153         this_ptr_conv.is_owned = false;
41154         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
41155 }
41156
41157 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
41158         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
41159         uint64_t ret_ref = 0;
41160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41162         return ret_ref;
41163 }
41164
41165 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
41166         LDKRoutingFees a_conv;
41167         a_conv.inner = untag_ptr(a);
41168         a_conv.is_owned = ptr_is_owned(a);
41169         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41170         a_conv.is_owned = false;
41171         LDKRoutingFees b_conv;
41172         b_conv.inner = untag_ptr(b);
41173         b_conv.is_owned = ptr_is_owned(b);
41174         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41175         b_conv.is_owned = false;
41176         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
41177         return ret_conv;
41178 }
41179
41180 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
41181         LDKRoutingFees ret_var = RoutingFees_clone(arg);
41182         uint64_t ret_ref = 0;
41183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41185         return ret_ref;
41186 }
41187 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
41188         LDKRoutingFees arg_conv;
41189         arg_conv.inner = untag_ptr(arg);
41190         arg_conv.is_owned = ptr_is_owned(arg);
41191         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41192         arg_conv.is_owned = false;
41193         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
41194         return ret_conv;
41195 }
41196
41197 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
41198         LDKRoutingFees orig_conv;
41199         orig_conv.inner = untag_ptr(orig);
41200         orig_conv.is_owned = ptr_is_owned(orig);
41201         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41202         orig_conv.is_owned = false;
41203         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
41204         uint64_t ret_ref = 0;
41205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41207         return ret_ref;
41208 }
41209
41210 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
41211         LDKRoutingFees o_conv;
41212         o_conv.inner = untag_ptr(o);
41213         o_conv.is_owned = ptr_is_owned(o);
41214         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41215         o_conv.is_owned = false;
41216         int64_t ret_conv = RoutingFees_hash(&o_conv);
41217         return ret_conv;
41218 }
41219
41220 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
41221         LDKRoutingFees obj_conv;
41222         obj_conv.inner = untag_ptr(obj);
41223         obj_conv.is_owned = ptr_is_owned(obj);
41224         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41225         obj_conv.is_owned = false;
41226         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
41227         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41228         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41229         CVec_u8Z_free(ret_var);
41230         return ret_arr;
41231 }
41232
41233 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
41234         LDKu8slice ser_ref;
41235         ser_ref.datalen = ser->arr_len;
41236         ser_ref.data = ser->elems;
41237         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
41238         *ret_conv = RoutingFees_read(ser_ref);
41239         FREE(ser);
41240         return tag_ptr(ret_conv, true);
41241 }
41242
41243 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
41244         LDKNodeAnnouncementInfo this_obj_conv;
41245         this_obj_conv.inner = untag_ptr(this_obj);
41246         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41248         NodeAnnouncementInfo_free(this_obj_conv);
41249 }
41250
41251 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
41252         LDKNodeAnnouncementInfo this_ptr_conv;
41253         this_ptr_conv.inner = untag_ptr(this_ptr);
41254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41256         this_ptr_conv.is_owned = false;
41257         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
41258         uint64_t ret_ref = 0;
41259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41261         return ret_ref;
41262 }
41263
41264 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
41265         LDKNodeAnnouncementInfo this_ptr_conv;
41266         this_ptr_conv.inner = untag_ptr(this_ptr);
41267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41269         this_ptr_conv.is_owned = false;
41270         LDKNodeFeatures val_conv;
41271         val_conv.inner = untag_ptr(val);
41272         val_conv.is_owned = ptr_is_owned(val);
41273         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41274         val_conv = NodeFeatures_clone(&val_conv);
41275         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
41276 }
41277
41278 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
41279         LDKNodeAnnouncementInfo this_ptr_conv;
41280         this_ptr_conv.inner = untag_ptr(this_ptr);
41281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41283         this_ptr_conv.is_owned = false;
41284         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
41285         return ret_conv;
41286 }
41287
41288 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
41289         LDKNodeAnnouncementInfo this_ptr_conv;
41290         this_ptr_conv.inner = untag_ptr(this_ptr);
41291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41293         this_ptr_conv.is_owned = false;
41294         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
41295 }
41296
41297 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
41298         LDKNodeAnnouncementInfo this_ptr_conv;
41299         this_ptr_conv.inner = untag_ptr(this_ptr);
41300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41302         this_ptr_conv.is_owned = false;
41303         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
41304         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
41305         return ret_arr;
41306 }
41307
41308 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
41309         LDKNodeAnnouncementInfo this_ptr_conv;
41310         this_ptr_conv.inner = untag_ptr(this_ptr);
41311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41313         this_ptr_conv.is_owned = false;
41314         LDKThreeBytes val_ref;
41315         CHECK(val->arr_len == 3);
41316         memcpy(val_ref.data, val->elems, 3); FREE(val);
41317         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
41318 }
41319
41320 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
41321         LDKNodeAnnouncementInfo this_ptr_conv;
41322         this_ptr_conv.inner = untag_ptr(this_ptr);
41323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41325         this_ptr_conv.is_owned = false;
41326         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
41327         uint64_t ret_ref = 0;
41328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41330         return ret_ref;
41331 }
41332
41333 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
41334         LDKNodeAnnouncementInfo this_ptr_conv;
41335         this_ptr_conv.inner = untag_ptr(this_ptr);
41336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41338         this_ptr_conv.is_owned = false;
41339         LDKNodeAlias val_conv;
41340         val_conv.inner = untag_ptr(val);
41341         val_conv.is_owned = ptr_is_owned(val);
41342         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41343         val_conv = NodeAlias_clone(&val_conv);
41344         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
41345 }
41346
41347 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_addresses"))) TS_NodeAnnouncementInfo_get_addresses(uint64_t this_ptr) {
41348         LDKNodeAnnouncementInfo this_ptr_conv;
41349         this_ptr_conv.inner = untag_ptr(this_ptr);
41350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41352         this_ptr_conv.is_owned = false;
41353         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_get_addresses(&this_ptr_conv);
41354         uint64_tArray ret_arr = NULL;
41355         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
41356         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
41357         for (size_t m = 0; m < ret_var.datalen; m++) {
41358                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
41359                 *ret_conv_12_copy = ret_var.data[m];
41360                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
41361                 ret_arr_ptr[m] = ret_conv_12_ref;
41362         }
41363         
41364         FREE(ret_var.data);
41365         return ret_arr;
41366 }
41367
41368 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_addresses"))) TS_NodeAnnouncementInfo_set_addresses(uint64_t this_ptr, uint64_tArray val) {
41369         LDKNodeAnnouncementInfo this_ptr_conv;
41370         this_ptr_conv.inner = untag_ptr(this_ptr);
41371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41373         this_ptr_conv.is_owned = false;
41374         LDKCVec_NetAddressZ val_constr;
41375         val_constr.datalen = val->arr_len;
41376         if (val_constr.datalen > 0)
41377                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
41378         else
41379                 val_constr.data = NULL;
41380         uint64_t* val_vals = val->elems;
41381         for (size_t m = 0; m < val_constr.datalen; m++) {
41382                 uint64_t val_conv_12 = val_vals[m];
41383                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
41384                 CHECK_ACCESS(val_conv_12_ptr);
41385                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
41386                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
41387                 val_constr.data[m] = val_conv_12_conv;
41388         }
41389         FREE(val);
41390         NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
41391 }
41392
41393 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
41394         LDKNodeAnnouncementInfo this_ptr_conv;
41395         this_ptr_conv.inner = untag_ptr(this_ptr);
41396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41398         this_ptr_conv.is_owned = false;
41399         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
41400         uint64_t ret_ref = 0;
41401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41403         return ret_ref;
41404 }
41405
41406 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
41407         LDKNodeAnnouncementInfo this_ptr_conv;
41408         this_ptr_conv.inner = untag_ptr(this_ptr);
41409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41411         this_ptr_conv.is_owned = false;
41412         LDKNodeAnnouncement val_conv;
41413         val_conv.inner = untag_ptr(val);
41414         val_conv.is_owned = ptr_is_owned(val);
41415         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41416         val_conv = NodeAnnouncement_clone(&val_conv);
41417         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
41418 }
41419
41420 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_new"))) TS_NodeAnnouncementInfo_new(uint64_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, uint64_t alias_arg, uint64_tArray addresses_arg, uint64_t announcement_message_arg) {
41421         LDKNodeFeatures features_arg_conv;
41422         features_arg_conv.inner = untag_ptr(features_arg);
41423         features_arg_conv.is_owned = ptr_is_owned(features_arg);
41424         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
41425         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
41426         LDKThreeBytes rgb_arg_ref;
41427         CHECK(rgb_arg->arr_len == 3);
41428         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
41429         LDKNodeAlias alias_arg_conv;
41430         alias_arg_conv.inner = untag_ptr(alias_arg);
41431         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
41432         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
41433         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
41434         LDKCVec_NetAddressZ addresses_arg_constr;
41435         addresses_arg_constr.datalen = addresses_arg->arr_len;
41436         if (addresses_arg_constr.datalen > 0)
41437                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
41438         else
41439                 addresses_arg_constr.data = NULL;
41440         uint64_t* addresses_arg_vals = addresses_arg->elems;
41441         for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
41442                 uint64_t addresses_arg_conv_12 = addresses_arg_vals[m];
41443                 void* addresses_arg_conv_12_ptr = untag_ptr(addresses_arg_conv_12);
41444                 CHECK_ACCESS(addresses_arg_conv_12_ptr);
41445                 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
41446                 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
41447         }
41448         FREE(addresses_arg);
41449         LDKNodeAnnouncement announcement_message_arg_conv;
41450         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
41451         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
41452         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
41453         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
41454         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, announcement_message_arg_conv);
41455         uint64_t ret_ref = 0;
41456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41458         return ret_ref;
41459 }
41460
41461 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
41462         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
41463         uint64_t ret_ref = 0;
41464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41466         return ret_ref;
41467 }
41468 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
41469         LDKNodeAnnouncementInfo arg_conv;
41470         arg_conv.inner = untag_ptr(arg);
41471         arg_conv.is_owned = ptr_is_owned(arg);
41472         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41473         arg_conv.is_owned = false;
41474         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
41475         return ret_conv;
41476 }
41477
41478 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
41479         LDKNodeAnnouncementInfo orig_conv;
41480         orig_conv.inner = untag_ptr(orig);
41481         orig_conv.is_owned = ptr_is_owned(orig);
41482         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41483         orig_conv.is_owned = false;
41484         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
41485         uint64_t ret_ref = 0;
41486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41488         return ret_ref;
41489 }
41490
41491 jboolean  __attribute__((export_name("TS_NodeAnnouncementInfo_eq"))) TS_NodeAnnouncementInfo_eq(uint64_t a, uint64_t b) {
41492         LDKNodeAnnouncementInfo a_conv;
41493         a_conv.inner = untag_ptr(a);
41494         a_conv.is_owned = ptr_is_owned(a);
41495         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41496         a_conv.is_owned = false;
41497         LDKNodeAnnouncementInfo b_conv;
41498         b_conv.inner = untag_ptr(b);
41499         b_conv.is_owned = ptr_is_owned(b);
41500         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41501         b_conv.is_owned = false;
41502         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
41503         return ret_conv;
41504 }
41505
41506 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
41507         LDKNodeAnnouncementInfo obj_conv;
41508         obj_conv.inner = untag_ptr(obj);
41509         obj_conv.is_owned = ptr_is_owned(obj);
41510         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41511         obj_conv.is_owned = false;
41512         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
41513         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41514         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41515         CVec_u8Z_free(ret_var);
41516         return ret_arr;
41517 }
41518
41519 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
41520         LDKu8slice ser_ref;
41521         ser_ref.datalen = ser->arr_len;
41522         ser_ref.data = ser->elems;
41523         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
41524         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
41525         FREE(ser);
41526         return tag_ptr(ret_conv, true);
41527 }
41528
41529 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
41530         LDKNodeAlias this_obj_conv;
41531         this_obj_conv.inner = untag_ptr(this_obj);
41532         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41534         NodeAlias_free(this_obj_conv);
41535 }
41536
41537 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
41538         LDKNodeAlias this_ptr_conv;
41539         this_ptr_conv.inner = untag_ptr(this_ptr);
41540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41542         this_ptr_conv.is_owned = false;
41543         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41544         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
41545         return ret_arr;
41546 }
41547
41548 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
41549         LDKNodeAlias this_ptr_conv;
41550         this_ptr_conv.inner = untag_ptr(this_ptr);
41551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41553         this_ptr_conv.is_owned = false;
41554         LDKThirtyTwoBytes val_ref;
41555         CHECK(val->arr_len == 32);
41556         memcpy(val_ref.data, val->elems, 32); FREE(val);
41557         NodeAlias_set_a(&this_ptr_conv, val_ref);
41558 }
41559
41560 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
41561         LDKThirtyTwoBytes a_arg_ref;
41562         CHECK(a_arg->arr_len == 32);
41563         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
41564         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
41565         uint64_t ret_ref = 0;
41566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41568         return ret_ref;
41569 }
41570
41571 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
41572         LDKNodeAlias ret_var = NodeAlias_clone(arg);
41573         uint64_t ret_ref = 0;
41574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41576         return ret_ref;
41577 }
41578 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
41579         LDKNodeAlias arg_conv;
41580         arg_conv.inner = untag_ptr(arg);
41581         arg_conv.is_owned = ptr_is_owned(arg);
41582         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41583         arg_conv.is_owned = false;
41584         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
41585         return ret_conv;
41586 }
41587
41588 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
41589         LDKNodeAlias orig_conv;
41590         orig_conv.inner = untag_ptr(orig);
41591         orig_conv.is_owned = ptr_is_owned(orig);
41592         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41593         orig_conv.is_owned = false;
41594         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
41595         uint64_t ret_ref = 0;
41596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41598         return ret_ref;
41599 }
41600
41601 jboolean  __attribute__((export_name("TS_NodeAlias_eq"))) TS_NodeAlias_eq(uint64_t a, uint64_t b) {
41602         LDKNodeAlias a_conv;
41603         a_conv.inner = untag_ptr(a);
41604         a_conv.is_owned = ptr_is_owned(a);
41605         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41606         a_conv.is_owned = false;
41607         LDKNodeAlias b_conv;
41608         b_conv.inner = untag_ptr(b);
41609         b_conv.is_owned = ptr_is_owned(b);
41610         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41611         b_conv.is_owned = false;
41612         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
41613         return ret_conv;
41614 }
41615
41616 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
41617         LDKNodeAlias obj_conv;
41618         obj_conv.inner = untag_ptr(obj);
41619         obj_conv.is_owned = ptr_is_owned(obj);
41620         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41621         obj_conv.is_owned = false;
41622         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
41623         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41624         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41625         CVec_u8Z_free(ret_var);
41626         return ret_arr;
41627 }
41628
41629 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
41630         LDKu8slice ser_ref;
41631         ser_ref.datalen = ser->arr_len;
41632         ser_ref.data = ser->elems;
41633         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
41634         *ret_conv = NodeAlias_read(ser_ref);
41635         FREE(ser);
41636         return tag_ptr(ret_conv, true);
41637 }
41638
41639 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
41640         LDKNodeInfo this_obj_conv;
41641         this_obj_conv.inner = untag_ptr(this_obj);
41642         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41644         NodeInfo_free(this_obj_conv);
41645 }
41646
41647 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
41648         LDKNodeInfo this_ptr_conv;
41649         this_ptr_conv.inner = untag_ptr(this_ptr);
41650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41652         this_ptr_conv.is_owned = false;
41653         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
41654         int64_tArray ret_arr = NULL;
41655         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
41656         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
41657         for (size_t i = 0; i < ret_var.datalen; i++) {
41658                 int64_t ret_conv_8_conv = ret_var.data[i];
41659                 ret_arr_ptr[i] = ret_conv_8_conv;
41660         }
41661         
41662         FREE(ret_var.data);
41663         return ret_arr;
41664 }
41665
41666 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
41667         LDKNodeInfo this_ptr_conv;
41668         this_ptr_conv.inner = untag_ptr(this_ptr);
41669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41671         this_ptr_conv.is_owned = false;
41672         LDKCVec_u64Z val_constr;
41673         val_constr.datalen = val->arr_len;
41674         if (val_constr.datalen > 0)
41675                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
41676         else
41677                 val_constr.data = NULL;
41678         int64_t* val_vals = val->elems;
41679         for (size_t i = 0; i < val_constr.datalen; i++) {
41680                 int64_t val_conv_8 = val_vals[i];
41681                 val_constr.data[i] = val_conv_8;
41682         }
41683         FREE(val);
41684         NodeInfo_set_channels(&this_ptr_conv, val_constr);
41685 }
41686
41687 uint64_t  __attribute__((export_name("TS_NodeInfo_get_lowest_inbound_channel_fees"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint64_t this_ptr) {
41688         LDKNodeInfo this_ptr_conv;
41689         this_ptr_conv.inner = untag_ptr(this_ptr);
41690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41692         this_ptr_conv.is_owned = false;
41693         LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
41694         uint64_t ret_ref = 0;
41695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41697         return ret_ref;
41698 }
41699
41700 void  __attribute__((export_name("TS_NodeInfo_set_lowest_inbound_channel_fees"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint64_t this_ptr, uint64_t val) {
41701         LDKNodeInfo this_ptr_conv;
41702         this_ptr_conv.inner = untag_ptr(this_ptr);
41703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41705         this_ptr_conv.is_owned = false;
41706         LDKRoutingFees val_conv;
41707         val_conv.inner = untag_ptr(val);
41708         val_conv.is_owned = ptr_is_owned(val);
41709         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41710         val_conv = RoutingFees_clone(&val_conv);
41711         NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
41712 }
41713
41714 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
41715         LDKNodeInfo this_ptr_conv;
41716         this_ptr_conv.inner = untag_ptr(this_ptr);
41717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41719         this_ptr_conv.is_owned = false;
41720         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
41721         uint64_t ret_ref = 0;
41722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41724         return ret_ref;
41725 }
41726
41727 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
41728         LDKNodeInfo this_ptr_conv;
41729         this_ptr_conv.inner = untag_ptr(this_ptr);
41730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41732         this_ptr_conv.is_owned = false;
41733         LDKNodeAnnouncementInfo val_conv;
41734         val_conv.inner = untag_ptr(val);
41735         val_conv.is_owned = ptr_is_owned(val);
41736         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41737         val_conv = NodeAnnouncementInfo_clone(&val_conv);
41738         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
41739 }
41740
41741 uint64_t  __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint64_t lowest_inbound_channel_fees_arg, uint64_t announcement_info_arg) {
41742         LDKCVec_u64Z channels_arg_constr;
41743         channels_arg_constr.datalen = channels_arg->arr_len;
41744         if (channels_arg_constr.datalen > 0)
41745                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
41746         else
41747                 channels_arg_constr.data = NULL;
41748         int64_t* channels_arg_vals = channels_arg->elems;
41749         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
41750                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
41751                 channels_arg_constr.data[i] = channels_arg_conv_8;
41752         }
41753         FREE(channels_arg);
41754         LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
41755         lowest_inbound_channel_fees_arg_conv.inner = untag_ptr(lowest_inbound_channel_fees_arg);
41756         lowest_inbound_channel_fees_arg_conv.is_owned = ptr_is_owned(lowest_inbound_channel_fees_arg);
41757         CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
41758         lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
41759         LDKNodeAnnouncementInfo announcement_info_arg_conv;
41760         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
41761         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
41762         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
41763         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
41764         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
41765         uint64_t ret_ref = 0;
41766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41768         return ret_ref;
41769 }
41770
41771 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
41772         LDKNodeInfo ret_var = NodeInfo_clone(arg);
41773         uint64_t ret_ref = 0;
41774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41776         return ret_ref;
41777 }
41778 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
41779         LDKNodeInfo arg_conv;
41780         arg_conv.inner = untag_ptr(arg);
41781         arg_conv.is_owned = ptr_is_owned(arg);
41782         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41783         arg_conv.is_owned = false;
41784         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
41785         return ret_conv;
41786 }
41787
41788 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
41789         LDKNodeInfo orig_conv;
41790         orig_conv.inner = untag_ptr(orig);
41791         orig_conv.is_owned = ptr_is_owned(orig);
41792         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41793         orig_conv.is_owned = false;
41794         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
41795         uint64_t ret_ref = 0;
41796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41798         return ret_ref;
41799 }
41800
41801 jboolean  __attribute__((export_name("TS_NodeInfo_eq"))) TS_NodeInfo_eq(uint64_t a, uint64_t b) {
41802         LDKNodeInfo a_conv;
41803         a_conv.inner = untag_ptr(a);
41804         a_conv.is_owned = ptr_is_owned(a);
41805         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41806         a_conv.is_owned = false;
41807         LDKNodeInfo b_conv;
41808         b_conv.inner = untag_ptr(b);
41809         b_conv.is_owned = ptr_is_owned(b);
41810         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41811         b_conv.is_owned = false;
41812         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
41813         return ret_conv;
41814 }
41815
41816 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
41817         LDKNodeInfo obj_conv;
41818         obj_conv.inner = untag_ptr(obj);
41819         obj_conv.is_owned = ptr_is_owned(obj);
41820         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41821         obj_conv.is_owned = false;
41822         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
41823         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41824         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41825         CVec_u8Z_free(ret_var);
41826         return ret_arr;
41827 }
41828
41829 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
41830         LDKu8slice ser_ref;
41831         ser_ref.datalen = ser->arr_len;
41832         ser_ref.data = ser->elems;
41833         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
41834         *ret_conv = NodeInfo_read(ser_ref);
41835         FREE(ser);
41836         return tag_ptr(ret_conv, true);
41837 }
41838
41839 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
41840         LDKNetworkGraph obj_conv;
41841         obj_conv.inner = untag_ptr(obj);
41842         obj_conv.is_owned = ptr_is_owned(obj);
41843         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41844         obj_conv.is_owned = false;
41845         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
41846         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41847         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41848         CVec_u8Z_free(ret_var);
41849         return ret_arr;
41850 }
41851
41852 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
41853         LDKu8slice ser_ref;
41854         ser_ref.datalen = ser->arr_len;
41855         ser_ref.data = ser->elems;
41856         void* arg_ptr = untag_ptr(arg);
41857         CHECK_ACCESS(arg_ptr);
41858         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
41859         if (arg_conv.free == LDKLogger_JCalls_free) {
41860                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41861                 LDKLogger_JCalls_cloned(&arg_conv);
41862         }
41863         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
41864         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
41865         FREE(ser);
41866         return tag_ptr(ret_conv, true);
41867 }
41868
41869 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(int8_tArray genesis_hash, uint64_t logger) {
41870         LDKThirtyTwoBytes genesis_hash_ref;
41871         CHECK(genesis_hash->arr_len == 32);
41872         memcpy(genesis_hash_ref.data, genesis_hash->elems, 32); FREE(genesis_hash);
41873         void* logger_ptr = untag_ptr(logger);
41874         CHECK_ACCESS(logger_ptr);
41875         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41876         if (logger_conv.free == LDKLogger_JCalls_free) {
41877                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41878                 LDKLogger_JCalls_cloned(&logger_conv);
41879         }
41880         LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv);
41881         uint64_t ret_ref = 0;
41882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41884         return ret_ref;
41885 }
41886
41887 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
41888         LDKNetworkGraph this_arg_conv;
41889         this_arg_conv.inner = untag_ptr(this_arg);
41890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41892         this_arg_conv.is_owned = false;
41893         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
41894         uint64_t ret_ref = 0;
41895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41897         return ret_ref;
41898 }
41899
41900 uint64_t  __attribute__((export_name("TS_NetworkGraph_get_last_rapid_gossip_sync_timestamp"))) TS_NetworkGraph_get_last_rapid_gossip_sync_timestamp(uint64_t this_arg) {
41901         LDKNetworkGraph this_arg_conv;
41902         this_arg_conv.inner = untag_ptr(this_arg);
41903         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41905         this_arg_conv.is_owned = false;
41906         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
41907         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
41908         uint64_t ret_ref = tag_ptr(ret_copy, true);
41909         return ret_ref;
41910 }
41911
41912 void  __attribute__((export_name("TS_NetworkGraph_set_last_rapid_gossip_sync_timestamp"))) TS_NetworkGraph_set_last_rapid_gossip_sync_timestamp(uint64_t this_arg, int32_t last_rapid_gossip_sync_timestamp) {
41913         LDKNetworkGraph this_arg_conv;
41914         this_arg_conv.inner = untag_ptr(this_arg);
41915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41917         this_arg_conv.is_owned = false;
41918         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
41919 }
41920
41921 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
41922         LDKNetworkGraph this_arg_conv;
41923         this_arg_conv.inner = untag_ptr(this_arg);
41924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41926         this_arg_conv.is_owned = false;
41927         LDKNodeAnnouncement msg_conv;
41928         msg_conv.inner = untag_ptr(msg);
41929         msg_conv.is_owned = ptr_is_owned(msg);
41930         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41931         msg_conv.is_owned = false;
41932         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41933         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
41934         return tag_ptr(ret_conv, true);
41935 }
41936
41937 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_unsigned_announcement"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint64_t this_arg, uint64_t msg) {
41938         LDKNetworkGraph this_arg_conv;
41939         this_arg_conv.inner = untag_ptr(this_arg);
41940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41942         this_arg_conv.is_owned = false;
41943         LDKUnsignedNodeAnnouncement msg_conv;
41944         msg_conv.inner = untag_ptr(msg);
41945         msg_conv.is_owned = ptr_is_owned(msg);
41946         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41947         msg_conv.is_owned = false;
41948         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41949         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
41950         return tag_ptr(ret_conv, true);
41951 }
41952
41953 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_from_announcement"))) TS_NetworkGraph_update_channel_from_announcement(uint64_t this_arg, uint64_t msg, uint64_t chain_access) {
41954         LDKNetworkGraph this_arg_conv;
41955         this_arg_conv.inner = untag_ptr(this_arg);
41956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41958         this_arg_conv.is_owned = false;
41959         LDKChannelAnnouncement msg_conv;
41960         msg_conv.inner = untag_ptr(msg);
41961         msg_conv.is_owned = ptr_is_owned(msg);
41962         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41963         msg_conv.is_owned = false;
41964         void* chain_access_ptr = untag_ptr(chain_access);
41965         CHECK_ACCESS(chain_access_ptr);
41966         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41967         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41968         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41969                 // Manually implement clone for Java trait instances
41970                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41971                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41972                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
41973                 }
41974         }
41975         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41976         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
41977         return tag_ptr(ret_conv, true);
41978 }
41979
41980 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_from_unsigned_announcement"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint64_t this_arg, uint64_t msg, uint64_t chain_access) {
41981         LDKNetworkGraph this_arg_conv;
41982         this_arg_conv.inner = untag_ptr(this_arg);
41983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41985         this_arg_conv.is_owned = false;
41986         LDKUnsignedChannelAnnouncement msg_conv;
41987         msg_conv.inner = untag_ptr(msg);
41988         msg_conv.is_owned = ptr_is_owned(msg);
41989         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41990         msg_conv.is_owned = false;
41991         void* chain_access_ptr = untag_ptr(chain_access);
41992         CHECK_ACCESS(chain_access_ptr);
41993         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41994         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41995         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41996                 // Manually implement clone for Java trait instances
41997                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41998                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41999                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
42000                 }
42001         }
42002         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
42003         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
42004         return tag_ptr(ret_conv, true);
42005 }
42006
42007 uint64_t  __attribute__((export_name("TS_NetworkGraph_add_channel_from_partial_announcement"))) TS_NetworkGraph_add_channel_from_partial_announcement(uint64_t this_arg, int64_t short_channel_id, int64_t timestamp, uint64_t features, int8_tArray node_id_1, int8_tArray node_id_2) {
42008         LDKNetworkGraph this_arg_conv;
42009         this_arg_conv.inner = untag_ptr(this_arg);
42010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42012         this_arg_conv.is_owned = false;
42013         LDKChannelFeatures features_conv;
42014         features_conv.inner = untag_ptr(features);
42015         features_conv.is_owned = ptr_is_owned(features);
42016         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
42017         features_conv = ChannelFeatures_clone(&features_conv);
42018         LDKPublicKey node_id_1_ref;
42019         CHECK(node_id_1->arr_len == 33);
42020         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
42021         LDKPublicKey node_id_2_ref;
42022         CHECK(node_id_2->arr_len == 33);
42023         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
42024         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
42025         *ret_conv = NetworkGraph_add_channel_from_partial_announcement(&this_arg_conv, short_channel_id, timestamp, features_conv, node_id_1_ref, node_id_2_ref);
42026         return tag_ptr(ret_conv, true);
42027 }
42028
42029 void  __attribute__((export_name("TS_NetworkGraph_channel_failed"))) TS_NetworkGraph_channel_failed(uint64_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
42030         LDKNetworkGraph this_arg_conv;
42031         this_arg_conv.inner = untag_ptr(this_arg);
42032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42034         this_arg_conv.is_owned = false;
42035         NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
42036 }
42037
42038 void  __attribute__((export_name("TS_NetworkGraph_node_failed_permanent"))) TS_NetworkGraph_node_failed_permanent(uint64_t this_arg, int8_tArray node_id) {
42039         LDKNetworkGraph this_arg_conv;
42040         this_arg_conv.inner = untag_ptr(this_arg);
42041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42043         this_arg_conv.is_owned = false;
42044         LDKPublicKey node_id_ref;
42045         CHECK(node_id->arr_len == 33);
42046         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
42047         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
42048 }
42049
42050 void  __attribute__((export_name("TS_NetworkGraph_remove_stale_channels_and_tracking_with_time"))) TS_NetworkGraph_remove_stale_channels_and_tracking_with_time(uint64_t this_arg, int64_t current_time_unix) {
42051         LDKNetworkGraph this_arg_conv;
42052         this_arg_conv.inner = untag_ptr(this_arg);
42053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42055         this_arg_conv.is_owned = false;
42056         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
42057 }
42058
42059 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
42060         LDKNetworkGraph this_arg_conv;
42061         this_arg_conv.inner = untag_ptr(this_arg);
42062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42064         this_arg_conv.is_owned = false;
42065         LDKChannelUpdate msg_conv;
42066         msg_conv.inner = untag_ptr(msg);
42067         msg_conv.is_owned = ptr_is_owned(msg);
42068         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
42069         msg_conv.is_owned = false;
42070         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
42071         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
42072         return tag_ptr(ret_conv, true);
42073 }
42074
42075 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
42076         LDKNetworkGraph this_arg_conv;
42077         this_arg_conv.inner = untag_ptr(this_arg);
42078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42080         this_arg_conv.is_owned = false;
42081         LDKUnsignedChannelUpdate msg_conv;
42082         msg_conv.inner = untag_ptr(msg);
42083         msg_conv.is_owned = ptr_is_owned(msg);
42084         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
42085         msg_conv.is_owned = false;
42086         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
42087         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
42088         return tag_ptr(ret_conv, true);
42089 }
42090
42091 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
42092         LDKReadOnlyNetworkGraph this_arg_conv;
42093         this_arg_conv.inner = untag_ptr(this_arg);
42094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42096         this_arg_conv.is_owned = false;
42097         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
42098         uint64_t ret_ref = 0;
42099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42101         return ret_ref;
42102 }
42103
42104 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
42105         LDKReadOnlyNetworkGraph this_arg_conv;
42106         this_arg_conv.inner = untag_ptr(this_arg);
42107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42109         this_arg_conv.is_owned = false;
42110         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
42111         int64_tArray ret_arr = NULL;
42112         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
42113         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
42114         for (size_t i = 0; i < ret_var.datalen; i++) {
42115                 int64_t ret_conv_8_conv = ret_var.data[i];
42116                 ret_arr_ptr[i] = ret_conv_8_conv;
42117         }
42118         
42119         FREE(ret_var.data);
42120         return ret_arr;
42121 }
42122
42123 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
42124         LDKReadOnlyNetworkGraph this_arg_conv;
42125         this_arg_conv.inner = untag_ptr(this_arg);
42126         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42128         this_arg_conv.is_owned = false;
42129         LDKNodeId node_id_conv;
42130         node_id_conv.inner = untag_ptr(node_id);
42131         node_id_conv.is_owned = ptr_is_owned(node_id);
42132         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
42133         node_id_conv.is_owned = false;
42134         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
42135         uint64_t ret_ref = 0;
42136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42138         return ret_ref;
42139 }
42140
42141 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
42142         LDKReadOnlyNetworkGraph this_arg_conv;
42143         this_arg_conv.inner = untag_ptr(this_arg);
42144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42146         this_arg_conv.is_owned = false;
42147         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
42148         uint64_tArray ret_arr = NULL;
42149         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42150         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42151         for (size_t i = 0; i < ret_var.datalen; i++) {
42152                 LDKNodeId ret_conv_8_var = ret_var.data[i];
42153                 uint64_t ret_conv_8_ref = 0;
42154                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
42155                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
42156                 ret_arr_ptr[i] = ret_conv_8_ref;
42157         }
42158         
42159         FREE(ret_var.data);
42160         return ret_arr;
42161 }
42162
42163 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
42164         LDKReadOnlyNetworkGraph this_arg_conv;
42165         this_arg_conv.inner = untag_ptr(this_arg);
42166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42168         this_arg_conv.is_owned = false;
42169         LDKPublicKey pubkey_ref;
42170         CHECK(pubkey->arr_len == 33);
42171         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
42172         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
42173         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
42174         uint64_t ret_ref = tag_ptr(ret_copy, true);
42175         return ret_ref;
42176 }
42177
42178 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
42179         LDKRouteHop this_obj_conv;
42180         this_obj_conv.inner = untag_ptr(this_obj);
42181         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42183         RouteHop_free(this_obj_conv);
42184 }
42185
42186 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
42187         LDKRouteHop this_ptr_conv;
42188         this_ptr_conv.inner = untag_ptr(this_ptr);
42189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42191         this_ptr_conv.is_owned = false;
42192         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42193         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
42194         return ret_arr;
42195 }
42196
42197 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
42198         LDKRouteHop this_ptr_conv;
42199         this_ptr_conv.inner = untag_ptr(this_ptr);
42200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42202         this_ptr_conv.is_owned = false;
42203         LDKPublicKey val_ref;
42204         CHECK(val->arr_len == 33);
42205         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42206         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
42207 }
42208
42209 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
42210         LDKRouteHop this_ptr_conv;
42211         this_ptr_conv.inner = untag_ptr(this_ptr);
42212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42214         this_ptr_conv.is_owned = false;
42215         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
42216         uint64_t ret_ref = 0;
42217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42219         return ret_ref;
42220 }
42221
42222 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
42223         LDKRouteHop this_ptr_conv;
42224         this_ptr_conv.inner = untag_ptr(this_ptr);
42225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42227         this_ptr_conv.is_owned = false;
42228         LDKNodeFeatures val_conv;
42229         val_conv.inner = untag_ptr(val);
42230         val_conv.is_owned = ptr_is_owned(val);
42231         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42232         val_conv = NodeFeatures_clone(&val_conv);
42233         RouteHop_set_node_features(&this_ptr_conv, val_conv);
42234 }
42235
42236 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
42237         LDKRouteHop this_ptr_conv;
42238         this_ptr_conv.inner = untag_ptr(this_ptr);
42239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42241         this_ptr_conv.is_owned = false;
42242         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
42243         return ret_conv;
42244 }
42245
42246 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
42247         LDKRouteHop this_ptr_conv;
42248         this_ptr_conv.inner = untag_ptr(this_ptr);
42249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42251         this_ptr_conv.is_owned = false;
42252         RouteHop_set_short_channel_id(&this_ptr_conv, val);
42253 }
42254
42255 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
42256         LDKRouteHop this_ptr_conv;
42257         this_ptr_conv.inner = untag_ptr(this_ptr);
42258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42260         this_ptr_conv.is_owned = false;
42261         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
42262         uint64_t ret_ref = 0;
42263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42265         return ret_ref;
42266 }
42267
42268 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
42269         LDKRouteHop this_ptr_conv;
42270         this_ptr_conv.inner = untag_ptr(this_ptr);
42271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42273         this_ptr_conv.is_owned = false;
42274         LDKChannelFeatures val_conv;
42275         val_conv.inner = untag_ptr(val);
42276         val_conv.is_owned = ptr_is_owned(val);
42277         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42278         val_conv = ChannelFeatures_clone(&val_conv);
42279         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
42280 }
42281
42282 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
42283         LDKRouteHop this_ptr_conv;
42284         this_ptr_conv.inner = untag_ptr(this_ptr);
42285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42287         this_ptr_conv.is_owned = false;
42288         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
42289         return ret_conv;
42290 }
42291
42292 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
42293         LDKRouteHop this_ptr_conv;
42294         this_ptr_conv.inner = untag_ptr(this_ptr);
42295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42297         this_ptr_conv.is_owned = false;
42298         RouteHop_set_fee_msat(&this_ptr_conv, val);
42299 }
42300
42301 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
42302         LDKRouteHop this_ptr_conv;
42303         this_ptr_conv.inner = untag_ptr(this_ptr);
42304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42306         this_ptr_conv.is_owned = false;
42307         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
42308         return ret_conv;
42309 }
42310
42311 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
42312         LDKRouteHop this_ptr_conv;
42313         this_ptr_conv.inner = untag_ptr(this_ptr);
42314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42316         this_ptr_conv.is_owned = false;
42317         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
42318 }
42319
42320 uint64_t  __attribute__((export_name("TS_RouteHop_new"))) TS_RouteHop_new(int8_tArray pubkey_arg, uint64_t node_features_arg, int64_t short_channel_id_arg, uint64_t channel_features_arg, int64_t fee_msat_arg, int32_t cltv_expiry_delta_arg) {
42321         LDKPublicKey pubkey_arg_ref;
42322         CHECK(pubkey_arg->arr_len == 33);
42323         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
42324         LDKNodeFeatures node_features_arg_conv;
42325         node_features_arg_conv.inner = untag_ptr(node_features_arg);
42326         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
42327         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
42328         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
42329         LDKChannelFeatures channel_features_arg_conv;
42330         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
42331         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
42332         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
42333         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
42334         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);
42335         uint64_t ret_ref = 0;
42336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42338         return ret_ref;
42339 }
42340
42341 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
42342         LDKRouteHop ret_var = RouteHop_clone(arg);
42343         uint64_t ret_ref = 0;
42344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42346         return ret_ref;
42347 }
42348 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
42349         LDKRouteHop arg_conv;
42350         arg_conv.inner = untag_ptr(arg);
42351         arg_conv.is_owned = ptr_is_owned(arg);
42352         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42353         arg_conv.is_owned = false;
42354         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
42355         return ret_conv;
42356 }
42357
42358 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
42359         LDKRouteHop orig_conv;
42360         orig_conv.inner = untag_ptr(orig);
42361         orig_conv.is_owned = ptr_is_owned(orig);
42362         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42363         orig_conv.is_owned = false;
42364         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
42365         uint64_t ret_ref = 0;
42366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42368         return ret_ref;
42369 }
42370
42371 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
42372         LDKRouteHop o_conv;
42373         o_conv.inner = untag_ptr(o);
42374         o_conv.is_owned = ptr_is_owned(o);
42375         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42376         o_conv.is_owned = false;
42377         int64_t ret_conv = RouteHop_hash(&o_conv);
42378         return ret_conv;
42379 }
42380
42381 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
42382         LDKRouteHop a_conv;
42383         a_conv.inner = untag_ptr(a);
42384         a_conv.is_owned = ptr_is_owned(a);
42385         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42386         a_conv.is_owned = false;
42387         LDKRouteHop b_conv;
42388         b_conv.inner = untag_ptr(b);
42389         b_conv.is_owned = ptr_is_owned(b);
42390         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42391         b_conv.is_owned = false;
42392         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
42393         return ret_conv;
42394 }
42395
42396 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
42397         LDKRouteHop obj_conv;
42398         obj_conv.inner = untag_ptr(obj);
42399         obj_conv.is_owned = ptr_is_owned(obj);
42400         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42401         obj_conv.is_owned = false;
42402         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
42403         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42404         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42405         CVec_u8Z_free(ret_var);
42406         return ret_arr;
42407 }
42408
42409 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
42410         LDKu8slice ser_ref;
42411         ser_ref.datalen = ser->arr_len;
42412         ser_ref.data = ser->elems;
42413         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
42414         *ret_conv = RouteHop_read(ser_ref);
42415         FREE(ser);
42416         return tag_ptr(ret_conv, true);
42417 }
42418
42419 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
42420         LDKRoute this_obj_conv;
42421         this_obj_conv.inner = untag_ptr(this_obj);
42422         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42424         Route_free(this_obj_conv);
42425 }
42426
42427 ptrArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
42428         LDKRoute this_ptr_conv;
42429         this_ptr_conv.inner = untag_ptr(this_ptr);
42430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42432         this_ptr_conv.is_owned = false;
42433         LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
42434         ptrArray ret_arr = NULL;
42435         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
42436         uint64_tArray *ret_arr_ptr = (uint64_tArray*)(((uint8_t*)ret_arr) + 8);
42437         for (size_t m = 0; m < ret_var.datalen; m++) {
42438                 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
42439                 uint64_tArray ret_conv_12_arr = NULL;
42440                 ret_conv_12_arr = init_uint64_tArray(ret_conv_12_var.datalen, __LINE__);
42441                 uint64_t *ret_conv_12_arr_ptr = (uint64_t*)(((uint8_t*)ret_conv_12_arr) + 8);
42442                 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
42443                         LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
42444                         uint64_t ret_conv_12_conv_10_ref = 0;
42445                         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
42446                         ret_conv_12_conv_10_ref = tag_ptr(ret_conv_12_conv_10_var.inner, ret_conv_12_conv_10_var.is_owned);
42447                         ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
42448                 }
42449                 
42450                 FREE(ret_conv_12_var.data);
42451                 ret_arr_ptr[m] = ret_conv_12_arr;
42452         }
42453         
42454         FREE(ret_var.data);
42455         return ret_arr;
42456 }
42457
42458 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, ptrArray val) {
42459         LDKRoute this_ptr_conv;
42460         this_ptr_conv.inner = untag_ptr(this_ptr);
42461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42463         this_ptr_conv.is_owned = false;
42464         LDKCVec_CVec_RouteHopZZ val_constr;
42465         val_constr.datalen = val->arr_len;
42466         if (val_constr.datalen > 0)
42467                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
42468         else
42469                 val_constr.data = NULL;
42470         uint64_tArray* val_vals = (void*) val->elems;
42471         for (size_t m = 0; m < val_constr.datalen; m++) {
42472                 uint64_tArray val_conv_12 = val_vals[m];
42473                 LDKCVec_RouteHopZ val_conv_12_constr;
42474                 val_conv_12_constr.datalen = val_conv_12->arr_len;
42475                 if (val_conv_12_constr.datalen > 0)
42476                         val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
42477                 else
42478                         val_conv_12_constr.data = NULL;
42479                 uint64_t* val_conv_12_vals = val_conv_12->elems;
42480                 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
42481                         uint64_t val_conv_12_conv_10 = val_conv_12_vals[k];
42482                         LDKRouteHop val_conv_12_conv_10_conv;
42483                         val_conv_12_conv_10_conv.inner = untag_ptr(val_conv_12_conv_10);
42484                         val_conv_12_conv_10_conv.is_owned = ptr_is_owned(val_conv_12_conv_10);
42485                         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
42486                         val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
42487                         val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
42488                 }
42489                 FREE(val_conv_12);
42490                 val_constr.data[m] = val_conv_12_constr;
42491         }
42492         FREE(val);
42493         Route_set_paths(&this_ptr_conv, val_constr);
42494 }
42495
42496 uint64_t  __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint64_t this_ptr) {
42497         LDKRoute this_ptr_conv;
42498         this_ptr_conv.inner = untag_ptr(this_ptr);
42499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42501         this_ptr_conv.is_owned = false;
42502         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
42503         uint64_t ret_ref = 0;
42504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42506         return ret_ref;
42507 }
42508
42509 void  __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint64_t this_ptr, uint64_t val) {
42510         LDKRoute this_ptr_conv;
42511         this_ptr_conv.inner = untag_ptr(this_ptr);
42512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42514         this_ptr_conv.is_owned = false;
42515         LDKPaymentParameters val_conv;
42516         val_conv.inner = untag_ptr(val);
42517         val_conv.is_owned = ptr_is_owned(val);
42518         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42519         val_conv = PaymentParameters_clone(&val_conv);
42520         Route_set_payment_params(&this_ptr_conv, val_conv);
42521 }
42522
42523 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(ptrArray paths_arg, uint64_t payment_params_arg) {
42524         LDKCVec_CVec_RouteHopZZ paths_arg_constr;
42525         paths_arg_constr.datalen = paths_arg->arr_len;
42526         if (paths_arg_constr.datalen > 0)
42527                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
42528         else
42529                 paths_arg_constr.data = NULL;
42530         uint64_tArray* paths_arg_vals = (void*) paths_arg->elems;
42531         for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
42532                 uint64_tArray paths_arg_conv_12 = paths_arg_vals[m];
42533                 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
42534                 paths_arg_conv_12_constr.datalen = paths_arg_conv_12->arr_len;
42535                 if (paths_arg_conv_12_constr.datalen > 0)
42536                         paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
42537                 else
42538                         paths_arg_conv_12_constr.data = NULL;
42539                 uint64_t* paths_arg_conv_12_vals = paths_arg_conv_12->elems;
42540                 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
42541                         uint64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
42542                         LDKRouteHop paths_arg_conv_12_conv_10_conv;
42543                         paths_arg_conv_12_conv_10_conv.inner = untag_ptr(paths_arg_conv_12_conv_10);
42544                         paths_arg_conv_12_conv_10_conv.is_owned = ptr_is_owned(paths_arg_conv_12_conv_10);
42545                         CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
42546                         paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
42547                         paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
42548                 }
42549                 FREE(paths_arg_conv_12);
42550                 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
42551         }
42552         FREE(paths_arg);
42553         LDKPaymentParameters payment_params_arg_conv;
42554         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
42555         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
42556         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
42557         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
42558         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
42559         uint64_t ret_ref = 0;
42560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42562         return ret_ref;
42563 }
42564
42565 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
42566         LDKRoute ret_var = Route_clone(arg);
42567         uint64_t ret_ref = 0;
42568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42570         return ret_ref;
42571 }
42572 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
42573         LDKRoute arg_conv;
42574         arg_conv.inner = untag_ptr(arg);
42575         arg_conv.is_owned = ptr_is_owned(arg);
42576         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42577         arg_conv.is_owned = false;
42578         int64_t ret_conv = Route_clone_ptr(&arg_conv);
42579         return ret_conv;
42580 }
42581
42582 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
42583         LDKRoute orig_conv;
42584         orig_conv.inner = untag_ptr(orig);
42585         orig_conv.is_owned = ptr_is_owned(orig);
42586         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42587         orig_conv.is_owned = false;
42588         LDKRoute ret_var = Route_clone(&orig_conv);
42589         uint64_t ret_ref = 0;
42590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42592         return ret_ref;
42593 }
42594
42595 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
42596         LDKRoute o_conv;
42597         o_conv.inner = untag_ptr(o);
42598         o_conv.is_owned = ptr_is_owned(o);
42599         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42600         o_conv.is_owned = false;
42601         int64_t ret_conv = Route_hash(&o_conv);
42602         return ret_conv;
42603 }
42604
42605 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
42606         LDKRoute a_conv;
42607         a_conv.inner = untag_ptr(a);
42608         a_conv.is_owned = ptr_is_owned(a);
42609         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42610         a_conv.is_owned = false;
42611         LDKRoute b_conv;
42612         b_conv.inner = untag_ptr(b);
42613         b_conv.is_owned = ptr_is_owned(b);
42614         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42615         b_conv.is_owned = false;
42616         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
42617         return ret_conv;
42618 }
42619
42620 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
42621         LDKRoute this_arg_conv;
42622         this_arg_conv.inner = untag_ptr(this_arg);
42623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42625         this_arg_conv.is_owned = false;
42626         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
42627         return ret_conv;
42628 }
42629
42630 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
42631         LDKRoute this_arg_conv;
42632         this_arg_conv.inner = untag_ptr(this_arg);
42633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42635         this_arg_conv.is_owned = false;
42636         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
42637         return ret_conv;
42638 }
42639
42640 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
42641         LDKRoute obj_conv;
42642         obj_conv.inner = untag_ptr(obj);
42643         obj_conv.is_owned = ptr_is_owned(obj);
42644         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42645         obj_conv.is_owned = false;
42646         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
42647         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42648         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42649         CVec_u8Z_free(ret_var);
42650         return ret_arr;
42651 }
42652
42653 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
42654         LDKu8slice ser_ref;
42655         ser_ref.datalen = ser->arr_len;
42656         ser_ref.data = ser->elems;
42657         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
42658         *ret_conv = Route_read(ser_ref);
42659         FREE(ser);
42660         return tag_ptr(ret_conv, true);
42661 }
42662
42663 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
42664         LDKRouteParameters this_obj_conv;
42665         this_obj_conv.inner = untag_ptr(this_obj);
42666         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42668         RouteParameters_free(this_obj_conv);
42669 }
42670
42671 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
42672         LDKRouteParameters this_ptr_conv;
42673         this_ptr_conv.inner = untag_ptr(this_ptr);
42674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42676         this_ptr_conv.is_owned = false;
42677         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
42678         uint64_t ret_ref = 0;
42679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42681         return ret_ref;
42682 }
42683
42684 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
42685         LDKRouteParameters this_ptr_conv;
42686         this_ptr_conv.inner = untag_ptr(this_ptr);
42687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42689         this_ptr_conv.is_owned = false;
42690         LDKPaymentParameters val_conv;
42691         val_conv.inner = untag_ptr(val);
42692         val_conv.is_owned = ptr_is_owned(val);
42693         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42694         val_conv = PaymentParameters_clone(&val_conv);
42695         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
42696 }
42697
42698 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
42699         LDKRouteParameters this_ptr_conv;
42700         this_ptr_conv.inner = untag_ptr(this_ptr);
42701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42703         this_ptr_conv.is_owned = false;
42704         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
42705         return ret_conv;
42706 }
42707
42708 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
42709         LDKRouteParameters this_ptr_conv;
42710         this_ptr_conv.inner = untag_ptr(this_ptr);
42711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42713         this_ptr_conv.is_owned = false;
42714         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
42715 }
42716
42717 int32_t  __attribute__((export_name("TS_RouteParameters_get_final_cltv_expiry_delta"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint64_t this_ptr) {
42718         LDKRouteParameters this_ptr_conv;
42719         this_ptr_conv.inner = untag_ptr(this_ptr);
42720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42722         this_ptr_conv.is_owned = false;
42723         int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
42724         return ret_conv;
42725 }
42726
42727 void  __attribute__((export_name("TS_RouteParameters_set_final_cltv_expiry_delta"))) TS_RouteParameters_set_final_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
42728         LDKRouteParameters this_ptr_conv;
42729         this_ptr_conv.inner = untag_ptr(this_ptr);
42730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42732         this_ptr_conv.is_owned = false;
42733         RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
42734 }
42735
42736 uint64_t  __attribute__((export_name("TS_RouteParameters_new"))) TS_RouteParameters_new(uint64_t payment_params_arg, int64_t final_value_msat_arg, int32_t final_cltv_expiry_delta_arg) {
42737         LDKPaymentParameters payment_params_arg_conv;
42738         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
42739         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
42740         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
42741         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
42742         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
42743         uint64_t ret_ref = 0;
42744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42746         return ret_ref;
42747 }
42748
42749 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
42750         LDKRouteParameters ret_var = RouteParameters_clone(arg);
42751         uint64_t ret_ref = 0;
42752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42754         return ret_ref;
42755 }
42756 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
42757         LDKRouteParameters arg_conv;
42758         arg_conv.inner = untag_ptr(arg);
42759         arg_conv.is_owned = ptr_is_owned(arg);
42760         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42761         arg_conv.is_owned = false;
42762         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
42763         return ret_conv;
42764 }
42765
42766 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
42767         LDKRouteParameters orig_conv;
42768         orig_conv.inner = untag_ptr(orig);
42769         orig_conv.is_owned = ptr_is_owned(orig);
42770         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42771         orig_conv.is_owned = false;
42772         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
42773         uint64_t ret_ref = 0;
42774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42776         return ret_ref;
42777 }
42778
42779 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
42780         LDKRouteParameters obj_conv;
42781         obj_conv.inner = untag_ptr(obj);
42782         obj_conv.is_owned = ptr_is_owned(obj);
42783         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42784         obj_conv.is_owned = false;
42785         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
42786         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42787         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42788         CVec_u8Z_free(ret_var);
42789         return ret_arr;
42790 }
42791
42792 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
42793         LDKu8slice ser_ref;
42794         ser_ref.datalen = ser->arr_len;
42795         ser_ref.data = ser->elems;
42796         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
42797         *ret_conv = RouteParameters_read(ser_ref);
42798         FREE(ser);
42799         return tag_ptr(ret_conv, true);
42800 }
42801
42802 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
42803         LDKPaymentParameters this_obj_conv;
42804         this_obj_conv.inner = untag_ptr(this_obj);
42805         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42807         PaymentParameters_free(this_obj_conv);
42808 }
42809
42810 int8_tArray  __attribute__((export_name("TS_PaymentParameters_get_payee_pubkey"))) TS_PaymentParameters_get_payee_pubkey(uint64_t this_ptr) {
42811         LDKPaymentParameters this_ptr_conv;
42812         this_ptr_conv.inner = untag_ptr(this_ptr);
42813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42815         this_ptr_conv.is_owned = false;
42816         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42817         memcpy(ret_arr->elems, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form, 33);
42818         return ret_arr;
42819 }
42820
42821 void  __attribute__((export_name("TS_PaymentParameters_set_payee_pubkey"))) TS_PaymentParameters_set_payee_pubkey(uint64_t this_ptr, int8_tArray val) {
42822         LDKPaymentParameters this_ptr_conv;
42823         this_ptr_conv.inner = untag_ptr(this_ptr);
42824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42826         this_ptr_conv.is_owned = false;
42827         LDKPublicKey val_ref;
42828         CHECK(val->arr_len == 33);
42829         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42830         PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
42831 }
42832
42833 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_features"))) TS_PaymentParameters_get_features(uint64_t this_ptr) {
42834         LDKPaymentParameters this_ptr_conv;
42835         this_ptr_conv.inner = untag_ptr(this_ptr);
42836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42838         this_ptr_conv.is_owned = false;
42839         LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
42840         uint64_t ret_ref = 0;
42841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42843         return ret_ref;
42844 }
42845
42846 void  __attribute__((export_name("TS_PaymentParameters_set_features"))) TS_PaymentParameters_set_features(uint64_t this_ptr, uint64_t val) {
42847         LDKPaymentParameters this_ptr_conv;
42848         this_ptr_conv.inner = untag_ptr(this_ptr);
42849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42851         this_ptr_conv.is_owned = false;
42852         LDKInvoiceFeatures val_conv;
42853         val_conv.inner = untag_ptr(val);
42854         val_conv.is_owned = ptr_is_owned(val);
42855         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42856         val_conv = InvoiceFeatures_clone(&val_conv);
42857         PaymentParameters_set_features(&this_ptr_conv, val_conv);
42858 }
42859
42860 uint64_tArray  __attribute__((export_name("TS_PaymentParameters_get_route_hints"))) TS_PaymentParameters_get_route_hints(uint64_t this_ptr) {
42861         LDKPaymentParameters this_ptr_conv;
42862         this_ptr_conv.inner = untag_ptr(this_ptr);
42863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42865         this_ptr_conv.is_owned = false;
42866         LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
42867         uint64_tArray ret_arr = NULL;
42868         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42869         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42870         for (size_t l = 0; l < ret_var.datalen; l++) {
42871                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
42872                 uint64_t ret_conv_11_ref = 0;
42873                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
42874                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
42875                 ret_arr_ptr[l] = ret_conv_11_ref;
42876         }
42877         
42878         FREE(ret_var.data);
42879         return ret_arr;
42880 }
42881
42882 void  __attribute__((export_name("TS_PaymentParameters_set_route_hints"))) TS_PaymentParameters_set_route_hints(uint64_t this_ptr, uint64_tArray val) {
42883         LDKPaymentParameters this_ptr_conv;
42884         this_ptr_conv.inner = untag_ptr(this_ptr);
42885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42887         this_ptr_conv.is_owned = false;
42888         LDKCVec_RouteHintZ val_constr;
42889         val_constr.datalen = val->arr_len;
42890         if (val_constr.datalen > 0)
42891                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
42892         else
42893                 val_constr.data = NULL;
42894         uint64_t* val_vals = val->elems;
42895         for (size_t l = 0; l < val_constr.datalen; l++) {
42896                 uint64_t val_conv_11 = val_vals[l];
42897                 LDKRouteHint val_conv_11_conv;
42898                 val_conv_11_conv.inner = untag_ptr(val_conv_11);
42899                 val_conv_11_conv.is_owned = ptr_is_owned(val_conv_11);
42900                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
42901                 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
42902                 val_constr.data[l] = val_conv_11_conv;
42903         }
42904         FREE(val);
42905         PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
42906 }
42907
42908 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
42909         LDKPaymentParameters this_ptr_conv;
42910         this_ptr_conv.inner = untag_ptr(this_ptr);
42911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42913         this_ptr_conv.is_owned = false;
42914         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42915         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
42916         uint64_t ret_ref = tag_ptr(ret_copy, true);
42917         return ret_ref;
42918 }
42919
42920 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
42921         LDKPaymentParameters this_ptr_conv;
42922         this_ptr_conv.inner = untag_ptr(this_ptr);
42923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42925         this_ptr_conv.is_owned = false;
42926         void* val_ptr = untag_ptr(val);
42927         CHECK_ACCESS(val_ptr);
42928         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42929         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42930         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
42931 }
42932
42933 int32_t  __attribute__((export_name("TS_PaymentParameters_get_max_total_cltv_expiry_delta"))) TS_PaymentParameters_get_max_total_cltv_expiry_delta(uint64_t this_ptr) {
42934         LDKPaymentParameters this_ptr_conv;
42935         this_ptr_conv.inner = untag_ptr(this_ptr);
42936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42938         this_ptr_conv.is_owned = false;
42939         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
42940         return ret_conv;
42941 }
42942
42943 void  __attribute__((export_name("TS_PaymentParameters_set_max_total_cltv_expiry_delta"))) TS_PaymentParameters_set_max_total_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
42944         LDKPaymentParameters this_ptr_conv;
42945         this_ptr_conv.inner = untag_ptr(this_ptr);
42946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42948         this_ptr_conv.is_owned = false;
42949         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
42950 }
42951
42952 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
42953         LDKPaymentParameters this_ptr_conv;
42954         this_ptr_conv.inner = untag_ptr(this_ptr);
42955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42957         this_ptr_conv.is_owned = false;
42958         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
42959         return ret_conv;
42960 }
42961
42962 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
42963         LDKPaymentParameters this_ptr_conv;
42964         this_ptr_conv.inner = untag_ptr(this_ptr);
42965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42967         this_ptr_conv.is_owned = false;
42968         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
42969 }
42970
42971 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_channel_saturation_power_of_half"))) TS_PaymentParameters_get_max_channel_saturation_power_of_half(uint64_t this_ptr) {
42972         LDKPaymentParameters this_ptr_conv;
42973         this_ptr_conv.inner = untag_ptr(this_ptr);
42974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42976         this_ptr_conv.is_owned = false;
42977         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
42978         return ret_conv;
42979 }
42980
42981 void  __attribute__((export_name("TS_PaymentParameters_set_max_channel_saturation_power_of_half"))) TS_PaymentParameters_set_max_channel_saturation_power_of_half(uint64_t this_ptr, int8_t val) {
42982         LDKPaymentParameters this_ptr_conv;
42983         this_ptr_conv.inner = untag_ptr(this_ptr);
42984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42986         this_ptr_conv.is_owned = false;
42987         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
42988 }
42989
42990 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
42991         LDKPaymentParameters this_ptr_conv;
42992         this_ptr_conv.inner = untag_ptr(this_ptr);
42993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42995         this_ptr_conv.is_owned = false;
42996         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
42997         int64_tArray ret_arr = NULL;
42998         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
42999         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
43000         for (size_t i = 0; i < ret_var.datalen; i++) {
43001                 int64_t ret_conv_8_conv = ret_var.data[i];
43002                 ret_arr_ptr[i] = ret_conv_8_conv;
43003         }
43004         
43005         FREE(ret_var.data);
43006         return ret_arr;
43007 }
43008
43009 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
43010         LDKPaymentParameters this_ptr_conv;
43011         this_ptr_conv.inner = untag_ptr(this_ptr);
43012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43014         this_ptr_conv.is_owned = false;
43015         LDKCVec_u64Z val_constr;
43016         val_constr.datalen = val->arr_len;
43017         if (val_constr.datalen > 0)
43018                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
43019         else
43020                 val_constr.data = NULL;
43021         int64_t* val_vals = val->elems;
43022         for (size_t i = 0; i < val_constr.datalen; i++) {
43023                 int64_t val_conv_8 = val_vals[i];
43024                 val_constr.data[i] = val_conv_8;
43025         }
43026         FREE(val);
43027         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
43028 }
43029
43030 uint64_t  __attribute__((export_name("TS_PaymentParameters_new"))) TS_PaymentParameters_new(int8_tArray payee_pubkey_arg, uint64_t features_arg, uint64_tArray route_hints_arg, uint64_t expiry_time_arg, int32_t max_total_cltv_expiry_delta_arg, int8_t max_path_count_arg, int8_t max_channel_saturation_power_of_half_arg, int64_tArray previously_failed_channels_arg) {
43031         LDKPublicKey payee_pubkey_arg_ref;
43032         CHECK(payee_pubkey_arg->arr_len == 33);
43033         memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg);
43034         LDKInvoiceFeatures features_arg_conv;
43035         features_arg_conv.inner = untag_ptr(features_arg);
43036         features_arg_conv.is_owned = ptr_is_owned(features_arg);
43037         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
43038         features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
43039         LDKCVec_RouteHintZ route_hints_arg_constr;
43040         route_hints_arg_constr.datalen = route_hints_arg->arr_len;
43041         if (route_hints_arg_constr.datalen > 0)
43042                 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
43043         else
43044                 route_hints_arg_constr.data = NULL;
43045         uint64_t* route_hints_arg_vals = route_hints_arg->elems;
43046         for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
43047                 uint64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
43048                 LDKRouteHint route_hints_arg_conv_11_conv;
43049                 route_hints_arg_conv_11_conv.inner = untag_ptr(route_hints_arg_conv_11);
43050                 route_hints_arg_conv_11_conv.is_owned = ptr_is_owned(route_hints_arg_conv_11);
43051                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
43052                 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
43053                 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
43054         }
43055         FREE(route_hints_arg);
43056         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
43057         CHECK_ACCESS(expiry_time_arg_ptr);
43058         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
43059         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
43060         LDKCVec_u64Z previously_failed_channels_arg_constr;
43061         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
43062         if (previously_failed_channels_arg_constr.datalen > 0)
43063                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
43064         else
43065                 previously_failed_channels_arg_constr.data = NULL;
43066         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
43067         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
43068                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
43069                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
43070         }
43071         FREE(previously_failed_channels_arg);
43072         LDKPaymentParameters ret_var = PaymentParameters_new(payee_pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv, max_total_cltv_expiry_delta_arg, max_path_count_arg, max_channel_saturation_power_of_half_arg, previously_failed_channels_arg_constr);
43073         uint64_t ret_ref = 0;
43074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43076         return ret_ref;
43077 }
43078
43079 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
43080         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
43081         uint64_t ret_ref = 0;
43082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43084         return ret_ref;
43085 }
43086 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
43087         LDKPaymentParameters arg_conv;
43088         arg_conv.inner = untag_ptr(arg);
43089         arg_conv.is_owned = ptr_is_owned(arg);
43090         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43091         arg_conv.is_owned = false;
43092         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
43093         return ret_conv;
43094 }
43095
43096 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
43097         LDKPaymentParameters orig_conv;
43098         orig_conv.inner = untag_ptr(orig);
43099         orig_conv.is_owned = ptr_is_owned(orig);
43100         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43101         orig_conv.is_owned = false;
43102         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
43103         uint64_t ret_ref = 0;
43104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43106         return ret_ref;
43107 }
43108
43109 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
43110         LDKPaymentParameters o_conv;
43111         o_conv.inner = untag_ptr(o);
43112         o_conv.is_owned = ptr_is_owned(o);
43113         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43114         o_conv.is_owned = false;
43115         int64_t ret_conv = PaymentParameters_hash(&o_conv);
43116         return ret_conv;
43117 }
43118
43119 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
43120         LDKPaymentParameters a_conv;
43121         a_conv.inner = untag_ptr(a);
43122         a_conv.is_owned = ptr_is_owned(a);
43123         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43124         a_conv.is_owned = false;
43125         LDKPaymentParameters b_conv;
43126         b_conv.inner = untag_ptr(b);
43127         b_conv.is_owned = ptr_is_owned(b);
43128         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43129         b_conv.is_owned = false;
43130         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
43131         return ret_conv;
43132 }
43133
43134 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
43135         LDKPaymentParameters obj_conv;
43136         obj_conv.inner = untag_ptr(obj);
43137         obj_conv.is_owned = ptr_is_owned(obj);
43138         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43139         obj_conv.is_owned = false;
43140         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
43141         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43142         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43143         CVec_u8Z_free(ret_var);
43144         return ret_arr;
43145 }
43146
43147 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser) {
43148         LDKu8slice ser_ref;
43149         ser_ref.datalen = ser->arr_len;
43150         ser_ref.data = ser->elems;
43151         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
43152         *ret_conv = PaymentParameters_read(ser_ref);
43153         FREE(ser);
43154         return tag_ptr(ret_conv, true);
43155 }
43156
43157 uint64_t  __attribute__((export_name("TS_PaymentParameters_from_node_id"))) TS_PaymentParameters_from_node_id(int8_tArray payee_pubkey) {
43158         LDKPublicKey payee_pubkey_ref;
43159         CHECK(payee_pubkey->arr_len == 33);
43160         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
43161         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
43162         uint64_t ret_ref = 0;
43163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43165         return ret_ref;
43166 }
43167
43168 uint64_t  __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey) {
43169         LDKPublicKey payee_pubkey_ref;
43170         CHECK(payee_pubkey->arr_len == 33);
43171         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
43172         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
43173         uint64_t ret_ref = 0;
43174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43176         return ret_ref;
43177 }
43178
43179 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
43180         LDKRouteHint this_obj_conv;
43181         this_obj_conv.inner = untag_ptr(this_obj);
43182         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43184         RouteHint_free(this_obj_conv);
43185 }
43186
43187 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
43188         LDKRouteHint this_ptr_conv;
43189         this_ptr_conv.inner = untag_ptr(this_ptr);
43190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43192         this_ptr_conv.is_owned = false;
43193         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
43194         uint64_tArray ret_arr = NULL;
43195         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
43196         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
43197         for (size_t o = 0; o < ret_var.datalen; o++) {
43198                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
43199                 uint64_t ret_conv_14_ref = 0;
43200                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
43201                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
43202                 ret_arr_ptr[o] = ret_conv_14_ref;
43203         }
43204         
43205         FREE(ret_var.data);
43206         return ret_arr;
43207 }
43208
43209 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
43210         LDKRouteHint this_ptr_conv;
43211         this_ptr_conv.inner = untag_ptr(this_ptr);
43212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43214         this_ptr_conv.is_owned = false;
43215         LDKCVec_RouteHintHopZ val_constr;
43216         val_constr.datalen = val->arr_len;
43217         if (val_constr.datalen > 0)
43218                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
43219         else
43220                 val_constr.data = NULL;
43221         uint64_t* val_vals = val->elems;
43222         for (size_t o = 0; o < val_constr.datalen; o++) {
43223                 uint64_t val_conv_14 = val_vals[o];
43224                 LDKRouteHintHop val_conv_14_conv;
43225                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
43226                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
43227                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
43228                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
43229                 val_constr.data[o] = val_conv_14_conv;
43230         }
43231         FREE(val);
43232         RouteHint_set_a(&this_ptr_conv, val_constr);
43233 }
43234
43235 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
43236         LDKCVec_RouteHintHopZ a_arg_constr;
43237         a_arg_constr.datalen = a_arg->arr_len;
43238         if (a_arg_constr.datalen > 0)
43239                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
43240         else
43241                 a_arg_constr.data = NULL;
43242         uint64_t* a_arg_vals = a_arg->elems;
43243         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
43244                 uint64_t a_arg_conv_14 = a_arg_vals[o];
43245                 LDKRouteHintHop a_arg_conv_14_conv;
43246                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
43247                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
43248                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
43249                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
43250                 a_arg_constr.data[o] = a_arg_conv_14_conv;
43251         }
43252         FREE(a_arg);
43253         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
43254         uint64_t ret_ref = 0;
43255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43257         return ret_ref;
43258 }
43259
43260 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
43261         LDKRouteHint ret_var = RouteHint_clone(arg);
43262         uint64_t ret_ref = 0;
43263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43265         return ret_ref;
43266 }
43267 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
43268         LDKRouteHint arg_conv;
43269         arg_conv.inner = untag_ptr(arg);
43270         arg_conv.is_owned = ptr_is_owned(arg);
43271         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43272         arg_conv.is_owned = false;
43273         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
43274         return ret_conv;
43275 }
43276
43277 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
43278         LDKRouteHint orig_conv;
43279         orig_conv.inner = untag_ptr(orig);
43280         orig_conv.is_owned = ptr_is_owned(orig);
43281         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43282         orig_conv.is_owned = false;
43283         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
43284         uint64_t ret_ref = 0;
43285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43287         return ret_ref;
43288 }
43289
43290 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
43291         LDKRouteHint o_conv;
43292         o_conv.inner = untag_ptr(o);
43293         o_conv.is_owned = ptr_is_owned(o);
43294         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43295         o_conv.is_owned = false;
43296         int64_t ret_conv = RouteHint_hash(&o_conv);
43297         return ret_conv;
43298 }
43299
43300 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
43301         LDKRouteHint a_conv;
43302         a_conv.inner = untag_ptr(a);
43303         a_conv.is_owned = ptr_is_owned(a);
43304         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43305         a_conv.is_owned = false;
43306         LDKRouteHint b_conv;
43307         b_conv.inner = untag_ptr(b);
43308         b_conv.is_owned = ptr_is_owned(b);
43309         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43310         b_conv.is_owned = false;
43311         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
43312         return ret_conv;
43313 }
43314
43315 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
43316         LDKRouteHint obj_conv;
43317         obj_conv.inner = untag_ptr(obj);
43318         obj_conv.is_owned = ptr_is_owned(obj);
43319         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43320         obj_conv.is_owned = false;
43321         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
43322         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43323         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43324         CVec_u8Z_free(ret_var);
43325         return ret_arr;
43326 }
43327
43328 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
43329         LDKu8slice ser_ref;
43330         ser_ref.datalen = ser->arr_len;
43331         ser_ref.data = ser->elems;
43332         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
43333         *ret_conv = RouteHint_read(ser_ref);
43334         FREE(ser);
43335         return tag_ptr(ret_conv, true);
43336 }
43337
43338 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
43339         LDKRouteHintHop this_obj_conv;
43340         this_obj_conv.inner = untag_ptr(this_obj);
43341         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43343         RouteHintHop_free(this_obj_conv);
43344 }
43345
43346 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
43347         LDKRouteHintHop this_ptr_conv;
43348         this_ptr_conv.inner = untag_ptr(this_ptr);
43349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43351         this_ptr_conv.is_owned = false;
43352         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43353         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
43354         return ret_arr;
43355 }
43356
43357 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
43358         LDKRouteHintHop this_ptr_conv;
43359         this_ptr_conv.inner = untag_ptr(this_ptr);
43360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43362         this_ptr_conv.is_owned = false;
43363         LDKPublicKey val_ref;
43364         CHECK(val->arr_len == 33);
43365         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43366         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
43367 }
43368
43369 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
43370         LDKRouteHintHop this_ptr_conv;
43371         this_ptr_conv.inner = untag_ptr(this_ptr);
43372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43374         this_ptr_conv.is_owned = false;
43375         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
43376         return ret_conv;
43377 }
43378
43379 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
43380         LDKRouteHintHop this_ptr_conv;
43381         this_ptr_conv.inner = untag_ptr(this_ptr);
43382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43384         this_ptr_conv.is_owned = false;
43385         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
43386 }
43387
43388 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
43389         LDKRouteHintHop this_ptr_conv;
43390         this_ptr_conv.inner = untag_ptr(this_ptr);
43391         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43393         this_ptr_conv.is_owned = false;
43394         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
43395         uint64_t ret_ref = 0;
43396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43398         return ret_ref;
43399 }
43400
43401 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
43402         LDKRouteHintHop this_ptr_conv;
43403         this_ptr_conv.inner = untag_ptr(this_ptr);
43404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43406         this_ptr_conv.is_owned = false;
43407         LDKRoutingFees val_conv;
43408         val_conv.inner = untag_ptr(val);
43409         val_conv.is_owned = ptr_is_owned(val);
43410         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43411         val_conv = RoutingFees_clone(&val_conv);
43412         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
43413 }
43414
43415 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
43416         LDKRouteHintHop this_ptr_conv;
43417         this_ptr_conv.inner = untag_ptr(this_ptr);
43418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43420         this_ptr_conv.is_owned = false;
43421         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
43422         return ret_conv;
43423 }
43424
43425 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
43426         LDKRouteHintHop this_ptr_conv;
43427         this_ptr_conv.inner = untag_ptr(this_ptr);
43428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43430         this_ptr_conv.is_owned = false;
43431         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
43432 }
43433
43434 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
43435         LDKRouteHintHop this_ptr_conv;
43436         this_ptr_conv.inner = untag_ptr(this_ptr);
43437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43439         this_ptr_conv.is_owned = false;
43440         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43441         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
43442         uint64_t ret_ref = tag_ptr(ret_copy, true);
43443         return ret_ref;
43444 }
43445
43446 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
43447         LDKRouteHintHop this_ptr_conv;
43448         this_ptr_conv.inner = untag_ptr(this_ptr);
43449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43451         this_ptr_conv.is_owned = false;
43452         void* val_ptr = untag_ptr(val);
43453         CHECK_ACCESS(val_ptr);
43454         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
43455         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
43456         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
43457 }
43458
43459 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
43460         LDKRouteHintHop this_ptr_conv;
43461         this_ptr_conv.inner = untag_ptr(this_ptr);
43462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43464         this_ptr_conv.is_owned = false;
43465         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43466         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
43467         uint64_t ret_ref = tag_ptr(ret_copy, true);
43468         return ret_ref;
43469 }
43470
43471 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
43472         LDKRouteHintHop this_ptr_conv;
43473         this_ptr_conv.inner = untag_ptr(this_ptr);
43474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43476         this_ptr_conv.is_owned = false;
43477         void* val_ptr = untag_ptr(val);
43478         CHECK_ACCESS(val_ptr);
43479         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
43480         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
43481         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
43482 }
43483
43484 uint64_t  __attribute__((export_name("TS_RouteHintHop_new"))) TS_RouteHintHop_new(int8_tArray src_node_id_arg, int64_t short_channel_id_arg, uint64_t fees_arg, int16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg) {
43485         LDKPublicKey src_node_id_arg_ref;
43486         CHECK(src_node_id_arg->arr_len == 33);
43487         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
43488         LDKRoutingFees fees_arg_conv;
43489         fees_arg_conv.inner = untag_ptr(fees_arg);
43490         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
43491         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
43492         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
43493         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
43494         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
43495         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
43496         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
43497         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
43498         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
43499         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
43500         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
43501         LDKRouteHintHop ret_var = RouteHintHop_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv);
43502         uint64_t ret_ref = 0;
43503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43505         return ret_ref;
43506 }
43507
43508 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
43509         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
43510         uint64_t ret_ref = 0;
43511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43513         return ret_ref;
43514 }
43515 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
43516         LDKRouteHintHop arg_conv;
43517         arg_conv.inner = untag_ptr(arg);
43518         arg_conv.is_owned = ptr_is_owned(arg);
43519         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43520         arg_conv.is_owned = false;
43521         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
43522         return ret_conv;
43523 }
43524
43525 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
43526         LDKRouteHintHop orig_conv;
43527         orig_conv.inner = untag_ptr(orig);
43528         orig_conv.is_owned = ptr_is_owned(orig);
43529         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43530         orig_conv.is_owned = false;
43531         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
43532         uint64_t ret_ref = 0;
43533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43535         return ret_ref;
43536 }
43537
43538 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
43539         LDKRouteHintHop o_conv;
43540         o_conv.inner = untag_ptr(o);
43541         o_conv.is_owned = ptr_is_owned(o);
43542         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43543         o_conv.is_owned = false;
43544         int64_t ret_conv = RouteHintHop_hash(&o_conv);
43545         return ret_conv;
43546 }
43547
43548 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
43549         LDKRouteHintHop a_conv;
43550         a_conv.inner = untag_ptr(a);
43551         a_conv.is_owned = ptr_is_owned(a);
43552         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43553         a_conv.is_owned = false;
43554         LDKRouteHintHop b_conv;
43555         b_conv.inner = untag_ptr(b);
43556         b_conv.is_owned = ptr_is_owned(b);
43557         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43558         b_conv.is_owned = false;
43559         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
43560         return ret_conv;
43561 }
43562
43563 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
43564         LDKRouteHintHop obj_conv;
43565         obj_conv.inner = untag_ptr(obj);
43566         obj_conv.is_owned = ptr_is_owned(obj);
43567         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43568         obj_conv.is_owned = false;
43569         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
43570         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43571         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43572         CVec_u8Z_free(ret_var);
43573         return ret_arr;
43574 }
43575
43576 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
43577         LDKu8slice ser_ref;
43578         ser_ref.datalen = ser->arr_len;
43579         ser_ref.data = ser->elems;
43580         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
43581         *ret_conv = RouteHintHop_read(ser_ref);
43582         FREE(ser);
43583         return tag_ptr(ret_conv, true);
43584 }
43585
43586 uint64_t  __attribute__((export_name("TS_find_route"))) TS_find_route(int8_tArray our_node_pubkey, uint64_t route_params, uint64_t network_graph, uint64_tArray first_hops, uint64_t logger, uint64_t scorer, int8_tArray random_seed_bytes) {
43587         LDKPublicKey our_node_pubkey_ref;
43588         CHECK(our_node_pubkey->arr_len == 33);
43589         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
43590         LDKRouteParameters route_params_conv;
43591         route_params_conv.inner = untag_ptr(route_params);
43592         route_params_conv.is_owned = ptr_is_owned(route_params);
43593         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
43594         route_params_conv.is_owned = false;
43595         LDKNetworkGraph network_graph_conv;
43596         network_graph_conv.inner = untag_ptr(network_graph);
43597         network_graph_conv.is_owned = ptr_is_owned(network_graph);
43598         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43599         network_graph_conv.is_owned = false;
43600         LDKCVec_ChannelDetailsZ first_hops_constr;
43601         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
43602         if (first_hops != 0) {
43603                 first_hops_constr.datalen = first_hops->arr_len;
43604                 if (first_hops_constr.datalen > 0)
43605                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
43606                 else
43607                         first_hops_constr.data = NULL;
43608                 uint64_t* first_hops_vals = first_hops->elems;
43609                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
43610                         uint64_t first_hops_conv_16 = first_hops_vals[q];
43611                         LDKChannelDetails first_hops_conv_16_conv;
43612                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
43613                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
43614                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
43615                         first_hops_conv_16_conv.is_owned = false;
43616                         first_hops_constr.data[q] = first_hops_conv_16_conv;
43617                 }
43618                 FREE(first_hops);
43619                 first_hops_ptr = &first_hops_constr;
43620         }
43621         void* logger_ptr = untag_ptr(logger);
43622         CHECK_ACCESS(logger_ptr);
43623         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43624         if (logger_conv.free == LDKLogger_JCalls_free) {
43625                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43626                 LDKLogger_JCalls_cloned(&logger_conv);
43627         }
43628         void* scorer_ptr = untag_ptr(scorer);
43629         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
43630         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
43631         unsigned char random_seed_bytes_arr[32];
43632         CHECK(random_seed_bytes->arr_len == 32);
43633         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
43634         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
43635         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
43636         *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_graph_conv, first_hops_ptr, logger_conv, scorer_conv, random_seed_bytes_ref);
43637         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
43638         return tag_ptr(ret_conv, true);
43639 }
43640
43641 uint64_t  __attribute__((export_name("TS_build_route_from_hops"))) TS_build_route_from_hops(int8_tArray our_node_pubkey, ptrArray hops, uint64_t route_params, uint64_t network_graph, uint64_t logger, int8_tArray random_seed_bytes) {
43642         LDKPublicKey our_node_pubkey_ref;
43643         CHECK(our_node_pubkey->arr_len == 33);
43644         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
43645         LDKCVec_PublicKeyZ hops_constr;
43646         hops_constr.datalen = hops->arr_len;
43647         if (hops_constr.datalen > 0)
43648                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
43649         else
43650                 hops_constr.data = NULL;
43651         int8_tArray* hops_vals = (void*) hops->elems;
43652         for (size_t m = 0; m < hops_constr.datalen; m++) {
43653                 int8_tArray hops_conv_12 = hops_vals[m];
43654                 LDKPublicKey hops_conv_12_ref;
43655                 CHECK(hops_conv_12->arr_len == 33);
43656                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
43657                 hops_constr.data[m] = hops_conv_12_ref;
43658         }
43659         FREE(hops);
43660         LDKRouteParameters route_params_conv;
43661         route_params_conv.inner = untag_ptr(route_params);
43662         route_params_conv.is_owned = ptr_is_owned(route_params);
43663         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
43664         route_params_conv.is_owned = false;
43665         LDKNetworkGraph network_graph_conv;
43666         network_graph_conv.inner = untag_ptr(network_graph);
43667         network_graph_conv.is_owned = ptr_is_owned(network_graph);
43668         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43669         network_graph_conv.is_owned = false;
43670         void* logger_ptr = untag_ptr(logger);
43671         CHECK_ACCESS(logger_ptr);
43672         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43673         if (logger_conv.free == LDKLogger_JCalls_free) {
43674                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43675                 LDKLogger_JCalls_cloned(&logger_conv);
43676         }
43677         unsigned char random_seed_bytes_arr[32];
43678         CHECK(random_seed_bytes->arr_len == 32);
43679         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
43680         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
43681         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
43682         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
43683         return tag_ptr(ret_conv, true);
43684 }
43685
43686 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
43687         if (!ptr_is_owned(this_ptr)) return;
43688         void* this_ptr_ptr = untag_ptr(this_ptr);
43689         CHECK_ACCESS(this_ptr_ptr);
43690         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
43691         FREE(untag_ptr(this_ptr));
43692         Score_free(this_ptr_conv);
43693 }
43694
43695 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
43696         if (!ptr_is_owned(this_ptr)) return;
43697         void* this_ptr_ptr = untag_ptr(this_ptr);
43698         CHECK_ACCESS(this_ptr_ptr);
43699         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
43700         FREE(untag_ptr(this_ptr));
43701         LockableScore_free(this_ptr_conv);
43702 }
43703
43704 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
43705         if (!ptr_is_owned(this_ptr)) return;
43706         void* this_ptr_ptr = untag_ptr(this_ptr);
43707         CHECK_ACCESS(this_ptr_ptr);
43708         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
43709         FREE(untag_ptr(this_ptr));
43710         WriteableScore_free(this_ptr_conv);
43711 }
43712
43713 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
43714         LDKMultiThreadedLockableScore this_obj_conv;
43715         this_obj_conv.inner = untag_ptr(this_obj);
43716         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43718         MultiThreadedLockableScore_free(this_obj_conv);
43719 }
43720
43721 void  __attribute__((export_name("TS_MultiThreadedScoreLock_free"))) TS_MultiThreadedScoreLock_free(uint64_t this_obj) {
43722         LDKMultiThreadedScoreLock this_obj_conv;
43723         this_obj_conv.inner = untag_ptr(this_obj);
43724         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43726         MultiThreadedScoreLock_free(this_obj_conv);
43727 }
43728
43729 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLock_as_Score"))) TS_MultiThreadedScoreLock_as_Score(uint64_t this_arg) {
43730         LDKMultiThreadedScoreLock this_arg_conv;
43731         this_arg_conv.inner = untag_ptr(this_arg);
43732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43734         this_arg_conv.is_owned = false;
43735         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
43736         *ret_ret = MultiThreadedScoreLock_as_Score(&this_arg_conv);
43737         return tag_ptr(ret_ret, true);
43738 }
43739
43740 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLock_write"))) TS_MultiThreadedScoreLock_write(uint64_t obj) {
43741         LDKMultiThreadedScoreLock obj_conv;
43742         obj_conv.inner = untag_ptr(obj);
43743         obj_conv.is_owned = ptr_is_owned(obj);
43744         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43745         obj_conv.is_owned = false;
43746         LDKCVec_u8Z ret_var = MultiThreadedScoreLock_write(&obj_conv);
43747         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43748         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43749         CVec_u8Z_free(ret_var);
43750         return ret_arr;
43751 }
43752
43753 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
43754         LDKMultiThreadedLockableScore this_arg_conv;
43755         this_arg_conv.inner = untag_ptr(this_arg);
43756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43758         this_arg_conv.is_owned = false;
43759         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
43760         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
43761         return tag_ptr(ret_ret, true);
43762 }
43763
43764 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
43765         LDKMultiThreadedLockableScore obj_conv;
43766         obj_conv.inner = untag_ptr(obj);
43767         obj_conv.is_owned = ptr_is_owned(obj);
43768         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43769         obj_conv.is_owned = false;
43770         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
43771         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43772         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43773         CVec_u8Z_free(ret_var);
43774         return ret_arr;
43775 }
43776
43777 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
43778         LDKMultiThreadedLockableScore this_arg_conv;
43779         this_arg_conv.inner = untag_ptr(this_arg);
43780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43782         this_arg_conv.is_owned = false;
43783         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
43784         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
43785         return tag_ptr(ret_ret, true);
43786 }
43787
43788 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
43789         void* score_ptr = untag_ptr(score);
43790         CHECK_ACCESS(score_ptr);
43791         LDKScore score_conv = *(LDKScore*)(score_ptr);
43792         if (score_conv.free == LDKScore_JCalls_free) {
43793                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43794                 LDKScore_JCalls_cloned(&score_conv);
43795         }
43796         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
43797         uint64_t ret_ref = 0;
43798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43800         return ret_ref;
43801 }
43802
43803 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
43804         LDKChannelUsage this_obj_conv;
43805         this_obj_conv.inner = untag_ptr(this_obj);
43806         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43808         ChannelUsage_free(this_obj_conv);
43809 }
43810
43811 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
43812         LDKChannelUsage this_ptr_conv;
43813         this_ptr_conv.inner = untag_ptr(this_ptr);
43814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43816         this_ptr_conv.is_owned = false;
43817         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
43818         return ret_conv;
43819 }
43820
43821 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
43822         LDKChannelUsage this_ptr_conv;
43823         this_ptr_conv.inner = untag_ptr(this_ptr);
43824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43826         this_ptr_conv.is_owned = false;
43827         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
43828 }
43829
43830 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
43831         LDKChannelUsage this_ptr_conv;
43832         this_ptr_conv.inner = untag_ptr(this_ptr);
43833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43835         this_ptr_conv.is_owned = false;
43836         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
43837         return ret_conv;
43838 }
43839
43840 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
43841         LDKChannelUsage this_ptr_conv;
43842         this_ptr_conv.inner = untag_ptr(this_ptr);
43843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43845         this_ptr_conv.is_owned = false;
43846         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
43847 }
43848
43849 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
43850         LDKChannelUsage this_ptr_conv;
43851         this_ptr_conv.inner = untag_ptr(this_ptr);
43852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43854         this_ptr_conv.is_owned = false;
43855         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43856         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
43857         uint64_t ret_ref = tag_ptr(ret_copy, true);
43858         return ret_ref;
43859 }
43860
43861 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
43862         LDKChannelUsage this_ptr_conv;
43863         this_ptr_conv.inner = untag_ptr(this_ptr);
43864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43866         this_ptr_conv.is_owned = false;
43867         void* val_ptr = untag_ptr(val);
43868         CHECK_ACCESS(val_ptr);
43869         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
43870         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
43871         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
43872 }
43873
43874 uint64_t  __attribute__((export_name("TS_ChannelUsage_new"))) TS_ChannelUsage_new(int64_t amount_msat_arg, int64_t inflight_htlc_msat_arg, uint64_t effective_capacity_arg) {
43875         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
43876         CHECK_ACCESS(effective_capacity_arg_ptr);
43877         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
43878         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
43879         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
43880         uint64_t ret_ref = 0;
43881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43883         return ret_ref;
43884 }
43885
43886 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
43887         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
43888         uint64_t ret_ref = 0;
43889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43891         return ret_ref;
43892 }
43893 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
43894         LDKChannelUsage arg_conv;
43895         arg_conv.inner = untag_ptr(arg);
43896         arg_conv.is_owned = ptr_is_owned(arg);
43897         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43898         arg_conv.is_owned = false;
43899         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
43900         return ret_conv;
43901 }
43902
43903 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
43904         LDKChannelUsage orig_conv;
43905         orig_conv.inner = untag_ptr(orig);
43906         orig_conv.is_owned = ptr_is_owned(orig);
43907         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43908         orig_conv.is_owned = false;
43909         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
43910         uint64_t ret_ref = 0;
43911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43913         return ret_ref;
43914 }
43915
43916 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
43917         LDKFixedPenaltyScorer this_obj_conv;
43918         this_obj_conv.inner = untag_ptr(this_obj);
43919         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43921         FixedPenaltyScorer_free(this_obj_conv);
43922 }
43923
43924 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
43925         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
43926         uint64_t ret_ref = 0;
43927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43929         return ret_ref;
43930 }
43931 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
43932         LDKFixedPenaltyScorer arg_conv;
43933         arg_conv.inner = untag_ptr(arg);
43934         arg_conv.is_owned = ptr_is_owned(arg);
43935         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43936         arg_conv.is_owned = false;
43937         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
43938         return ret_conv;
43939 }
43940
43941 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
43942         LDKFixedPenaltyScorer orig_conv;
43943         orig_conv.inner = untag_ptr(orig);
43944         orig_conv.is_owned = ptr_is_owned(orig);
43945         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43946         orig_conv.is_owned = false;
43947         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
43948         uint64_t ret_ref = 0;
43949         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43950         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43951         return ret_ref;
43952 }
43953
43954 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
43955         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
43956         uint64_t ret_ref = 0;
43957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43959         return ret_ref;
43960 }
43961
43962 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint64_t this_arg) {
43963         LDKFixedPenaltyScorer this_arg_conv;
43964         this_arg_conv.inner = untag_ptr(this_arg);
43965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43967         this_arg_conv.is_owned = false;
43968         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
43969         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
43970         return tag_ptr(ret_ret, true);
43971 }
43972
43973 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
43974         LDKFixedPenaltyScorer obj_conv;
43975         obj_conv.inner = untag_ptr(obj);
43976         obj_conv.is_owned = ptr_is_owned(obj);
43977         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43978         obj_conv.is_owned = false;
43979         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
43980         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43981         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43982         CVec_u8Z_free(ret_var);
43983         return ret_arr;
43984 }
43985
43986 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
43987         LDKu8slice ser_ref;
43988         ser_ref.datalen = ser->arr_len;
43989         ser_ref.data = ser->elems;
43990         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
43991         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
43992         FREE(ser);
43993         return tag_ptr(ret_conv, true);
43994 }
43995
43996 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
43997         LDKProbabilisticScorer this_obj_conv;
43998         this_obj_conv.inner = untag_ptr(this_obj);
43999         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44001         ProbabilisticScorer_free(this_obj_conv);
44002 }
44003
44004 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_free"))) TS_ProbabilisticScoringParameters_free(uint64_t this_obj) {
44005         LDKProbabilisticScoringParameters this_obj_conv;
44006         this_obj_conv.inner = untag_ptr(this_obj);
44007         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44009         ProbabilisticScoringParameters_free(this_obj_conv);
44010 }
44011
44012 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_msat(uint64_t this_ptr) {
44013         LDKProbabilisticScoringParameters this_ptr_conv;
44014         this_ptr_conv.inner = untag_ptr(this_ptr);
44015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44017         this_ptr_conv.is_owned = false;
44018         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
44019         return ret_conv;
44020 }
44021
44022 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
44023         LDKProbabilisticScoringParameters this_ptr_conv;
44024         this_ptr_conv.inner = untag_ptr(this_ptr);
44025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44027         this_ptr_conv.is_owned = false;
44028         ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
44029 }
44030
44031 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(uint64_t this_ptr) {
44032         LDKProbabilisticScoringParameters this_ptr_conv;
44033         this_ptr_conv.inner = untag_ptr(this_ptr);
44034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44036         this_ptr_conv.is_owned = false;
44037         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
44038         return ret_conv;
44039 }
44040
44041 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(uint64_t this_ptr, int64_t val) {
44042         LDKProbabilisticScoringParameters this_ptr_conv;
44043         this_ptr_conv.inner = untag_ptr(this_ptr);
44044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44046         this_ptr_conv.is_owned = false;
44047         ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
44048 }
44049
44050 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
44051         LDKProbabilisticScoringParameters this_ptr_conv;
44052         this_ptr_conv.inner = untag_ptr(this_ptr);
44053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44055         this_ptr_conv.is_owned = false;
44056         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
44057         return ret_conv;
44058 }
44059
44060 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(uint64_t this_ptr, int64_t val) {
44061         LDKProbabilisticScoringParameters this_ptr_conv;
44062         this_ptr_conv.inner = untag_ptr(this_ptr);
44063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44065         this_ptr_conv.is_owned = false;
44066         ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
44067 }
44068
44069 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
44070         LDKProbabilisticScoringParameters this_ptr_conv;
44071         this_ptr_conv.inner = untag_ptr(this_ptr);
44072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44074         this_ptr_conv.is_owned = false;
44075         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
44076         return ret_conv;
44077 }
44078
44079 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_set_liquidity_offset_half_life(uint64_t this_ptr, int64_t val) {
44080         LDKProbabilisticScoringParameters this_ptr_conv;
44081         this_ptr_conv.inner = untag_ptr(this_ptr);
44082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44084         this_ptr_conv.is_owned = false;
44085         ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
44086 }
44087
44088 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(uint64_t this_ptr) {
44089         LDKProbabilisticScoringParameters this_ptr_conv;
44090         this_ptr_conv.inner = untag_ptr(this_ptr);
44091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44093         this_ptr_conv.is_owned = false;
44094         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
44095         return ret_conv;
44096 }
44097
44098 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(uint64_t this_ptr, int64_t val) {
44099         LDKProbabilisticScoringParameters this_ptr_conv;
44100         this_ptr_conv.inner = untag_ptr(this_ptr);
44101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44103         this_ptr_conv.is_owned = false;
44104         ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
44105 }
44106
44107 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
44108         LDKProbabilisticScoringParameters this_ptr_conv;
44109         this_ptr_conv.inner = untag_ptr(this_ptr);
44110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44112         this_ptr_conv.is_owned = false;
44113         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
44114         return ret_conv;
44115 }
44116
44117 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(uint64_t this_ptr, int64_t val) {
44118         LDKProbabilisticScoringParameters this_ptr_conv;
44119         this_ptr_conv.inner = untag_ptr(this_ptr);
44120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44122         this_ptr_conv.is_owned = false;
44123         ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
44124 }
44125
44126 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(uint64_t this_ptr) {
44127         LDKProbabilisticScoringParameters this_ptr_conv;
44128         this_ptr_conv.inner = untag_ptr(this_ptr);
44129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44131         this_ptr_conv.is_owned = false;
44132         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
44133         return ret_conv;
44134 }
44135
44136 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(uint64_t this_ptr, int64_t val) {
44137         LDKProbabilisticScoringParameters this_ptr_conv;
44138         this_ptr_conv.inner = untag_ptr(this_ptr);
44139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44141         this_ptr_conv.is_owned = false;
44142         ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
44143 }
44144
44145 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_historical_no_updates_half_life"))) TS_ProbabilisticScoringParameters_get_historical_no_updates_half_life(uint64_t this_ptr) {
44146         LDKProbabilisticScoringParameters this_ptr_conv;
44147         this_ptr_conv.inner = untag_ptr(this_ptr);
44148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44150         this_ptr_conv.is_owned = false;
44151         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_no_updates_half_life(&this_ptr_conv);
44152         return ret_conv;
44153 }
44154
44155 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_historical_no_updates_half_life"))) TS_ProbabilisticScoringParameters_set_historical_no_updates_half_life(uint64_t this_ptr, int64_t val) {
44156         LDKProbabilisticScoringParameters this_ptr_conv;
44157         this_ptr_conv.inner = untag_ptr(this_ptr);
44158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44160         this_ptr_conv.is_owned = false;
44161         ProbabilisticScoringParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
44162 }
44163
44164 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
44165         LDKProbabilisticScoringParameters this_ptr_conv;
44166         this_ptr_conv.inner = untag_ptr(this_ptr);
44167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44169         this_ptr_conv.is_owned = false;
44170         int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
44171         return ret_conv;
44172 }
44173
44174 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_anti_probing_penalty_msat"))) TS_ProbabilisticScoringParameters_set_anti_probing_penalty_msat(uint64_t this_ptr, int64_t val) {
44175         LDKProbabilisticScoringParameters this_ptr_conv;
44176         this_ptr_conv.inner = untag_ptr(this_ptr);
44177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44179         this_ptr_conv.is_owned = false;
44180         ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
44181 }
44182
44183 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
44184         LDKProbabilisticScoringParameters this_ptr_conv;
44185         this_ptr_conv.inner = untag_ptr(this_ptr);
44186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44188         this_ptr_conv.is_owned = false;
44189         int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
44190         return ret_conv;
44191 }
44192
44193 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(uint64_t this_ptr, int64_t val) {
44194         LDKProbabilisticScoringParameters this_ptr_conv;
44195         this_ptr_conv.inner = untag_ptr(this_ptr);
44196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44198         this_ptr_conv.is_owned = false;
44199         ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
44200 }
44201
44202 static inline uint64_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
44203         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
44204         uint64_t ret_ref = 0;
44205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44207         return ret_ref;
44208 }
44209 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone_ptr"))) TS_ProbabilisticScoringParameters_clone_ptr(uint64_t arg) {
44210         LDKProbabilisticScoringParameters arg_conv;
44211         arg_conv.inner = untag_ptr(arg);
44212         arg_conv.is_owned = ptr_is_owned(arg);
44213         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44214         arg_conv.is_owned = false;
44215         int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
44216         return ret_conv;
44217 }
44218
44219 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone"))) TS_ProbabilisticScoringParameters_clone(uint64_t orig) {
44220         LDKProbabilisticScoringParameters orig_conv;
44221         orig_conv.inner = untag_ptr(orig);
44222         orig_conv.is_owned = ptr_is_owned(orig);
44223         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44224         orig_conv.is_owned = false;
44225         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
44226         uint64_t ret_ref = 0;
44227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44229         return ret_ref;
44230 }
44231
44232 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t params, uint64_t network_graph, uint64_t logger) {
44233         LDKProbabilisticScoringParameters params_conv;
44234         params_conv.inner = untag_ptr(params);
44235         params_conv.is_owned = ptr_is_owned(params);
44236         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
44237         params_conv = ProbabilisticScoringParameters_clone(&params_conv);
44238         LDKNetworkGraph network_graph_conv;
44239         network_graph_conv.inner = untag_ptr(network_graph);
44240         network_graph_conv.is_owned = ptr_is_owned(network_graph);
44241         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
44242         network_graph_conv.is_owned = false;
44243         void* logger_ptr = untag_ptr(logger);
44244         CHECK_ACCESS(logger_ptr);
44245         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44246         if (logger_conv.free == LDKLogger_JCalls_free) {
44247                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44248                 LDKLogger_JCalls_cloned(&logger_conv);
44249         }
44250         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
44251         uint64_t ret_ref = 0;
44252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44254         return ret_ref;
44255 }
44256
44257 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
44258         LDKProbabilisticScorer this_arg_conv;
44259         this_arg_conv.inner = untag_ptr(this_arg);
44260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44262         this_arg_conv.is_owned = false;
44263         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
44264 }
44265
44266 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_estimated_channel_liquidity_range"))) TS_ProbabilisticScorer_estimated_channel_liquidity_range(uint64_t this_arg, int64_t scid, uint64_t target) {
44267         LDKProbabilisticScorer this_arg_conv;
44268         this_arg_conv.inner = untag_ptr(this_arg);
44269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44271         this_arg_conv.is_owned = false;
44272         LDKNodeId target_conv;
44273         target_conv.inner = untag_ptr(target);
44274         target_conv.is_owned = ptr_is_owned(target);
44275         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
44276         target_conv.is_owned = false;
44277         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
44278         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
44279         uint64_t ret_ref = tag_ptr(ret_copy, true);
44280         return ret_ref;
44281 }
44282
44283 void  __attribute__((export_name("TS_ProbabilisticScorer_add_banned"))) TS_ProbabilisticScorer_add_banned(uint64_t this_arg, uint64_t node_id) {
44284         LDKProbabilisticScorer this_arg_conv;
44285         this_arg_conv.inner = untag_ptr(this_arg);
44286         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44288         this_arg_conv.is_owned = false;
44289         LDKNodeId node_id_conv;
44290         node_id_conv.inner = untag_ptr(node_id);
44291         node_id_conv.is_owned = ptr_is_owned(node_id);
44292         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
44293         node_id_conv.is_owned = false;
44294         ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
44295 }
44296
44297 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_banned"))) TS_ProbabilisticScorer_remove_banned(uint64_t this_arg, uint64_t node_id) {
44298         LDKProbabilisticScorer this_arg_conv;
44299         this_arg_conv.inner = untag_ptr(this_arg);
44300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44302         this_arg_conv.is_owned = false;
44303         LDKNodeId node_id_conv;
44304         node_id_conv.inner = untag_ptr(node_id);
44305         node_id_conv.is_owned = ptr_is_owned(node_id);
44306         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
44307         node_id_conv.is_owned = false;
44308         ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
44309 }
44310
44311 void  __attribute__((export_name("TS_ProbabilisticScorer_set_manual_penalty"))) TS_ProbabilisticScorer_set_manual_penalty(uint64_t this_arg, uint64_t node_id, int64_t penalty) {
44312         LDKProbabilisticScorer this_arg_conv;
44313         this_arg_conv.inner = untag_ptr(this_arg);
44314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44316         this_arg_conv.is_owned = false;
44317         LDKNodeId node_id_conv;
44318         node_id_conv.inner = untag_ptr(node_id);
44319         node_id_conv.is_owned = ptr_is_owned(node_id);
44320         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
44321         node_id_conv.is_owned = false;
44322         ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
44323 }
44324
44325 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_manual_penalty"))) TS_ProbabilisticScorer_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
44326         LDKProbabilisticScorer this_arg_conv;
44327         this_arg_conv.inner = untag_ptr(this_arg);
44328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44330         this_arg_conv.is_owned = false;
44331         LDKNodeId node_id_conv;
44332         node_id_conv.inner = untag_ptr(node_id);
44333         node_id_conv.is_owned = ptr_is_owned(node_id);
44334         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
44335         node_id_conv.is_owned = false;
44336         ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
44337 }
44338
44339 void  __attribute__((export_name("TS_ProbabilisticScorer_clear_manual_penalties"))) TS_ProbabilisticScorer_clear_manual_penalties(uint64_t this_arg) {
44340         LDKProbabilisticScorer this_arg_conv;
44341         this_arg_conv.inner = untag_ptr(this_arg);
44342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44344         this_arg_conv.is_owned = false;
44345         ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
44346 }
44347
44348 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_add_banned_from_list"))) TS_ProbabilisticScoringParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
44349         LDKProbabilisticScoringParameters this_arg_conv;
44350         this_arg_conv.inner = untag_ptr(this_arg);
44351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44353         this_arg_conv.is_owned = false;
44354         LDKCVec_NodeIdZ node_ids_constr;
44355         node_ids_constr.datalen = node_ids->arr_len;
44356         if (node_ids_constr.datalen > 0)
44357                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
44358         else
44359                 node_ids_constr.data = NULL;
44360         uint64_t* node_ids_vals = node_ids->elems;
44361         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
44362                 uint64_t node_ids_conv_8 = node_ids_vals[i];
44363                 LDKNodeId node_ids_conv_8_conv;
44364                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
44365                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
44366                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
44367                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
44368                 node_ids_constr.data[i] = node_ids_conv_8_conv;
44369         }
44370         FREE(node_ids);
44371         ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
44372 }
44373
44374 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_default"))) TS_ProbabilisticScoringParameters_default() {
44375         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
44376         uint64_t ret_ref = 0;
44377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44379         return ret_ref;
44380 }
44381
44382 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
44383         LDKProbabilisticScorer this_arg_conv;
44384         this_arg_conv.inner = untag_ptr(this_arg);
44385         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44387         this_arg_conv.is_owned = false;
44388         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
44389         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
44390         return tag_ptr(ret_ret, true);
44391 }
44392
44393 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
44394         LDKProbabilisticScorer obj_conv;
44395         obj_conv.inner = untag_ptr(obj);
44396         obj_conv.is_owned = ptr_is_owned(obj);
44397         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44398         obj_conv.is_owned = false;
44399         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
44400         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44401         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44402         CVec_u8Z_free(ret_var);
44403         return ret_arr;
44404 }
44405
44406 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_read"))) TS_ProbabilisticScorer_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b, uint64_t arg_c) {
44407         LDKu8slice ser_ref;
44408         ser_ref.datalen = ser->arr_len;
44409         ser_ref.data = ser->elems;
44410         LDKProbabilisticScoringParameters arg_a_conv;
44411         arg_a_conv.inner = untag_ptr(arg_a);
44412         arg_a_conv.is_owned = ptr_is_owned(arg_a);
44413         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
44414         arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
44415         LDKNetworkGraph arg_b_conv;
44416         arg_b_conv.inner = untag_ptr(arg_b);
44417         arg_b_conv.is_owned = ptr_is_owned(arg_b);
44418         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
44419         arg_b_conv.is_owned = false;
44420         void* arg_c_ptr = untag_ptr(arg_c);
44421         CHECK_ACCESS(arg_c_ptr);
44422         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
44423         if (arg_c_conv.free == LDKLogger_JCalls_free) {
44424                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44425                 LDKLogger_JCalls_cloned(&arg_c_conv);
44426         }
44427         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
44428         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
44429         FREE(ser);
44430         return tag_ptr(ret_conv, true);
44431 }
44432
44433 void  __attribute__((export_name("TS_BlindedRoute_free"))) TS_BlindedRoute_free(uint64_t this_obj) {
44434         LDKBlindedRoute this_obj_conv;
44435         this_obj_conv.inner = untag_ptr(this_obj);
44436         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44438         BlindedRoute_free(this_obj_conv);
44439 }
44440
44441 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
44442         LDKBlindedHop this_obj_conv;
44443         this_obj_conv.inner = untag_ptr(this_obj);
44444         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44446         BlindedHop_free(this_obj_conv);
44447 }
44448
44449 uint64_t  __attribute__((export_name("TS_BlindedRoute_new"))) TS_BlindedRoute_new(ptrArray node_pks, uint64_t keys_manager) {
44450         LDKCVec_PublicKeyZ node_pks_constr;
44451         node_pks_constr.datalen = node_pks->arr_len;
44452         if (node_pks_constr.datalen > 0)
44453                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
44454         else
44455                 node_pks_constr.data = NULL;
44456         int8_tArray* node_pks_vals = (void*) node_pks->elems;
44457         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
44458                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
44459                 LDKPublicKey node_pks_conv_12_ref;
44460                 CHECK(node_pks_conv_12->arr_len == 33);
44461                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
44462                 node_pks_constr.data[m] = node_pks_conv_12_ref;
44463         }
44464         FREE(node_pks);
44465         void* keys_manager_ptr = untag_ptr(keys_manager);
44466         if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); }
44467         LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
44468         LDKCResult_BlindedRouteNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteNoneZ), "LDKCResult_BlindedRouteNoneZ");
44469         *ret_conv = BlindedRoute_new(node_pks_constr, keys_manager_conv);
44470         return tag_ptr(ret_conv, true);
44471 }
44472
44473 int8_tArray  __attribute__((export_name("TS_BlindedRoute_write"))) TS_BlindedRoute_write(uint64_t obj) {
44474         LDKBlindedRoute obj_conv;
44475         obj_conv.inner = untag_ptr(obj);
44476         obj_conv.is_owned = ptr_is_owned(obj);
44477         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44478         obj_conv.is_owned = false;
44479         LDKCVec_u8Z ret_var = BlindedRoute_write(&obj_conv);
44480         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44481         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44482         CVec_u8Z_free(ret_var);
44483         return ret_arr;
44484 }
44485
44486 uint64_t  __attribute__((export_name("TS_BlindedRoute_read"))) TS_BlindedRoute_read(int8_tArray ser) {
44487         LDKu8slice ser_ref;
44488         ser_ref.datalen = ser->arr_len;
44489         ser_ref.data = ser->elems;
44490         LDKCResult_BlindedRouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteDecodeErrorZ), "LDKCResult_BlindedRouteDecodeErrorZ");
44491         *ret_conv = BlindedRoute_read(ser_ref);
44492         FREE(ser);
44493         return tag_ptr(ret_conv, true);
44494 }
44495
44496 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
44497         LDKBlindedHop obj_conv;
44498         obj_conv.inner = untag_ptr(obj);
44499         obj_conv.is_owned = ptr_is_owned(obj);
44500         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44501         obj_conv.is_owned = false;
44502         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
44503         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44504         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44505         CVec_u8Z_free(ret_var);
44506         return ret_arr;
44507 }
44508
44509 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
44510         LDKu8slice ser_ref;
44511         ser_ref.datalen = ser->arr_len;
44512         ser_ref.data = ser->elems;
44513         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
44514         *ret_conv = BlindedHop_read(ser_ref);
44515         FREE(ser);
44516         return tag_ptr(ret_conv, true);
44517 }
44518
44519 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
44520         LDKOnionMessenger this_obj_conv;
44521         this_obj_conv.inner = untag_ptr(this_obj);
44522         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44524         OnionMessenger_free(this_obj_conv);
44525 }
44526
44527 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
44528         if (!ptr_is_owned(this_ptr)) return;
44529         void* this_ptr_ptr = untag_ptr(this_ptr);
44530         CHECK_ACCESS(this_ptr_ptr);
44531         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
44532         FREE(untag_ptr(this_ptr));
44533         Destination_free(this_ptr_conv);
44534 }
44535
44536 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
44537         LDKPublicKey a_ref;
44538         CHECK(a->arr_len == 33);
44539         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
44540         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
44541         *ret_copy = Destination_node(a_ref);
44542         uint64_t ret_ref = tag_ptr(ret_copy, true);
44543         return ret_ref;
44544 }
44545
44546 uint64_t  __attribute__((export_name("TS_Destination_blinded_route"))) TS_Destination_blinded_route(uint64_t a) {
44547         LDKBlindedRoute a_conv;
44548         a_conv.inner = untag_ptr(a);
44549         a_conv.is_owned = ptr_is_owned(a);
44550         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44551         // WARNING: we need a move here but no clone is available for LDKBlindedRoute
44552         
44553         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
44554         *ret_copy = Destination_blinded_route(a_conv);
44555         uint64_t ret_ref = tag_ptr(ret_copy, true);
44556         return ret_ref;
44557 }
44558
44559 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
44560         if (!ptr_is_owned(this_ptr)) return;
44561         void* this_ptr_ptr = untag_ptr(this_ptr);
44562         CHECK_ACCESS(this_ptr_ptr);
44563         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
44564         FREE(untag_ptr(this_ptr));
44565         SendError_free(this_ptr_conv);
44566 }
44567
44568 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
44569         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
44570         *ret_copy = SendError_clone(arg);
44571         uint64_t ret_ref = tag_ptr(ret_copy, true);
44572         return ret_ref;
44573 }
44574 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
44575         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
44576         int64_t ret_conv = SendError_clone_ptr(arg_conv);
44577         return ret_conv;
44578 }
44579
44580 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
44581         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
44582         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
44583         *ret_copy = SendError_clone(orig_conv);
44584         uint64_t ret_ref = tag_ptr(ret_copy, true);
44585         return ret_ref;
44586 }
44587
44588 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
44589         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
44590         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
44591         *ret_copy = SendError_secp256k1(a_conv);
44592         uint64_t ret_ref = tag_ptr(ret_copy, true);
44593         return ret_ref;
44594 }
44595
44596 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
44597         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
44598         *ret_copy = SendError_too_big_packet();
44599         uint64_t ret_ref = tag_ptr(ret_copy, true);
44600         return ret_ref;
44601 }
44602
44603 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
44604         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
44605         *ret_copy = SendError_too_few_blinded_hops();
44606         uint64_t ret_ref = tag_ptr(ret_copy, true);
44607         return ret_ref;
44608 }
44609
44610 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop() {
44611         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
44612         *ret_copy = SendError_invalid_first_hop();
44613         uint64_t ret_ref = tag_ptr(ret_copy, true);
44614         return ret_ref;
44615 }
44616
44617 uint64_t  __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
44618         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
44619         *ret_copy = SendError_invalid_message();
44620         uint64_t ret_ref = tag_ptr(ret_copy, true);
44621         return ret_ref;
44622 }
44623
44624 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
44625         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
44626         *ret_copy = SendError_buffer_full();
44627         uint64_t ret_ref = tag_ptr(ret_copy, true);
44628         return ret_ref;
44629 }
44630
44631 jboolean  __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
44632         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
44633         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
44634         jboolean ret_conv = SendError_eq(a_conv, b_conv);
44635         return ret_conv;
44636 }
44637
44638 void  __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
44639         if (!ptr_is_owned(this_ptr)) return;
44640         void* this_ptr_ptr = untag_ptr(this_ptr);
44641         CHECK_ACCESS(this_ptr_ptr);
44642         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
44643         FREE(untag_ptr(this_ptr));
44644         CustomOnionMessageHandler_free(this_ptr_conv);
44645 }
44646
44647 uint64_t  __attribute__((export_name("TS_OnionMessenger_new"))) TS_OnionMessenger_new(uint64_t keys_manager, uint64_t logger, uint64_t custom_handler) {
44648         void* keys_manager_ptr = untag_ptr(keys_manager);
44649         CHECK_ACCESS(keys_manager_ptr);
44650         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
44651         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
44652                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44653                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
44654         }
44655         void* logger_ptr = untag_ptr(logger);
44656         CHECK_ACCESS(logger_ptr);
44657         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44658         if (logger_conv.free == LDKLogger_JCalls_free) {
44659                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44660                 LDKLogger_JCalls_cloned(&logger_conv);
44661         }
44662         void* custom_handler_ptr = untag_ptr(custom_handler);
44663         CHECK_ACCESS(custom_handler_ptr);
44664         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
44665         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
44666                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44667                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
44668         }
44669         LDKOnionMessenger ret_var = OnionMessenger_new(keys_manager_conv, logger_conv, custom_handler_conv);
44670         uint64_t ret_ref = 0;
44671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44673         return ret_ref;
44674 }
44675
44676 uint64_t  __attribute__((export_name("TS_OnionMessenger_send_custom_onion_message"))) TS_OnionMessenger_send_custom_onion_message(uint64_t this_arg, ptrArray intermediate_nodes, uint64_t destination, uint64_t msg, uint64_t reply_path) {
44677         LDKOnionMessenger this_arg_conv;
44678         this_arg_conv.inner = untag_ptr(this_arg);
44679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44681         this_arg_conv.is_owned = false;
44682         LDKCVec_PublicKeyZ intermediate_nodes_constr;
44683         intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
44684         if (intermediate_nodes_constr.datalen > 0)
44685                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
44686         else
44687                 intermediate_nodes_constr.data = NULL;
44688         int8_tArray* intermediate_nodes_vals = (void*) intermediate_nodes->elems;
44689         for (size_t m = 0; m < intermediate_nodes_constr.datalen; m++) {
44690                 int8_tArray intermediate_nodes_conv_12 = intermediate_nodes_vals[m];
44691                 LDKPublicKey intermediate_nodes_conv_12_ref;
44692                 CHECK(intermediate_nodes_conv_12->arr_len == 33);
44693                 memcpy(intermediate_nodes_conv_12_ref.compressed_form, intermediate_nodes_conv_12->elems, 33); FREE(intermediate_nodes_conv_12);
44694                 intermediate_nodes_constr.data[m] = intermediate_nodes_conv_12_ref;
44695         }
44696         FREE(intermediate_nodes);
44697         void* destination_ptr = untag_ptr(destination);
44698         CHECK_ACCESS(destination_ptr);
44699         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
44700         // WARNING: we may need a move here but no clone is available for LDKDestination
44701         void* msg_ptr = untag_ptr(msg);
44702         CHECK_ACCESS(msg_ptr);
44703         LDKCustomOnionMessageContents msg_conv = *(LDKCustomOnionMessageContents*)(msg_ptr);
44704         if (msg_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
44705                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44706                 LDKCustomOnionMessageContents_JCalls_cloned(&msg_conv);
44707         }
44708         LDKBlindedRoute reply_path_conv;
44709         reply_path_conv.inner = untag_ptr(reply_path);
44710         reply_path_conv.is_owned = ptr_is_owned(reply_path);
44711         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
44712         reply_path_conv.is_owned = false;
44713         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
44714         *ret_conv = OnionMessenger_send_custom_onion_message(&this_arg_conv, intermediate_nodes_constr, destination_conv, msg_conv, reply_path_conv);
44715         return tag_ptr(ret_conv, true);
44716 }
44717
44718 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
44719         LDKOnionMessenger this_arg_conv;
44720         this_arg_conv.inner = untag_ptr(this_arg);
44721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44723         this_arg_conv.is_owned = false;
44724         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
44725         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
44726         return tag_ptr(ret_ret, true);
44727 }
44728
44729 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageProvider"))) TS_OnionMessenger_as_OnionMessageProvider(uint64_t this_arg) {
44730         LDKOnionMessenger this_arg_conv;
44731         this_arg_conv.inner = untag_ptr(this_arg);
44732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44734         this_arg_conv.is_owned = false;
44735         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
44736         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
44737         return tag_ptr(ret_ret, true);
44738 }
44739
44740 static inline uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg) {
44741         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
44742         *ret_ret = CustomOnionMessageContents_clone(arg);
44743         return tag_ptr(ret_ret, true);
44744 }
44745 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone_ptr"))) TS_CustomOnionMessageContents_clone_ptr(uint64_t arg) {
44746         void* arg_ptr = untag_ptr(arg);
44747         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
44748         LDKCustomOnionMessageContents* arg_conv = (LDKCustomOnionMessageContents*)arg_ptr;
44749         int64_t ret_conv = CustomOnionMessageContents_clone_ptr(arg_conv);
44750         return ret_conv;
44751 }
44752
44753 uint64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone"))) TS_CustomOnionMessageContents_clone(uint64_t orig) {
44754         void* orig_ptr = untag_ptr(orig);
44755         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
44756         LDKCustomOnionMessageContents* orig_conv = (LDKCustomOnionMessageContents*)orig_ptr;
44757         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
44758         *ret_ret = CustomOnionMessageContents_clone(orig_conv);
44759         return tag_ptr(ret_ret, true);
44760 }
44761
44762 void  __attribute__((export_name("TS_CustomOnionMessageContents_free"))) TS_CustomOnionMessageContents_free(uint64_t this_ptr) {
44763         if (!ptr_is_owned(this_ptr)) return;
44764         void* this_ptr_ptr = untag_ptr(this_ptr);
44765         CHECK_ACCESS(this_ptr_ptr);
44766         LDKCustomOnionMessageContents this_ptr_conv = *(LDKCustomOnionMessageContents*)(this_ptr_ptr);
44767         FREE(untag_ptr(this_ptr));
44768         CustomOnionMessageContents_free(this_ptr_conv);
44769 }
44770
44771 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
44772         LDKRapidGossipSync this_obj_conv;
44773         this_obj_conv.inner = untag_ptr(this_obj);
44774         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44776         RapidGossipSync_free(this_obj_conv);
44777 }
44778
44779 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph) {
44780         LDKNetworkGraph network_graph_conv;
44781         network_graph_conv.inner = untag_ptr(network_graph);
44782         network_graph_conv.is_owned = ptr_is_owned(network_graph);
44783         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
44784         network_graph_conv.is_owned = false;
44785         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv);
44786         uint64_t ret_ref = 0;
44787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44789         return ret_ref;
44790 }
44791
44792 uint64_t  __attribute__((export_name("TS_RapidGossipSync_update_network_graph"))) TS_RapidGossipSync_update_network_graph(uint64_t this_arg, int8_tArray update_data) {
44793         LDKRapidGossipSync this_arg_conv;
44794         this_arg_conv.inner = untag_ptr(this_arg);
44795         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44797         this_arg_conv.is_owned = false;
44798         LDKu8slice update_data_ref;
44799         update_data_ref.datalen = update_data->arr_len;
44800         update_data_ref.data = update_data->elems;
44801         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
44802         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
44803         FREE(update_data);
44804         return tag_ptr(ret_conv, true);
44805 }
44806
44807 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
44808         LDKRapidGossipSync this_arg_conv;
44809         this_arg_conv.inner = untag_ptr(this_arg);
44810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44812         this_arg_conv.is_owned = false;
44813         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
44814         return ret_conv;
44815 }
44816
44817 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
44818         if (!ptr_is_owned(this_ptr)) return;
44819         void* this_ptr_ptr = untag_ptr(this_ptr);
44820         CHECK_ACCESS(this_ptr_ptr);
44821         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
44822         FREE(untag_ptr(this_ptr));
44823         GraphSyncError_free(this_ptr_conv);
44824 }
44825
44826 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
44827         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
44828         *ret_copy = GraphSyncError_clone(arg);
44829         uint64_t ret_ref = tag_ptr(ret_copy, true);
44830         return ret_ref;
44831 }
44832 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
44833         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
44834         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
44835         return ret_conv;
44836 }
44837
44838 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
44839         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
44840         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
44841         *ret_copy = GraphSyncError_clone(orig_conv);
44842         uint64_t ret_ref = tag_ptr(ret_copy, true);
44843         return ret_ref;
44844 }
44845
44846 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
44847         void* a_ptr = untag_ptr(a);
44848         CHECK_ACCESS(a_ptr);
44849         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
44850         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
44851         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
44852         *ret_copy = GraphSyncError_decode_error(a_conv);
44853         uint64_t ret_ref = tag_ptr(ret_copy, true);
44854         return ret_ref;
44855 }
44856
44857 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
44858         LDKLightningError a_conv;
44859         a_conv.inner = untag_ptr(a);
44860         a_conv.is_owned = ptr_is_owned(a);
44861         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44862         a_conv = LightningError_clone(&a_conv);
44863         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
44864         *ret_copy = GraphSyncError_lightning_error(a_conv);
44865         uint64_t ret_ref = tag_ptr(ret_copy, true);
44866         return ret_ref;
44867 }
44868
44869 void  __attribute__((export_name("TS_ParseError_free"))) TS_ParseError_free(uint64_t this_ptr) {
44870         if (!ptr_is_owned(this_ptr)) return;
44871         void* this_ptr_ptr = untag_ptr(this_ptr);
44872         CHECK_ACCESS(this_ptr_ptr);
44873         LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
44874         FREE(untag_ptr(this_ptr));
44875         ParseError_free(this_ptr_conv);
44876 }
44877
44878 static inline uint64_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
44879         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44880         *ret_copy = ParseError_clone(arg);
44881         uint64_t ret_ref = tag_ptr(ret_copy, true);
44882         return ret_ref;
44883 }
44884 int64_t  __attribute__((export_name("TS_ParseError_clone_ptr"))) TS_ParseError_clone_ptr(uint64_t arg) {
44885         LDKParseError* arg_conv = (LDKParseError*)untag_ptr(arg);
44886         int64_t ret_conv = ParseError_clone_ptr(arg_conv);
44887         return ret_conv;
44888 }
44889
44890 uint64_t  __attribute__((export_name("TS_ParseError_clone"))) TS_ParseError_clone(uint64_t orig) {
44891         LDKParseError* orig_conv = (LDKParseError*)untag_ptr(orig);
44892         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44893         *ret_copy = ParseError_clone(orig_conv);
44894         uint64_t ret_ref = tag_ptr(ret_copy, true);
44895         return ret_ref;
44896 }
44897
44898 uint64_t  __attribute__((export_name("TS_ParseError_bech32_error"))) TS_ParseError_bech32_error(uint64_t a) {
44899         void* a_ptr = untag_ptr(a);
44900         CHECK_ACCESS(a_ptr);
44901         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
44902         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
44903         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44904         *ret_copy = ParseError_bech32_error(a_conv);
44905         uint64_t ret_ref = tag_ptr(ret_copy, true);
44906         return ret_ref;
44907 }
44908
44909 uint64_t  __attribute__((export_name("TS_ParseError_parse_amount_error"))) TS_ParseError_parse_amount_error(int32_t a) {
44910         
44911         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44912         *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
44913         uint64_t ret_ref = tag_ptr(ret_copy, true);
44914         return ret_ref;
44915 }
44916
44917 uint64_t  __attribute__((export_name("TS_ParseError_malformed_signature"))) TS_ParseError_malformed_signature(uint32_t a) {
44918         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
44919         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44920         *ret_copy = ParseError_malformed_signature(a_conv);
44921         uint64_t ret_ref = tag_ptr(ret_copy, true);
44922         return ret_ref;
44923 }
44924
44925 uint64_t  __attribute__((export_name("TS_ParseError_bad_prefix"))) TS_ParseError_bad_prefix() {
44926         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44927         *ret_copy = ParseError_bad_prefix();
44928         uint64_t ret_ref = tag_ptr(ret_copy, true);
44929         return ret_ref;
44930 }
44931
44932 uint64_t  __attribute__((export_name("TS_ParseError_unknown_currency"))) TS_ParseError_unknown_currency() {
44933         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44934         *ret_copy = ParseError_unknown_currency();
44935         uint64_t ret_ref = tag_ptr(ret_copy, true);
44936         return ret_ref;
44937 }
44938
44939 uint64_t  __attribute__((export_name("TS_ParseError_unknown_si_prefix"))) TS_ParseError_unknown_si_prefix() {
44940         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44941         *ret_copy = ParseError_unknown_si_prefix();
44942         uint64_t ret_ref = tag_ptr(ret_copy, true);
44943         return ret_ref;
44944 }
44945
44946 uint64_t  __attribute__((export_name("TS_ParseError_malformed_hrp"))) TS_ParseError_malformed_hrp() {
44947         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44948         *ret_copy = ParseError_malformed_hrp();
44949         uint64_t ret_ref = tag_ptr(ret_copy, true);
44950         return ret_ref;
44951 }
44952
44953 uint64_t  __attribute__((export_name("TS_ParseError_too_short_data_part"))) TS_ParseError_too_short_data_part() {
44954         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44955         *ret_copy = ParseError_too_short_data_part();
44956         uint64_t ret_ref = tag_ptr(ret_copy, true);
44957         return ret_ref;
44958 }
44959
44960 uint64_t  __attribute__((export_name("TS_ParseError_unexpected_end_of_tagged_fields"))) TS_ParseError_unexpected_end_of_tagged_fields() {
44961         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44962         *ret_copy = ParseError_unexpected_end_of_tagged_fields();
44963         uint64_t ret_ref = tag_ptr(ret_copy, true);
44964         return ret_ref;
44965 }
44966
44967 uint64_t  __attribute__((export_name("TS_ParseError_description_decode_error"))) TS_ParseError_description_decode_error(int32_t a) {
44968         
44969         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44970         *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
44971         uint64_t ret_ref = tag_ptr(ret_copy, true);
44972         return ret_ref;
44973 }
44974
44975 uint64_t  __attribute__((export_name("TS_ParseError_padding_error"))) TS_ParseError_padding_error() {
44976         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44977         *ret_copy = ParseError_padding_error();
44978         uint64_t ret_ref = tag_ptr(ret_copy, true);
44979         return ret_ref;
44980 }
44981
44982 uint64_t  __attribute__((export_name("TS_ParseError_integer_overflow_error"))) TS_ParseError_integer_overflow_error() {
44983         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44984         *ret_copy = ParseError_integer_overflow_error();
44985         uint64_t ret_ref = tag_ptr(ret_copy, true);
44986         return ret_ref;
44987 }
44988
44989 uint64_t  __attribute__((export_name("TS_ParseError_invalid_seg_wit_program_length"))) TS_ParseError_invalid_seg_wit_program_length() {
44990         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44991         *ret_copy = ParseError_invalid_seg_wit_program_length();
44992         uint64_t ret_ref = tag_ptr(ret_copy, true);
44993         return ret_ref;
44994 }
44995
44996 uint64_t  __attribute__((export_name("TS_ParseError_invalid_pub_key_hash_length"))) TS_ParseError_invalid_pub_key_hash_length() {
44997         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44998         *ret_copy = ParseError_invalid_pub_key_hash_length();
44999         uint64_t ret_ref = tag_ptr(ret_copy, true);
45000         return ret_ref;
45001 }
45002
45003 uint64_t  __attribute__((export_name("TS_ParseError_invalid_script_hash_length"))) TS_ParseError_invalid_script_hash_length() {
45004         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45005         *ret_copy = ParseError_invalid_script_hash_length();
45006         uint64_t ret_ref = tag_ptr(ret_copy, true);
45007         return ret_ref;
45008 }
45009
45010 uint64_t  __attribute__((export_name("TS_ParseError_invalid_recovery_id"))) TS_ParseError_invalid_recovery_id() {
45011         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45012         *ret_copy = ParseError_invalid_recovery_id();
45013         uint64_t ret_ref = tag_ptr(ret_copy, true);
45014         return ret_ref;
45015 }
45016
45017 uint64_t  __attribute__((export_name("TS_ParseError_invalid_slice_length"))) TS_ParseError_invalid_slice_length(jstring a) {
45018         LDKStr a_conv = str_ref_to_owned_c(a);
45019         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45020         *ret_copy = ParseError_invalid_slice_length(a_conv);
45021         uint64_t ret_ref = tag_ptr(ret_copy, true);
45022         return ret_ref;
45023 }
45024
45025 uint64_t  __attribute__((export_name("TS_ParseError_skip"))) TS_ParseError_skip() {
45026         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45027         *ret_copy = ParseError_skip();
45028         uint64_t ret_ref = tag_ptr(ret_copy, true);
45029         return ret_ref;
45030 }
45031
45032 jboolean  __attribute__((export_name("TS_ParseError_eq"))) TS_ParseError_eq(uint64_t a, uint64_t b) {
45033         LDKParseError* a_conv = (LDKParseError*)untag_ptr(a);
45034         LDKParseError* b_conv = (LDKParseError*)untag_ptr(b);
45035         jboolean ret_conv = ParseError_eq(a_conv, b_conv);
45036         return ret_conv;
45037 }
45038
45039 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
45040         if (!ptr_is_owned(this_ptr)) return;
45041         void* this_ptr_ptr = untag_ptr(this_ptr);
45042         CHECK_ACCESS(this_ptr_ptr);
45043         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
45044         FREE(untag_ptr(this_ptr));
45045         ParseOrSemanticError_free(this_ptr_conv);
45046 }
45047
45048 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
45049         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45050         *ret_copy = ParseOrSemanticError_clone(arg);
45051         uint64_t ret_ref = tag_ptr(ret_copy, true);
45052         return ret_ref;
45053 }
45054 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
45055         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
45056         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
45057         return ret_conv;
45058 }
45059
45060 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
45061         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
45062         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45063         *ret_copy = ParseOrSemanticError_clone(orig_conv);
45064         uint64_t ret_ref = tag_ptr(ret_copy, true);
45065         return ret_ref;
45066 }
45067
45068 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
45069         void* a_ptr = untag_ptr(a);
45070         CHECK_ACCESS(a_ptr);
45071         LDKParseError a_conv = *(LDKParseError*)(a_ptr);
45072         a_conv = ParseError_clone((LDKParseError*)untag_ptr(a));
45073         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45074         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
45075         uint64_t ret_ref = tag_ptr(ret_copy, true);
45076         return ret_ref;
45077 }
45078
45079 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
45080         LDKSemanticError a_conv = LDKSemanticError_from_js(a);
45081         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45082         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
45083         uint64_t ret_ref = tag_ptr(ret_copy, true);
45084         return ret_ref;
45085 }
45086
45087 jboolean  __attribute__((export_name("TS_ParseOrSemanticError_eq"))) TS_ParseOrSemanticError_eq(uint64_t a, uint64_t b) {
45088         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
45089         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
45090         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
45091         return ret_conv;
45092 }
45093
45094 void  __attribute__((export_name("TS_Invoice_free"))) TS_Invoice_free(uint64_t this_obj) {
45095         LDKInvoice this_obj_conv;
45096         this_obj_conv.inner = untag_ptr(this_obj);
45097         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45099         Invoice_free(this_obj_conv);
45100 }
45101
45102 jboolean  __attribute__((export_name("TS_Invoice_eq"))) TS_Invoice_eq(uint64_t a, uint64_t b) {
45103         LDKInvoice a_conv;
45104         a_conv.inner = untag_ptr(a);
45105         a_conv.is_owned = ptr_is_owned(a);
45106         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45107         a_conv.is_owned = false;
45108         LDKInvoice b_conv;
45109         b_conv.inner = untag_ptr(b);
45110         b_conv.is_owned = ptr_is_owned(b);
45111         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45112         b_conv.is_owned = false;
45113         jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
45114         return ret_conv;
45115 }
45116
45117 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
45118         LDKInvoice ret_var = Invoice_clone(arg);
45119         uint64_t ret_ref = 0;
45120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45122         return ret_ref;
45123 }
45124 int64_t  __attribute__((export_name("TS_Invoice_clone_ptr"))) TS_Invoice_clone_ptr(uint64_t arg) {
45125         LDKInvoice arg_conv;
45126         arg_conv.inner = untag_ptr(arg);
45127         arg_conv.is_owned = ptr_is_owned(arg);
45128         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45129         arg_conv.is_owned = false;
45130         int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
45131         return ret_conv;
45132 }
45133
45134 uint64_t  __attribute__((export_name("TS_Invoice_clone"))) TS_Invoice_clone(uint64_t orig) {
45135         LDKInvoice orig_conv;
45136         orig_conv.inner = untag_ptr(orig);
45137         orig_conv.is_owned = ptr_is_owned(orig);
45138         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45139         orig_conv.is_owned = false;
45140         LDKInvoice ret_var = Invoice_clone(&orig_conv);
45141         uint64_t ret_ref = 0;
45142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45144         return ret_ref;
45145 }
45146
45147 int64_t  __attribute__((export_name("TS_Invoice_hash"))) TS_Invoice_hash(uint64_t o) {
45148         LDKInvoice o_conv;
45149         o_conv.inner = untag_ptr(o);
45150         o_conv.is_owned = ptr_is_owned(o);
45151         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45152         o_conv.is_owned = false;
45153         int64_t ret_conv = Invoice_hash(&o_conv);
45154         return ret_conv;
45155 }
45156
45157 void  __attribute__((export_name("TS_SignedRawInvoice_free"))) TS_SignedRawInvoice_free(uint64_t this_obj) {
45158         LDKSignedRawInvoice this_obj_conv;
45159         this_obj_conv.inner = untag_ptr(this_obj);
45160         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45162         SignedRawInvoice_free(this_obj_conv);
45163 }
45164
45165 jboolean  __attribute__((export_name("TS_SignedRawInvoice_eq"))) TS_SignedRawInvoice_eq(uint64_t a, uint64_t b) {
45166         LDKSignedRawInvoice a_conv;
45167         a_conv.inner = untag_ptr(a);
45168         a_conv.is_owned = ptr_is_owned(a);
45169         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45170         a_conv.is_owned = false;
45171         LDKSignedRawInvoice b_conv;
45172         b_conv.inner = untag_ptr(b);
45173         b_conv.is_owned = ptr_is_owned(b);
45174         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45175         b_conv.is_owned = false;
45176         jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
45177         return ret_conv;
45178 }
45179
45180 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
45181         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
45182         uint64_t ret_ref = 0;
45183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45185         return ret_ref;
45186 }
45187 int64_t  __attribute__((export_name("TS_SignedRawInvoice_clone_ptr"))) TS_SignedRawInvoice_clone_ptr(uint64_t arg) {
45188         LDKSignedRawInvoice arg_conv;
45189         arg_conv.inner = untag_ptr(arg);
45190         arg_conv.is_owned = ptr_is_owned(arg);
45191         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45192         arg_conv.is_owned = false;
45193         int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
45194         return ret_conv;
45195 }
45196
45197 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_clone"))) TS_SignedRawInvoice_clone(uint64_t orig) {
45198         LDKSignedRawInvoice orig_conv;
45199         orig_conv.inner = untag_ptr(orig);
45200         orig_conv.is_owned = ptr_is_owned(orig);
45201         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45202         orig_conv.is_owned = false;
45203         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
45204         uint64_t ret_ref = 0;
45205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45207         return ret_ref;
45208 }
45209
45210 int64_t  __attribute__((export_name("TS_SignedRawInvoice_hash"))) TS_SignedRawInvoice_hash(uint64_t o) {
45211         LDKSignedRawInvoice o_conv;
45212         o_conv.inner = untag_ptr(o);
45213         o_conv.is_owned = ptr_is_owned(o);
45214         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45215         o_conv.is_owned = false;
45216         int64_t ret_conv = SignedRawInvoice_hash(&o_conv);
45217         return ret_conv;
45218 }
45219
45220 void  __attribute__((export_name("TS_RawInvoice_free"))) TS_RawInvoice_free(uint64_t this_obj) {
45221         LDKRawInvoice this_obj_conv;
45222         this_obj_conv.inner = untag_ptr(this_obj);
45223         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45225         RawInvoice_free(this_obj_conv);
45226 }
45227
45228 uint64_t  __attribute__((export_name("TS_RawInvoice_get_data"))) TS_RawInvoice_get_data(uint64_t this_ptr) {
45229         LDKRawInvoice this_ptr_conv;
45230         this_ptr_conv.inner = untag_ptr(this_ptr);
45231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45233         this_ptr_conv.is_owned = false;
45234         LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
45235         uint64_t ret_ref = 0;
45236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45238         return ret_ref;
45239 }
45240
45241 void  __attribute__((export_name("TS_RawInvoice_set_data"))) TS_RawInvoice_set_data(uint64_t this_ptr, uint64_t val) {
45242         LDKRawInvoice this_ptr_conv;
45243         this_ptr_conv.inner = untag_ptr(this_ptr);
45244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45246         this_ptr_conv.is_owned = false;
45247         LDKRawDataPart val_conv;
45248         val_conv.inner = untag_ptr(val);
45249         val_conv.is_owned = ptr_is_owned(val);
45250         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45251         val_conv = RawDataPart_clone(&val_conv);
45252         RawInvoice_set_data(&this_ptr_conv, val_conv);
45253 }
45254
45255 jboolean  __attribute__((export_name("TS_RawInvoice_eq"))) TS_RawInvoice_eq(uint64_t a, uint64_t b) {
45256         LDKRawInvoice a_conv;
45257         a_conv.inner = untag_ptr(a);
45258         a_conv.is_owned = ptr_is_owned(a);
45259         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45260         a_conv.is_owned = false;
45261         LDKRawInvoice b_conv;
45262         b_conv.inner = untag_ptr(b);
45263         b_conv.is_owned = ptr_is_owned(b);
45264         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45265         b_conv.is_owned = false;
45266         jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
45267         return ret_conv;
45268 }
45269
45270 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
45271         LDKRawInvoice ret_var = RawInvoice_clone(arg);
45272         uint64_t ret_ref = 0;
45273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45275         return ret_ref;
45276 }
45277 int64_t  __attribute__((export_name("TS_RawInvoice_clone_ptr"))) TS_RawInvoice_clone_ptr(uint64_t arg) {
45278         LDKRawInvoice arg_conv;
45279         arg_conv.inner = untag_ptr(arg);
45280         arg_conv.is_owned = ptr_is_owned(arg);
45281         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45282         arg_conv.is_owned = false;
45283         int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
45284         return ret_conv;
45285 }
45286
45287 uint64_t  __attribute__((export_name("TS_RawInvoice_clone"))) TS_RawInvoice_clone(uint64_t orig) {
45288         LDKRawInvoice orig_conv;
45289         orig_conv.inner = untag_ptr(orig);
45290         orig_conv.is_owned = ptr_is_owned(orig);
45291         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45292         orig_conv.is_owned = false;
45293         LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
45294         uint64_t ret_ref = 0;
45295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45297         return ret_ref;
45298 }
45299
45300 int64_t  __attribute__((export_name("TS_RawInvoice_hash"))) TS_RawInvoice_hash(uint64_t o) {
45301         LDKRawInvoice o_conv;
45302         o_conv.inner = untag_ptr(o);
45303         o_conv.is_owned = ptr_is_owned(o);
45304         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45305         o_conv.is_owned = false;
45306         int64_t ret_conv = RawInvoice_hash(&o_conv);
45307         return ret_conv;
45308 }
45309
45310 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
45311         LDKRawDataPart this_obj_conv;
45312         this_obj_conv.inner = untag_ptr(this_obj);
45313         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45315         RawDataPart_free(this_obj_conv);
45316 }
45317
45318 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
45319         LDKRawDataPart this_ptr_conv;
45320         this_ptr_conv.inner = untag_ptr(this_ptr);
45321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45323         this_ptr_conv.is_owned = false;
45324         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
45325         uint64_t ret_ref = 0;
45326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45328         return ret_ref;
45329 }
45330
45331 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
45332         LDKRawDataPart this_ptr_conv;
45333         this_ptr_conv.inner = untag_ptr(this_ptr);
45334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45336         this_ptr_conv.is_owned = false;
45337         LDKPositiveTimestamp val_conv;
45338         val_conv.inner = untag_ptr(val);
45339         val_conv.is_owned = ptr_is_owned(val);
45340         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45341         val_conv = PositiveTimestamp_clone(&val_conv);
45342         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
45343 }
45344
45345 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
45346         LDKRawDataPart a_conv;
45347         a_conv.inner = untag_ptr(a);
45348         a_conv.is_owned = ptr_is_owned(a);
45349         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45350         a_conv.is_owned = false;
45351         LDKRawDataPart b_conv;
45352         b_conv.inner = untag_ptr(b);
45353         b_conv.is_owned = ptr_is_owned(b);
45354         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45355         b_conv.is_owned = false;
45356         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
45357         return ret_conv;
45358 }
45359
45360 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
45361         LDKRawDataPart ret_var = RawDataPart_clone(arg);
45362         uint64_t ret_ref = 0;
45363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45365         return ret_ref;
45366 }
45367 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
45368         LDKRawDataPart arg_conv;
45369         arg_conv.inner = untag_ptr(arg);
45370         arg_conv.is_owned = ptr_is_owned(arg);
45371         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45372         arg_conv.is_owned = false;
45373         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
45374         return ret_conv;
45375 }
45376
45377 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
45378         LDKRawDataPart orig_conv;
45379         orig_conv.inner = untag_ptr(orig);
45380         orig_conv.is_owned = ptr_is_owned(orig);
45381         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45382         orig_conv.is_owned = false;
45383         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
45384         uint64_t ret_ref = 0;
45385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45387         return ret_ref;
45388 }
45389
45390 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
45391         LDKRawDataPart o_conv;
45392         o_conv.inner = untag_ptr(o);
45393         o_conv.is_owned = ptr_is_owned(o);
45394         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45395         o_conv.is_owned = false;
45396         int64_t ret_conv = RawDataPart_hash(&o_conv);
45397         return ret_conv;
45398 }
45399
45400 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
45401         LDKPositiveTimestamp this_obj_conv;
45402         this_obj_conv.inner = untag_ptr(this_obj);
45403         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45405         PositiveTimestamp_free(this_obj_conv);
45406 }
45407
45408 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
45409         LDKPositiveTimestamp a_conv;
45410         a_conv.inner = untag_ptr(a);
45411         a_conv.is_owned = ptr_is_owned(a);
45412         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45413         a_conv.is_owned = false;
45414         LDKPositiveTimestamp b_conv;
45415         b_conv.inner = untag_ptr(b);
45416         b_conv.is_owned = ptr_is_owned(b);
45417         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45418         b_conv.is_owned = false;
45419         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
45420         return ret_conv;
45421 }
45422
45423 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
45424         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
45425         uint64_t ret_ref = 0;
45426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45428         return ret_ref;
45429 }
45430 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
45431         LDKPositiveTimestamp arg_conv;
45432         arg_conv.inner = untag_ptr(arg);
45433         arg_conv.is_owned = ptr_is_owned(arg);
45434         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45435         arg_conv.is_owned = false;
45436         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
45437         return ret_conv;
45438 }
45439
45440 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
45441         LDKPositiveTimestamp orig_conv;
45442         orig_conv.inner = untag_ptr(orig);
45443         orig_conv.is_owned = ptr_is_owned(orig);
45444         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45445         orig_conv.is_owned = false;
45446         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
45447         uint64_t ret_ref = 0;
45448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45450         return ret_ref;
45451 }
45452
45453 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
45454         LDKPositiveTimestamp o_conv;
45455         o_conv.inner = untag_ptr(o);
45456         o_conv.is_owned = ptr_is_owned(o);
45457         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45458         o_conv.is_owned = false;
45459         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
45460         return ret_conv;
45461 }
45462
45463 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
45464         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
45465         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
45466         return ret_conv;
45467 }
45468
45469 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
45470         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
45471         return ret_conv;
45472 }
45473
45474 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
45475         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
45476         return ret_conv;
45477 }
45478
45479 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
45480         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
45481         return ret_conv;
45482 }
45483
45484 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
45485         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
45486         return ret_conv;
45487 }
45488
45489 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
45490         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
45491         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
45492         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
45493         return ret_conv;
45494 }
45495
45496 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
45497         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
45498         int64_t ret_conv = SiPrefix_hash(o_conv);
45499         return ret_conv;
45500 }
45501
45502 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
45503         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
45504         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
45505         return ret_conv;
45506 }
45507
45508 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
45509         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
45510         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
45511         return ret_conv;
45512 }
45513
45514 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
45515         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
45516         return ret_conv;
45517 }
45518
45519 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
45520         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
45521         return ret_conv;
45522 }
45523
45524 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
45525         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
45526         return ret_conv;
45527 }
45528
45529 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
45530         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
45531         return ret_conv;
45532 }
45533
45534 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
45535         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
45536         return ret_conv;
45537 }
45538
45539 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
45540         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
45541         int64_t ret_conv = Currency_hash(o_conv);
45542         return ret_conv;
45543 }
45544
45545 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
45546         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
45547         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
45548         jboolean ret_conv = Currency_eq(a_conv, b_conv);
45549         return ret_conv;
45550 }
45551
45552 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
45553         LDKSha256 this_obj_conv;
45554         this_obj_conv.inner = untag_ptr(this_obj);
45555         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45557         Sha256_free(this_obj_conv);
45558 }
45559
45560 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
45561         LDKSha256 ret_var = Sha256_clone(arg);
45562         uint64_t ret_ref = 0;
45563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45565         return ret_ref;
45566 }
45567 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
45568         LDKSha256 arg_conv;
45569         arg_conv.inner = untag_ptr(arg);
45570         arg_conv.is_owned = ptr_is_owned(arg);
45571         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45572         arg_conv.is_owned = false;
45573         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
45574         return ret_conv;
45575 }
45576
45577 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
45578         LDKSha256 orig_conv;
45579         orig_conv.inner = untag_ptr(orig);
45580         orig_conv.is_owned = ptr_is_owned(orig);
45581         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45582         orig_conv.is_owned = false;
45583         LDKSha256 ret_var = Sha256_clone(&orig_conv);
45584         uint64_t ret_ref = 0;
45585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45587         return ret_ref;
45588 }
45589
45590 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
45591         LDKSha256 o_conv;
45592         o_conv.inner = untag_ptr(o);
45593         o_conv.is_owned = ptr_is_owned(o);
45594         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45595         o_conv.is_owned = false;
45596         int64_t ret_conv = Sha256_hash(&o_conv);
45597         return ret_conv;
45598 }
45599
45600 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
45601         LDKSha256 a_conv;
45602         a_conv.inner = untag_ptr(a);
45603         a_conv.is_owned = ptr_is_owned(a);
45604         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45605         a_conv.is_owned = false;
45606         LDKSha256 b_conv;
45607         b_conv.inner = untag_ptr(b);
45608         b_conv.is_owned = ptr_is_owned(b);
45609         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45610         b_conv.is_owned = false;
45611         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
45612         return ret_conv;
45613 }
45614
45615 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
45616         LDKDescription this_obj_conv;
45617         this_obj_conv.inner = untag_ptr(this_obj);
45618         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45620         Description_free(this_obj_conv);
45621 }
45622
45623 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
45624         LDKDescription ret_var = Description_clone(arg);
45625         uint64_t ret_ref = 0;
45626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45628         return ret_ref;
45629 }
45630 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
45631         LDKDescription arg_conv;
45632         arg_conv.inner = untag_ptr(arg);
45633         arg_conv.is_owned = ptr_is_owned(arg);
45634         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45635         arg_conv.is_owned = false;
45636         int64_t ret_conv = Description_clone_ptr(&arg_conv);
45637         return ret_conv;
45638 }
45639
45640 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
45641         LDKDescription orig_conv;
45642         orig_conv.inner = untag_ptr(orig);
45643         orig_conv.is_owned = ptr_is_owned(orig);
45644         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45645         orig_conv.is_owned = false;
45646         LDKDescription ret_var = Description_clone(&orig_conv);
45647         uint64_t ret_ref = 0;
45648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45650         return ret_ref;
45651 }
45652
45653 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
45654         LDKDescription o_conv;
45655         o_conv.inner = untag_ptr(o);
45656         o_conv.is_owned = ptr_is_owned(o);
45657         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45658         o_conv.is_owned = false;
45659         int64_t ret_conv = Description_hash(&o_conv);
45660         return ret_conv;
45661 }
45662
45663 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
45664         LDKDescription a_conv;
45665         a_conv.inner = untag_ptr(a);
45666         a_conv.is_owned = ptr_is_owned(a);
45667         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45668         a_conv.is_owned = false;
45669         LDKDescription b_conv;
45670         b_conv.inner = untag_ptr(b);
45671         b_conv.is_owned = ptr_is_owned(b);
45672         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45673         b_conv.is_owned = false;
45674         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
45675         return ret_conv;
45676 }
45677
45678 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
45679         LDKPayeePubKey this_obj_conv;
45680         this_obj_conv.inner = untag_ptr(this_obj);
45681         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45683         PayeePubKey_free(this_obj_conv);
45684 }
45685
45686 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
45687         LDKPayeePubKey this_ptr_conv;
45688         this_ptr_conv.inner = untag_ptr(this_ptr);
45689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45691         this_ptr_conv.is_owned = false;
45692         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45693         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
45694         return ret_arr;
45695 }
45696
45697 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
45698         LDKPayeePubKey this_ptr_conv;
45699         this_ptr_conv.inner = untag_ptr(this_ptr);
45700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45702         this_ptr_conv.is_owned = false;
45703         LDKPublicKey val_ref;
45704         CHECK(val->arr_len == 33);
45705         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45706         PayeePubKey_set_a(&this_ptr_conv, val_ref);
45707 }
45708
45709 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
45710         LDKPublicKey a_arg_ref;
45711         CHECK(a_arg->arr_len == 33);
45712         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
45713         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
45714         uint64_t ret_ref = 0;
45715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45717         return ret_ref;
45718 }
45719
45720 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
45721         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
45722         uint64_t ret_ref = 0;
45723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45725         return ret_ref;
45726 }
45727 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
45728         LDKPayeePubKey arg_conv;
45729         arg_conv.inner = untag_ptr(arg);
45730         arg_conv.is_owned = ptr_is_owned(arg);
45731         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45732         arg_conv.is_owned = false;
45733         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
45734         return ret_conv;
45735 }
45736
45737 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
45738         LDKPayeePubKey orig_conv;
45739         orig_conv.inner = untag_ptr(orig);
45740         orig_conv.is_owned = ptr_is_owned(orig);
45741         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45742         orig_conv.is_owned = false;
45743         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
45744         uint64_t ret_ref = 0;
45745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45747         return ret_ref;
45748 }
45749
45750 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
45751         LDKPayeePubKey o_conv;
45752         o_conv.inner = untag_ptr(o);
45753         o_conv.is_owned = ptr_is_owned(o);
45754         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45755         o_conv.is_owned = false;
45756         int64_t ret_conv = PayeePubKey_hash(&o_conv);
45757         return ret_conv;
45758 }
45759
45760 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
45761         LDKPayeePubKey a_conv;
45762         a_conv.inner = untag_ptr(a);
45763         a_conv.is_owned = ptr_is_owned(a);
45764         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45765         a_conv.is_owned = false;
45766         LDKPayeePubKey b_conv;
45767         b_conv.inner = untag_ptr(b);
45768         b_conv.is_owned = ptr_is_owned(b);
45769         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45770         b_conv.is_owned = false;
45771         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
45772         return ret_conv;
45773 }
45774
45775 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
45776         LDKExpiryTime this_obj_conv;
45777         this_obj_conv.inner = untag_ptr(this_obj);
45778         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45780         ExpiryTime_free(this_obj_conv);
45781 }
45782
45783 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
45784         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
45785         uint64_t ret_ref = 0;
45786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45788         return ret_ref;
45789 }
45790 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
45791         LDKExpiryTime arg_conv;
45792         arg_conv.inner = untag_ptr(arg);
45793         arg_conv.is_owned = ptr_is_owned(arg);
45794         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45795         arg_conv.is_owned = false;
45796         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
45797         return ret_conv;
45798 }
45799
45800 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
45801         LDKExpiryTime orig_conv;
45802         orig_conv.inner = untag_ptr(orig);
45803         orig_conv.is_owned = ptr_is_owned(orig);
45804         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45805         orig_conv.is_owned = false;
45806         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
45807         uint64_t ret_ref = 0;
45808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45810         return ret_ref;
45811 }
45812
45813 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
45814         LDKExpiryTime o_conv;
45815         o_conv.inner = untag_ptr(o);
45816         o_conv.is_owned = ptr_is_owned(o);
45817         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45818         o_conv.is_owned = false;
45819         int64_t ret_conv = ExpiryTime_hash(&o_conv);
45820         return ret_conv;
45821 }
45822
45823 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
45824         LDKExpiryTime a_conv;
45825         a_conv.inner = untag_ptr(a);
45826         a_conv.is_owned = ptr_is_owned(a);
45827         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45828         a_conv.is_owned = false;
45829         LDKExpiryTime b_conv;
45830         b_conv.inner = untag_ptr(b);
45831         b_conv.is_owned = ptr_is_owned(b);
45832         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45833         b_conv.is_owned = false;
45834         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
45835         return ret_conv;
45836 }
45837
45838 void  __attribute__((export_name("TS_MinFinalCltvExpiry_free"))) TS_MinFinalCltvExpiry_free(uint64_t this_obj) {
45839         LDKMinFinalCltvExpiry this_obj_conv;
45840         this_obj_conv.inner = untag_ptr(this_obj);
45841         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45843         MinFinalCltvExpiry_free(this_obj_conv);
45844 }
45845
45846 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_get_a"))) TS_MinFinalCltvExpiry_get_a(uint64_t this_ptr) {
45847         LDKMinFinalCltvExpiry this_ptr_conv;
45848         this_ptr_conv.inner = untag_ptr(this_ptr);
45849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45851         this_ptr_conv.is_owned = false;
45852         int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv);
45853         return ret_conv;
45854 }
45855
45856 void  __attribute__((export_name("TS_MinFinalCltvExpiry_set_a"))) TS_MinFinalCltvExpiry_set_a(uint64_t this_ptr, int64_t val) {
45857         LDKMinFinalCltvExpiry this_ptr_conv;
45858         this_ptr_conv.inner = untag_ptr(this_ptr);
45859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45861         this_ptr_conv.is_owned = false;
45862         MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
45863 }
45864
45865 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_new"))) TS_MinFinalCltvExpiry_new(int64_t a_arg) {
45866         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
45867         uint64_t ret_ref = 0;
45868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45870         return ret_ref;
45871 }
45872
45873 static inline uint64_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
45874         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
45875         uint64_t ret_ref = 0;
45876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45878         return ret_ref;
45879 }
45880 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_clone_ptr"))) TS_MinFinalCltvExpiry_clone_ptr(uint64_t arg) {
45881         LDKMinFinalCltvExpiry arg_conv;
45882         arg_conv.inner = untag_ptr(arg);
45883         arg_conv.is_owned = ptr_is_owned(arg);
45884         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45885         arg_conv.is_owned = false;
45886         int64_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv);
45887         return ret_conv;
45888 }
45889
45890 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_clone"))) TS_MinFinalCltvExpiry_clone(uint64_t orig) {
45891         LDKMinFinalCltvExpiry orig_conv;
45892         orig_conv.inner = untag_ptr(orig);
45893         orig_conv.is_owned = ptr_is_owned(orig);
45894         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45895         orig_conv.is_owned = false;
45896         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
45897         uint64_t ret_ref = 0;
45898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45900         return ret_ref;
45901 }
45902
45903 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_hash"))) TS_MinFinalCltvExpiry_hash(uint64_t o) {
45904         LDKMinFinalCltvExpiry o_conv;
45905         o_conv.inner = untag_ptr(o);
45906         o_conv.is_owned = ptr_is_owned(o);
45907         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45908         o_conv.is_owned = false;
45909         int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv);
45910         return ret_conv;
45911 }
45912
45913 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiry_eq"))) TS_MinFinalCltvExpiry_eq(uint64_t a, uint64_t b) {
45914         LDKMinFinalCltvExpiry a_conv;
45915         a_conv.inner = untag_ptr(a);
45916         a_conv.is_owned = ptr_is_owned(a);
45917         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45918         a_conv.is_owned = false;
45919         LDKMinFinalCltvExpiry b_conv;
45920         b_conv.inner = untag_ptr(b);
45921         b_conv.is_owned = ptr_is_owned(b);
45922         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45923         b_conv.is_owned = false;
45924         jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
45925         return ret_conv;
45926 }
45927
45928 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
45929         if (!ptr_is_owned(this_ptr)) return;
45930         void* this_ptr_ptr = untag_ptr(this_ptr);
45931         CHECK_ACCESS(this_ptr_ptr);
45932         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
45933         FREE(untag_ptr(this_ptr));
45934         Fallback_free(this_ptr_conv);
45935 }
45936
45937 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
45938         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
45939         *ret_copy = Fallback_clone(arg);
45940         uint64_t ret_ref = tag_ptr(ret_copy, true);
45941         return ret_ref;
45942 }
45943 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
45944         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
45945         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
45946         return ret_conv;
45947 }
45948
45949 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
45950         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
45951         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
45952         *ret_copy = Fallback_clone(orig_conv);
45953         uint64_t ret_ref = tag_ptr(ret_copy, true);
45954         return ret_ref;
45955 }
45956
45957 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
45958         
45959         LDKCVec_u8Z program_ref;
45960         program_ref.datalen = program->arr_len;
45961         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
45962         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
45963         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
45964         *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
45965         uint64_t ret_ref = tag_ptr(ret_copy, true);
45966         return ret_ref;
45967 }
45968
45969 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
45970         LDKTwentyBytes a_ref;
45971         CHECK(a->arr_len == 20);
45972         memcpy(a_ref.data, a->elems, 20); FREE(a);
45973         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
45974         *ret_copy = Fallback_pub_key_hash(a_ref);
45975         uint64_t ret_ref = tag_ptr(ret_copy, true);
45976         return ret_ref;
45977 }
45978
45979 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
45980         LDKTwentyBytes a_ref;
45981         CHECK(a->arr_len == 20);
45982         memcpy(a_ref.data, a->elems, 20); FREE(a);
45983         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
45984         *ret_copy = Fallback_script_hash(a_ref);
45985         uint64_t ret_ref = tag_ptr(ret_copy, true);
45986         return ret_ref;
45987 }
45988
45989 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
45990         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
45991         int64_t ret_conv = Fallback_hash(o_conv);
45992         return ret_conv;
45993 }
45994
45995 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
45996         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
45997         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
45998         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
45999         return ret_conv;
46000 }
46001
46002 void  __attribute__((export_name("TS_InvoiceSignature_free"))) TS_InvoiceSignature_free(uint64_t this_obj) {
46003         LDKInvoiceSignature this_obj_conv;
46004         this_obj_conv.inner = untag_ptr(this_obj);
46005         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46007         InvoiceSignature_free(this_obj_conv);
46008 }
46009
46010 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
46011         LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
46012         uint64_t ret_ref = 0;
46013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46015         return ret_ref;
46016 }
46017 int64_t  __attribute__((export_name("TS_InvoiceSignature_clone_ptr"))) TS_InvoiceSignature_clone_ptr(uint64_t arg) {
46018         LDKInvoiceSignature arg_conv;
46019         arg_conv.inner = untag_ptr(arg);
46020         arg_conv.is_owned = ptr_is_owned(arg);
46021         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46022         arg_conv.is_owned = false;
46023         int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
46024         return ret_conv;
46025 }
46026
46027 uint64_t  __attribute__((export_name("TS_InvoiceSignature_clone"))) TS_InvoiceSignature_clone(uint64_t orig) {
46028         LDKInvoiceSignature orig_conv;
46029         orig_conv.inner = untag_ptr(orig);
46030         orig_conv.is_owned = ptr_is_owned(orig);
46031         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46032         orig_conv.is_owned = false;
46033         LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
46034         uint64_t ret_ref = 0;
46035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46037         return ret_ref;
46038 }
46039
46040 int64_t  __attribute__((export_name("TS_InvoiceSignature_hash"))) TS_InvoiceSignature_hash(uint64_t o) {
46041         LDKInvoiceSignature o_conv;
46042         o_conv.inner = untag_ptr(o);
46043         o_conv.is_owned = ptr_is_owned(o);
46044         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46045         o_conv.is_owned = false;
46046         int64_t ret_conv = InvoiceSignature_hash(&o_conv);
46047         return ret_conv;
46048 }
46049
46050 jboolean  __attribute__((export_name("TS_InvoiceSignature_eq"))) TS_InvoiceSignature_eq(uint64_t a, uint64_t b) {
46051         LDKInvoiceSignature a_conv;
46052         a_conv.inner = untag_ptr(a);
46053         a_conv.is_owned = ptr_is_owned(a);
46054         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46055         a_conv.is_owned = false;
46056         LDKInvoiceSignature b_conv;
46057         b_conv.inner = untag_ptr(b);
46058         b_conv.is_owned = ptr_is_owned(b);
46059         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46060         b_conv.is_owned = false;
46061         jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
46062         return ret_conv;
46063 }
46064
46065 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
46066         LDKPrivateRoute this_obj_conv;
46067         this_obj_conv.inner = untag_ptr(this_obj);
46068         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46070         PrivateRoute_free(this_obj_conv);
46071 }
46072
46073 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
46074         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
46075         uint64_t ret_ref = 0;
46076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46078         return ret_ref;
46079 }
46080 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
46081         LDKPrivateRoute arg_conv;
46082         arg_conv.inner = untag_ptr(arg);
46083         arg_conv.is_owned = ptr_is_owned(arg);
46084         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46085         arg_conv.is_owned = false;
46086         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
46087         return ret_conv;
46088 }
46089
46090 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
46091         LDKPrivateRoute orig_conv;
46092         orig_conv.inner = untag_ptr(orig);
46093         orig_conv.is_owned = ptr_is_owned(orig);
46094         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46095         orig_conv.is_owned = false;
46096         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
46097         uint64_t ret_ref = 0;
46098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46100         return ret_ref;
46101 }
46102
46103 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
46104         LDKPrivateRoute o_conv;
46105         o_conv.inner = untag_ptr(o);
46106         o_conv.is_owned = ptr_is_owned(o);
46107         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46108         o_conv.is_owned = false;
46109         int64_t ret_conv = PrivateRoute_hash(&o_conv);
46110         return ret_conv;
46111 }
46112
46113 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
46114         LDKPrivateRoute a_conv;
46115         a_conv.inner = untag_ptr(a);
46116         a_conv.is_owned = ptr_is_owned(a);
46117         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46118         a_conv.is_owned = false;
46119         LDKPrivateRoute b_conv;
46120         b_conv.inner = untag_ptr(b);
46121         b_conv.is_owned = ptr_is_owned(b);
46122         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46123         b_conv.is_owned = false;
46124         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
46125         return ret_conv;
46126 }
46127
46128 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_into_parts"))) TS_SignedRawInvoice_into_parts(uint64_t this_arg) {
46129         LDKSignedRawInvoice this_arg_conv;
46130         this_arg_conv.inner = untag_ptr(this_arg);
46131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46133         this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
46134         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
46135         *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
46136         return tag_ptr(ret_conv, true);
46137 }
46138
46139 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_raw_invoice"))) TS_SignedRawInvoice_raw_invoice(uint64_t this_arg) {
46140         LDKSignedRawInvoice this_arg_conv;
46141         this_arg_conv.inner = untag_ptr(this_arg);
46142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46144         this_arg_conv.is_owned = false;
46145         LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
46146         uint64_t ret_ref = 0;
46147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46149         return ret_ref;
46150 }
46151
46152 int8_tArray  __attribute__((export_name("TS_SignedRawInvoice_signable_hash"))) TS_SignedRawInvoice_signable_hash(uint64_t this_arg) {
46153         LDKSignedRawInvoice this_arg_conv;
46154         this_arg_conv.inner = untag_ptr(this_arg);
46155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46157         this_arg_conv.is_owned = false;
46158         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46159         memcpy(ret_arr->elems, *SignedRawInvoice_signable_hash(&this_arg_conv), 32);
46160         return ret_arr;
46161 }
46162
46163 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_signature"))) TS_SignedRawInvoice_signature(uint64_t this_arg) {
46164         LDKSignedRawInvoice this_arg_conv;
46165         this_arg_conv.inner = untag_ptr(this_arg);
46166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46168         this_arg_conv.is_owned = false;
46169         LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
46170         uint64_t ret_ref = 0;
46171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46173         return ret_ref;
46174 }
46175
46176 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_recover_payee_pub_key"))) TS_SignedRawInvoice_recover_payee_pub_key(uint64_t this_arg) {
46177         LDKSignedRawInvoice this_arg_conv;
46178         this_arg_conv.inner = untag_ptr(this_arg);
46179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46181         this_arg_conv.is_owned = false;
46182         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
46183         *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
46184         return tag_ptr(ret_conv, true);
46185 }
46186
46187 jboolean  __attribute__((export_name("TS_SignedRawInvoice_check_signature"))) TS_SignedRawInvoice_check_signature(uint64_t this_arg) {
46188         LDKSignedRawInvoice this_arg_conv;
46189         this_arg_conv.inner = untag_ptr(this_arg);
46190         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46192         this_arg_conv.is_owned = false;
46193         jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
46194         return ret_conv;
46195 }
46196
46197 int8_tArray  __attribute__((export_name("TS_RawInvoice_signable_hash"))) TS_RawInvoice_signable_hash(uint64_t this_arg) {
46198         LDKRawInvoice this_arg_conv;
46199         this_arg_conv.inner = untag_ptr(this_arg);
46200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46202         this_arg_conv.is_owned = false;
46203         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46204         memcpy(ret_arr->elems, RawInvoice_signable_hash(&this_arg_conv).data, 32);
46205         return ret_arr;
46206 }
46207
46208 uint64_t  __attribute__((export_name("TS_RawInvoice_payment_hash"))) TS_RawInvoice_payment_hash(uint64_t this_arg) {
46209         LDKRawInvoice this_arg_conv;
46210         this_arg_conv.inner = untag_ptr(this_arg);
46211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46213         this_arg_conv.is_owned = false;
46214         LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
46215         uint64_t ret_ref = 0;
46216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46218         return ret_ref;
46219 }
46220
46221 uint64_t  __attribute__((export_name("TS_RawInvoice_description"))) TS_RawInvoice_description(uint64_t this_arg) {
46222         LDKRawInvoice this_arg_conv;
46223         this_arg_conv.inner = untag_ptr(this_arg);
46224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46226         this_arg_conv.is_owned = false;
46227         LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
46228         uint64_t ret_ref = 0;
46229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46231         return ret_ref;
46232 }
46233
46234 uint64_t  __attribute__((export_name("TS_RawInvoice_payee_pub_key"))) TS_RawInvoice_payee_pub_key(uint64_t this_arg) {
46235         LDKRawInvoice this_arg_conv;
46236         this_arg_conv.inner = untag_ptr(this_arg);
46237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46239         this_arg_conv.is_owned = false;
46240         LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
46241         uint64_t ret_ref = 0;
46242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46244         return ret_ref;
46245 }
46246
46247 uint64_t  __attribute__((export_name("TS_RawInvoice_description_hash"))) TS_RawInvoice_description_hash(uint64_t this_arg) {
46248         LDKRawInvoice this_arg_conv;
46249         this_arg_conv.inner = untag_ptr(this_arg);
46250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46252         this_arg_conv.is_owned = false;
46253         LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
46254         uint64_t ret_ref = 0;
46255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46257         return ret_ref;
46258 }
46259
46260 uint64_t  __attribute__((export_name("TS_RawInvoice_expiry_time"))) TS_RawInvoice_expiry_time(uint64_t this_arg) {
46261         LDKRawInvoice this_arg_conv;
46262         this_arg_conv.inner = untag_ptr(this_arg);
46263         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46265         this_arg_conv.is_owned = false;
46266         LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
46267         uint64_t ret_ref = 0;
46268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46270         return ret_ref;
46271 }
46272
46273 uint64_t  __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry"))) TS_RawInvoice_min_final_cltv_expiry(uint64_t this_arg) {
46274         LDKRawInvoice this_arg_conv;
46275         this_arg_conv.inner = untag_ptr(this_arg);
46276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46278         this_arg_conv.is_owned = false;
46279         LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
46280         uint64_t ret_ref = 0;
46281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46283         return ret_ref;
46284 }
46285
46286 int8_tArray  __attribute__((export_name("TS_RawInvoice_payment_secret"))) TS_RawInvoice_payment_secret(uint64_t this_arg) {
46287         LDKRawInvoice this_arg_conv;
46288         this_arg_conv.inner = untag_ptr(this_arg);
46289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46291         this_arg_conv.is_owned = false;
46292         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46293         memcpy(ret_arr->elems, RawInvoice_payment_secret(&this_arg_conv).data, 32);
46294         return ret_arr;
46295 }
46296
46297 uint64_t  __attribute__((export_name("TS_RawInvoice_features"))) TS_RawInvoice_features(uint64_t this_arg) {
46298         LDKRawInvoice this_arg_conv;
46299         this_arg_conv.inner = untag_ptr(this_arg);
46300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46302         this_arg_conv.is_owned = false;
46303         LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
46304         uint64_t ret_ref = 0;
46305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46307         return ret_ref;
46308 }
46309
46310 uint64_tArray  __attribute__((export_name("TS_RawInvoice_private_routes"))) TS_RawInvoice_private_routes(uint64_t this_arg) {
46311         LDKRawInvoice this_arg_conv;
46312         this_arg_conv.inner = untag_ptr(this_arg);
46313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46315         this_arg_conv.is_owned = false;
46316         LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
46317         uint64_tArray ret_arr = NULL;
46318         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46319         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46320         for (size_t o = 0; o < ret_var.datalen; o++) {
46321                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
46322                 uint64_t ret_conv_14_ref = 0;
46323                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
46324                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
46325                 ret_arr_ptr[o] = ret_conv_14_ref;
46326         }
46327         
46328         FREE(ret_var.data);
46329         return ret_arr;
46330 }
46331
46332 uint64_t  __attribute__((export_name("TS_RawInvoice_amount_pico_btc"))) TS_RawInvoice_amount_pico_btc(uint64_t this_arg) {
46333         LDKRawInvoice this_arg_conv;
46334         this_arg_conv.inner = untag_ptr(this_arg);
46335         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46337         this_arg_conv.is_owned = false;
46338         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46339         *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
46340         uint64_t ret_ref = tag_ptr(ret_copy, true);
46341         return ret_ref;
46342 }
46343
46344 uint32_t  __attribute__((export_name("TS_RawInvoice_currency"))) TS_RawInvoice_currency(uint64_t this_arg) {
46345         LDKRawInvoice this_arg_conv;
46346         this_arg_conv.inner = untag_ptr(this_arg);
46347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46349         this_arg_conv.is_owned = false;
46350         uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
46351         return ret_conv;
46352 }
46353
46354 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
46355         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
46356         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
46357         return tag_ptr(ret_conv, true);
46358 }
46359
46360 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
46361         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
46362         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
46363         return tag_ptr(ret_conv, true);
46364 }
46365
46366 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
46367         LDKPositiveTimestamp this_arg_conv;
46368         this_arg_conv.inner = untag_ptr(this_arg);
46369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46371         this_arg_conv.is_owned = false;
46372         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
46373         return ret_conv;
46374 }
46375
46376 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
46377         LDKPositiveTimestamp this_arg_conv;
46378         this_arg_conv.inner = untag_ptr(this_arg);
46379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46381         this_arg_conv.is_owned = false;
46382         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
46383         return ret_conv;
46384 }
46385
46386 uint64_t  __attribute__((export_name("TS_Invoice_into_signed_raw"))) TS_Invoice_into_signed_raw(uint64_t this_arg) {
46387         LDKInvoice this_arg_conv;
46388         this_arg_conv.inner = untag_ptr(this_arg);
46389         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46391         this_arg_conv = Invoice_clone(&this_arg_conv);
46392         LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
46393         uint64_t ret_ref = 0;
46394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46396         return ret_ref;
46397 }
46398
46399 uint64_t  __attribute__((export_name("TS_Invoice_check_signature"))) TS_Invoice_check_signature(uint64_t this_arg) {
46400         LDKInvoice this_arg_conv;
46401         this_arg_conv.inner = untag_ptr(this_arg);
46402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46404         this_arg_conv.is_owned = false;
46405         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
46406         *ret_conv = Invoice_check_signature(&this_arg_conv);
46407         return tag_ptr(ret_conv, true);
46408 }
46409
46410 uint64_t  __attribute__((export_name("TS_Invoice_from_signed"))) TS_Invoice_from_signed(uint64_t signed_invoice) {
46411         LDKSignedRawInvoice signed_invoice_conv;
46412         signed_invoice_conv.inner = untag_ptr(signed_invoice);
46413         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
46414         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
46415         signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
46416         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
46417         *ret_conv = Invoice_from_signed(signed_invoice_conv);
46418         return tag_ptr(ret_conv, true);
46419 }
46420
46421 int64_t  __attribute__((export_name("TS_Invoice_duration_since_epoch"))) TS_Invoice_duration_since_epoch(uint64_t this_arg) {
46422         LDKInvoice this_arg_conv;
46423         this_arg_conv.inner = untag_ptr(this_arg);
46424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46426         this_arg_conv.is_owned = false;
46427         int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
46428         return ret_conv;
46429 }
46430
46431 int8_tArray  __attribute__((export_name("TS_Invoice_payment_hash"))) TS_Invoice_payment_hash(uint64_t this_arg) {
46432         LDKInvoice this_arg_conv;
46433         this_arg_conv.inner = untag_ptr(this_arg);
46434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46436         this_arg_conv.is_owned = false;
46437         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46438         memcpy(ret_arr->elems, *Invoice_payment_hash(&this_arg_conv), 32);
46439         return ret_arr;
46440 }
46441
46442 int8_tArray  __attribute__((export_name("TS_Invoice_payee_pub_key"))) TS_Invoice_payee_pub_key(uint64_t this_arg) {
46443         LDKInvoice this_arg_conv;
46444         this_arg_conv.inner = untag_ptr(this_arg);
46445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46447         this_arg_conv.is_owned = false;
46448         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46449         memcpy(ret_arr->elems, Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
46450         return ret_arr;
46451 }
46452
46453 int8_tArray  __attribute__((export_name("TS_Invoice_payment_secret"))) TS_Invoice_payment_secret(uint64_t this_arg) {
46454         LDKInvoice this_arg_conv;
46455         this_arg_conv.inner = untag_ptr(this_arg);
46456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46458         this_arg_conv.is_owned = false;
46459         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46460         memcpy(ret_arr->elems, *Invoice_payment_secret(&this_arg_conv), 32);
46461         return ret_arr;
46462 }
46463
46464 uint64_t  __attribute__((export_name("TS_Invoice_features"))) TS_Invoice_features(uint64_t this_arg) {
46465         LDKInvoice this_arg_conv;
46466         this_arg_conv.inner = untag_ptr(this_arg);
46467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46469         this_arg_conv.is_owned = false;
46470         LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
46471         uint64_t ret_ref = 0;
46472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46474         return ret_ref;
46475 }
46476
46477 int8_tArray  __attribute__((export_name("TS_Invoice_recover_payee_pub_key"))) TS_Invoice_recover_payee_pub_key(uint64_t this_arg) {
46478         LDKInvoice this_arg_conv;
46479         this_arg_conv.inner = untag_ptr(this_arg);
46480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46482         this_arg_conv.is_owned = false;
46483         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46484         memcpy(ret_arr->elems, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
46485         return ret_arr;
46486 }
46487
46488 int64_t  __attribute__((export_name("TS_Invoice_expiry_time"))) TS_Invoice_expiry_time(uint64_t this_arg) {
46489         LDKInvoice this_arg_conv;
46490         this_arg_conv.inner = untag_ptr(this_arg);
46491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46493         this_arg_conv.is_owned = false;
46494         int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
46495         return ret_conv;
46496 }
46497
46498 jboolean  __attribute__((export_name("TS_Invoice_would_expire"))) TS_Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
46499         LDKInvoice this_arg_conv;
46500         this_arg_conv.inner = untag_ptr(this_arg);
46501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46503         this_arg_conv.is_owned = false;
46504         jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
46505         return ret_conv;
46506 }
46507
46508 int64_t  __attribute__((export_name("TS_Invoice_min_final_cltv_expiry"))) TS_Invoice_min_final_cltv_expiry(uint64_t this_arg) {
46509         LDKInvoice this_arg_conv;
46510         this_arg_conv.inner = untag_ptr(this_arg);
46511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46513         this_arg_conv.is_owned = false;
46514         int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv);
46515         return ret_conv;
46516 }
46517
46518 uint64_tArray  __attribute__((export_name("TS_Invoice_private_routes"))) TS_Invoice_private_routes(uint64_t this_arg) {
46519         LDKInvoice this_arg_conv;
46520         this_arg_conv.inner = untag_ptr(this_arg);
46521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46523         this_arg_conv.is_owned = false;
46524         LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
46525         uint64_tArray ret_arr = NULL;
46526         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46527         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46528         for (size_t o = 0; o < ret_var.datalen; o++) {
46529                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
46530                 uint64_t ret_conv_14_ref = 0;
46531                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
46532                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
46533                 ret_arr_ptr[o] = ret_conv_14_ref;
46534         }
46535         
46536         FREE(ret_var.data);
46537         return ret_arr;
46538 }
46539
46540 uint64_tArray  __attribute__((export_name("TS_Invoice_route_hints"))) TS_Invoice_route_hints(uint64_t this_arg) {
46541         LDKInvoice this_arg_conv;
46542         this_arg_conv.inner = untag_ptr(this_arg);
46543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46545         this_arg_conv.is_owned = false;
46546         LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
46547         uint64_tArray ret_arr = NULL;
46548         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46549         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46550         for (size_t l = 0; l < ret_var.datalen; l++) {
46551                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
46552                 uint64_t ret_conv_11_ref = 0;
46553                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
46554                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
46555                 ret_arr_ptr[l] = ret_conv_11_ref;
46556         }
46557         
46558         FREE(ret_var.data);
46559         return ret_arr;
46560 }
46561
46562 uint32_t  __attribute__((export_name("TS_Invoice_currency"))) TS_Invoice_currency(uint64_t this_arg) {
46563         LDKInvoice this_arg_conv;
46564         this_arg_conv.inner = untag_ptr(this_arg);
46565         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46567         this_arg_conv.is_owned = false;
46568         uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
46569         return ret_conv;
46570 }
46571
46572 uint64_t  __attribute__((export_name("TS_Invoice_amount_milli_satoshis"))) TS_Invoice_amount_milli_satoshis(uint64_t this_arg) {
46573         LDKInvoice this_arg_conv;
46574         this_arg_conv.inner = untag_ptr(this_arg);
46575         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46577         this_arg_conv.is_owned = false;
46578         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46579         *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
46580         uint64_t ret_ref = tag_ptr(ret_copy, true);
46581         return ret_ref;
46582 }
46583
46584 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
46585         LDKStr description_conv = str_ref_to_owned_c(description);
46586         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
46587         *ret_conv = Description_new(description_conv);
46588         return tag_ptr(ret_conv, true);
46589 }
46590
46591 jstring  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
46592         LDKDescription this_arg_conv;
46593         this_arg_conv.inner = untag_ptr(this_arg);
46594         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46596         this_arg_conv = Description_clone(&this_arg_conv);
46597         LDKStr ret_str = Description_into_inner(this_arg_conv);
46598         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46599         Str_free(ret_str);
46600         return ret_conv;
46601 }
46602
46603 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
46604         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
46605         uint64_t ret_ref = 0;
46606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46608         return ret_ref;
46609 }
46610
46611 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
46612         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
46613         uint64_t ret_ref = 0;
46614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46616         return ret_ref;
46617 }
46618
46619 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
46620         LDKExpiryTime this_arg_conv;
46621         this_arg_conv.inner = untag_ptr(this_arg);
46622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46624         this_arg_conv.is_owned = false;
46625         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
46626         return ret_conv;
46627 }
46628
46629 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
46630         LDKExpiryTime this_arg_conv;
46631         this_arg_conv.inner = untag_ptr(this_arg);
46632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46634         this_arg_conv.is_owned = false;
46635         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
46636         return ret_conv;
46637 }
46638
46639 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
46640         LDKRouteHint hops_conv;
46641         hops_conv.inner = untag_ptr(hops);
46642         hops_conv.is_owned = ptr_is_owned(hops);
46643         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
46644         hops_conv = RouteHint_clone(&hops_conv);
46645         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
46646         *ret_conv = PrivateRoute_new(hops_conv);
46647         return tag_ptr(ret_conv, true);
46648 }
46649
46650 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
46651         LDKPrivateRoute this_arg_conv;
46652         this_arg_conv.inner = untag_ptr(this_arg);
46653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46655         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
46656         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
46657         uint64_t ret_ref = 0;
46658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46660         return ret_ref;
46661 }
46662
46663 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
46664         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
46665         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
46666         return ret_conv;
46667 }
46668
46669 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
46670         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
46671         return ret_conv;
46672 }
46673
46674 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
46675         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
46676         return ret_conv;
46677 }
46678
46679 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
46680         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
46681         return ret_conv;
46682 }
46683
46684 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
46685         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
46686         return ret_conv;
46687 }
46688
46689 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
46690         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
46691         return ret_conv;
46692 }
46693
46694 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
46695         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
46696         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
46697         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
46698         return ret_conv;
46699 }
46700
46701 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
46702         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
46703         LDKStr ret_str = CreationError_to_str(o_conv);
46704         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46705         Str_free(ret_str);
46706         return ret_conv;
46707 }
46708
46709 uint32_t  __attribute__((export_name("TS_SemanticError_clone"))) TS_SemanticError_clone(uint64_t orig) {
46710         LDKSemanticError* orig_conv = (LDKSemanticError*)untag_ptr(orig);
46711         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
46712         return ret_conv;
46713 }
46714
46715 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_hash"))) TS_SemanticError_no_payment_hash() {
46716         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
46717         return ret_conv;
46718 }
46719
46720 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_hashes"))) TS_SemanticError_multiple_payment_hashes() {
46721         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
46722         return ret_conv;
46723 }
46724
46725 uint32_t  __attribute__((export_name("TS_SemanticError_no_description"))) TS_SemanticError_no_description() {
46726         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
46727         return ret_conv;
46728 }
46729
46730 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_descriptions"))) TS_SemanticError_multiple_descriptions() {
46731         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
46732         return ret_conv;
46733 }
46734
46735 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_secret"))) TS_SemanticError_no_payment_secret() {
46736         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
46737         return ret_conv;
46738 }
46739
46740 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_secrets"))) TS_SemanticError_multiple_payment_secrets() {
46741         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
46742         return ret_conv;
46743 }
46744
46745 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_features"))) TS_SemanticError_invalid_features() {
46746         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
46747         return ret_conv;
46748 }
46749
46750 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_recovery_id"))) TS_SemanticError_invalid_recovery_id() {
46751         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
46752         return ret_conv;
46753 }
46754
46755 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_signature"))) TS_SemanticError_invalid_signature() {
46756         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
46757         return ret_conv;
46758 }
46759
46760 uint32_t  __attribute__((export_name("TS_SemanticError_imprecise_amount"))) TS_SemanticError_imprecise_amount() {
46761         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
46762         return ret_conv;
46763 }
46764
46765 jboolean  __attribute__((export_name("TS_SemanticError_eq"))) TS_SemanticError_eq(uint64_t a, uint64_t b) {
46766         LDKSemanticError* a_conv = (LDKSemanticError*)untag_ptr(a);
46767         LDKSemanticError* b_conv = (LDKSemanticError*)untag_ptr(b);
46768         jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
46769         return ret_conv;
46770 }
46771
46772 jstring  __attribute__((export_name("TS_SemanticError_to_str"))) TS_SemanticError_to_str(uint64_t o) {
46773         LDKSemanticError* o_conv = (LDKSemanticError*)untag_ptr(o);
46774         LDKStr ret_str = SemanticError_to_str(o_conv);
46775         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46776         Str_free(ret_str);
46777         return ret_conv;
46778 }
46779
46780 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
46781         if (!ptr_is_owned(this_ptr)) return;
46782         void* this_ptr_ptr = untag_ptr(this_ptr);
46783         CHECK_ACCESS(this_ptr_ptr);
46784         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
46785         FREE(untag_ptr(this_ptr));
46786         SignOrCreationError_free(this_ptr_conv);
46787 }
46788
46789 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
46790         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
46791         *ret_copy = SignOrCreationError_clone(arg);
46792         uint64_t ret_ref = tag_ptr(ret_copy, true);
46793         return ret_ref;
46794 }
46795 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
46796         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
46797         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
46798         return ret_conv;
46799 }
46800
46801 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
46802         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
46803         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
46804         *ret_copy = SignOrCreationError_clone(orig_conv);
46805         uint64_t ret_ref = tag_ptr(ret_copy, true);
46806         return ret_ref;
46807 }
46808
46809 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
46810         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
46811         *ret_copy = SignOrCreationError_sign_error();
46812         uint64_t ret_ref = tag_ptr(ret_copy, true);
46813         return ret_ref;
46814 }
46815
46816 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
46817         LDKCreationError a_conv = LDKCreationError_from_js(a);
46818         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
46819         *ret_copy = SignOrCreationError_creation_error(a_conv);
46820         uint64_t ret_ref = tag_ptr(ret_copy, true);
46821         return ret_ref;
46822 }
46823
46824 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
46825         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
46826         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
46827         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
46828         return ret_conv;
46829 }
46830
46831 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
46832         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
46833         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
46834         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46835         Str_free(ret_str);
46836         return ret_conv;
46837 }
46838
46839 void  __attribute__((export_name("TS_InvoicePayer_free"))) TS_InvoicePayer_free(uint64_t this_obj) {
46840         LDKInvoicePayer this_obj_conv;
46841         this_obj_conv.inner = untag_ptr(this_obj);
46842         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46844         InvoicePayer_free(this_obj_conv);
46845 }
46846
46847 void  __attribute__((export_name("TS_Payer_free"))) TS_Payer_free(uint64_t this_ptr) {
46848         if (!ptr_is_owned(this_ptr)) return;
46849         void* this_ptr_ptr = untag_ptr(this_ptr);
46850         CHECK_ACCESS(this_ptr_ptr);
46851         LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
46852         FREE(untag_ptr(this_ptr));
46853         Payer_free(this_ptr_conv);
46854 }
46855
46856 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
46857         if (!ptr_is_owned(this_ptr)) return;
46858         void* this_ptr_ptr = untag_ptr(this_ptr);
46859         CHECK_ACCESS(this_ptr_ptr);
46860         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
46861         FREE(untag_ptr(this_ptr));
46862         Router_free(this_ptr_conv);
46863 }
46864
46865 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
46866         if (!ptr_is_owned(this_ptr)) return;
46867         void* this_ptr_ptr = untag_ptr(this_ptr);
46868         CHECK_ACCESS(this_ptr_ptr);
46869         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
46870         FREE(untag_ptr(this_ptr));
46871         Retry_free(this_ptr_conv);
46872 }
46873
46874 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
46875         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
46876         *ret_copy = Retry_clone(arg);
46877         uint64_t ret_ref = tag_ptr(ret_copy, true);
46878         return ret_ref;
46879 }
46880 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
46881         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
46882         int64_t ret_conv = Retry_clone_ptr(arg_conv);
46883         return ret_conv;
46884 }
46885
46886 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
46887         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
46888         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
46889         *ret_copy = Retry_clone(orig_conv);
46890         uint64_t ret_ref = tag_ptr(ret_copy, true);
46891         return ret_ref;
46892 }
46893
46894 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) {
46895         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
46896         *ret_copy = Retry_attempts(a);
46897         uint64_t ret_ref = tag_ptr(ret_copy, true);
46898         return ret_ref;
46899 }
46900
46901 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
46902         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
46903         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
46904         jboolean ret_conv = Retry_eq(a_conv, b_conv);
46905         return ret_conv;
46906 }
46907
46908 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
46909         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
46910         int64_t ret_conv = Retry_hash(o_conv);
46911         return ret_conv;
46912 }
46913
46914 void  __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint64_t this_ptr) {
46915         if (!ptr_is_owned(this_ptr)) return;
46916         void* this_ptr_ptr = untag_ptr(this_ptr);
46917         CHECK_ACCESS(this_ptr_ptr);
46918         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
46919         FREE(untag_ptr(this_ptr));
46920         PaymentError_free(this_ptr_conv);
46921 }
46922
46923 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
46924         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
46925         *ret_copy = PaymentError_clone(arg);
46926         uint64_t ret_ref = tag_ptr(ret_copy, true);
46927         return ret_ref;
46928 }
46929 int64_t  __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint64_t arg) {
46930         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
46931         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
46932         return ret_conv;
46933 }
46934
46935 uint64_t  __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint64_t orig) {
46936         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
46937         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
46938         *ret_copy = PaymentError_clone(orig_conv);
46939         uint64_t ret_ref = tag_ptr(ret_copy, true);
46940         return ret_ref;
46941 }
46942
46943 uint64_t  __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
46944         LDKStr a_conv = str_ref_to_owned_c(a);
46945         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
46946         *ret_copy = PaymentError_invoice(a_conv);
46947         uint64_t ret_ref = tag_ptr(ret_copy, true);
46948         return ret_ref;
46949 }
46950
46951 uint64_t  __attribute__((export_name("TS_PaymentError_routing"))) TS_PaymentError_routing(uint64_t a) {
46952         LDKLightningError a_conv;
46953         a_conv.inner = untag_ptr(a);
46954         a_conv.is_owned = ptr_is_owned(a);
46955         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46956         a_conv = LightningError_clone(&a_conv);
46957         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
46958         *ret_copy = PaymentError_routing(a_conv);
46959         uint64_t ret_ref = tag_ptr(ret_copy, true);
46960         return ret_ref;
46961 }
46962
46963 uint64_t  __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint64_t a) {
46964         void* a_ptr = untag_ptr(a);
46965         CHECK_ACCESS(a_ptr);
46966         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
46967         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
46968         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
46969         *ret_copy = PaymentError_sending(a_conv);
46970         uint64_t ret_ref = tag_ptr(ret_copy, true);
46971         return ret_ref;
46972 }
46973
46974 uint64_t  __attribute__((export_name("TS_InvoicePayer_new"))) TS_InvoicePayer_new(uint64_t payer, uint64_t router, uint64_t logger, uint64_t event_handler, uint64_t retry) {
46975         void* payer_ptr = untag_ptr(payer);
46976         CHECK_ACCESS(payer_ptr);
46977         LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
46978         if (payer_conv.free == LDKPayer_JCalls_free) {
46979                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46980                 LDKPayer_JCalls_cloned(&payer_conv);
46981         }
46982         void* router_ptr = untag_ptr(router);
46983         CHECK_ACCESS(router_ptr);
46984         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
46985         if (router_conv.free == LDKRouter_JCalls_free) {
46986                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46987                 LDKRouter_JCalls_cloned(&router_conv);
46988         }
46989         void* logger_ptr = untag_ptr(logger);
46990         CHECK_ACCESS(logger_ptr);
46991         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46992         if (logger_conv.free == LDKLogger_JCalls_free) {
46993                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46994                 LDKLogger_JCalls_cloned(&logger_conv);
46995         }
46996         void* event_handler_ptr = untag_ptr(event_handler);
46997         CHECK_ACCESS(event_handler_ptr);
46998         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
46999         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
47000                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47001                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
47002         }
47003         void* retry_ptr = untag_ptr(retry);
47004         CHECK_ACCESS(retry_ptr);
47005         LDKRetry retry_conv = *(LDKRetry*)(retry_ptr);
47006         retry_conv = Retry_clone((LDKRetry*)untag_ptr(retry));
47007         LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, logger_conv, event_handler_conv, retry_conv);
47008         uint64_t ret_ref = 0;
47009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47011         return ret_ref;
47012 }
47013
47014 uint64_t  __attribute__((export_name("TS_InvoicePayer_pay_invoice"))) TS_InvoicePayer_pay_invoice(uint64_t this_arg, uint64_t invoice) {
47015         LDKInvoicePayer this_arg_conv;
47016         this_arg_conv.inner = untag_ptr(this_arg);
47017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47019         this_arg_conv.is_owned = false;
47020         LDKInvoice invoice_conv;
47021         invoice_conv.inner = untag_ptr(invoice);
47022         invoice_conv.is_owned = ptr_is_owned(invoice);
47023         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
47024         invoice_conv.is_owned = false;
47025         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
47026         *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
47027         return tag_ptr(ret_conv, true);
47028 }
47029
47030 uint64_t  __attribute__((export_name("TS_InvoicePayer_pay_zero_value_invoice"))) TS_InvoicePayer_pay_zero_value_invoice(uint64_t this_arg, uint64_t invoice, int64_t amount_msats) {
47031         LDKInvoicePayer this_arg_conv;
47032         this_arg_conv.inner = untag_ptr(this_arg);
47033         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47035         this_arg_conv.is_owned = false;
47036         LDKInvoice invoice_conv;
47037         invoice_conv.inner = untag_ptr(invoice);
47038         invoice_conv.is_owned = ptr_is_owned(invoice);
47039         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
47040         invoice_conv.is_owned = false;
47041         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
47042         *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
47043         return tag_ptr(ret_conv, true);
47044 }
47045
47046 uint64_t  __attribute__((export_name("TS_InvoicePayer_pay_pubkey"))) TS_InvoicePayer_pay_pubkey(uint64_t this_arg, int8_tArray pubkey, int8_tArray payment_preimage, int64_t amount_msats, int32_t final_cltv_expiry_delta) {
47047         LDKInvoicePayer this_arg_conv;
47048         this_arg_conv.inner = untag_ptr(this_arg);
47049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47051         this_arg_conv.is_owned = false;
47052         LDKPublicKey pubkey_ref;
47053         CHECK(pubkey->arr_len == 33);
47054         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
47055         LDKThirtyTwoBytes payment_preimage_ref;
47056         CHECK(payment_preimage->arr_len == 32);
47057         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
47058         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
47059         *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
47060         return tag_ptr(ret_conv, true);
47061 }
47062
47063 void  __attribute__((export_name("TS_InvoicePayer_remove_cached_payment"))) TS_InvoicePayer_remove_cached_payment(uint64_t this_arg, int8_tArray payment_hash) {
47064         LDKInvoicePayer this_arg_conv;
47065         this_arg_conv.inner = untag_ptr(this_arg);
47066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47068         this_arg_conv.is_owned = false;
47069         unsigned char payment_hash_arr[32];
47070         CHECK(payment_hash->arr_len == 32);
47071         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
47072         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
47073         InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
47074 }
47075
47076 uint64_t  __attribute__((export_name("TS_InvoicePayer_as_EventHandler"))) TS_InvoicePayer_as_EventHandler(uint64_t this_arg) {
47077         LDKInvoicePayer this_arg_conv;
47078         this_arg_conv.inner = untag_ptr(this_arg);
47079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47081         this_arg_conv.is_owned = false;
47082         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
47083         *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
47084         return tag_ptr(ret_ret, true);
47085 }
47086
47087 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
47088         LDKInFlightHtlcs this_obj_conv;
47089         this_obj_conv.inner = untag_ptr(this_obj);
47090         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47092         InFlightHtlcs_free(this_obj_conv);
47093 }
47094
47095 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_used_liquidity_msat"))) TS_InFlightHtlcs_used_liquidity_msat(uint64_t this_arg, uint64_t source, uint64_t target, int64_t channel_scid) {
47096         LDKInFlightHtlcs this_arg_conv;
47097         this_arg_conv.inner = untag_ptr(this_arg);
47098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47100         this_arg_conv.is_owned = false;
47101         LDKNodeId source_conv;
47102         source_conv.inner = untag_ptr(source);
47103         source_conv.is_owned = ptr_is_owned(source);
47104         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
47105         source_conv.is_owned = false;
47106         LDKNodeId target_conv;
47107         target_conv.inner = untag_ptr(target);
47108         target_conv.is_owned = ptr_is_owned(target);
47109         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
47110         target_conv.is_owned = false;
47111         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47112         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
47113         uint64_t ret_ref = tag_ptr(ret_copy, true);
47114         return ret_ref;
47115 }
47116
47117 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
47118         LDKInFlightHtlcs obj_conv;
47119         obj_conv.inner = untag_ptr(obj);
47120         obj_conv.is_owned = ptr_is_owned(obj);
47121         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47122         obj_conv.is_owned = false;
47123         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
47124         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47125         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47126         CVec_u8Z_free(ret_var);
47127         return ret_arr;
47128 }
47129
47130 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
47131         LDKu8slice ser_ref;
47132         ser_ref.datalen = ser->arr_len;
47133         ser_ref.data = ser->elems;
47134         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
47135         *ret_conv = InFlightHtlcs_read(ser_ref);
47136         FREE(ser);
47137         return tag_ptr(ret_conv, true);
47138 }
47139
47140 uint64_t  __attribute__((export_name("TS_create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch"))) TS_create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(uint64_t channelmanager, uint64_t keys_manager, uint64_t logger, uint32_t network, uint64_t amt_msat, uint64_t description_hash, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs) {
47141         LDKChannelManager channelmanager_conv;
47142         channelmanager_conv.inner = untag_ptr(channelmanager);
47143         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
47144         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
47145         channelmanager_conv.is_owned = false;
47146         void* keys_manager_ptr = untag_ptr(keys_manager);
47147         CHECK_ACCESS(keys_manager_ptr);
47148         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47149         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47150                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47151                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47152         }
47153         void* logger_ptr = untag_ptr(logger);
47154         CHECK_ACCESS(logger_ptr);
47155         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47156         if (logger_conv.free == LDKLogger_JCalls_free) {
47157                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47158                 LDKLogger_JCalls_cloned(&logger_conv);
47159         }
47160         LDKCurrency network_conv = LDKCurrency_from_js(network);
47161         void* amt_msat_ptr = untag_ptr(amt_msat);
47162         CHECK_ACCESS(amt_msat_ptr);
47163         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47164         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47165         LDKSha256 description_hash_conv;
47166         description_hash_conv.inner = untag_ptr(description_hash);
47167         description_hash_conv.is_owned = ptr_is_owned(description_hash);
47168         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
47169         description_hash_conv = Sha256_clone(&description_hash_conv);
47170         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47171         *ret_conv = create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(&channelmanager_conv, keys_manager_conv, logger_conv, network_conv, amt_msat_conv, description_hash_conv, duration_since_epoch, invoice_expiry_delta_secs);
47172         return tag_ptr(ret_conv, true);
47173 }
47174
47175 uint64_t  __attribute__((export_name("TS_create_invoice_from_channelmanager_and_duration_since_epoch"))) TS_create_invoice_from_channelmanager_and_duration_since_epoch(uint64_t channelmanager, uint64_t keys_manager, uint64_t logger, uint32_t network, uint64_t amt_msat, jstring description, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs) {
47176         LDKChannelManager channelmanager_conv;
47177         channelmanager_conv.inner = untag_ptr(channelmanager);
47178         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
47179         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
47180         channelmanager_conv.is_owned = false;
47181         void* keys_manager_ptr = untag_ptr(keys_manager);
47182         CHECK_ACCESS(keys_manager_ptr);
47183         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47184         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47185                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47186                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47187         }
47188         void* logger_ptr = untag_ptr(logger);
47189         CHECK_ACCESS(logger_ptr);
47190         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47191         if (logger_conv.free == LDKLogger_JCalls_free) {
47192                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47193                 LDKLogger_JCalls_cloned(&logger_conv);
47194         }
47195         LDKCurrency network_conv = LDKCurrency_from_js(network);
47196         void* amt_msat_ptr = untag_ptr(amt_msat);
47197         CHECK_ACCESS(amt_msat_ptr);
47198         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47199         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47200         LDKStr description_conv = str_ref_to_owned_c(description);
47201         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47202         *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch(&channelmanager_conv, keys_manager_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs);
47203         return tag_ptr(ret_conv, true);
47204 }
47205
47206 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
47207         LDKDefaultRouter this_obj_conv;
47208         this_obj_conv.inner = untag_ptr(this_obj);
47209         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47211         DefaultRouter_free(this_obj_conv);
47212 }
47213
47214 uint64_t  __attribute__((export_name("TS_DefaultRouter_new"))) TS_DefaultRouter_new(uint64_t network_graph, uint64_t logger, int8_tArray random_seed_bytes, uint64_t scorer) {
47215         LDKNetworkGraph network_graph_conv;
47216         network_graph_conv.inner = untag_ptr(network_graph);
47217         network_graph_conv.is_owned = ptr_is_owned(network_graph);
47218         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
47219         network_graph_conv.is_owned = false;
47220         void* logger_ptr = untag_ptr(logger);
47221         CHECK_ACCESS(logger_ptr);
47222         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47223         if (logger_conv.free == LDKLogger_JCalls_free) {
47224                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47225                 LDKLogger_JCalls_cloned(&logger_conv);
47226         }
47227         LDKThirtyTwoBytes random_seed_bytes_ref;
47228         CHECK(random_seed_bytes->arr_len == 32);
47229         memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
47230         void* scorer_ptr = untag_ptr(scorer);
47231         CHECK_ACCESS(scorer_ptr);
47232         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
47233         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
47234                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47235                 LDKLockableScore_JCalls_cloned(&scorer_conv);
47236         }
47237         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv);
47238         uint64_t ret_ref = 0;
47239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47241         return ret_ref;
47242 }
47243
47244 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
47245         LDKDefaultRouter this_arg_conv;
47246         this_arg_conv.inner = untag_ptr(this_arg);
47247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47249         this_arg_conv.is_owned = false;
47250         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
47251         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
47252         return tag_ptr(ret_ret, true);
47253 }
47254
47255 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Payer"))) TS_ChannelManager_as_Payer(uint64_t this_arg) {
47256         LDKChannelManager this_arg_conv;
47257         this_arg_conv.inner = untag_ptr(this_arg);
47258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47260         this_arg_conv.is_owned = false;
47261         LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
47262         *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
47263         return tag_ptr(ret_ret, true);
47264 }
47265
47266 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
47267         LDKStr s_conv = str_ref_to_owned_c(s);
47268         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
47269         *ret_conv = SiPrefix_from_str(s_conv);
47270         return tag_ptr(ret_conv, true);
47271 }
47272
47273 uint64_t  __attribute__((export_name("TS_Invoice_from_str"))) TS_Invoice_from_str(jstring s) {
47274         LDKStr s_conv = str_ref_to_owned_c(s);
47275         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
47276         *ret_conv = Invoice_from_str(s_conv);
47277         return tag_ptr(ret_conv, true);
47278 }
47279
47280 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_from_str"))) TS_SignedRawInvoice_from_str(jstring s) {
47281         LDKStr s_conv = str_ref_to_owned_c(s);
47282         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
47283         *ret_conv = SignedRawInvoice_from_str(s_conv);
47284         return tag_ptr(ret_conv, true);
47285 }
47286
47287 jstring  __attribute__((export_name("TS_ParseError_to_str"))) TS_ParseError_to_str(uint64_t o) {
47288         LDKParseError* o_conv = (LDKParseError*)untag_ptr(o);
47289         LDKStr ret_str = ParseError_to_str(o_conv);
47290         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
47291         Str_free(ret_str);
47292         return ret_conv;
47293 }
47294
47295 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
47296         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
47297         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
47298         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
47299         Str_free(ret_str);
47300         return ret_conv;
47301 }
47302
47303 jstring  __attribute__((export_name("TS_Invoice_to_str"))) TS_Invoice_to_str(uint64_t o) {
47304         LDKInvoice o_conv;
47305         o_conv.inner = untag_ptr(o);
47306         o_conv.is_owned = ptr_is_owned(o);
47307         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47308         o_conv.is_owned = false;
47309         LDKStr ret_str = Invoice_to_str(&o_conv);
47310         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
47311         Str_free(ret_str);
47312         return ret_conv;
47313 }
47314
47315 jstring  __attribute__((export_name("TS_SignedRawInvoice_to_str"))) TS_SignedRawInvoice_to_str(uint64_t o) {
47316         LDKSignedRawInvoice o_conv;
47317         o_conv.inner = untag_ptr(o);
47318         o_conv.is_owned = ptr_is_owned(o);
47319         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47320         o_conv.is_owned = false;
47321         LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
47322         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
47323         Str_free(ret_str);
47324         return ret_conv;
47325 }
47326
47327 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
47328         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
47329         LDKStr ret_str = Currency_to_str(o_conv);
47330         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
47331         Str_free(ret_str);
47332         return ret_conv;
47333 }
47334
47335 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
47336         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
47337         LDKStr ret_str = SiPrefix_to_str(o_conv);
47338         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
47339         Str_free(ret_str);
47340         return ret_conv;
47341 }
47342